@loaders.gl/scene 5.0.0-beta.7 → 5.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/dist.dev.js +989 -211
  2. package/dist/dist.min.js +18 -18
  3. package/dist/draco/lib/draco-parser.cjs +8 -5
  4. package/dist/draco/lib/draco-parser.cjs.map +2 -2
  5. package/dist/draco/lib/draco-parser.d.ts +2 -1
  6. package/dist/draco/lib/draco-parser.d.ts.map +1 -1
  7. package/dist/draco/lib/draco-parser.js +6 -3
  8. package/dist/draco/lib/draco-parser.js.map +1 -1
  9. package/dist/draco/lib/parse-draco.cjs +2 -1
  10. package/dist/draco/lib/parse-draco.cjs.map +2 -2
  11. package/dist/draco/lib/parse-draco.d.ts.map +1 -1
  12. package/dist/draco/lib/parse-draco.js +2 -1
  13. package/dist/draco/lib/parse-draco.js.map +1 -1
  14. package/dist/draco/lib/utils/version.cjs +1 -1
  15. package/dist/draco/lib/utils/version.js +1 -1
  16. package/dist/draco-worker-node.js +933 -152
  17. package/dist/draco-worker-node.js.map +4 -4
  18. package/dist/draco-worker.js +830 -56
  19. package/dist/draco-worker.js.map +4 -4
  20. package/dist/draco-writer-worker-node.cjs +773 -186
  21. package/dist/draco-writer-worker-node.cjs.map +4 -4
  22. package/dist/draco-writer-worker.js +630 -46
  23. package/dist/draco-writer-worker.js.map +4 -4
  24. package/dist/gltf/lib/parsers/parse-gltf.cjs +8 -7
  25. package/dist/gltf/lib/parsers/parse-gltf.cjs.map +3 -3
  26. package/dist/gltf/lib/parsers/parse-gltf.d.ts.map +1 -1
  27. package/dist/gltf/lib/parsers/parse-gltf.js +3 -1
  28. package/dist/gltf/lib/parsers/parse-gltf.js.map +1 -1
  29. package/dist/gltf/lib/utils/version.cjs +1 -1
  30. package/dist/gltf/lib/utils/version.js +1 -1
  31. package/dist/mtl-loader-types.cjs +1 -1
  32. package/dist/obj/mtl-loader-types.cjs +1 -1
  33. package/dist/obj/mtl-loader-types.js +1 -1
  34. package/dist/obj/obj-loader-types.cjs +1 -1
  35. package/dist/obj/obj-loader-types.js +1 -1
  36. package/dist/obj/obj-writer.cjs +1 -1
  37. package/dist/obj/obj-writer.js +1 -1
  38. package/dist/obj-loader-types.cjs +1 -1
  39. package/dist/obj-worker.js +37 -1
  40. package/dist/obj-writer.cjs +1 -1
  41. package/dist/stl-loader-types.cjs +1 -1
  42. package/dist/stl-loader-types.js +1 -1
  43. package/dist/usd/usd-loader-types.cjs +1 -1
  44. package/dist/usd/usd-loader-types.js +1 -1
  45. package/dist/usd-loader-types.cjs +1 -1
  46. package/package.json +6 -6
  47. package/src/draco/lib/draco-parser.ts +6 -3
  48. package/src/draco/lib/parse-draco.ts +2 -1
  49. package/src/gltf/lib/parsers/parse-gltf.ts +2 -1
package/dist/dist.min.js CHANGED
@@ -4,54 +4,54 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var hB=Object.create;var Au=Object.defineProperty;var pB=Object.getOwnPropertyDescriptor;var mB=Object.getOwnPropertyNames;var bB=Object.getPrototypeOf,gB=Object.prototype.hasOwnProperty;var p=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var yB=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},J=(r,e)=>{for(var t in e)Au(r,t,{get:e[t],enumerable:!0})},Pw=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of mB(e))!gB.call(r,s)&&s!==t&&Au(r,s,{get:()=>e[s],enumerable:!(n=pB(e,s))||n.enumerable});return r};var wB=(r,e,t)=>(t=r!=null?hB(bB(r)):{},Pw(e||!r||!r.__esModule?Au(t,"default",{value:r,enumerable:!0}):t,r)),xB=r=>Pw(Au({},"__esModule",{value:!0}),r);var jw=yB((TU,Vw)=>{Vw.exports=globalThis.loaders});function Ie(r,e=8){let t=r*e;if(!Number.isSafeInteger(r)||r<0||!Number.isSafeInteger(t)||t>256*1024*1024-Vd)throw new Error("USDC: decoded allocation limit exceeded");return Vd+=t,r}function Tt(r){if(!Number.isSafeInteger(r)||r<0||r>4e6)throw new Error("USDC: decoded allocation limit exceeded");return Ie(r)}function Gw(r,e,t,n,s,i){for(;e<t;){let o=r[e++];if(e>t)throw new Error("USDC: truncated LZ4 token");let a=o>>4;if(a===15){let f;do{if(e>=t)throw new Error("USDC: truncated LZ4 length");f=r[e++],a+=f}while(f===255)}if(a>0){if(e+a>t)throw new Error("USDC: truncated LZ4 literal");for(let f=0;f<a;f++){if(s>=i)throw new Error("USDC: LZ4 output overflow");n[s++]=r[e++]}}if(e>=t)break;if(e+2>t)throw new Error("USDC: truncated LZ4 offset");let c=r[e++]|r[e++]<<8;if(c===0)throw new Error("USDC: invalid LZ4 match offset");let u=(o&15)+4;if(u===19){let f;do{if(e>=t)throw new Error("USDC: truncated LZ4 length");f=r[e++],u+=f}while(f===255)}let l=s-c;if(l<0)throw new Error("USDC: invalid LZ4 match position");for(let f=0;f<u;f++){if(s>=i)throw new Error("USDC: LZ4 output overflow");n[s++]=n[l+f]}}return s}function Gd(r,e,t=!1){let n=new Uint8Array(Ie(e,1));if(!r.length)throw new Error("USDC: missing LZ4 chunk header");let s=r[0];if(s===0){let i=Gw(r,1,r.length,n,0,e);if(!t&&i!==e)throw new Error("USDC: incomplete LZ4 output");return n.subarray(0,i)}else{if(1+s*4>r.length)throw new Error("USDC: truncated LZ4 chunk sizes");let o=1,a=[];for(let l=0;l<s;l++){let f=(r[o]|r[o+1]<<8|r[o+2]<<16|r[o+3]<<24)>>>0;a.push(f),o+=4}let c=o,u=0;for(let l=0;l<s;l++){let f=a[l],d=Math.min(65536,e-u);if(f>r.length-c)throw new Error("USDC: truncated LZ4 chunk");let h=Gw(r,c,c+f,n,u,u+d);if(c+=f,l<s-1&&h!==u+d)throw new Error("USDC: incomplete LZ4 chunk");u=h}if(c!==r.length||!t&&u!==e)throw new Error("USDC: incomplete LZ4 output");return n.subarray(0,u)}}function Lr(r,e){let t=e*4+(e*2+7>>3)+4,n=Gd(new Uint8Array(r),t,!0);return SB(n,e)}function SB(r,e){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),n=0,s=t.getInt32(n,!0);n+=4;let i=e*2+7>>3;if(r.length<n+i)throw new Error("USDC: truncated integer codes");let o=n,a=n+i,c=new Int32Array(Ie(e)),u=0,l=o,f=a;for(let d=0;d<e;){let h=r[l++];for(let m=0;m<4&&d<e;m++,d++){let b=h>>m*2&3,g=0;switch(b){case 0:g=s;break;case 1:g=t.getInt8(f),f+=1;break;case 2:g=t.getInt16(f,!0),f+=2;break;case 3:g=t.getInt32(f,!0),f+=4;break}u+=g,c[d]=u}}return c}var Vd,jd,zw,TB,S,_B,AB,vB,IB,zd,ci,vu,Ww=p(()=>{"use strict";Vd=0;jd=new TextDecoder,zw=new Float32Array(32);for(let r=0;r<32;r++)zw[r]=Math.pow(2,r-15);TB=Math.pow(2,-14),S={Invalid:0,Bool:1,UChar:2,Int:3,UInt:4,Int64:5,UInt64:6,Half:7,Float:8,Double:9,String:10,Token:11,AssetPath:12,Matrix2d:13,Matrix3d:14,Matrix4d:15,Quatd:16,Quatf:17,Quath:18,Vec2d:19,Vec2f:20,Vec2h:21,Vec2i:22,Vec3d:23,Vec3f:24,Vec3h:25,Vec3i:26,Vec4d:27,Vec4f:28,Vec4h:29,Vec4i:30,Dictionary:31,TokenListOp:32,StringListOp:33,PathListOp:34,ReferenceListOp:35,IntListOp:36,Int64ListOp:37,UIntListOp:38,UInt64ListOp:39,PathVector:40,TokenVector:41,Specifier:42,Permission:43,Variability:44,VariantSelectionMap:45,TimeSamples:46,Payload:47,DoubleVector:48,LayerOffsetVector:49,StringVector:50,ValueBlock:51,Value:52,UnregisteredValue:53,UnregisteredValueListOp:54,PayloadListOp:55,TimeCode:56,PathExpression:57,Relocates:58,Spline:59,AnimationBlock:60},_B=new Set([S.Int,S.UInt,S.Float,S.Double,S.Half,S.String,S.Token]),AB=4294967295,vB=105,IB=116;zd=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.offset=0}seek(e){if(!Number.isSafeInteger(e)||e<0||e>this.buffer.byteLength)throw new Error("USDC: invalid seek");this.offset=e}tell(){return this.offset}readUint8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readInt8(){let e=this.view.getInt8(this.offset);return this.offset+=1,e}readUint16(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readInt16(){let e=this.view.getInt16(this.offset,!0);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readInt32(){let e=this.view.getInt32(this.offset,!0);return this.offset+=4,e}readUint64(){let e=this.view.getUint32(this.offset,!0),t=this.view.getUint32(this.offset+4,!0);this.offset+=8;let n=t*4294967296+e;if(!Number.isSafeInteger(n))throw new Error("USDC: integer exceeds safe precision");return n}readInt64(){let e=this.view.getUint32(this.offset,!0),t=this.view.getInt32(this.offset+4,!0);this.offset+=8;let n=t*4294967296+e;if(!Number.isSafeInteger(n))throw new Error("USDC: integer exceeds safe precision");return n}readFloat32(){let e=this.view.getFloat32(this.offset,!0);return this.offset+=4,e}readFloat64(){let e=this.view.getFloat64(this.offset,!0);return this.offset+=8,e}readBytes(e){let t=new Uint8Array(this.buffer,this.offset,e);return this.offset+=e,t}readString(e){let t=this.readBytes(e),n=0;for(;n<e&&t[n]!==0;)n++;return jd.decode(t.subarray(0,n))}},ci=class{constructor(e,t){this.lo=e,this.hi=t}get isArray(){return(this.hi&2147483648)!==0}get isInlined(){return(this.hi&1073741824)!==0}get isCompressed(){return(this.hi&536870912)!==0}get typeEnum(){return this.hi>>16&255}get payload(){return this.lo+(this.hi&65535)*4294967296}getInlinedValue(){return this.lo}},vu=class{parseData(e){Vd=0,this._valueReadCount=0,this._activeDictionaries=new Set,this.buffer=e instanceof ArrayBuffer?e:e.buffer,this.reader=new zd(this.buffer),this.version={major:0,minor:0,patch:0},this._conversionBuffer=new ArrayBuffer(4),this._conversionView=new DataView(this._conversionBuffer),this._readBootstrap(),this._readTOC(),this._readTokens(),this._readStrings(),this._readFields(),this._readFieldSets(),this._readPaths(),this._readSpecs(),this.specsByPath=Object.create(null);for(let t of this.specs){let n=this.paths[t.pathIndex];if(!n)continue;let s=this._getFieldsForSpec(t);this.specsByPath[n]={specType:t.specType,fields:s}}return{specsByPath:this.specsByPath}}_readBootstrap(){let e=this.reader;if(e.seek(0),e.readString(8)!=="PXR-USDC")throw new Error("THREE.USDCParser: Not a valid USDC file.");this.version.major=e.readUint8(),this.version.minor=e.readUint8(),this.version.patch=e.readUint8(),e.readBytes(5),this.tocOffset=e.readUint64()}_readTOC(){let e=this.reader;e.seek(this.tocOffset);let t=e.readUint64();if(t>16)throw new Error("USDC: invalid section count");this.sections=Object.create(null);for(let n=0;n<t;n++){let s=e.readString(16),i=e.readUint64(),o=e.readUint64();this.sections[s]={start:i,size:o}}}_readTokens(){let e=this.sections.TOKENS;if(!e)return;let t=this.reader;t.seek(e.start);let n=Tt(t.readUint64());if(this.tokens=[],this.version.major===0&&this.version.minor<4){let s=t.readUint64(),i=t.readBytes(s),o=0;for(let a=0;a<n;a++){let c=o;for(;c<i.length&&i[c]!==0;)c++;if(c>=i.length)throw new Error("USDC: unterminated token data");this.tokens.push(jd.decode(i.subarray(o,c))),o=c+1}}else{let s=t.readUint64(),i=t.readUint64(),o=t.readBytes(i),a=Gd(o,s);Ie(a.length,2);let c=0;for(let u=0;u<n;u++){let l=c;for(;l<a.length&&a[l]!==0;)l++;if(l>=a.length)throw new Error("USDC: unterminated token data");this.tokens.push(jd.decode(a.subarray(c,l))),c=l+1}}}_readStrings(){let e=this.sections.STRINGS;if(!e){this.strings=[];return}let t=this.reader;t.seek(e.start);let n=Tt(t.readUint64());this.strings=[];for(let s=0;s<n;s++)this.strings.push(t.readUint32())}_readFields(){let e=this.sections.FIELDS;if(!e)return;let t=this.reader;if(t.seek(e.start),this.fields=[],this.version.major===0&&this.version.minor<4){let n=Math.floor(e.size/12);for(let s=0;s<n;s++){let i=t.readUint32(),o=t.readUint32(),a=t.readUint32();this.fields.push({tokenIndex:i,valueRep:new ci(o,a)})}}else{let n=Tt(t.readUint64()),s=t.readUint64(),i=t.readBytes(s),o=Lr(i.buffer.slice(i.byteOffset,i.byteOffset+s),n),a=t.readUint64(),c=t.readBytes(a),u=Gd(c,n*8),l=new DataView(u.buffer,u.byteOffset,u.byteLength);for(let f=0;f<n;f++){let d=l.getUint32(f*8,!0),h=l.getUint32(f*8+4,!0);this.fields.push({tokenIndex:o[f],valueRep:new ci(d,h)})}}}_readFieldSets(){let e=this.sections.FIELDSETS;if(!e)return;let t=this.reader;if(t.seek(e.start),this.fieldSets=[],this.version.major===0&&this.version.minor<4){let n=Math.floor(e.size/4);for(let s=0;s<n;s++)this.fieldSets.push(t.readUint32())}else{let n=Tt(t.readUint64()),s=t.readUint64(),i=t.readBytes(s),o=Lr(i.buffer.slice(i.byteOffset,i.byteOffset+s),n);for(let a=0;a<n;a++)this.fieldSets.push(o[a])}}_readPaths(){let e=this.sections.PATHS;if(!e)return;let t=this.reader;t.seek(e.start);let n=Tt(t.readUint64());if(this.paths=new Array(Ie(n)).fill(""),this.version.major===0&&this.version.minor<4)this._readPathsRecursive("");else{t.readUint64();let s=t.readUint64(),i=t.readBytes(s),o=Lr(i.buffer.slice(i.byteOffset,i.byteOffset+s),n),a=t.readUint64(),c=t.readBytes(a),u=Lr(c.buffer.slice(c.byteOffset,c.byteOffset+a),n),l=t.readUint64(),f=t.readBytes(l),d=Lr(f.buffer.slice(f.byteOffset,f.byteOffset+l),n);this._buildPathsFromCompressed(o,u,d)}}_readPathsRecursive(e,t=0){let n=this.reader;if(t>1e3)return;let s=n.readUint32(),i=n.readUint32(),o=n.readUint8(),a=(o&1)!==0,c=(o&2)!==0,u=(o&4)!==0,l;if(e==="")l="/";else{let f=this.tokens[i]||"";u?l=e+"."+f:l=e==="/"?"/"+f:e+"/"+f}if(Ie(l.length,2),this.paths[s]=l,a&&c){let f=n.readUint64();this._readPathsRecursive(l,t+1),n.seek(f),this._readPathsRecursive(e,t+1)}else a?this._readPathsRecursive(l,t+1):c&&this._readPathsRecursive(e,t+1)}_buildPathsFromCompressed(e,t,n){let s=0,i=[{startIndex:0,parentPath:""}];for(;i.length;){let o=i.pop(),a=o.startIndex,c=o.parentPath;for(;a<e.length;){if(++s>e.length*2)throw new Error("USDC: path traversal limit exceeded");let u=a++,l=e[u],f=t[u],d=n[u];if(l<0||l>=this.paths.length||Math.abs(f)>=this.tokens.length||d<-2)throw new Error("USDC: invalid compressed path index");let h;if(c==="")h="/",c=h;else{let g=this.tokens[Math.abs(f)];h=f<0?c+"."+g:c==="/"?"/"+g:c+"/"+g}Ie(h.length,2),this.paths[l]=h;let m=d>0||d===-1,b=d>=0;if((m||b)&&a>=e.length)throw new Error("USDC: missing compressed path entry");if(m&&b){let g=u+d;if(g<=a||g>=e.length)throw new Error("USDC: invalid compressed path jump");i.push({startIndex:g,parentPath:c})}if(m)c=h;else if(!b)break}}}_readSpecs(){let e=this.sections.SPECS;if(!e)return;let t=this.reader;if(t.seek(e.start),this.specs=[],this.version.major===0&&this.version.minor<4){let n=this.version.minor===0&&this.version.patch===1?16:12,s=Math.floor(e.size/n);for(let i=0;i<s;i++){let o=t.readUint32(),a=t.readUint32(),c=t.readUint32();n===16&&t.readUint32(),this.specs.push({pathIndex:o,fieldSetIndex:a,specType:c})}}else{let n=Tt(t.readUint64()),s=t.readUint64(),i=t.readBytes(s),o=Lr(i.buffer.slice(i.byteOffset,i.byteOffset+s),n),a=t.readUint64(),c=t.readBytes(a),u=Lr(c.buffer.slice(c.byteOffset,c.byteOffset+a),n),l=t.readUint64(),f=t.readBytes(l),d=Lr(f.buffer.slice(f.byteOffset,f.byteOffset+l),n);for(let h=0;h<n;h++)this.specs.push({pathIndex:o[h],fieldSetIndex:u[h],specType:d[h]})}}_readValue(e){if(this._valueReadCount=(this._valueReadCount||0)+1,this._valueReadCount>1e6)throw new Error("USDC: value traversal limit exceeded");let t=e.typeEnum,n=e.isArray,s=e.isInlined;if(t===S.TimeSamples)return this._readTimeSamples(e);if(s)return this._readInlinedValue(e);let i=e.payload;if(i===0&&n)return[];if(i<0||i>=this.buffer.byteLength)throw new RangeError("USDCParser: Invalid payload offset "+i+" for type "+t+".");let o=this.reader.tell();this.reader.seek(i);let a;return n?a=this._readArrayValue(e):a=this._readScalarValue(t),this.reader.seek(o),a}_readInlinedValue(e){let t=e.typeEnum,n=e.getInlinedValue(),s=this._conversionView;switch(t){case S.Dictionary:if(n!==0)throw new Error("USDC: invalid inline dictionary");return Object.create(null);case S.Bool:return n!==0;case S.UChar:return n&255;case S.Int:case S.Int64:return n|0;case S.UInt:case S.UInt64:return n>>>0;case S.Half:return this._halfToFloat(n&65535);case S.Float:return s.setUint32(0,n,!0),s.getFloat32(0,!0);case S.Double:return s.setUint32(0,n,!0),s.getFloat32(0,!0);case S.Token:return this.tokens[n]||"";case S.String:return this.tokens[this.strings[n]]||"";case S.AssetPath:return this.tokens[n]||"";case S.Specifier:return n;case S.Permission:case S.Variability:return n;case S.Vec2h:return s.setUint32(0,n,!0),[this._halfToFloat(s.getUint16(0,!0)),this._halfToFloat(s.getUint16(2,!0))];case S.Vec2f:case S.Vec2i:return s.setUint32(0,n,!0),[s.getInt8(0),s.getInt8(1)];case S.Vec3f:case S.Vec3i:return s.setUint32(0,n,!0),[s.getInt8(0),s.getInt8(1),s.getInt8(2)];case S.Vec4f:case S.Vec4i:return s.setUint32(0,n,!0),[s.getInt8(0),s.getInt8(1),s.getInt8(2),s.getInt8(3)];case S.Matrix2d:{s.setUint32(0,n,!0);let i=s.getInt8(0),o=s.getInt8(1);return[i,0,0,o]}case S.Matrix3d:{s.setUint32(0,n,!0);let i=s.getInt8(0),o=s.getInt8(1),a=s.getInt8(2);return[i,0,0,0,o,0,0,0,a]}case S.Matrix4d:{s.setUint32(0,n,!0);let i=s.getInt8(0),o=s.getInt8(1),a=s.getInt8(2),c=s.getInt8(3);return[i,0,0,0,0,o,0,0,0,0,a,0,0,0,0,c]}default:throw new Error("USDC: unsupported inline value type "+t)}}_readTimeSamples(e){let t=this.reader,n=e.payload,s=t.tell();t.seek(n);let i=t.tell(),o=t.readInt64();t.seek(i+o);let a=t.readUint32(),c=t.readUint32(),u=new ci(a,c),l=this._readValue(u),f=i+o+8;t.seek(f);let d=t.tell(),h=t.readInt64();t.seek(d+h);let m=Tt(t.readUint64()),b=[];for(let x=0;x<m;x++){let T=t.readUint32(),_=t.readUint32();b.push(new ci(T,_))}let g=[];for(let x=0;x<m;x++)g.push(this._readValue(b[x]));return t.seek(s),{times:l instanceof Float64Array?Array.from(l):Array.isArray(l)?l:[l],values:g}}_readScalarValue(e){let t=this.reader;switch(e){case S.Invalid:return null;case S.Bool:return t.readUint8()!==0;case S.UChar:return t.readUint8();case S.Int:return t.readInt32();case S.UInt:return t.readUint32();case S.Int64:return t.readInt64();case S.UInt64:return t.readUint64();case S.Half:return this._readHalf();case S.Float:return t.readFloat32();case S.Double:return t.readFloat64();case S.String:case S.Token:{let n=t.readUint32();return this.tokens[n]||""}case S.AssetPath:{let n=t.readUint32();return this.tokens[n]||""}case S.Vec2f:return[t.readFloat32(),t.readFloat32()];case S.Vec2d:return[t.readFloat64(),t.readFloat64()];case S.Vec2i:return[t.readInt32(),t.readInt32()];case S.Vec3f:return[t.readFloat32(),t.readFloat32(),t.readFloat32()];case S.Vec3d:return[t.readFloat64(),t.readFloat64(),t.readFloat64()];case S.Vec3i:return[t.readInt32(),t.readInt32(),t.readInt32()];case S.Vec4f:return[t.readFloat32(),t.readFloat32(),t.readFloat32(),t.readFloat32()];case S.Vec4d:return[t.readFloat64(),t.readFloat64(),t.readFloat64(),t.readFloat64()];case S.Quatf:return[t.readFloat32(),t.readFloat32(),t.readFloat32(),t.readFloat32()];case S.Quatd:return[t.readFloat64(),t.readFloat64(),t.readFloat64(),t.readFloat64()];case S.Matrix4d:{let n=[];for(let s=0;s<16;s++)n.push(t.readFloat64());return n}case S.TokenVector:{let n=Tt(t.readUint64()),s=[];for(let i=0;i<n;i++){let o=t.readUint32();s.push(this.tokens[o]||"")}return s}case S.PathVector:{let n=Tt(t.readUint64()),s=[];for(let i=0;i<n;i++){let o=t.readUint32();s.push(this.paths[o]||"")}return s}case S.DoubleVector:{let n=Tt(t.readUint64()),s=new Float64Array(Ie(n));for(let i=0;i<n;i++)s[i]=t.readFloat64();return s}case S.Dictionary:return this._readDictionary();case S.TokenListOp:case S.StringListOp:case S.IntListOp:case S.Int64ListOp:case S.UIntListOp:case S.UInt64ListOp:throw new Error("USDC: value list operations are unsupported");case S.PathListOp:{let n=t.readUint8();if(n&24||(n&102).toString(2).replaceAll("0","").length>1)throw new Error("USDC: compound path list operations are unsupported");let s=(n&2)!==0,i=(n&4)!==0,o=(n&8)!==0,a=(n&16)!==0,c=(n&32)!==0,u=(n&64)!==0,l=()=>{let b=Tt(t.readUint64()),g=[];for(let y=0;y<b;y++){let x=t.readUint32();g.push(this.paths[x])}return g},f=null,d=null,h=null,m=null;return s&&(f=l()),i&&(d=l()),c&&(h=l()),u&&(m=l()),o&&l(),a&&l(),h&&h.length>0?h:f&&f.length>0?f:m&&m.length>0?m:d&&d.length>0?d:null}case S.VariantSelectionMap:{let n=Tt(t.readUint64()),s=Object.create(null);for(let i=0;i<n;i++){let o=t.readUint32(),a=t.readUint32(),c=this.tokens[this.strings[o]],u=this.tokens[this.strings[a]];c&&u&&(s[c]=u)}return s}default:throw new Error("USDC: unsupported encoding: "+["USDCParser: Unsupported scalar type",e].join(" "))}}_readDictionary(){let e=this.reader,t=e.tell();if(this._activeDictionaries||=new Set,this._activeDictionaries.has(t))throw new Error("USDC: cyclic dictionary value");if(this._activeDictionaries.size>=64)throw new Error("USDC: dictionary depth limit exceeded");this._activeDictionaries.add(t);try{let n=Tt(e.readUint64());if(n>Math.floor((this.buffer.byteLength-e.tell())/20))throw new Error("USDC: truncated dictionary entries");let s=Object.create(null);for(let i=0;i<n;i++){let o=e.readUint32(),a=this.tokens[this.strings[o]];if(typeof a!="string"||Object.hasOwn(s,a))throw new Error("USDC: invalid dictionary key");let c=e.tell(),u=e.readInt64();if(u<8)throw new Error("USDC: invalid dictionary value offset");e.seek(c+u);let l=new ci(e.readUint32(),e.readUint32());if(l.typeEnum<S.Bool||l.typeEnum>S.AssetPath&&l.typeEnum!==S.Dictionary||l.isArray&&!_B.has(l.typeEnum))throw new Error("USDC: unsupported dictionary value type");let f=e.tell(),d=this._readValue(l);s[a]=l.typeEnum===S.AssetPath?{assetPath:d}:d,e.seek(f)}return s}finally{this._activeDictionaries.delete(t)}}_readArrayValue(e){let t=this.reader,n=e.typeEnum,s=e.isCompressed,i;if(this.version.major===0&&this.version.minor<7?i=t.readUint32():i=t.readUint64(),!Number.isSafeInteger(i)||i<0)throw new RangeError("USDCParser: Invalid array size "+i+" for type "+n+".");if(i>2147483647)throw new RangeError("USDCParser: Array size "+i+" exceeds implementation limits.");if(i=Tt(i),i===0)return[];if(s)return this._readCompressedArray(n,i);switch(n){case S.Int:{let o=new Int32Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readInt32();return o}case S.UInt:{let o=new Uint32Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readUint32();return o}case S.Float:{let o=new Float32Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readFloat32();return o}case S.Double:{let o=new Float64Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readFloat64();return o}case S.Vec2f:{let o=new Float32Array(Ie(i*2));for(let a=0;a<i*2;a++)o[a]=t.readFloat32();return o}case S.Vec3f:{let o=new Float32Array(Ie(i*3));for(let a=0;a<i*3;a++)o[a]=t.readFloat32();return o}case S.Vec4f:{let o=new Float32Array(Ie(i*4));for(let a=0;a<i*4;a++)o[a]=t.readFloat32();return o}case S.Vec3h:{let o=new Float32Array(Ie(i*3));for(let a=0;a<i*3;a++)o[a]=this._readHalf();return o}case S.Quatf:{let o=new Float32Array(Ie(i*4));for(let a=0;a<i*4;a++)o[a]=t.readFloat32();return o}case S.Quath:{let o=new Float32Array(Ie(i*4));for(let a=0;a<i*4;a++)o[a]=this._readHalf();return o}case S.Matrix4d:{let o=new Float64Array(Ie(i*16));for(let a=0;a<i*16;a++)o[a]=t.readFloat64();return o}case S.String:case S.Token:{let o=[];for(let a=0;a<i;a++){let c=t.readUint32(),u=n===S.String?this.strings[c]:c,l=this.tokens[u];if(typeof l!="string")throw new Error("USDC: invalid string array index");o.push(l)}return o}case S.Half:{let o=new Float32Array(Ie(i));for(let a=0;a<i;a++)o[a]=this._readHalf();return o}default:throw new Error("USDC: unsupported encoding: "+["USDCParser: Unsupported array type",n].join(" "))}}_readCompressedArray(e,t){let n=this.reader;switch(e){case S.Int:case S.UInt:{let s=n.readUint64(),i=n.readBytes(s),o=Lr(i.buffer.slice(i.byteOffset,i.byteOffset+s),t);return e===S.UInt?new Uint32Array(o.buffer,o.byteOffset,o.length):o}case S.Half:case S.Double:case S.Float:{let s=n.readInt8();if(s===vB){let i=n.readUint64(),o=n.readBytes(i),a=Lr(o.buffer.slice(o.byteOffset,o.byteOffset+i),t),c=e===S.Double?new Float64Array(Ie(t)):new Float32Array(Ie(t));for(let u=0;u<t;u++)c[u]=e===S.Half?this._convertHalfInteger(a[u]):a[u];return c}else if(s===IB){let i=Tt(n.readUint32());if(i===0)throw new Error("USDC: invalid float lookup table");let o=e===S.Double?new Float64Array(Ie(i)):new Float32Array(Ie(i));for(let f=0;f<i;f++)o[f]=e===S.Half?this._readHalf():e===S.Double?n.readFloat64():n.readFloat32();let a=n.readUint64(),c=n.readBytes(a),u=Lr(c.buffer.slice(c.byteOffset,c.byteOffset+a),t),l=e===S.Double?new Float64Array(Ie(t)):new Float32Array(Ie(t));for(let f=0;f<t;f++){if(u[f]<0||u[f]>=i)throw new Error("USDC: invalid float lookup index");l[f]=o[u[f]]}return l}throw new Error("USDC: unsupported encoding: "+["USDCParser: Unknown float compression code",s].join(" "))}default:throw new Error("USDC: unsupported encoding: "+["USDCParser: Unsupported compressed array type",e].join(" "))}}_convertHalfInteger(e){let t=Math.abs(e);if(t<=2048)return e;if(t>=65520)return Math.sign(e)*(1/0);let n=2**(Math.floor(Math.log2(t))-10),s=t/n,i=Math.floor(s),o=s-i,a=o>.5||o===.5&&i%2!==0?i+1:i;return Math.sign(e)*a*n}_readHalf(){return this._halfToFloat(this.reader.readUint16())}_halfToFloat(e){let t=(e&32768)>>15,n=(e&31744)>>10,s=e&1023;return n===0?s===0?t?-0:0:(t?-1:1)*TB*(s/1024):n===31?s?NaN:t?-1/0:1/0:(t?-1:1)*zw[n]*(1+s/1024)}_getFieldsForSpec(e){let t=Object.create(null),n=e.fieldSetIndex,s=1e4,i=0;for(;n<this.fieldSets.length&&i<s;){let o=this.fieldSets[n];if(o===AB||o===-1)break;let a=this.fields[o];if(!a)throw new Error("USDC: invalid field index");if(a){let c=this.tokens[a.tokenIndex],u=this._readValue(a.valueRep);t[c]=u}n++,i++}if(i>=s)throw new Error("USDC: field traversal limit exceeded");return t}}});function qw(r,e){if(r.byteLength<88||r.byteLength>64*1024*1024)throw new Error("USDC: invalid input size");let t=new Uint8Array(r);if(t[8]!==0||t[9]!==8||t[10]!==0)throw new Error("USDC: initial decoder requires crate version 0.8.0");let n=new DataView(r),s=n.getBigUint64(16,!0);if(s>BigInt(r.byteLength-8))throw new Error("USDC: invalid section table");let i=Number(s),o=n.getBigUint64(i,!0);if(o>16n||i+8+Number(o)*32>r.byteLength)throw new Error("USDC: invalid section table length");let a=new Set;for(let f=0;f<Number(o);f++){let d=i+8+f*32,h=t.subarray(d,d+16),m=h.indexOf(0),b=new TextDecoder().decode(h.subarray(0,m<0?h.length:m));if(a.has(b))throw new Error("USDC: duplicate section");a.add(b);let g=n.getBigUint64(d+16,!0),y=n.getBigUint64(d+24,!0);if(g<88n||g+y>BigInt(r.byteLength))throw new Error("USDC: section out of bounds")}for(let f of["TOKENS","STRINGS","FIELDS","FIELDSETS","PATHS","SPECS"])if(!a.has(f))throw new Error("USDC: missing required section");let{specsByPath:c}=new vu().parseData(r),u=new Map;for(let[f,d]of Object.entries(c)){if(d.specType===7&&f==="/"||d.specType===1||d.specType===8)continue;if(d.specType!==6||!/^\/(?:[A-Za-z_][\w:]*\/)*[A-Za-z_][\w:]*$/.test(f))throw new Error("USDC: unsupported prim specification");let h=d.fields,m=h.specifier??0;if(m!==0&&m!==1&&m!==2)throw new Error("USDC: invalid prim specifier");let b=Iu(h,new Set(["specifier","typeName","primChildren","properties"]));u.set(f,{name:f.slice(f.lastIndexOf("/")+1),path:f,sourceUrl:e,type:String(h.typeName||""),specifier:["def","over","class"][m],attributes:Object.create(null),metadata:b,variants:Object.create(null),children:[]})}let l=[];for(let f of u.values()){let d=f.path.slice(0,f.path.lastIndexOf("/"));if(!d)l.push(f);else{let h=u.get(d);if(!h)throw new Error("USDC: missing parent prim");h.children.push(f)}}$w(l,c["/"]?.fields.primChildren);for(let f of u.values())$w(f.children,c[f.path]?.fields.primChildren);for(let[f,d]of Object.entries(c)){if(d.specType!==1&&d.specType!==8)continue;let h=f.indexOf("."),m=u.get(f.slice(0,h));if(h<0||!m)throw new Error("USDC: property has no owning prim");let b=f.slice(h+1),g=d.fields,y=d.specType===8?"rel":String(g.typeName||""),x=Kw(d.specType===8?g.targetPaths:g.default,y),T=Iu(g,new Set(["typeName","default","targetPaths","timeSamples"]));g.timeSamples!==void 0&&(T.timeSamples=EB(g.timeSamples,y)),m.attributes[b]={name:b,type:y,value:x,metadata:T}}return{format:"usdc",url:e,metadata:Iu(c["/"]?.fields||{},new Set(["primChildren"])),rootPrims:l,layers:[]}}function Iu(r,e){let t=Object.create(null);for(let[n,s]of Object.entries(r))e.has(n)||(t[n]=Su(s));return t}function Su(r){if(r==null)return null;if(typeof r=="number"||typeof r=="string"||typeof r=="boolean")return r;if(Array.isArray(r))return r.map(Su);if(ArrayBuffer.isView(r)&&!(r instanceof DataView))return Array.from(r);if(typeof r=="object")return Iu(r,new Set);throw new Error("USDC: unsupported decoded value")}function Kw(r,e){let t=Su(r);if(e==="asset"&&typeof t=="string")return{assetPath:t};if(e==="rel"&&Array.isArray(t))return t.map(s=>typeof s=="string"?{path:s}:s);let n=/^(?:(?:point|normal|vector|color|texCoord)([234])[fdh]|(?:float|double|half|int)([234]))\[\]$/.exec(e);if(n&&Array.isArray(t)){let s=Number(n[1]||n[2]);if(t.length%s)throw new Error("USDC: incomplete vector tuple");let i=[];for(let o=0;o<t.length;o+=s)i.push(t.slice(o,o+s));return i}return t}function $w(r,e){if(e===void 0)return;if(!Array.isArray(e))throw new Error("USDC: invalid primChildren order");let t=new Map(r.map(s=>[s.name,s])),n=[];for(let s of e){let i=typeof s=="string"?t.get(s):void 0;if(!i)throw new Error("USDC: invalid primChildren reference");n.push(i),t.delete(s)}for(let s of t.values())n.push(s);for(let s=0;s<n.length;s++)r[s]=n[s]}function EB(r,e){if(!r||typeof r!="object")throw new Error("USDC: invalid time samples");let t=r,n=Su(t.times);if(!Array.isArray(n)||!Array.isArray(t.values)||n.length!==t.values.length)throw new Error("USDC: invalid time samples");return{times:n,values:t.values.map(s=>Kw(s,e))}}var Xw=p(()=>{"use strict";Ww()});function Hw(r,e){if(!r.trimStart().startsWith("#usda"))throw new Error("OpenUSD ASCII layers must begin with the #usda header.");return new Wd(r,e).parse()}var LB,BB,Wd,$d,Jw=p(()=>{"use strict";LB=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/,BB=new Set(["uniform","varying","custom","prepend","append","add","delete","reorder"]);Wd=class{tokenizer;url;constructor(e,t){this.tokenizer=new $d(e),this.url=t}parse(){let e=this.tokenizer.match("(")?this.parseMetadata(")"):{},t=[];for(;!this.tokenizer.isAtEnd();)this.isPrimDeclaration()?t.push(this.parsePrim("")):this.tokenizer.read();return{format:"usda",url:this.url,metadata:e,rootPrims:t,layers:this.url?[this.url]:[]}}parsePrim(e){let n=this.tokenizer.read().value,s=this.tokenizer.read(),i=this.tokenizer.peek().kind==="string",o=i?s.value:"",a=i?this.tokenizer.read().value:s.value,c=`${e}/${a}`,u=this.tokenizer.match("(")?this.parseMetadata(")"):{};this.tokenizer.expect("{");let l=this.parsePrimContents(c);return{name:a,path:c,sourceUrl:this.url,type:o,specifier:n,attributes:l.attributes,metadata:{...u,...l.metadata},variants:l.variants,children:l.children}}parsePrimContents(e){let t={},n={},s=[],i={};for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match("}");)if(this.isPrimDeclaration())s.push(this.parsePrim(e));else if(this.tokenizer.peek().value==="variantSet")this.parseVariantSet(e,i);else{let o=this.parseAttribute();o&&(t[o.name]=o)}return{attributes:t,metadata:n,children:s,variants:i}}parseVariantSet(e,t){this.tokenizer.expect("variantSet");let n=this.tokenizer.read().value;this.tokenizer.expect("="),this.tokenizer.expect("{");let s={};for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match("}");){let i=this.tokenizer.read().value;this.tokenizer.expect("{");let o=this.parsePrimContents(e);s[i]={attributes:o.attributes,metadata:o.metadata,children:o.children}}t[n]=s}parseAttribute(){let e=this.tokenizer.read();if(e.kind==="end")return null;let t=[e];for(;!this.tokenizer.isAtEnd()&&this.tokenizer.peek().line===e.line;){let u=this.tokenizer.peek();if(u.value==="="){this.tokenizer.read();break}if(u.value==="{"||u.value==="}")return null;t.push(this.tokenizer.read())}if(!(this.tokenizer.previousValue==="="))return null;let s=t.filter(u=>!BB.has(u.value));if(s.length===0)return null;let i=s[s.length-1].value,o=s.slice(0,-1).map(u=>u.value).join(""),a=this.parseValue(),c=this.tokenizer.match("(")?this.parseMetadata(")"):{};return{name:i,type:o,value:a,metadata:c}}parseMetadata(e){let t={};for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match(e);){if(this.tokenizer.match(","),this.tokenizer.peek().value===e){this.tokenizer.read();break}let n=this.tokenizer.read(),s=[n];for(;!this.tokenizer.isAtEnd()&&this.tokenizer.peek().line===n.line;){if(this.tokenizer.peek().value==="="||this.tokenizer.peek().value===":"){this.tokenizer.read();break}if(this.tokenizer.peek().value===e)break;s.push(this.tokenizer.read())}if(this.tokenizer.previousValue!=="="&&this.tokenizer.previousValue!==":")continue;let i=s[s.length-1].value;t[i]=this.parseValue(),this.tokenizer.match(",")}return t}parseValue(){let e=this.tokenizer.read();if(e.value==="[")return this.parseList("]");if(e.value==="(")return this.parseList(")");if(e.value==="{")return this.parseMetadata("}");if(e.kind==="asset"){let t={assetPath:e.value};return this.tokenizer.peek().kind==="path"&&this.tokenizer.peek().line===e.line&&(t.primPath=this.tokenizer.read().value),t}return e.kind==="path"?{path:e.value}:e.kind==="number"?Number(e.value):e.value==="true"?!0:e.value==="false"?!1:e.value==="None"||e.value==="null"?null:e.value}parseList(e){let t=[];for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match(e);)this.tokenizer.match(",")||(t.push(this.parseValue()),this.tokenizer.match(","));return t}isPrimDeclaration(){let e=this.tokenizer.peek().value;return e==="def"||e==="over"||e==="class"}},$d=class{source;offset=0;line=1;bufferedToken=null;previousValue="";constructor(e){this.source=e}peek(){return this.bufferedToken||=this.readToken(),this.bufferedToken}read(){let e=this.peek();return this.bufferedToken=null,this.previousValue=e.value,e}match(e){return this.peek().value!==e?!1:(this.read(),!0)}expect(e){let t=this.read();if(t.value!==e)throw new Error(`Expected "${e}" at USDA line ${t.line}, received "${t.value}".`)}isAtEnd(){return this.peek().kind==="end"}readToken(){this.skipIgnoredText();let e=this.line,t=this.source[this.offset];if(t===void 0)return{value:"",line:e,kind:"end"};if("{}[](),=".includes(t))return this.offset++,{value:t,line:e,kind:"punctuation"};if(t==='"'||t==="'")return{value:this.readQuotedString(t),line:e,kind:"string"};if(t==="@")return{value:this.readDelimitedValue("@"),line:e,kind:"asset"};if(t==="<")return{value:this.readDelimitedValue(">"),line:e,kind:"path"};let n=this.source.slice(this.offset).match(LB);if(n)return this.offset+=n[0].length,{value:n[0],line:e,kind:"number"};let s=this.offset;for(;this.offset<this.source.length;){let i=this.source[this.offset];if(/\s/.test(i)||"{}[](),=@<>".includes(i))break;this.offset++}return this.offset===s&&this.offset++,{value:this.source.slice(s,this.offset),line:e,kind:"word"}}skipIgnoredText(){for(;this.offset<this.source.length;){let e=this.source[this.offset];if(e===`
7
+ "use strict";var __exports__=(()=>{var hF=Object.create;var Vu=Object.defineProperty;var pF=Object.getOwnPropertyDescriptor;var mF=Object.getOwnPropertyNames;var bF=Object.getPrototypeOf,gF=Object.prototype.hasOwnProperty;var p=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var yF=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},J=(r,e)=>{for(var t in e)Vu(r,t,{get:e[t],enumerable:!0})},Bx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of mF(e))!gF.call(r,s)&&s!==t&&Vu(r,s,{get:()=>e[s],enumerable:!(n=pF(e,s))||n.enumerable});return r};var wF=(r,e,t)=>(t=r!=null?hF(bF(r)):{},Bx(e||!r||!r.__esModule?Vu(t,"default",{value:r,enumerable:!0}):t,r)),xF=r=>Bx(Vu({},"__esModule",{value:!0}),r);var Ox=yF((kP,Fx)=>{Fx.exports=globalThis.loaders});function Ie(r,e=8){let t=r*e;if(!Number.isSafeInteger(r)||r<0||!Number.isSafeInteger(t)||t>256*1024*1024-ph)throw new Error("USDC: decoded allocation limit exceeded");return ph+=t,r}function Tt(r){if(!Number.isSafeInteger(r)||r<0||r>4e6)throw new Error("USDC: decoded allocation limit exceeded");return Ie(r)}function Mx(r,e,t,n,s,i){for(;e<t;){let o=r[e++];if(e>t)throw new Error("USDC: truncated LZ4 token");let a=o>>4;if(a===15){let f;do{if(e>=t)throw new Error("USDC: truncated LZ4 length");f=r[e++],a+=f}while(f===255)}if(a>0){if(e+a>t)throw new Error("USDC: truncated LZ4 literal");for(let f=0;f<a;f++){if(s>=i)throw new Error("USDC: LZ4 output overflow");n[s++]=r[e++]}}if(e>=t)break;if(e+2>t)throw new Error("USDC: truncated LZ4 offset");let c=r[e++]|r[e++]<<8;if(c===0)throw new Error("USDC: invalid LZ4 match offset");let u=(o&15)+4;if(u===19){let f;do{if(e>=t)throw new Error("USDC: truncated LZ4 length");f=r[e++],u+=f}while(f===255)}let l=s-c;if(l<0)throw new Error("USDC: invalid LZ4 match position");for(let f=0;f<u;f++){if(s>=i)throw new Error("USDC: LZ4 output overflow");n[s++]=n[l+f]}}return s}function bh(r,e,t=!1){let n=new Uint8Array(Ie(e,1));if(!r.length)throw new Error("USDC: missing LZ4 chunk header");let s=r[0];if(s===0){let i=Mx(r,1,r.length,n,0,e);if(!t&&i!==e)throw new Error("USDC: incomplete LZ4 output");return n.subarray(0,i)}else{if(1+s*4>r.length)throw new Error("USDC: truncated LZ4 chunk sizes");let o=1,a=[];for(let l=0;l<s;l++){let f=(r[o]|r[o+1]<<8|r[o+2]<<16|r[o+3]<<24)>>>0;a.push(f),o+=4}let c=o,u=0;for(let l=0;l<s;l++){let f=a[l],d=Math.min(65536,e-u);if(f>r.length-c)throw new Error("USDC: truncated LZ4 chunk");let h=Mx(r,c,c+f,n,u,u+d);if(c+=f,l<s-1&&h!==u+d)throw new Error("USDC: incomplete LZ4 chunk");u=h}if(c!==r.length||!t&&u!==e)throw new Error("USDC: incomplete LZ4 output");return n.subarray(0,u)}}function Br(r,e){let t=e*4+(e*2+7>>3)+4,n=bh(new Uint8Array(r),t,!0);return SF(n,e)}function SF(r,e){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),n=0,s=t.getInt32(n,!0);n+=4;let i=e*2+7>>3;if(r.length<n+i)throw new Error("USDC: truncated integer codes");let o=n,a=n+i,c=new Int32Array(Ie(e)),u=0,l=o,f=a;for(let d=0;d<e;){let h=r[l++];for(let m=0;m<4&&d<e;m++,d++){let b=h>>m*2&3,g=0;switch(b){case 0:g=s;break;case 1:g=t.getInt8(f),f+=1;break;case 2:g=t.getInt16(f,!0),f+=2;break;case 3:g=t.getInt32(f,!0),f+=4;break}u+=g,c[d]=u}}return c}var ph,mh,Dx,TF,S,_F,AF,vF,IF,gh,hi,ju,Rx=p(()=>{"use strict";ph=0;mh=new TextDecoder,Dx=new Float32Array(32);for(let r=0;r<32;r++)Dx[r]=Math.pow(2,r-15);TF=Math.pow(2,-14),S={Invalid:0,Bool:1,UChar:2,Int:3,UInt:4,Int64:5,UInt64:6,Half:7,Float:8,Double:9,String:10,Token:11,AssetPath:12,Matrix2d:13,Matrix3d:14,Matrix4d:15,Quatd:16,Quatf:17,Quath:18,Vec2d:19,Vec2f:20,Vec2h:21,Vec2i:22,Vec3d:23,Vec3f:24,Vec3h:25,Vec3i:26,Vec4d:27,Vec4f:28,Vec4h:29,Vec4i:30,Dictionary:31,TokenListOp:32,StringListOp:33,PathListOp:34,ReferenceListOp:35,IntListOp:36,Int64ListOp:37,UIntListOp:38,UInt64ListOp:39,PathVector:40,TokenVector:41,Specifier:42,Permission:43,Variability:44,VariantSelectionMap:45,TimeSamples:46,Payload:47,DoubleVector:48,LayerOffsetVector:49,StringVector:50,ValueBlock:51,Value:52,UnregisteredValue:53,UnregisteredValueListOp:54,PayloadListOp:55,TimeCode:56,PathExpression:57,Relocates:58,Spline:59,AnimationBlock:60},_F=new Set([S.Int,S.UInt,S.Float,S.Double,S.Half,S.String,S.Token]),AF=4294967295,vF=105,IF=116;gh=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.offset=0}seek(e){if(!Number.isSafeInteger(e)||e<0||e>this.buffer.byteLength)throw new Error("USDC: invalid seek");this.offset=e}tell(){return this.offset}readUint8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readInt8(){let e=this.view.getInt8(this.offset);return this.offset+=1,e}readUint16(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readInt16(){let e=this.view.getInt16(this.offset,!0);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readInt32(){let e=this.view.getInt32(this.offset,!0);return this.offset+=4,e}readUint64(){let e=this.view.getUint32(this.offset,!0),t=this.view.getUint32(this.offset+4,!0);this.offset+=8;let n=t*4294967296+e;if(!Number.isSafeInteger(n))throw new Error("USDC: integer exceeds safe precision");return n}readInt64(){let e=this.view.getUint32(this.offset,!0),t=this.view.getInt32(this.offset+4,!0);this.offset+=8;let n=t*4294967296+e;if(!Number.isSafeInteger(n))throw new Error("USDC: integer exceeds safe precision");return n}readFloat32(){let e=this.view.getFloat32(this.offset,!0);return this.offset+=4,e}readFloat64(){let e=this.view.getFloat64(this.offset,!0);return this.offset+=8,e}readBytes(e){let t=new Uint8Array(this.buffer,this.offset,e);return this.offset+=e,t}readString(e){let t=this.readBytes(e),n=0;for(;n<e&&t[n]!==0;)n++;return mh.decode(t.subarray(0,n))}},hi=class{constructor(e,t){this.lo=e,this.hi=t}get isArray(){return(this.hi&2147483648)!==0}get isInlined(){return(this.hi&1073741824)!==0}get isCompressed(){return(this.hi&536870912)!==0}get typeEnum(){return this.hi>>16&255}get payload(){return this.lo+(this.hi&65535)*4294967296}getInlinedValue(){return this.lo}},ju=class{parseData(e){ph=0,this._valueReadCount=0,this._activeDictionaries=new Set,this.buffer=e instanceof ArrayBuffer?e:e.buffer,this.reader=new gh(this.buffer),this.version={major:0,minor:0,patch:0},this._conversionBuffer=new ArrayBuffer(4),this._conversionView=new DataView(this._conversionBuffer),this._readBootstrap(),this._readTOC(),this._readTokens(),this._readStrings(),this._readFields(),this._readFieldSets(),this._readPaths(),this._readSpecs(),this.specsByPath=Object.create(null);for(let t of this.specs){let n=this.paths[t.pathIndex];if(!n)continue;let s=this._getFieldsForSpec(t);this.specsByPath[n]={specType:t.specType,fields:s}}return{specsByPath:this.specsByPath}}_readBootstrap(){let e=this.reader;if(e.seek(0),e.readString(8)!=="PXR-USDC")throw new Error("THREE.USDCParser: Not a valid USDC file.");this.version.major=e.readUint8(),this.version.minor=e.readUint8(),this.version.patch=e.readUint8(),e.readBytes(5),this.tocOffset=e.readUint64()}_readTOC(){let e=this.reader;e.seek(this.tocOffset);let t=e.readUint64();if(t>16)throw new Error("USDC: invalid section count");this.sections=Object.create(null);for(let n=0;n<t;n++){let s=e.readString(16),i=e.readUint64(),o=e.readUint64();this.sections[s]={start:i,size:o}}}_readTokens(){let e=this.sections.TOKENS;if(!e)return;let t=this.reader;t.seek(e.start);let n=Tt(t.readUint64());if(this.tokens=[],this.version.major===0&&this.version.minor<4){let s=t.readUint64(),i=t.readBytes(s),o=0;for(let a=0;a<n;a++){let c=o;for(;c<i.length&&i[c]!==0;)c++;if(c>=i.length)throw new Error("USDC: unterminated token data");this.tokens.push(mh.decode(i.subarray(o,c))),o=c+1}}else{let s=t.readUint64(),i=t.readUint64(),o=t.readBytes(i),a=bh(o,s);Ie(a.length,2);let c=0;for(let u=0;u<n;u++){let l=c;for(;l<a.length&&a[l]!==0;)l++;if(l>=a.length)throw new Error("USDC: unterminated token data");this.tokens.push(mh.decode(a.subarray(c,l))),c=l+1}}}_readStrings(){let e=this.sections.STRINGS;if(!e){this.strings=[];return}let t=this.reader;t.seek(e.start);let n=Tt(t.readUint64());this.strings=[];for(let s=0;s<n;s++)this.strings.push(t.readUint32())}_readFields(){let e=this.sections.FIELDS;if(!e)return;let t=this.reader;if(t.seek(e.start),this.fields=[],this.version.major===0&&this.version.minor<4){let n=Math.floor(e.size/12);for(let s=0;s<n;s++){let i=t.readUint32(),o=t.readUint32(),a=t.readUint32();this.fields.push({tokenIndex:i,valueRep:new hi(o,a)})}}else{let n=Tt(t.readUint64()),s=t.readUint64(),i=t.readBytes(s),o=Br(i.buffer.slice(i.byteOffset,i.byteOffset+s),n),a=t.readUint64(),c=t.readBytes(a),u=bh(c,n*8),l=new DataView(u.buffer,u.byteOffset,u.byteLength);for(let f=0;f<n;f++){let d=l.getUint32(f*8,!0),h=l.getUint32(f*8+4,!0);this.fields.push({tokenIndex:o[f],valueRep:new hi(d,h)})}}}_readFieldSets(){let e=this.sections.FIELDSETS;if(!e)return;let t=this.reader;if(t.seek(e.start),this.fieldSets=[],this.version.major===0&&this.version.minor<4){let n=Math.floor(e.size/4);for(let s=0;s<n;s++)this.fieldSets.push(t.readUint32())}else{let n=Tt(t.readUint64()),s=t.readUint64(),i=t.readBytes(s),o=Br(i.buffer.slice(i.byteOffset,i.byteOffset+s),n);for(let a=0;a<n;a++)this.fieldSets.push(o[a])}}_readPaths(){let e=this.sections.PATHS;if(!e)return;let t=this.reader;t.seek(e.start);let n=Tt(t.readUint64());if(this.paths=new Array(Ie(n)).fill(""),this.version.major===0&&this.version.minor<4)this._readPathsRecursive("");else{t.readUint64();let s=t.readUint64(),i=t.readBytes(s),o=Br(i.buffer.slice(i.byteOffset,i.byteOffset+s),n),a=t.readUint64(),c=t.readBytes(a),u=Br(c.buffer.slice(c.byteOffset,c.byteOffset+a),n),l=t.readUint64(),f=t.readBytes(l),d=Br(f.buffer.slice(f.byteOffset,f.byteOffset+l),n);this._buildPathsFromCompressed(o,u,d)}}_readPathsRecursive(e,t=0){let n=this.reader;if(t>1e3)return;let s=n.readUint32(),i=n.readUint32(),o=n.readUint8(),a=(o&1)!==0,c=(o&2)!==0,u=(o&4)!==0,l;if(e==="")l="/";else{let f=this.tokens[i]||"";u?l=e+"."+f:l=e==="/"?"/"+f:e+"/"+f}if(Ie(l.length,2),this.paths[s]=l,a&&c){let f=n.readUint64();this._readPathsRecursive(l,t+1),n.seek(f),this._readPathsRecursive(e,t+1)}else a?this._readPathsRecursive(l,t+1):c&&this._readPathsRecursive(e,t+1)}_buildPathsFromCompressed(e,t,n){let s=0,i=[{startIndex:0,parentPath:""}];for(;i.length;){let o=i.pop(),a=o.startIndex,c=o.parentPath;for(;a<e.length;){if(++s>e.length*2)throw new Error("USDC: path traversal limit exceeded");let u=a++,l=e[u],f=t[u],d=n[u];if(l<0||l>=this.paths.length||Math.abs(f)>=this.tokens.length||d<-2)throw new Error("USDC: invalid compressed path index");let h;if(c==="")h="/",c=h;else{let g=this.tokens[Math.abs(f)];h=f<0?c+"."+g:c==="/"?"/"+g:c+"/"+g}Ie(h.length,2),this.paths[l]=h;let m=d>0||d===-1,b=d>=0;if((m||b)&&a>=e.length)throw new Error("USDC: missing compressed path entry");if(m&&b){let g=u+d;if(g<=a||g>=e.length)throw new Error("USDC: invalid compressed path jump");i.push({startIndex:g,parentPath:c})}if(m)c=h;else if(!b)break}}}_readSpecs(){let e=this.sections.SPECS;if(!e)return;let t=this.reader;if(t.seek(e.start),this.specs=[],this.version.major===0&&this.version.minor<4){let n=this.version.minor===0&&this.version.patch===1?16:12,s=Math.floor(e.size/n);for(let i=0;i<s;i++){let o=t.readUint32(),a=t.readUint32(),c=t.readUint32();n===16&&t.readUint32(),this.specs.push({pathIndex:o,fieldSetIndex:a,specType:c})}}else{let n=Tt(t.readUint64()),s=t.readUint64(),i=t.readBytes(s),o=Br(i.buffer.slice(i.byteOffset,i.byteOffset+s),n),a=t.readUint64(),c=t.readBytes(a),u=Br(c.buffer.slice(c.byteOffset,c.byteOffset+a),n),l=t.readUint64(),f=t.readBytes(l),d=Br(f.buffer.slice(f.byteOffset,f.byteOffset+l),n);for(let h=0;h<n;h++)this.specs.push({pathIndex:o[h],fieldSetIndex:u[h],specType:d[h]})}}_readValue(e){if(this._valueReadCount=(this._valueReadCount||0)+1,this._valueReadCount>1e6)throw new Error("USDC: value traversal limit exceeded");let t=e.typeEnum,n=e.isArray,s=e.isInlined;if(t===S.TimeSamples)return this._readTimeSamples(e);if(s)return this._readInlinedValue(e);let i=e.payload;if(i===0&&n)return[];if(i<0||i>=this.buffer.byteLength)throw new RangeError("USDCParser: Invalid payload offset "+i+" for type "+t+".");let o=this.reader.tell();this.reader.seek(i);let a;return n?a=this._readArrayValue(e):a=this._readScalarValue(t),this.reader.seek(o),a}_readInlinedValue(e){let t=e.typeEnum,n=e.getInlinedValue(),s=this._conversionView;switch(t){case S.Dictionary:if(n!==0)throw new Error("USDC: invalid inline dictionary");return Object.create(null);case S.Bool:return n!==0;case S.UChar:return n&255;case S.Int:case S.Int64:return n|0;case S.UInt:case S.UInt64:return n>>>0;case S.Half:return this._halfToFloat(n&65535);case S.Float:return s.setUint32(0,n,!0),s.getFloat32(0,!0);case S.Double:return s.setUint32(0,n,!0),s.getFloat32(0,!0);case S.Token:return this.tokens[n]||"";case S.String:return this.tokens[this.strings[n]]||"";case S.AssetPath:return this.tokens[n]||"";case S.Specifier:return n;case S.Permission:case S.Variability:return n;case S.Vec2h:return s.setUint32(0,n,!0),[this._halfToFloat(s.getUint16(0,!0)),this._halfToFloat(s.getUint16(2,!0))];case S.Vec2f:case S.Vec2i:return s.setUint32(0,n,!0),[s.getInt8(0),s.getInt8(1)];case S.Vec3f:case S.Vec3i:return s.setUint32(0,n,!0),[s.getInt8(0),s.getInt8(1),s.getInt8(2)];case S.Vec4f:case S.Vec4i:return s.setUint32(0,n,!0),[s.getInt8(0),s.getInt8(1),s.getInt8(2),s.getInt8(3)];case S.Matrix2d:{s.setUint32(0,n,!0);let i=s.getInt8(0),o=s.getInt8(1);return[i,0,0,o]}case S.Matrix3d:{s.setUint32(0,n,!0);let i=s.getInt8(0),o=s.getInt8(1),a=s.getInt8(2);return[i,0,0,0,o,0,0,0,a]}case S.Matrix4d:{s.setUint32(0,n,!0);let i=s.getInt8(0),o=s.getInt8(1),a=s.getInt8(2),c=s.getInt8(3);return[i,0,0,0,0,o,0,0,0,0,a,0,0,0,0,c]}default:throw new Error("USDC: unsupported inline value type "+t)}}_readTimeSamples(e){let t=this.reader,n=e.payload,s=t.tell();t.seek(n);let i=t.tell(),o=t.readInt64();t.seek(i+o);let a=t.readUint32(),c=t.readUint32(),u=new hi(a,c),l=this._readValue(u),f=i+o+8;t.seek(f);let d=t.tell(),h=t.readInt64();t.seek(d+h);let m=Tt(t.readUint64()),b=[];for(let x=0;x<m;x++){let T=t.readUint32(),_=t.readUint32();b.push(new hi(T,_))}let g=[];for(let x=0;x<m;x++)g.push(this._readValue(b[x]));return t.seek(s),{times:l instanceof Float64Array?Array.from(l):Array.isArray(l)?l:[l],values:g}}_readScalarValue(e){let t=this.reader;switch(e){case S.Invalid:return null;case S.Bool:return t.readUint8()!==0;case S.UChar:return t.readUint8();case S.Int:return t.readInt32();case S.UInt:return t.readUint32();case S.Int64:return t.readInt64();case S.UInt64:return t.readUint64();case S.Half:return this._readHalf();case S.Float:return t.readFloat32();case S.Double:return t.readFloat64();case S.String:case S.Token:{let n=t.readUint32();return this.tokens[n]||""}case S.AssetPath:{let n=t.readUint32();return this.tokens[n]||""}case S.Vec2f:return[t.readFloat32(),t.readFloat32()];case S.Vec2d:return[t.readFloat64(),t.readFloat64()];case S.Vec2i:return[t.readInt32(),t.readInt32()];case S.Vec3f:return[t.readFloat32(),t.readFloat32(),t.readFloat32()];case S.Vec3d:return[t.readFloat64(),t.readFloat64(),t.readFloat64()];case S.Vec3i:return[t.readInt32(),t.readInt32(),t.readInt32()];case S.Vec4f:return[t.readFloat32(),t.readFloat32(),t.readFloat32(),t.readFloat32()];case S.Vec4d:return[t.readFloat64(),t.readFloat64(),t.readFloat64(),t.readFloat64()];case S.Quatf:return[t.readFloat32(),t.readFloat32(),t.readFloat32(),t.readFloat32()];case S.Quatd:return[t.readFloat64(),t.readFloat64(),t.readFloat64(),t.readFloat64()];case S.Matrix4d:{let n=[];for(let s=0;s<16;s++)n.push(t.readFloat64());return n}case S.TokenVector:{let n=Tt(t.readUint64()),s=[];for(let i=0;i<n;i++){let o=t.readUint32();s.push(this.tokens[o]||"")}return s}case S.PathVector:{let n=Tt(t.readUint64()),s=[];for(let i=0;i<n;i++){let o=t.readUint32();s.push(this.paths[o]||"")}return s}case S.DoubleVector:{let n=Tt(t.readUint64()),s=new Float64Array(Ie(n));for(let i=0;i<n;i++)s[i]=t.readFloat64();return s}case S.Dictionary:return this._readDictionary();case S.TokenListOp:case S.StringListOp:case S.IntListOp:case S.Int64ListOp:case S.UIntListOp:case S.UInt64ListOp:throw new Error("USDC: value list operations are unsupported");case S.PathListOp:{let n=t.readUint8();if(n&24||(n&102).toString(2).replaceAll("0","").length>1)throw new Error("USDC: compound path list operations are unsupported");let s=(n&2)!==0,i=(n&4)!==0,o=(n&8)!==0,a=(n&16)!==0,c=(n&32)!==0,u=(n&64)!==0,l=()=>{let b=Tt(t.readUint64()),g=[];for(let y=0;y<b;y++){let x=t.readUint32();g.push(this.paths[x])}return g},f=null,d=null,h=null,m=null;return s&&(f=l()),i&&(d=l()),c&&(h=l()),u&&(m=l()),o&&l(),a&&l(),h&&h.length>0?h:f&&f.length>0?f:m&&m.length>0?m:d&&d.length>0?d:null}case S.VariantSelectionMap:{let n=Tt(t.readUint64()),s=Object.create(null);for(let i=0;i<n;i++){let o=t.readUint32(),a=t.readUint32(),c=this.tokens[this.strings[o]],u=this.tokens[this.strings[a]];c&&u&&(s[c]=u)}return s}default:throw new Error("USDC: unsupported encoding: "+["USDCParser: Unsupported scalar type",e].join(" "))}}_readDictionary(){let e=this.reader,t=e.tell();if(this._activeDictionaries||=new Set,this._activeDictionaries.has(t))throw new Error("USDC: cyclic dictionary value");if(this._activeDictionaries.size>=64)throw new Error("USDC: dictionary depth limit exceeded");this._activeDictionaries.add(t);try{let n=Tt(e.readUint64());if(n>Math.floor((this.buffer.byteLength-e.tell())/20))throw new Error("USDC: truncated dictionary entries");let s=Object.create(null);for(let i=0;i<n;i++){let o=e.readUint32(),a=this.tokens[this.strings[o]];if(typeof a!="string"||Object.hasOwn(s,a))throw new Error("USDC: invalid dictionary key");let c=e.tell(),u=e.readInt64();if(u<8)throw new Error("USDC: invalid dictionary value offset");e.seek(c+u);let l=new hi(e.readUint32(),e.readUint32());if(l.typeEnum<S.Bool||l.typeEnum>S.AssetPath&&l.typeEnum!==S.Dictionary||l.isArray&&!_F.has(l.typeEnum))throw new Error("USDC: unsupported dictionary value type");let f=e.tell(),d=this._readValue(l);s[a]=l.typeEnum===S.AssetPath?{assetPath:d}:d,e.seek(f)}return s}finally{this._activeDictionaries.delete(t)}}_readArrayValue(e){let t=this.reader,n=e.typeEnum,s=e.isCompressed,i;if(this.version.major===0&&this.version.minor<7?i=t.readUint32():i=t.readUint64(),!Number.isSafeInteger(i)||i<0)throw new RangeError("USDCParser: Invalid array size "+i+" for type "+n+".");if(i>2147483647)throw new RangeError("USDCParser: Array size "+i+" exceeds implementation limits.");if(i=Tt(i),i===0)return[];if(s)return this._readCompressedArray(n,i);switch(n){case S.Int:{let o=new Int32Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readInt32();return o}case S.UInt:{let o=new Uint32Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readUint32();return o}case S.Float:{let o=new Float32Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readFloat32();return o}case S.Double:{let o=new Float64Array(Ie(i));for(let a=0;a<i;a++)o[a]=t.readFloat64();return o}case S.Vec2f:{let o=new Float32Array(Ie(i*2));for(let a=0;a<i*2;a++)o[a]=t.readFloat32();return o}case S.Vec3f:{let o=new Float32Array(Ie(i*3));for(let a=0;a<i*3;a++)o[a]=t.readFloat32();return o}case S.Vec4f:{let o=new Float32Array(Ie(i*4));for(let a=0;a<i*4;a++)o[a]=t.readFloat32();return o}case S.Vec3h:{let o=new Float32Array(Ie(i*3));for(let a=0;a<i*3;a++)o[a]=this._readHalf();return o}case S.Quatf:{let o=new Float32Array(Ie(i*4));for(let a=0;a<i*4;a++)o[a]=t.readFloat32();return o}case S.Quath:{let o=new Float32Array(Ie(i*4));for(let a=0;a<i*4;a++)o[a]=this._readHalf();return o}case S.Matrix4d:{let o=new Float64Array(Ie(i*16));for(let a=0;a<i*16;a++)o[a]=t.readFloat64();return o}case S.String:case S.Token:{let o=[];for(let a=0;a<i;a++){let c=t.readUint32(),u=n===S.String?this.strings[c]:c,l=this.tokens[u];if(typeof l!="string")throw new Error("USDC: invalid string array index");o.push(l)}return o}case S.Half:{let o=new Float32Array(Ie(i));for(let a=0;a<i;a++)o[a]=this._readHalf();return o}default:throw new Error("USDC: unsupported encoding: "+["USDCParser: Unsupported array type",n].join(" "))}}_readCompressedArray(e,t){let n=this.reader;switch(e){case S.Int:case S.UInt:{let s=n.readUint64(),i=n.readBytes(s),o=Br(i.buffer.slice(i.byteOffset,i.byteOffset+s),t);return e===S.UInt?new Uint32Array(o.buffer,o.byteOffset,o.length):o}case S.Half:case S.Double:case S.Float:{let s=n.readInt8();if(s===vF){let i=n.readUint64(),o=n.readBytes(i),a=Br(o.buffer.slice(o.byteOffset,o.byteOffset+i),t),c=e===S.Double?new Float64Array(Ie(t)):new Float32Array(Ie(t));for(let u=0;u<t;u++)c[u]=e===S.Half?this._convertHalfInteger(a[u]):a[u];return c}else if(s===IF){let i=Tt(n.readUint32());if(i===0)throw new Error("USDC: invalid float lookup table");let o=e===S.Double?new Float64Array(Ie(i)):new Float32Array(Ie(i));for(let f=0;f<i;f++)o[f]=e===S.Half?this._readHalf():e===S.Double?n.readFloat64():n.readFloat32();let a=n.readUint64(),c=n.readBytes(a),u=Br(c.buffer.slice(c.byteOffset,c.byteOffset+a),t),l=e===S.Double?new Float64Array(Ie(t)):new Float32Array(Ie(t));for(let f=0;f<t;f++){if(u[f]<0||u[f]>=i)throw new Error("USDC: invalid float lookup index");l[f]=o[u[f]]}return l}throw new Error("USDC: unsupported encoding: "+["USDCParser: Unknown float compression code",s].join(" "))}default:throw new Error("USDC: unsupported encoding: "+["USDCParser: Unsupported compressed array type",e].join(" "))}}_convertHalfInteger(e){let t=Math.abs(e);if(t<=2048)return e;if(t>=65520)return Math.sign(e)*(1/0);let n=2**(Math.floor(Math.log2(t))-10),s=t/n,i=Math.floor(s),o=s-i,a=o>.5||o===.5&&i%2!==0?i+1:i;return Math.sign(e)*a*n}_readHalf(){return this._halfToFloat(this.reader.readUint16())}_halfToFloat(e){let t=(e&32768)>>15,n=(e&31744)>>10,s=e&1023;return n===0?s===0?t?-0:0:(t?-1:1)*TF*(s/1024):n===31?s?NaN:t?-1/0:1/0:(t?-1:1)*Dx[n]*(1+s/1024)}_getFieldsForSpec(e){let t=Object.create(null),n=e.fieldSetIndex,s=1e4,i=0;for(;n<this.fieldSets.length&&i<s;){let o=this.fieldSets[n];if(o===AF||o===-1)break;let a=this.fields[o];if(!a)throw new Error("USDC: invalid field index");if(a){let c=this.tokens[a.tokenIndex],u=this._readValue(a.valueRep);t[c]=u}n++,i++}if(i>=s)throw new Error("USDC: field traversal limit exceeded");return t}}});function Nx(r,e){if(r.byteLength<88||r.byteLength>64*1024*1024)throw new Error("USDC: invalid input size");let t=new Uint8Array(r);if(t[8]!==0||t[9]!==8||t[10]!==0)throw new Error("USDC: initial decoder requires crate version 0.8.0");let n=new DataView(r),s=n.getBigUint64(16,!0);if(s>BigInt(r.byteLength-8))throw new Error("USDC: invalid section table");let i=Number(s),o=n.getBigUint64(i,!0);if(o>16n||i+8+Number(o)*32>r.byteLength)throw new Error("USDC: invalid section table length");let a=new Set;for(let f=0;f<Number(o);f++){let d=i+8+f*32,h=t.subarray(d,d+16),m=h.indexOf(0),b=new TextDecoder().decode(h.subarray(0,m<0?h.length:m));if(a.has(b))throw new Error("USDC: duplicate section");a.add(b);let g=n.getBigUint64(d+16,!0),y=n.getBigUint64(d+24,!0);if(g<88n||g+y>BigInt(r.byteLength))throw new Error("USDC: section out of bounds")}for(let f of["TOKENS","STRINGS","FIELDS","FIELDSETS","PATHS","SPECS"])if(!a.has(f))throw new Error("USDC: missing required section");let{specsByPath:c}=new ju().parseData(r),u=new Map;for(let[f,d]of Object.entries(c)){if(d.specType===7&&f==="/"||d.specType===1||d.specType===8)continue;if(d.specType!==6||!/^\/(?:[A-Za-z_][\w:]*\/)*[A-Za-z_][\w:]*$/.test(f))throw new Error("USDC: unsupported prim specification");let h=d.fields,m=h.specifier??0;if(m!==0&&m!==1&&m!==2)throw new Error("USDC: invalid prim specifier");let b=Gu(h,new Set(["specifier","typeName","primChildren","properties"]));u.set(f,{name:f.slice(f.lastIndexOf("/")+1),path:f,sourceUrl:e,type:String(h.typeName||""),specifier:["def","over","class"][m],attributes:Object.create(null),metadata:b,variants:Object.create(null),children:[]})}let l=[];for(let f of u.values()){let d=f.path.slice(0,f.path.lastIndexOf("/"));if(!d)l.push(f);else{let h=u.get(d);if(!h)throw new Error("USDC: missing parent prim");h.children.push(f)}}kx(l,c["/"]?.fields.primChildren);for(let f of u.values())kx(f.children,c[f.path]?.fields.primChildren);for(let[f,d]of Object.entries(c)){if(d.specType!==1&&d.specType!==8)continue;let h=f.indexOf("."),m=u.get(f.slice(0,h));if(h<0||!m)throw new Error("USDC: property has no owning prim");let b=f.slice(h+1),g=d.fields,y=d.specType===8?"rel":String(g.typeName||""),x=Cx(d.specType===8?g.targetPaths:g.default,y),T=Gu(g,new Set(["typeName","default","targetPaths","timeSamples"]));g.timeSamples!==void 0&&(T.timeSamples=EF(g.timeSamples,y)),m.attributes[b]={name:b,type:y,value:x,metadata:T}}return{format:"usdc",url:e,metadata:Gu(c["/"]?.fields||{},new Set(["primChildren"])),rootPrims:l,layers:[]}}function Gu(r,e){let t=Object.create(null);for(let[n,s]of Object.entries(r))e.has(n)||(t[n]=zu(s));return t}function zu(r){if(r==null)return null;if(typeof r=="number"||typeof r=="string"||typeof r=="boolean")return r;if(Array.isArray(r))return r.map(zu);if(ArrayBuffer.isView(r)&&!(r instanceof DataView))return Array.from(r);if(typeof r=="object")return Gu(r,new Set);throw new Error("USDC: unsupported decoded value")}function Cx(r,e){let t=zu(r);if(e==="asset"&&typeof t=="string")return{assetPath:t};if(e==="rel"&&Array.isArray(t))return t.map(s=>typeof s=="string"?{path:s}:s);let n=/^(?:(?:point|normal|vector|color|texCoord)([234])[fdh]|(?:float|double|half|int)([234]))\[\]$/.exec(e);if(n&&Array.isArray(t)){let s=Number(n[1]||n[2]);if(t.length%s)throw new Error("USDC: incomplete vector tuple");let i=[];for(let o=0;o<t.length;o+=s)i.push(t.slice(o,o+s));return i}return t}function kx(r,e){if(e===void 0)return;if(!Array.isArray(e))throw new Error("USDC: invalid primChildren order");let t=new Map(r.map(s=>[s.name,s])),n=[];for(let s of e){let i=typeof s=="string"?t.get(s):void 0;if(!i)throw new Error("USDC: invalid primChildren reference");n.push(i),t.delete(s)}for(let s of t.values())n.push(s);for(let s=0;s<n.length;s++)r[s]=n[s]}function EF(r,e){if(!r||typeof r!="object")throw new Error("USDC: invalid time samples");let t=r,n=zu(t.times);if(!Array.isArray(n)||!Array.isArray(t.values)||n.length!==t.values.length)throw new Error("USDC: invalid time samples");return{times:n,values:t.values.map(s=>Cx(s,e))}}var Ux=p(()=>{"use strict";Rx()});function Px(r,e){if(!r.trimStart().startsWith("#usda"))throw new Error("OpenUSD ASCII layers must begin with the #usda header.");return new yh(r,e).parse()}var LF,BF,yh,wh,Vx=p(()=>{"use strict";LF=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/,BF=new Set(["uniform","varying","custom","prepend","append","add","delete","reorder"]);yh=class{tokenizer;url;constructor(e,t){this.tokenizer=new wh(e),this.url=t}parse(){let e=this.tokenizer.match("(")?this.parseMetadata(")"):{},t=[];for(;!this.tokenizer.isAtEnd();)this.isPrimDeclaration()?t.push(this.parsePrim("")):this.tokenizer.read();return{format:"usda",url:this.url,metadata:e,rootPrims:t,layers:this.url?[this.url]:[]}}parsePrim(e){let n=this.tokenizer.read().value,s=this.tokenizer.read(),i=this.tokenizer.peek().kind==="string",o=i?s.value:"",a=i?this.tokenizer.read().value:s.value,c=`${e}/${a}`,u=this.tokenizer.match("(")?this.parseMetadata(")"):{};this.tokenizer.expect("{");let l=this.parsePrimContents(c);return{name:a,path:c,sourceUrl:this.url,type:o,specifier:n,attributes:l.attributes,metadata:{...u,...l.metadata},variants:l.variants,children:l.children}}parsePrimContents(e){let t={},n={},s=[],i={};for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match("}");)if(this.isPrimDeclaration())s.push(this.parsePrim(e));else if(this.tokenizer.peek().value==="variantSet")this.parseVariantSet(e,i);else{let o=this.parseAttribute();o&&(t[o.name]=o)}return{attributes:t,metadata:n,children:s,variants:i}}parseVariantSet(e,t){this.tokenizer.expect("variantSet");let n=this.tokenizer.read().value;this.tokenizer.expect("="),this.tokenizer.expect("{");let s={};for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match("}");){let i=this.tokenizer.read().value;this.tokenizer.expect("{");let o=this.parsePrimContents(e);s[i]={attributes:o.attributes,metadata:o.metadata,children:o.children}}t[n]=s}parseAttribute(){let e=this.tokenizer.read();if(e.kind==="end")return null;let t=[e];for(;!this.tokenizer.isAtEnd()&&this.tokenizer.peek().line===e.line;){let u=this.tokenizer.peek();if(u.value==="="){this.tokenizer.read();break}if(u.value==="{"||u.value==="}")return null;t.push(this.tokenizer.read())}if(!(this.tokenizer.previousValue==="="))return null;let s=t.filter(u=>!BF.has(u.value));if(s.length===0)return null;let i=s[s.length-1].value,o=s.slice(0,-1).map(u=>u.value).join(""),a=this.parseValue(),c=this.tokenizer.match("(")?this.parseMetadata(")"):{};return{name:i,type:o,value:a,metadata:c}}parseMetadata(e){let t={};for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match(e);){if(this.tokenizer.match(","),this.tokenizer.peek().value===e){this.tokenizer.read();break}let n=this.tokenizer.read(),s=[n];for(;!this.tokenizer.isAtEnd()&&this.tokenizer.peek().line===n.line;){if(this.tokenizer.peek().value==="="||this.tokenizer.peek().value===":"){this.tokenizer.read();break}if(this.tokenizer.peek().value===e)break;s.push(this.tokenizer.read())}if(this.tokenizer.previousValue!=="="&&this.tokenizer.previousValue!==":")continue;let i=s[s.length-1].value;t[i]=this.parseValue(),this.tokenizer.match(",")}return t}parseValue(){let e=this.tokenizer.read();if(e.value==="[")return this.parseList("]");if(e.value==="(")return this.parseList(")");if(e.value==="{")return this.parseMetadata("}");if(e.kind==="asset"){let t={assetPath:e.value};return this.tokenizer.peek().kind==="path"&&this.tokenizer.peek().line===e.line&&(t.primPath=this.tokenizer.read().value),t}return e.kind==="path"?{path:e.value}:e.kind==="number"?Number(e.value):e.value==="true"?!0:e.value==="false"?!1:e.value==="None"||e.value==="null"?null:e.value}parseList(e){let t=[];for(;!this.tokenizer.isAtEnd()&&!this.tokenizer.match(e);)this.tokenizer.match(",")||(t.push(this.parseValue()),this.tokenizer.match(","));return t}isPrimDeclaration(){let e=this.tokenizer.peek().value;return e==="def"||e==="over"||e==="class"}},wh=class{source;offset=0;line=1;bufferedToken=null;previousValue="";constructor(e){this.source=e}peek(){return this.bufferedToken||=this.readToken(),this.bufferedToken}read(){let e=this.peek();return this.bufferedToken=null,this.previousValue=e.value,e}match(e){return this.peek().value!==e?!1:(this.read(),!0)}expect(e){let t=this.read();if(t.value!==e)throw new Error(`Expected "${e}" at USDA line ${t.line}, received "${t.value}".`)}isAtEnd(){return this.peek().kind==="end"}readToken(){this.skipIgnoredText();let e=this.line,t=this.source[this.offset];if(t===void 0)return{value:"",line:e,kind:"end"};if("{}[](),=".includes(t))return this.offset++,{value:t,line:e,kind:"punctuation"};if(t==='"'||t==="'")return{value:this.readQuotedString(t),line:e,kind:"string"};if(t==="@")return{value:this.readDelimitedValue("@"),line:e,kind:"asset"};if(t==="<")return{value:this.readDelimitedValue(">"),line:e,kind:"path"};let n=this.source.slice(this.offset).match(LF);if(n)return this.offset+=n[0].length,{value:n[0],line:e,kind:"number"};let s=this.offset;for(;this.offset<this.source.length;){let i=this.source[this.offset];if(/\s/.test(i)||"{}[](),=@<>".includes(i))break;this.offset++}return this.offset===s&&this.offset++,{value:this.source.slice(s,this.offset),line:e,kind:"word"}}skipIgnoredText(){for(;this.offset<this.source.length;){let e=this.source[this.offset];if(e===`
8
8
  `)this.line++,this.offset++;else if(/\s/.test(e))this.offset++;else if(e==="#")for(;this.offset<this.source.length&&this.source[this.offset]!==`
9
9
  `;)this.offset++;else if(e==="/"&&this.source[this.offset+1]==="*"){for(this.offset+=2;this.offset<this.source.length&&!this.source.startsWith("*/",this.offset);)this.source[this.offset]===`
10
10
  `&&this.line++,this.offset++;this.offset+=2}else if(this.source.startsWith('"""',this.offset)){for(this.offset+=3;this.offset<this.source.length&&!this.source.startsWith('"""',this.offset);)this.source[this.offset]===`
11
11
  `&&this.line++,this.offset++;this.offset+=3}else break}}readQuotedString(e){this.offset++;let t="";for(;this.offset<this.source.length;){let n=this.source[this.offset++];if(n===e)break;if(n==="\\"&&this.offset<this.source.length){let s=this.source[this.offset++];t+=s==="n"?`
12
- `:s}else t+=n}return t}readDelimitedValue(e){this.offset++;let t=this.offset;for(;this.offset<this.source.length&&this.source[this.offset]!==e;)this.offset++;let n=this.source.slice(t,this.offset);return this.offset++,n}}});function Yw(r){let e=new DataView(r),t=FB(e),n=e.getUint16(t+10,!0),s=e.getUint32(t+16,!0),i=s,o=new Map,a=new TextDecoder,c=0;for(let u=0;u<n;u++){if(s+46>t)throw new Error("USDZ archive contains a truncated ZIP central-directory entry.");if(e.getUint32(s,!0)!==33639248)throw new Error("USDZ archive contains an invalid ZIP central-directory entry.");let l=e.getUint16(s+10,!0),f=e.getUint32(s+20,!0),d=e.getUint32(s+24,!0),h=e.getUint16(s+28,!0),m=e.getUint16(s+30,!0),b=e.getUint16(s+32,!0),g=e.getUint32(s+42,!0);if(s+46+h+m+b>t)throw new Error("USDZ archive contains a truncated ZIP filename or extra field.");let y=a.decode(new Uint8Array(r,s+46,h));if(l!==0)throw new Error(`USDZ entry "${y}" is compressed; USDZ requires stored ZIP entries.`);if(g+30>i||f!==d)throw new Error(`USDZ entry "${y}" has invalid stored ZIP bounds.`);if(e.getUint32(g,!0)!==67324752)throw new Error(`USDZ entry "${y}" has an invalid local ZIP header.`);let x=e.getUint16(g+26,!0),T=e.getUint16(g+28,!0),_=g+30+x+T;if((e.getUint16(s+8,!0)|e.getUint16(g+6,!0))&1)throw new Error(`USDZ entry "${y}" is encrypted.`);if(_+f>i||e.getUint16(g+8,!0)!==0||a.decode(new Uint8Array(r,g+30,x))!==y||o.has(y))throw new Error(`USDZ entry "${y}" has invalid or duplicate stored ZIP data.`);if(c+=f,c>r.byteLength)throw new Error("USDZ archive exceeds its stored data budget.");o.set(y,r.slice(_,_+f)),s+=46+h+m+b}return o}function FB(r){let e=Math.max(0,r.byteLength-65557);for(let t=r.byteLength-22;t>=e;t--)if(r.getUint32(t,!0)===101010256)return t;throw new Error("USDZ archive does not contain a ZIP end-of-central-directory record.")}var Qw=p(()=>{"use strict"});async function Jd(r,e={},t){let n=RB(e.core?.baseUrl,t?.url),s={fetch:async o=>{let a=await(t?.fetch||fetch)(o);if(!(a instanceof Response))throw new Error(`OpenUSD reference "${o}" did not return an HTTP response.`);if(!a.ok)throw new Error(`Unable to load OpenUSD reference "${o}": ${a.status}.`);return a},cache:new Map,archiveFiles:new Map,layers:new Set,options:{...e,usd:{...NB,...e.usd}}},i;if(VB(r)){let o=Yw(r),a=o.keys().next().value;if(!a||!/\.(?:usd[ac]?)$/i.test(a))throw new Error("USDZ archive has no supported USD root layer.");let c="https://usd.archive/",u=Object.create(null);for(let[f,d]of o){let h=new URL(f,c);if(f.startsWith("/")||/^[a-z][a-z\d+.-]*:/i.test(f)||f.includes("\\")||/[\u0000-\u001f\u007f]/.test(f)||f.trim()!==f||f.split("/").some(m=>{let b=m.replace(/%2e/gi,".");return b==="."||b===".."})||h.origin!==new URL(c).origin||h.search||h.hash||u[h.href])throw new Error(`USDZ entry "${f}" has an ambiguous package URL.`);s.archiveFiles.set(h.href,d),u[h.href]=DB(f,d)}let l=new URL(a,c).href;i=qd(o.get(a),l),i.format="usdz",i.assets=u}else i=qd(r,n);return i.url&&(tx(i,i.url),s.layers.add(i.url)),s.options.usd?.compose!==!1&&(i.rootPrims=await Kd(i.rootPrims,i.url,{},s,0)),i.layers=Array.from(s.layers),n&&(i.url=n),i}function DB(r,e){let t=r.slice(r.lastIndexOf(".")+1).toLowerCase(),n=t==="png"?"image/png":/^(?:jpe?g)$/.test(t)?"image/jpeg":void 0;return n?{path:r,data:e,mimeType:n}:{path:r,data:e}}function RB(r,e){let t=ex(r);return t||ex(e)||r||e}function ex(r){try{return r?new URL(r).href:void 0}catch{return}}function kB(r,e){try{return new URL(r,e).href}catch{let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?`${e.slice(0,t+1)}${r}`:r}}function qd(r,e){return Zw.decode(r.slice(0,8))===OB?qw(r,e):Hw(Zw.decode(r),e)}function tx(r,e){let t=[...r.rootPrims];for(;t.length;){let n=t.pop();for(let s of Object.values(n.attributes))s.sourceUrl=e;for(let s of n.children)t.push(s);if("variants"in n)for(let s of Object.values(n.variants))for(let i of Object.values(s))t.push(i)}}async function Kd(r,e,t,n,s){if(s>(n.options.usd?.maxReferenceDepth??12))throw new Error("OpenUSD reference composition exceeded the configured depth limit.");let i=[];for(let o of r){if(o.specifier==="class")continue;let c={...PB(o.metadata.variants),...t,...n.options.usd?.variantSelections},u=o.sourceUrl||e,l=ka(o);for(let[d,h]of Object.entries(l.variants)){let m=c[d]||Object.keys(h)[0],b=h[m];b&&(l=Hd(l,{...l,attributes:b.attributes,metadata:b.metadata,children:b.children,variants:{}}))}let f=nx(l);if(n.options.usd?.loadReferences!==!1&&f.length>0)for(let d of f){if(!u)throw new Error("OpenUSD references require a source URL or options.core.baseUrl.");let h=kB(d.assetPath,u),m=await CB(h,n),b=UB(m,d.primPath),g=await Kd(b,h,c,n,s+1);for(let y of g)l=Hd(sx(y,l.path),l)}l.children=await Kd(l.children,u,c,n,s),i.push(l)}return i}async function CB(r,e){let t=e.cache.get(r);return t||(t=(async()=>{let s=e.archiveFiles.get(r);if(!s){let o;try{o=await e.fetch(r)}catch(a){throw new Error(`Unable to fetch USD layer "${r}": ${String(a)}`)}s=o.arrayBuffer()}let i=qd(await s,r);return tx(i,r),e.layers.add(r),i})(),e.cache.set(r,t)),t}function UB(r,e){let t=e||r.metadata.defaultPrim;if(typeof t!="string")return r.rootPrims;let n=t.startsWith("/")?t:`/${t}`,s=rx(r.rootPrims,n);return s?[s]:[]}function rx(r,e){for(let t of r){if(t.path===e)return t;let n=rx(t.children,e);if(n)return n}}function nx(r){let e=[];for(let t of[r.metadata.references,r.metadata.payload,r.metadata.payloads])Array.isArray(t)?e.push(...t.filter(Xd)):Xd(t)&&e.push(t);return e}function PB(r){return!r||typeof r!="object"||Array.isArray(r)||Xd(r)?{}:Object.fromEntries(Object.entries(r).filter(e=>typeof e[1]=="string"))}function Xd(r){return!!(r&&typeof r=="object"&&!Array.isArray(r)&&"assetPath"in r)}function ka(r){return{...r,attributes:{...r.attributes},metadata:{...r.metadata},variants:{...r.variants},children:r.children.map(ka)}}function sx(r,e){let t=ka(r);return t.path=e,t.children=t.children.map(n=>sx(n,`${e}/${n.name}`)),t}function Hd(r,e){let t=r.children.map(ka);for(let n of e.children){let s=t.findIndex(i=>i.name===n.name);s>=0?t[s]=Hd(t[s],n):t.push(ka(n))}return{...r,...e,sourceUrl:nx(e).length>0?e.sourceUrl:r.sourceUrl||e.sourceUrl,type:e.type||r.type,attributes:{...r.attributes,...e.attributes},metadata:{...r.metadata,...e.metadata},variants:{...r.variants,...e.variants},children:t}}function VB(r){return r.byteLength>=4&&new DataView(r).getUint32(0,!0)===MB}var Zw,OB,MB,NB,ix=p(()=>{"use strict";Xw();Jw();Qw();Zw=new TextDecoder,OB="PXR-USDC",MB=67324752;NB={compose:!0,loadReferences:!0,maxReferenceDepth:12,variantSelections:{}}});async function zB(r,e,t){return Jd(new TextEncoder().encode(r).buffer,e,t)}var DU,jB,GB,ox=p(()=>{"use strict";ix();Yd();({preload:DU,...jB}=Na),GB={...jB,parse:Jd,parseText:zB}});var ax={};J(ax,{USDLoaderWithParser:()=>GB});var cx=p(()=>{"use strict";ox()});async function $B(){let{USDLoaderWithParser:r}=await Promise.resolve().then(()=>(cx(),ax));return r}var WB,Na,Yd=p(()=>{"use strict";WB="5.0.0-beta.7";Na={dataType:null,batchType:null,name:"Universal Scene Description",id:"usd",module:"scene",version:WB,extensions:["usd","usda","usdc","usdz"],mimeTypes:["model/vnd.usd","model/vnd.usda","model/vnd.usdc","model/vnd.usdz+zip"],text:!0,binary:!0,tests:["#usda","PXR-USDC","PK"],options:{usd:{compose:!0,loadReferences:!0,maxReferenceDepth:12,variantSelections:{}}},preload:$B}});var ux,lx=p(()=>{"use strict";ux={name:"OBJ",id:"obj",module:"scene",encoding:"text",format:"obj",extensions:["obj"],mimeTypes:["text/plain"]}});function dx(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t}function F(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?i(l.value):s(l.value).then(a,c)}u((n=n.apply(r,e||[])).next())})}function fx(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(r){return this instanceof Y?(this.v=r,this):new Y(r)}function _t(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(h){return function(m){return Promise.resolve(m).then(h,f)}}function a(h,m){n[h]&&(s[h]=function(b){return new Promise(function(g,y){i.push([h,b,g,y])>1||c(h,b)})},m&&(s[h]=m(s[h])))}function c(h,m){try{u(n[h](m))}catch(b){d(i[0][3],b)}}function u(h){h.value instanceof Y?Promise.resolve(h.value.v).then(l,f):d(i[0][2],h)}function l(h){c("next",h)}function f(h){c("throw",h)}function d(h,m){h(m),i.shift(),i.length&&c(i[0][0],i[0][1])}}function Ao(r){var e,t;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=r[s]?function(o){return(t=!t)?{value:Y(r[s](o)),done:!1}:i?i(o):o}:i}}function Ht(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof fx=="function"?fx(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=r[i]&&function(o){return new Promise(function(a,c){o=r[i](o),s(a,c,o.done,o.value)})}}function s(i,o,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},o)}}var kt=p(()=>{});var hx,vo,qB,Jt,gn=p(()=>{hx=new TextDecoder("utf-8"),vo=hx.decode.bind(hx),qB=new TextEncoder,Jt=r=>qB.encode(r)});var KB,px,qe,At,Yt,Br,br,Eu,Lu,Bu,Fu,Ou,mx,Ca,bx,Mu,gx,Yn=p(()=>{KB=r=>typeof r=="number",px=r=>typeof r=="boolean",qe=r=>typeof r=="function",At=r=>r!=null&&Object(r)===r,Yt=r=>At(r)&&qe(r.then),Br=r=>At(r)&&qe(r[Symbol.iterator]),br=r=>At(r)&&qe(r[Symbol.asyncIterator]),Eu=r=>At(r)&&At(r.schema),Lu=r=>At(r)&&"done"in r&&"value"in r,Bu=r=>At(r)&&qe(r.stat)&&KB(r.fd),Fu=r=>At(r)&&Ca(r.body),Ou=r=>"_getDOMStream"in r&&"_getNodeStream"in r,mx=r=>At(r)&&qe(r.abort)&&qe(r.getWriter)&&!Ou(r),Ca=r=>At(r)&&qe(r.cancel)&&qe(r.getReader)&&!Ou(r),bx=r=>At(r)&&qe(r.end)&&qe(r.write)&&px(r.writable)&&!Ou(r),Mu=r=>At(r)&&qe(r.read)&&qe(r.pipe)&&px(r.readable)&&!Ou(r),gx=r=>At(r)&&qe(r.clear)&&qe(r.bytes)&&qe(r.position)&&qe(r.setPosition)&&qe(r.capacity)&&qe(r.getBufferIdentifier)&&qe(r.createLong)});var nh={};J(nh,{compareArrayLike:()=>rh,joinUint8Arrays:()=>Qt,memcpy:()=>Ua,rebaseValueOffsets:()=>Du,toArrayBufferView:()=>ee,toArrayBufferViewAsyncIterator:()=>Fr,toArrayBufferViewIterator:()=>Xr,toBigInt64Array:()=>Pa,toBigUint64Array:()=>ZB,toFloat32Array:()=>eF,toFloat32ArrayAsyncIterator:()=>bF,toFloat32ArrayIterator:()=>cF,toFloat64Array:()=>tF,toFloat64ArrayAsyncIterator:()=>gF,toFloat64ArrayIterator:()=>uF,toInt16Array:()=>JB,toInt16ArrayAsyncIterator:()=>dF,toInt16ArrayIterator:()=>sF,toInt32Array:()=>ui,toInt32ArrayAsyncIterator:()=>hF,toInt32ArrayIterator:()=>iF,toInt8Array:()=>HB,toInt8ArrayAsyncIterator:()=>fF,toInt8ArrayIterator:()=>nF,toUint16Array:()=>YB,toUint16ArrayAsyncIterator:()=>pF,toUint16ArrayIterator:()=>oF,toUint32Array:()=>QB,toUint32ArrayAsyncIterator:()=>mF,toUint32ArrayIterator:()=>aF,toUint8Array:()=>k,toUint8ArrayAsyncIterator:()=>th,toUint8ArrayIterator:()=>eh,toUint8ClampedArray:()=>rF,toUint8ClampedArrayAsyncIterator:()=>yF,toUint8ClampedArrayIterator:()=>lF});function XB(r){let e=r[0]?[r[0]]:[],t,n,s,i;for(let o,a,c=0,u=0,l=r.length;++c<l;){if(o=e[u],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(e[++u]=a);continue}if({byteOffset:t,byteLength:s}=o,{byteOffset:n,byteLength:i}=a,t+s<n||n+i<t){a&&(e[++u]=a);continue}e[u]=new Uint8Array(o.buffer,t,n-t+i)}return e}function Ua(r,e,t=0,n=e.byteLength){let s=r.byteLength,i=new Uint8Array(r.buffer,r.byteOffset,s),o=new Uint8Array(e.buffer,e.byteOffset,Math.min(n,s));return i.set(o,t),r}function Qt(r,e){let t=XB(r),n=t.reduce((l,f)=>l+f.byteLength,0),s,i,o,a=0,c=-1,u=Math.min(e||Number.POSITIVE_INFINITY,n);for(let l=t.length;++c<l;){if(s=t[c],i=s.subarray(0,Math.min(s.length,u-a)),u<=a+i.length){i.length<s.length?t[c]=s.subarray(i.length):i.length===s.length&&c++,o?Ua(o,i,a):o=i;break}Ua(o||(o=new Uint8Array(u)),i,a),a+=i.length}return[o||new Uint8Array(0),t.slice(c),n-(o?o.byteLength:0)]}function ee(r,e){let t=Lu(e)?e.value:e;return t instanceof r?r===Uint8Array?new r(t.buffer,t.byteOffset,t.byteLength):t:t?(typeof t=="string"&&(t=Jt(t)),t instanceof ArrayBuffer?new r(t):t instanceof Zd?new r(t):gx(t)?ee(r,t.bytes()):ArrayBuffer.isView(t)?t.byteLength<=0?new r(0):new r(t.buffer,t.byteOffset,t.byteLength/r.BYTES_PER_ELEMENT):r.from(t)):new r(0)}function*Xr(r,e){let t=function*(s){yield s},n=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Zd?t(e):Br(e)?e:t(e);return yield*Qd((function*(s){let i=null;do i=s.next(yield ee(r,i));while(!i.done)})(n[Symbol.iterator]())),new r}function Fr(r,e){return _t(this,arguments,function*(){if(Yt(e))return yield Y(yield Y(yield*Ao(Ht(Fr(r,yield Y(e))))));let n=function(o){return _t(this,arguments,function*(){yield yield Y(yield Y(o))})},s=function(o){return _t(this,arguments,function*(){yield Y(yield*Ao(Ht(Qd((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(o[Symbol.iterator]())))))})},i=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Zd?n(e):Br(e)?s(e):br(e)?e:n(e);return yield Y(yield*Ao(Ht(Qd((function(o){return _t(this,arguments,function*(){let a=null;do a=yield Y(o.next(yield yield Y(ee(r,a))));while(!a.done)})})(i[Symbol.asyncIterator]()))))),yield Y(new r)})}function Du(r,e,t){if(r!==0){t=t.slice(0,e);let n=typeof t[0]=="bigint"?BigInt(r):r;for(let s=-1,i=t.length;++s<i;)t[s]+=n}return t.subarray(0,e)}function rh(r,e){let t=0,n=r.length;if(n!==e.length)return!1;if(n>0)do if(r[t]!==e[t])return!1;while(++t<n);return!0}var Zd,HB,JB,ui,Pa,k,YB,QB,ZB,eF,tF,rF,Qd,nF,sF,iF,eh,oF,aF,cF,uF,lF,fF,dF,hF,th,pF,mF,bF,gF,yF,Ke=p(()=>{kt();gn();Yn();Zd=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;HB=r=>ee(Int8Array,r),JB=r=>ee(Int16Array,r),ui=r=>ee(Int32Array,r),Pa=r=>ee(BigInt64Array,r),k=r=>ee(Uint8Array,r),YB=r=>ee(Uint16Array,r),QB=r=>ee(Uint32Array,r),ZB=r=>ee(BigUint64Array,r),eF=r=>ee(Float32Array,r),tF=r=>ee(Float64Array,r),rF=r=>ee(Uint8ClampedArray,r),Qd=r=>(r.next(),r);nF=r=>Xr(Int8Array,r),sF=r=>Xr(Int16Array,r),iF=r=>Xr(Int32Array,r),eh=r=>Xr(Uint8Array,r),oF=r=>Xr(Uint16Array,r),aF=r=>Xr(Uint32Array,r),cF=r=>Xr(Float32Array,r),uF=r=>Xr(Float64Array,r),lF=r=>Xr(Uint8ClampedArray,r);fF=r=>Fr(Int8Array,r),dF=r=>Fr(Int16Array,r),hF=r=>Fr(Int32Array,r),th=r=>Fr(Uint8Array,r),pF=r=>Fr(Uint16Array,r),mF=r=>Fr(Uint32Array,r),bF=r=>Fr(Float32Array,r),gF=r=>Fr(Float64Array,r),yF=r=>Fr(Uint8ClampedArray,r)});function*wF(r){let e,t=!1,n=[],s,i,o,a=0;function c(){return i==="peek"?Qt(n,o)[0]:([s,n,a]=Qt(n,o),s)}({cmd:i,size:o}=(yield null)||{cmd:"read",size:0});let u=eh(r)[Symbol.iterator]();try{do if({done:e,value:s}=Number.isNaN(o-a)?u.next():u.next(o-a),!e&&s.byteLength>0&&(n.push(s),a+=s.byteLength),e||o<=a)do({cmd:i,size:o}=yield c());while(o<a);while(!e)}catch(l){t=!0,typeof u.throw=="function"&&u.throw(l)}finally{t===!1&&typeof u.return=="function"&&u.return(null)}return null}function xF(r){return _t(this,arguments,function*(){let t,n=!1,s=[],i,o,a,c=0;function u(){return o==="peek"?Qt(s,a)[0]:([i,s,c]=Qt(s,a),i)}({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0});let l=th(r)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(a-c)?yield Y(l.next()):yield Y(l.next(a-c)),!t&&i.byteLength>0&&(s.push(i),c+=i.byteLength),t||a<=c)do({cmd:o,size:a}=yield yield Y(u()));while(a<c);while(!t)}catch(f){n=!0,typeof l.throw=="function"&&(yield Y(l.throw(f)))}finally{n===!1&&typeof l.return=="function"&&(yield Y(l.return(new Uint8Array(0))))}return yield Y(null)})}function TF(r){return _t(this,arguments,function*(){let t=!1,n=!1,s=[],i,o,a,c=0;function u(){return o==="peek"?Qt(s,a)[0]:([i,s,c]=Qt(s,a),i)}({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0});let l=new ih(r);try{do if({done:t,value:i}=Number.isNaN(a-c)?yield Y(l.read()):yield Y(l.read(a-c)),!t&&i.byteLength>0&&(s.push(k(i)),c+=i.byteLength),t||a<=c)do({cmd:o,size:a}=yield yield Y(u()));while(a<c);while(!t)}catch(f){n=!0,yield Y(l.cancel(f))}finally{n===!1?yield Y(l.cancel()):r.locked&&l.releaseLock()}return yield Y(null)})}function _F(r){return _t(this,arguments,function*(){let t=[],n="error",s=!1,i=null,o,a,c=0,u=[],l;function f(){return o==="peek"?Qt(u,a)[0]:([l,u,c]=Qt(u,a),l)}if({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0},r.isTTY)return yield yield Y(new Uint8Array(0)),yield Y(null);try{t[0]=sh(r,"end"),t[1]=sh(r,"error");do{if(t[2]=sh(r,"readable"),[n,i]=yield Y(Promise.race(t.map(h=>h[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-c)?(l=k(r.read(a-c)),l.byteLength<a-c&&(l=k(r.read()))):l=k(r.read()),l.byteLength>0&&(u.push(l),c+=l.byteLength)),s||a<=c)do({cmd:o,size:a}=yield yield Y(f()));while(a<c)}while(!s)}finally{yield Y(d(t,n==="error"?i:null))}return yield Y(null);function d(h,m){return l=u=null,new Promise((b,g)=>{for(let[y,x]of h)r.off(y,x);try{let y=r.destroy;y&&y.call(r,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):b()}})}})}var Qe,Ru,ih,sh,Va=p(()=>{kt();Ke();Qe={fromIterable(r){return Ru(wF(r))},fromAsyncIterable(r){return Ru(xF(r))},fromDOMStream(r){return Ru(TF(r))},fromNodeStream(r){return Ru(_F(r))},toDOMStream(r,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,e){throw new Error('"toNodeStream" not available in this environment')}},Ru=r=>(r.next(),r);ih=class{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return F(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return F(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};let t=yield this.reader.read();return!t.done&&(t.value=k(t)),t})}},sh=(r,e)=>{let t=s=>n([e,s]),n;return[e,t,new Promise(s=>(n=s)&&r.once(e,t))]}});var ge,ku=p(()=>{(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(ge||(ge={}))});var he,oh=p(()=>{(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(he||(he={}))});var le,ah=p(()=>{(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(le||(le={}))});var ye,ch=p(()=>{(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(ye||(ye={}))});var L,ja=p(()=>{(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(L||(L={}))});var ae,uh=p(()=>{(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(ae||(ae={}))});var Nu=p(()=>{});var Hr,Cu,Uu,Io,lh=p(()=>{Hr=new Int32Array(2),Cu=new Float32Array(Hr.buffer),Uu=new Float64Array(Hr.buffer),Io=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var Ga,fh=p(()=>{(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Ga||(Ga={}))});var Ze,dh=p(()=>{Nu();fh();lh();Ze=class r{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new r(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Hr[0]=this.readInt32(e),Cu[0]}readFloat64(e){return Hr[Io?0:1]=this.readInt32(e),Hr[Io?1:0]=this.readInt32(e+4),Uu[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){Cu[0]=t,this.writeInt32(e,Hr[0])}writeFloat64(e,t){Uu[0]=t,this.writeInt32(e,Hr[Io?0:1]),this.writeInt32(e+4,Hr[Io?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let s=this.bytes_.subarray(e,e+n);return t===Ga.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let s=0;s<t;++s){let i=e(s);i!==null&&n.push(i)}return n}createObjList(e,t){let n=[];for(let s=0;s<t;++s){let i=e(s);i!==null&&n.push(i.unpack())}return n}}});var li,yx=p(()=>{dh();Nu();li=class r{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;e?t=e:t=1024,this.bb=Ze.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);let n=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<n+e+t;){let s=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(n)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=t<<1,s=Ze.allocate(n);return s.setPosition(n-t),s.bytes().set(e.bytes(),n-t),s}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);let s=2;this.addInt16(e-this.object_start);let i=(n+s)*2;this.addInt16(i);let o=0,a=this.space;e:for(t=0;t<this.vtables.length;t++){let c=this.bb.capacity()-this.vtables[t];if(i==this.bb.readInt16(c)){for(let u=2;u<i;u+=2)if(this.bb.readInt16(a+u)!=this.bb.readInt16(c+u))continue e;o=this.vtables[t];break}}return o?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,o-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let s=n?4:0;if(t){let i=t;if(this.prep(this.minalign,8+s),i.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=3;o>=0;o--)this.writeInt8(i.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(e),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,s=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(s)&&this.bb.readInt16(s+t)!=0))throw new TypeError("FlatBuffers: field "+t+" must be set")}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return e instanceof Uint8Array?t=e:t=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let s=e[n];if(s!==null)t.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}}});var ce=p(()=>{Nu();lh();yx();dh();fh()});var fi,hh=p(()=>{(function(r){r[r.BUFFER=0]="BUFFER"})(fi||(fi={}))});var et,So=p(()=>{(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(et||(et={}))});var yn,ph=p(()=>{ce();hh();So();yn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):et.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):fi.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,et.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,fi.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,t,n){return r.startBodyCompression(e),r.addCodec(e,t),r.addMethod(e,n),r.endBodyCompression(e)}}});var Eo,mh=p(()=>{Eo=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}}});var Lo,bh=p(()=>{Lo=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}}});var ot,gh=p(()=>{ce();ph();mh();bh();ot=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Lo).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Eo).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}buffersLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){let t=this.bb.__offset(this.bb_pos,10);return t?(e||new yn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}variadicBufferCounts(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}variadicBufferCountsLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startRecordBatch(e){e.startObject(5)}static addLength(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static addVariadicBufferCounts(e,t){e.addFieldOffset(4,t,0)}static createVariadicBufferCountsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startVariadicBufferCountsVector(e,t){e.startVector(8,t,8)}static endRecordBatch(e){return e.endObject()}}});var wn,wx=p(()=>{ce();gh();wn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new ot).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}}});var Qn,yh=p(()=>{(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Qn||(Qn={}))});var za,xx=p(()=>{(function(r){r[r.DenseArray=0]="DenseArray"})(za||(za={}))});var Mr,Vu=p(()=>{ce();Mr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(e,t,n){return r.startInt(e),r.addBitWidth(e,t),r.addIsSigned(e,n),r.endInt(e)}}});var Jr,wh=p(()=>{ce();xx();Vu();Jr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Mr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):za.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,za.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}}});var Oe,Bo=p(()=>{ce();Oe=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(e,t,n){return r.startKeyValue(e),r.addKey(e,t),r.addValue(e,n),r.endKeyValue(e)}}});var Wa,Tx=p(()=>{ce();Wa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return r.startBinary(e),r.endBinary(e)}}});var $a,_x=p(()=>{ce();$a=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinaryView(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinaryView(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startBinaryView(e){e.startObject(0)}static endBinaryView(e){return e.endObject()}static createBinaryView(e){return r.startBinaryView(e),r.endBinaryView(e)}}});var qa,Ax=p(()=>{ce();qa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return r.startBool(e),r.endBool(e)}}});var Zn,xh=p(()=>{ce();ch();Zn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ye.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ye.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,t){return r.startDate(e),r.addUnit(e,t),r.endDate(e)}}});var Yr,Th=p(()=>{ce();Yr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(e,t,n,s){return r.startDecimal(e),r.addPrecision(e,t),r.addScale(e,n),r.addBitWidth(e,s),r.endDecimal(e)}}});var es,_h=p(()=>{ce();ja();es=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDuration(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):L.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,L.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(e,t){return r.startDuration(e),r.addUnit(e,t),r.endDuration(e)}}});var ts,Ah=p(()=>{ce();ts=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(e,t){return r.startFixedSizeBinary(e),r.addByteWidth(e,t),r.endFixedSizeBinary(e)}}});var rs,vh=p(()=>{ce();rs=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(e,t){return r.startFixedSizeList(e),r.addListSize(e,t),r.endFixedSizeList(e)}}});var ns,Ih=p(()=>{ce();ah();ns=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):le.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,le.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,t){return r.startFloatingPoint(e),r.addPrecision(e,t),r.endFloatingPoint(e)}}});var ss,Sh=p(()=>{ce();uh();ss=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ae.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ae.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,t){return r.startInterval(e),r.addUnit(e,t),r.endInterval(e)}}});var Ka,vx=p(()=>{ce();Ka=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeBinary(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(e){return r.startLargeBinary(e),r.endLargeBinary(e)}}});var Xa,Ix=p(()=>{ce();Xa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeList(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(e){return r.startLargeList(e),r.endLargeList(e)}}});var Ha,Sx=p(()=>{ce();Ha=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeUtf8(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(e){return r.startLargeUtf8(e),r.endLargeUtf8(e)}}});var Ja,Ex=p(()=>{ce();Ja=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return r.startList(e),r.endList(e)}}});var is,Eh=p(()=>{ce();is=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(e,t){return r.startMap(e),r.addKeysSorted(e,t),r.endMap(e)}}});var Ya,Lx=p(()=>{ce();Ya=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return r.startNull(e),r.endNull(e)}}});var Qa,Bx=p(()=>{ce();Qa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return r.startStruct_(e),r.endStruct_(e)}}});var xn,Lh=p(()=>{ce();ja();xn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):L.MILLISECOND}bitWidth(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,L.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(e,t,n){return r.startTime(e),r.addUnit(e,t),r.addBitWidth(e,n),r.endTime(e)}}});var Tn,Bh=p(()=>{ce();ja();Tn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):L.SECOND}timezone(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,L.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,t,n){return r.startTimestamp(e),r.addUnit(e,t),r.addTimezone(e,n),r.endTimestamp(e)}}});var Dr,Fh=p(()=>{ce();oh();Dr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):he.Sparse}typeIds(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,he.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(e,t,n){return r.startUnion(e),r.addMode(e,t),r.addTypeIds(e,n),r.endUnion(e)}}});var Za,Fx=p(()=>{ce();Za=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return r.startUtf8(e),r.endUtf8(e)}}});var ec,Ox=p(()=>{ce();ec=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8View(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8View(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8View(e){e.startObject(0)}static endUtf8View(e){return e.endObject()}static createUtf8View(e){return r.startUtf8View(e),r.endUtf8View(e)}}});var z,ju=p(()=>{(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded",r[r.BinaryView=23]="BinaryView",r[r.Utf8View=24]="Utf8View",r[r.ListView=25]="ListView",r[r.LargeListView=26]="LargeListView"})(z||(z={}))});var at,Oh=p(()=>{ce();wh();Bo();ju();at=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):z.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new Jr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(e,t){let n=this.bb.__offset(this.bb_pos,14);return n?(t||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new Oe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,z.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}}});var Nt,Mh=p(()=>{ce();yh();Oh();Bo();Nt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Qn.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Oe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,Qn.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static createSchema(e,t,n,s,i){return r.startSchema(e),r.addEndianness(e,t),r.addFields(e,n),r.addCustomMetadata(e,s),r.addFeatures(e,i),r.endSchema(e)}}});var se,Gu=p(()=>{(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(se||(se={}))});var w,re,Me=p(()=>{ku();oh();ah();ch();ja();uh();Gu();(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.BinaryView=23]="BinaryView",r[r.Utf8View=24]="Utf8View",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond",r[r.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(w||(w={}));(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(re||(re={}))});var Dh={};J(Dh,{valueToString:()=>Rr});function Rr(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(e=>Rr(e))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(e,t)=>typeof t=="bigint"?`${t}`:t)}var tc=p(()=>{});function te(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Rh(r,e){return te(r/e)+te(r%e)/te(e)}var Qr=p(()=>{});var Ch={};J(Ch,{BN:()=>di,bigNumToBigInt:()=>Dx,bigNumToNumber:()=>Nh,bigNumToString:()=>Mo,isArrowBigNumSymbol:()=>Mx});function kr(r,...e){return e.length===0?Object.setPrototypeOf(ee(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}function Fo(...r){return kr.apply(this,r)}function Oo(...r){return kr.apply(this,r)}function rc(...r){return kr.apply(this,r)}function Nh(r,e){let{buffer:t,byteOffset:n,byteLength:s,signed:i}=r,o=new BigUint64Array(t,n,s/8),a=i&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),u=0;if(a){for(let l of o)c|=(l^vF)*(BigInt(1)<<BigInt(64*u++));c*=BigInt(-1),c-=BigInt(1)}else for(let l of o)c|=l*(BigInt(1)<<BigInt(64*u++));if(typeof e=="number"&&e>0){let l=BigInt("1".padEnd(e+1,"0")),f=c/l,d=a?-(c%l):c%l,h=te(f),m=`${d}`.padStart(e,"0");return+`${a&&h===0?"-":""}${h}.${m}`}return te(c)}function Mo(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return kh(r);let e=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return kh(r);e=e.slice();let n=1;for(let i=0;i<e.length;i++){let o=e[i],a=~o+n;e[i]=a,n&=o===0?1:0}return`-${kh(e)}`}function Dx(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Mo(r)}function kh(r){let e="",t=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),i=-1,o=n.length-1;do{for(t[0]=n[i=0];i<o;)n[i++]=t[1]=t[0]/10,t[0]=(t[0]-t[1]*10<<16)+n[i];n[i]=t[1]=t[0]/10,t[0]=t[0]-t[1]*10,e=`${t[0]}${e}`}while(s[0]||s[1]||s[2]||s[3]);return e??"0"}var Mx,AF,vF,di,zu=p(()=>{Ke();Qr();Mx=Symbol.for("isArrowBigNum");kr.prototype[Mx]=!0;kr.prototype.toJSON=function(){return`"${Mo(this)}"`};kr.prototype.valueOf=function(r){return Nh(this,r)};kr.prototype.toString=function(){return Mo(this)};kr.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Nh(this);case"string":return Mo(this);case"default":return Dx(this)}return Mo(this)};Object.setPrototypeOf(Fo.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Oo.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(rc.prototype,Object.create(Uint32Array.prototype));Object.assign(Fo.prototype,kr.prototype,{constructor:Fo,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Oo.prototype,kr.prototype,{constructor:Oo,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(rc.prototype,kr.prototype,{constructor:rc,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});AF=BigInt(4294967296)*BigInt(4294967296),vF=AF-BigInt(1);di=class r{static new(e,t){switch(t){case!0:return new Fo(e);case!1:return new Oo(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Fo(e)}return e.byteLength===16?new rc(e):new Oo(e)}static signed(e){return new Fo(e)}static unsigned(e){return new Oo(e)}static decimal(e){return new rc(e)}constructor(e,t){return r.new(e,t)}}});function or(r){let e=r;switch(r.typeId){case w.Decimal:return r.bitWidth/32;case w.Interval:return e.unit===ae.MONTH_DAY_NANO?4:1+e.unit;case w.BinaryView:case w.Utf8View:return 16;case w.FixedSizeList:return e.listSize;case w.FixedSizeBinary:return e.byteWidth;default:return 1}}var Rx,kx,Nx,Cx,Ux,Px,Vx,jx,Gx,zx,Wx,$x,qx,Kx,Xx,Hx,Jx,Yx,Qx,Zx,eT,tT,rT,nT,sT,iT,E,Ne,Fe,Zt,er,Pe,tr,rr,nr,vt,Nr,ct,Cr,It,sr,Ct,Z,Ur,ut,St,Pr,lt,Ut,Et,os,as,tt,cs,us,ls,fs,rt,ds,Zr,hs,ps,ft,ms,bs,nc,Lt,sc,ic,oc,ac,je,ir,pe,Bt,_n,gs,Pt,Be,dt,IF,Ge,we=p(()=>{Qr();Me();iT=Symbol.for("apache-arrow/DataType"),E=class r{static isDataType(e){return e?.[iT]===!0}static isNull(e){return e?.typeId===w.Null}static isInt(e){return e?.typeId===w.Int}static isFloat(e){return e?.typeId===w.Float}static isBinary(e){return e?.typeId===w.Binary}static isBinaryView(e){return e?.typeId===w.BinaryView}static isLargeBinary(e){return e?.typeId===w.LargeBinary}static isUtf8(e){return e?.typeId===w.Utf8}static isUtf8View(e){return e?.typeId===w.Utf8View}static isLargeUtf8(e){return e?.typeId===w.LargeUtf8}static isBool(e){return e?.typeId===w.Bool}static isDecimal(e){return e?.typeId===w.Decimal}static isDate(e){return e?.typeId===w.Date}static isTime(e){return e?.typeId===w.Time}static isTimestamp(e){return e?.typeId===w.Timestamp}static isInterval(e){return e?.typeId===w.Interval}static isDuration(e){return e?.typeId===w.Duration}static isList(e){return e?.typeId===w.List}static isLargeList(e){return e?.typeId===w.LargeList}static isStruct(e){return e?.typeId===w.Struct}static isUnion(e){return e?.typeId===w.Union}static isFixedSizeBinary(e){return e?.typeId===w.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===w.FixedSizeList}static isMap(e){return e?.typeId===w.Map}static isDictionary(e){return e?.typeId===w.Dictionary}static isDenseUnion(e){return r.isUnion(e)&&e.mode===he.Dense}static isSparseUnion(e){return r.isUnion(e)&&e.mode===he.Sparse}constructor(e){this.typeId=e}};Rx=Symbol.toStringTag;E[Rx]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[iT]=!0,r[Symbol.toStringTag]="DataType"))(E.prototype);Ne=class extends E{constructor(){super(w.Null)}toString(){return"Null"}};kx=Symbol.toStringTag;Ne[kx]=(r=>r[Symbol.toStringTag]="Null")(Ne.prototype);Fe=class extends E{constructor(e,t){super(w.Int),this.isSigned=e,this.bitWidth=t}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Nx=Symbol.toStringTag;Fe[Nx]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Fe.prototype);Zt=class extends Fe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},er=class extends Fe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Pe=class extends Fe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},tr=class extends Fe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},rr=class extends Fe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},nr=class extends Fe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},vt=class extends Fe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Nr=class extends Fe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Zt.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(er.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Pe.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(tr.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(rr.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(nr.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(vt.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Nr.prototype,"ArrayType",{value:BigUint64Array});ct=class extends E{constructor(e){super(w.Float),this.precision=e}get ArrayType(){switch(this.precision){case le.HALF:return Uint16Array;case le.SINGLE:return Float32Array;case le.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Cx=Symbol.toStringTag;ct[Cx]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ct.prototype);Cr=class extends ct{constructor(){super(le.HALF)}},It=class extends ct{constructor(){super(le.SINGLE)}},sr=class extends ct{constructor(){super(le.DOUBLE)}};Object.defineProperty(Cr.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(It.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(sr.prototype,"ArrayType",{value:Float64Array});Ct=class extends E{constructor(){super(w.Binary)}toString(){return"Binary"}};Ux=Symbol.toStringTag;Ct[Ux]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Ct.prototype);Z=class extends E{constructor(){super(w.BinaryView)}toString(){return"BinaryView"}};Px=Symbol.toStringTag;Z.ELEMENT_WIDTH=16;Z.INLINE_CAPACITY=12;Z.LENGTH_OFFSET=0;Z.INLINE_OFFSET=4;Z.BUFFER_INDEX_OFFSET=8;Z.BUFFER_OFFSET_OFFSET=12;Z[Px]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="BinaryView"))(Z.prototype);Ur=class extends E{constructor(){super(w.LargeBinary)}toString(){return"LargeBinary"}};Vx=Symbol.toStringTag;Ur[Vx]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Ur.prototype);ut=class extends E{constructor(){super(w.Utf8)}toString(){return"Utf8"}};jx=Symbol.toStringTag;ut[jx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(ut.prototype);St=class extends E{constructor(){super(w.Utf8View)}toString(){return"Utf8View"}};Gx=Symbol.toStringTag;St.ELEMENT_WIDTH=Z.ELEMENT_WIDTH;St.INLINE_CAPACITY=Z.INLINE_CAPACITY;St[Gx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8View"))(St.prototype);Pr=class extends E{constructor(){super(w.LargeUtf8)}toString(){return"LargeUtf8"}};zx=Symbol.toStringTag;Pr[zx]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Pr.prototype);lt=class extends E{constructor(){super(w.Bool)}toString(){return"Bool"}};Wx=Symbol.toStringTag;lt[Wx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(lt.prototype);Ut=class extends E{constructor(e,t,n=128){super(w.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};$x=Symbol.toStringTag;Ut[$x]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Ut.prototype);Et=class extends E{constructor(e){super(w.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${ye[this.unit]}>`}get ArrayType(){return this.unit===ye.DAY?Int32Array:BigInt64Array}};qx=Symbol.toStringTag;Et[qx]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Et.prototype);os=class extends Et{constructor(){super(ye.DAY)}},as=class extends Et{constructor(){super(ye.MILLISECOND)}},tt=class extends E{constructor(e,t){super(w.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${L[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Kx=Symbol.toStringTag;tt[Kx]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(tt.prototype);cs=class extends tt{constructor(){super(L.SECOND,32)}},us=class extends tt{constructor(){super(L.MILLISECOND,32)}},ls=class extends tt{constructor(){super(L.MICROSECOND,64)}},fs=class extends tt{constructor(){super(L.NANOSECOND,64)}},rt=class extends E{constructor(e,t){super(w.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${L[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Xx=Symbol.toStringTag;rt[Xx]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(rt.prototype);ds=class extends rt{constructor(e){super(L.SECOND,e)}},Zr=class extends rt{constructor(e){super(L.MILLISECOND,e)}},hs=class extends rt{constructor(e){super(L.MICROSECOND,e)}},ps=class extends rt{constructor(e){super(L.NANOSECOND,e)}},ft=class extends E{constructor(e){super(w.Interval),this.unit=e}toString(){return`Interval<${ae[this.unit]}>`}};Hx=Symbol.toStringTag;ft[Hx]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(ft.prototype);ms=class extends ft{constructor(){super(ae.DAY_TIME)}},bs=class extends ft{constructor(){super(ae.YEAR_MONTH)}},nc=class extends ft{constructor(){super(ae.MONTH_DAY_NANO)}},Lt=class extends E{constructor(e){super(w.Duration),this.unit=e}toString(){return`Duration<${L[this.unit]}>`}};Jx=Symbol.toStringTag;Lt[Jx]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Lt.prototype);sc=class extends Lt{constructor(){super(L.SECOND)}},ic=class extends Lt{constructor(){super(L.MILLISECOND)}},oc=class extends Lt{constructor(){super(L.MICROSECOND)}},ac=class extends Lt{constructor(){super(L.NANOSECOND)}},je=class extends E{constructor(e){super(w.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Yx=Symbol.toStringTag;je[Yx]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(je.prototype);ir=class extends E{constructor(e){super(w.LargeList),this.children=[e]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Qx=Symbol.toStringTag;ir[Qx]=(r=>(r.children=null,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeList"))(ir.prototype);pe=class extends E{constructor(e){super(w.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};Zx=Symbol.toStringTag;pe[Zx]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(pe.prototype);Bt=class extends E{constructor(e,t,n){super(w.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((s,i,o)=>(s[i]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}};eT=Symbol.toStringTag;Bt[eT]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Bt.prototype);_n=class extends Bt{constructor(e,t){super(he.Dense,e,t)}},gs=class extends Bt{constructor(e,t){super(he.Sparse,e,t)}},Pt=class extends E{constructor(e){super(w.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};tT=Symbol.toStringTag;Pt[tT]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Pt.prototype);Be=class extends E{constructor(e,t){super(w.FixedSizeList),this.listSize=e,this.children=[t]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};rT=Symbol.toStringTag;Be[rT]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Be.prototype);dt=class extends E{constructor(e,t=!1){var n,s,i;if(super(w.Map),this.children=[e],this.keysSorted=t,e&&(e.name="entries",!((n=e?.type)===null||n===void 0)&&n.children)){let o=(s=e?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(i=e?.type)===null||i===void 0?void 0:i.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};nT=Symbol.toStringTag;dt[nT]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(dt.prototype);IF=(r=>()=>++r)(-1),Ge=class extends E{constructor(e,t,n,s){super(w.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=s||!1,this.id=n==null?IF():te(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};sT=Symbol.toStringTag;Ge[sT]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ge.prototype)});function SF(r,e,t=!0){return typeof e=="number"?Do(r,e,t):typeof e=="string"&&e in w?Do(r,w[e],t):e&&e instanceof E?Do(r,aT(e),t):e?.type&&e.type instanceof E?Do(r,aT(e.type),t):Do(r,w.NONE,t)}function Do(r,e,t=!0){let n=null;switch(e){case w.Null:n=r.visitNull;break;case w.Bool:n=r.visitBool;break;case w.Int:n=r.visitInt;break;case w.Int8:n=r.visitInt8||r.visitInt;break;case w.Int16:n=r.visitInt16||r.visitInt;break;case w.Int32:n=r.visitInt32||r.visitInt;break;case w.Int64:n=r.visitInt64||r.visitInt;break;case w.Uint8:n=r.visitUint8||r.visitInt;break;case w.Uint16:n=r.visitUint16||r.visitInt;break;case w.Uint32:n=r.visitUint32||r.visitInt;break;case w.Uint64:n=r.visitUint64||r.visitInt;break;case w.Float:n=r.visitFloat;break;case w.Float16:n=r.visitFloat16||r.visitFloat;break;case w.Float32:n=r.visitFloat32||r.visitFloat;break;case w.Float64:n=r.visitFloat64||r.visitFloat;break;case w.Utf8:n=r.visitUtf8;break;case w.LargeUtf8:n=r.visitLargeUtf8;break;case w.Utf8View:n=r.visitUtf8View||r.visitUtf8;break;case w.Binary:n=r.visitBinary;break;case w.LargeBinary:n=r.visitLargeBinary;break;case w.BinaryView:n=r.visitBinaryView||r.visitBinary;break;case w.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case w.Date:n=r.visitDate;break;case w.DateDay:n=r.visitDateDay||r.visitDate;break;case w.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case w.Timestamp:n=r.visitTimestamp;break;case w.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case w.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case w.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case w.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case w.Time:n=r.visitTime;break;case w.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case w.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case w.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case w.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case w.Decimal:n=r.visitDecimal;break;case w.List:n=r.visitList;break;case w.LargeList:n=r.visitLargeList;break;case w.Struct:n=r.visitStruct;break;case w.Union:n=r.visitUnion;break;case w.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case w.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case w.Dictionary:n=r.visitDictionary;break;case w.Interval:n=r.visitInterval;break;case w.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case w.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case w.IntervalMonthDayNano:n=r.visitIntervalMonthDayNano||r.visitInterval;break;case w.Duration:n=r.visitDuration;break;case w.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case w.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case w.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case w.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case w.FixedSizeList:n=r.visitFixedSizeList;break;case w.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!t)return()=>null;throw new Error(`Unrecognized type '${w[e]}'`)}function aT(r){switch(r.typeId){case w.Null:return w.Null;case w.Int:{let{bitWidth:e,isSigned:t}=r;switch(e){case 8:return t?w.Int8:w.Uint8;case 16:return t?w.Int16:w.Uint16;case 32:return t?w.Int32:w.Uint32;case 64:return t?w.Int64:w.Uint64}return w.Int}case w.Float:switch(r.precision){case le.HALF:return w.Float16;case le.SINGLE:return w.Float32;case le.DOUBLE:return w.Float64}return w.Float;case w.Binary:return w.Binary;case w.LargeBinary:return w.LargeBinary;case w.BinaryView:return w.BinaryView;case w.Utf8:return w.Utf8;case w.LargeUtf8:return w.LargeUtf8;case w.Utf8View:return w.Utf8View;case w.Bool:return w.Bool;case w.Decimal:return w.Decimal;case w.Time:switch(r.unit){case L.SECOND:return w.TimeSecond;case L.MILLISECOND:return w.TimeMillisecond;case L.MICROSECOND:return w.TimeMicrosecond;case L.NANOSECOND:return w.TimeNanosecond}return w.Time;case w.Timestamp:switch(r.unit){case L.SECOND:return w.TimestampSecond;case L.MILLISECOND:return w.TimestampMillisecond;case L.MICROSECOND:return w.TimestampMicrosecond;case L.NANOSECOND:return w.TimestampNanosecond}return w.Timestamp;case w.Date:switch(r.unit){case ye.DAY:return w.DateDay;case ye.MILLISECOND:return w.DateMillisecond}return w.Date;case w.Interval:switch(r.unit){case ae.DAY_TIME:return w.IntervalDayTime;case ae.YEAR_MONTH:return w.IntervalYearMonth;case ae.MONTH_DAY_NANO:return w.IntervalMonthDayNano}return w.Interval;case w.Duration:switch(r.unit){case L.SECOND:return w.DurationSecond;case L.MILLISECOND:return w.DurationMillisecond;case L.MICROSECOND:return w.DurationMicrosecond;case L.NANOSECOND:return w.DurationNanosecond}return w.Duration;case w.Map:return w.Map;case w.List:return w.List;case w.LargeList:return w.LargeList;case w.Struct:return w.Struct;case w.Union:switch(r.mode){case he.Dense:return w.DenseUnion;case he.Sparse:return w.SparseUnion}return w.Union;case w.FixedSizeBinary:return w.FixedSizeBinary;case w.FixedSizeList:return w.FixedSizeList;case w.Dictionary:return w.Dictionary}throw new Error(`Unrecognized type '${w[r.typeId]}'`)}var R,Vt=p(()=>{Me();we();R=class{visitMany(e,...t){return e.map((n,s)=>this.visit(n,...t.map(i=>i[s])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return SF(this,e,t)}getVisitFnByTypeId(e,t=!0){return Do(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitUtf8View(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitBinaryView(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitLargeList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};R.prototype.visitInt8=null;R.prototype.visitInt16=null;R.prototype.visitInt32=null;R.prototype.visitInt64=null;R.prototype.visitUint8=null;R.prototype.visitUint16=null;R.prototype.visitUint32=null;R.prototype.visitUint64=null;R.prototype.visitFloat16=null;R.prototype.visitFloat32=null;R.prototype.visitFloat64=null;R.prototype.visitDateDay=null;R.prototype.visitDateMillisecond=null;R.prototype.visitTimestampSecond=null;R.prototype.visitTimestampMillisecond=null;R.prototype.visitTimestampMicrosecond=null;R.prototype.visitTimestampNanosecond=null;R.prototype.visitTimeSecond=null;R.prototype.visitTimeMillisecond=null;R.prototype.visitTimeMicrosecond=null;R.prototype.visitTimeNanosecond=null;R.prototype.visitDenseUnion=null;R.prototype.visitSparseUnion=null;R.prototype.visitIntervalDayTime=null;R.prototype.visitIntervalYearMonth=null;R.prototype.visitIntervalMonthDayNano=null;R.prototype.visitDuration=null;R.prototype.visitDurationSecond=null;R.prototype.visitDurationMillisecond=null;R.prototype.visitDurationMicrosecond=null;R.prototype.visitDurationNanosecond=null});var Uh={};J(Uh,{float64ToUint16:()=>cc,uint16ToFloat64:()=>Wu});function Wu(r){let e=(r&31744)>>10,t=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(e){case 31:return n*(t?Number.NaN:1/0);case 0:return n*(t?6103515625e-14*t:0)}return n*Math.pow(2,e-15)*(1+t)}function cc(r){if(r!==r)return 32256;cT[0]=r;let e=(Ro[1]&2147483648)>>16&65535,t=Ro[1]&2146435072,n=0;return t>=1089470464?Ro[0]>0?t=31744:(t=(t&2080374784)>>16,n=(Ro[1]&1048575)>>10):t<=1056964608?(n=1048576+(Ro[1]&1048575),n=1048576+(n<<(t>>20)-998)>>21,t=0):(t=t-1056964608>>10,n=(Ro[1]&1048575)+512>>10),e|t|n&65535}var cT,Ro,uc=p(()=>{cT=new Float64Array(1),Ro=new Uint32Array(cT.buffer)});function q(r){return(e,t,n)=>{if(e.setValid(t,n!=null))return r(e,t,n)}}var j,EF,uT,LF,An,Ph,lT,BF,$u,qu,Vh,fT,FF,dT,OF,hT,MF,jh,Ku,Xu,Hu,Ju,Gh,Yu,Qu,Zu,el,zh,Wh,pT,DF,RF,kF,NF,CF,UF,PF,mT,bT,VF,$h,tl,rl,nl,sl,il,ol,al,qh,jF,nt,ar=p(()=>{ht();Vt();Qr();gn();uc();Me();we();j=class extends R{};EF=(r,e,t)=>{r[e]=Math.floor(t/864e5)},uT=(r,e,t,n)=>{if(t+1<e.length){let s=te(e[t]),i=te(e[t+1]);r.set(n.subarray(0,i-s),s)}},LF=({offset:r,values:e},t,n)=>{let s=r+t;n?e[s>>3]|=1<<s%8:e[s>>3]&=~(1<<s%8)},An=({values:r},e,t)=>{r[e]=t},Ph=({values:r},e,t)=>{r[e]=t},lT=({values:r},e,t)=>{r[e]=cc(t)},BF=(r,e,t)=>{switch(r.type.precision){case le.HALF:return lT(r,e,t);case le.SINGLE:case le.DOUBLE:return Ph(r,e,t)}},$u=({values:r},e,t)=>{EF(r,e,t.valueOf())},qu=({values:r},e,t)=>{r[e]=BigInt(t)},Vh=({stride:r,values:e},t,n)=>{e.set(n.subarray(0,r),r*t)},fT=({values:r,valueOffsets:e},t,n)=>uT(r,e,t,n),FF=r=>{let e=r.variadicBuffers;return(!Array.isArray(e)||Object.isFrozen(e))&&(e=Array.from(e),r.variadicBuffers=e),e},dT=(r,e,t)=>{var n,s,i,o;let a=r.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=Z.ELEMENT_WIDTH,u=e*c,l=u+c;if(u<0||l>a.length)throw new RangeError(`BinaryView index ${e} out of bounds`);a.fill(0,u,l);let f=new DataView(a.buffer,a.byteOffset+u,c),d=t.length;if(f.setInt32(Z.LENGTH_OFFSET,d,!0),d<=Z.INLINE_CAPACITY){a.set(t,u+Z.INLINE_OFFSET);return}let h=((n=t[0])!==null&&n!==void 0?n:0)|((s=t[1])!==null&&s!==void 0?s:0)<<8|((i=t[2])!==null&&i!==void 0?i:0)<<16|((o=t[3])!==null&&o!==void 0?o:0)<<24;f.setUint32(Z.INLINE_OFFSET,h>>>0,!0);let m=FF(r),b=t.slice(),g=m.push(b)-1;f.setInt32(Z.BUFFER_INDEX_OFFSET,g,!0),f.setInt32(Z.BUFFER_OFFSET_OFFSET,0,!0)},OF=(r,e,t)=>{let n=t instanceof Uint8Array?t:new Uint8Array(t);dT(r,e,n)},hT=({values:r,valueOffsets:e},t,n)=>uT(r,e,t,Jt(n)),MF=(r,e,t)=>{let n=Jt(t);dT(r,e,n)},jh=(r,e,t)=>{r.type.unit===ye.DAY?$u(r,e,t):qu(r,e,t)},Ku=({values:r},e,t)=>{r[e]=BigInt(t/1e3)},Xu=({values:r},e,t)=>{r[e]=BigInt(t)},Hu=({values:r},e,t)=>{r[e]=BigInt(t*1e3)},Ju=({values:r},e,t)=>{r[e]=BigInt(t*1e6)},Gh=(r,e,t)=>{switch(r.type.unit){case L.SECOND:return Ku(r,e,t);case L.MILLISECOND:return Xu(r,e,t);case L.MICROSECOND:return Hu(r,e,t);case L.NANOSECOND:return Ju(r,e,t)}},Yu=({values:r},e,t)=>{r[e]=t},Qu=({values:r},e,t)=>{r[e]=t},Zu=({values:r},e,t)=>{r[e]=t},el=({values:r},e,t)=>{r[e]=t},zh=(r,e,t)=>{switch(r.type.unit){case L.SECOND:return Yu(r,e,t);case L.MILLISECOND:return Qu(r,e,t);case L.MICROSECOND:return Zu(r,e,t);case L.NANOSECOND:return el(r,e,t)}},Wh=({values:r,stride:e},t,n)=>{r.set(n.subarray(0,e),e*t)},pT=(r,e,t)=>{let n=r.children[0],s=r.valueOffsets,i=nt.getVisitFn(n),o=te(s[e]),a=te(s[e+1]);if(Array.isArray(t))for(let c=-1,u=o;u<a;)i(n,u++,t[++c]);else for(let c=-1,u=o;u<a;)i(n,u++,t.get(++c))},DF=(r,e,t)=>{let n=r.children[0],{valueOffsets:s}=r,i=nt.getVisitFn(n),{[e]:o,[e+1]:a}=s,c=t instanceof Map?t.entries():Object.entries(t);for(let u of c)if(i(n,o,u),++o>=a)break},RF=(r,e)=>(t,n,s,i)=>n&&t(n,r,e[i]),kF=(r,e)=>(t,n,s,i)=>n&&t(n,r,e.get(i)),NF=(r,e)=>(t,n,s,i)=>n&&t(n,r,e.get(s.name)),CF=(r,e)=>(t,n,s,i)=>n&&t(n,r,e[s.name]),UF=(r,e,t)=>{let n=r.type.children.map(i=>nt.getVisitFn(i.type)),s=t instanceof Map?NF(e,t):t instanceof B?kF(e,t):Array.isArray(t)?RF(e,t):CF(e,t);r.type.children.forEach((i,o)=>s(n[o],r.children[o],i,o))},PF=(r,e,t)=>{r.type.mode===he.Dense?mT(r,e,t):bT(r,e,t)},mT=(r,e,t)=>{let n=r.type.typeIdToChildIndex[r.typeIds[e]],s=r.children[n];nt.visit(s,r.valueOffsets[e],t)},bT=(r,e,t)=>{let n=r.type.typeIdToChildIndex[r.typeIds[e]],s=r.children[n];nt.visit(s,e,t)},VF=(r,e,t)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[e],t)},$h=(r,e,t)=>{switch(r.type.unit){case ae.YEAR_MONTH:return rl(r,e,t);case ae.DAY_TIME:return tl(r,e,t);case ae.MONTH_DAY_NANO:return nl(r,e,t)}},tl=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},rl=({values:r},e,t)=>{r[e]=t[0]*12+t[1]%12},nl=({values:r,stride:e},t,n)=>{r.set(n.subarray(0,e),e*t)},sl=({values:r},e,t)=>{r[e]=t},il=({values:r},e,t)=>{r[e]=t},ol=({values:r},e,t)=>{r[e]=t},al=({values:r},e,t)=>{r[e]=t},qh=(r,e,t)=>{switch(r.type.unit){case L.SECOND:return sl(r,e,t);case L.MILLISECOND:return il(r,e,t);case L.MICROSECOND:return ol(r,e,t);case L.NANOSECOND:return al(r,e,t)}},jF=(r,e,t)=>{let{stride:n}=r,s=r.children[0],i=nt.getVisitFn(s);if(Array.isArray(t))for(let o=-1,a=e*n;++o<n;)i(s,a+o,t[o]);else for(let o=-1,a=e*n;++o<n;)i(s,a+o,t.get(o))};j.prototype.visitBool=q(LF);j.prototype.visitInt=q(An);j.prototype.visitInt8=q(An);j.prototype.visitInt16=q(An);j.prototype.visitInt32=q(An);j.prototype.visitInt64=q(An);j.prototype.visitUint8=q(An);j.prototype.visitUint16=q(An);j.prototype.visitUint32=q(An);j.prototype.visitUint64=q(An);j.prototype.visitFloat=q(BF);j.prototype.visitFloat16=q(lT);j.prototype.visitFloat32=q(Ph);j.prototype.visitFloat64=q(Ph);j.prototype.visitUtf8=q(hT);j.prototype.visitLargeUtf8=q(hT);j.prototype.visitUtf8View=q(MF);j.prototype.visitBinary=q(fT);j.prototype.visitLargeBinary=q(fT);j.prototype.visitBinaryView=q(OF);j.prototype.visitFixedSizeBinary=q(Vh);j.prototype.visitDate=q(jh);j.prototype.visitDateDay=q($u);j.prototype.visitDateMillisecond=q(qu);j.prototype.visitTimestamp=q(Gh);j.prototype.visitTimestampSecond=q(Ku);j.prototype.visitTimestampMillisecond=q(Xu);j.prototype.visitTimestampMicrosecond=q(Hu);j.prototype.visitTimestampNanosecond=q(Ju);j.prototype.visitTime=q(zh);j.prototype.visitTimeSecond=q(Yu);j.prototype.visitTimeMillisecond=q(Qu);j.prototype.visitTimeMicrosecond=q(Zu);j.prototype.visitTimeNanosecond=q(el);j.prototype.visitDecimal=q(Wh);j.prototype.visitList=q(pT);j.prototype.visitLargeList=q(pT);j.prototype.visitStruct=q(UF);j.prototype.visitUnion=q(PF);j.prototype.visitDenseUnion=q(mT);j.prototype.visitSparseUnion=q(bT);j.prototype.visitDictionary=q(VF);j.prototype.visitInterval=q($h);j.prototype.visitIntervalDayTime=q(tl);j.prototype.visitIntervalYearMonth=q(rl);j.prototype.visitIntervalMonthDayNano=q(nl);j.prototype.visitDuration=q(qh);j.prototype.visitDurationSecond=q(sl);j.prototype.visitDurationMillisecond=q(il);j.prototype.visitDurationMicrosecond=q(ol);j.prototype.visitDurationNanosecond=q(al);j.prototype.visitFixedSizeList=q(jF);j.prototype.visitMap=q(DF);nt=new j});var Vr,ko,en,Kh,Xh,GF,cl=p(()=>{tc();hi();ar();Vr=Symbol.for("parent"),ko=Symbol.for("rowIndex"),en=class{constructor(e,t){return this[Vr]=e,this[ko]=t,new Proxy(this,GF)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[ko],t=this[Vr],n=t.type.children,s={};for(let i=-1,o=n.length;++i<o;)s[n[i].name]=ze.visit(t.children[i],e);return s}toString(){return`{${[...this].map(([e,t])=>`${Rr(e)}: ${Rr(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Kh(this[Vr],this[ko])}},Kh=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,ze.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(en.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Vr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ko]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});Xh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Vr].type.children.map(t=>t.name)}has(e,t){return e[Vr].type.children.some(n=>n.name===t)}getOwnPropertyDescriptor(e,t){if(e[Vr].type.children.some(n=>n.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Vr].type.children.findIndex(s=>s.name===t);if(n!==-1){let s=ze.visit(e[Vr].children[n],e[ko]);return Reflect.set(e,t,s),s}}set(e,t,n){let s=e[Vr].type.children.findIndex(i=>i.name===t);return s!==-1?(nt.visit(e[Vr].children[s],e[ko],n),Reflect.set(e,t,n)):Reflect.has(e,t)||typeof t=="symbol"?Reflect.set(e,t,n):!1}},GF=new Xh});function W(r){return(e,t)=>e.getValid(t)?r(e,t):null}var C,zF,No,WF,$F,gT,qF,yT,wT,ys,KF,xT,XF,TT,_T,HF,AT,JF,YF,QF,ZF,vT,IT,ST,ET,eO,LT,BT,FT,OT,tO,rO,MT,nO,sO,iO,DT,RT,oO,aO,kT,NT,CT,UT,PT,VT,jT,cO,uO,ze,hi=p(()=>{zu();ht();Vt();lc();cl();Qr();gn();uc();Me();C=class extends R{};zF=(r,e)=>864e5*r[e],No=16,WF=12,$F=(r,e)=>null,gT=(r,e,t)=>{if(t+1>=e.length)return null;let n=te(e[t]),s=te(e[t+1]);return r.subarray(n,s)},qF=({offset:r,values:e},t)=>{let n=r+t;return(e[n>>3]&1<<n%8)!==0},yT=({values:r},e)=>zF(r,e),wT=({values:r},e)=>te(r[e]),ys=({stride:r,values:e},t)=>e[r*t],KF=({stride:r,values:e},t)=>Wu(e[r*t]),xT=({values:r},e)=>r[e],XF=({stride:r,values:e},t)=>e.subarray(r*t,r*(t+1)),TT=({values:r,valueOffsets:e},t)=>gT(r,e,t),_T=(r,e)=>{var t;let n=r.values;if(!n)throw new Error("BinaryView data is missing view buffer");let s=e*No,i=s+No;if(s<0||i>n.length)throw new Error(`BinaryView data buffer is too short: expected ${No} bytes, got ${Math.max(0,n.length-s)}`);let o=n.subarray(s,i);if(o.length<No)throw new Error(`BinaryView data buffer is too short: expected ${No} bytes, got ${o.length}`);let a=new DataView(n.buffer,o.byteOffset,No),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=WF)return o.subarray(4,4+c);let u=a.getInt32(8,!0),l=a.getInt32(12,!0),f=(t=r.variadicBuffers)===null||t===void 0?void 0:t[u];if(!f)throw new Error(`BinaryView variadic buffer ${u} is missing`);return f.subarray(l,l+c)},HF=(r,e)=>_T(r,e),AT=({values:r,valueOffsets:e},t)=>{let n=gT(r,e,t);return n!==null?vo(n):null},JF=(r,e)=>{let t=_T(r,e);return vo(t)},YF=({values:r},e)=>r[e],QF=({type:r,values:e},t)=>r.precision!==le.HALF?e[t]:Wu(e[t]),ZF=(r,e)=>r.type.unit===ye.DAY?yT(r,e):wT(r,e),vT=({values:r},e)=>1e3*te(r[e]),IT=({values:r},e)=>te(r[e]),ST=({values:r},e)=>Rh(r[e],BigInt(1e3)),ET=({values:r},e)=>Rh(r[e],BigInt(1e6)),eO=(r,e)=>{switch(r.type.unit){case L.SECOND:return vT(r,e);case L.MILLISECOND:return IT(r,e);case L.MICROSECOND:return ST(r,e);case L.NANOSECOND:return ET(r,e)}},LT=({values:r},e)=>r[e],BT=({values:r},e)=>r[e],FT=({values:r},e)=>r[e],OT=({values:r},e)=>r[e],tO=(r,e)=>{switch(r.type.unit){case L.SECOND:return LT(r,e);case L.MILLISECOND:return BT(r,e);case L.MICROSECOND:return FT(r,e);case L.NANOSECOND:return OT(r,e)}},rO=({values:r,stride:e},t)=>di.decimal(r.subarray(e*t,e*(t+1))),MT=(r,e)=>{let{valueOffsets:t,stride:n,children:s}=r,i=te(t[e*n]),o=te(t[e*n+1]),c=s[0].slice(i,o-i);return new B([c])},nO=(r,e)=>{let{valueOffsets:t,children:n}=r,{[e]:s,[e+1]:i}=t,o=n[0];return new yr(o.slice(s,i-s))},sO=(r,e)=>new en(r,e),iO=(r,e)=>r.type.mode===he.Dense?DT(r,e):RT(r,e),DT=(r,e)=>{let t=r.type.typeIdToChildIndex[r.typeIds[e]],n=r.children[t];return ze.visit(n,r.valueOffsets[e])},RT=(r,e)=>{let t=r.type.typeIdToChildIndex[r.typeIds[e]],n=r.children[t];return ze.visit(n,e)},oO=(r,e)=>{var t;return(t=r.dictionary)===null||t===void 0?void 0:t.get(r.values[e])},aO=(r,e)=>r.type.unit===ae.MONTH_DAY_NANO?CT(r,e):r.type.unit===ae.DAY_TIME?kT(r,e):NT(r,e),kT=({values:r},e)=>r.subarray(2*e,2*(e+1)),NT=({values:r},e)=>{let t=r[e],n=new Int32Array(2);return n[0]=Math.trunc(t/12),n[1]=Math.trunc(t%12),n},CT=({values:r},e)=>r.subarray(4*e,4*(e+1)),UT=({values:r},e)=>r[e],PT=({values:r},e)=>r[e],VT=({values:r},e)=>r[e],jT=({values:r},e)=>r[e],cO=(r,e)=>{switch(r.type.unit){case L.SECOND:return UT(r,e);case L.MILLISECOND:return PT(r,e);case L.MICROSECOND:return VT(r,e);case L.NANOSECOND:return jT(r,e)}},uO=(r,e)=>{let{stride:t,children:n}=r,i=n[0].slice(e*t,t);return new B([i])};C.prototype.visitNull=W($F);C.prototype.visitBool=W(qF);C.prototype.visitInt=W(YF);C.prototype.visitInt8=W(ys);C.prototype.visitInt16=W(ys);C.prototype.visitInt32=W(ys);C.prototype.visitInt64=W(xT);C.prototype.visitUint8=W(ys);C.prototype.visitUint16=W(ys);C.prototype.visitUint32=W(ys);C.prototype.visitUint64=W(xT);C.prototype.visitFloat=W(QF);C.prototype.visitFloat16=W(KF);C.prototype.visitFloat32=W(ys);C.prototype.visitFloat64=W(ys);C.prototype.visitUtf8=W(AT);C.prototype.visitLargeUtf8=W(AT);C.prototype.visitUtf8View=W(JF);C.prototype.visitBinary=W(TT);C.prototype.visitLargeBinary=W(TT);C.prototype.visitBinaryView=W(HF);C.prototype.visitFixedSizeBinary=W(XF);C.prototype.visitDate=W(ZF);C.prototype.visitDateDay=W(yT);C.prototype.visitDateMillisecond=W(wT);C.prototype.visitTimestamp=W(eO);C.prototype.visitTimestampSecond=W(vT);C.prototype.visitTimestampMillisecond=W(IT);C.prototype.visitTimestampMicrosecond=W(ST);C.prototype.visitTimestampNanosecond=W(ET);C.prototype.visitTime=W(tO);C.prototype.visitTimeSecond=W(LT);C.prototype.visitTimeMillisecond=W(BT);C.prototype.visitTimeMicrosecond=W(FT);C.prototype.visitTimeNanosecond=W(OT);C.prototype.visitDecimal=W(rO);C.prototype.visitList=W(MT);C.prototype.visitLargeList=W(MT);C.prototype.visitStruct=W(sO);C.prototype.visitUnion=W(iO);C.prototype.visitDenseUnion=W(DT);C.prototype.visitSparseUnion=W(RT);C.prototype.visitDictionary=W(oO);C.prototype.visitInterval=W(aO);C.prototype.visitIntervalDayTime=W(kT);C.prototype.visitIntervalYearMonth=W(NT);C.prototype.visitIntervalMonthDayNano=W(CT);C.prototype.visitDuration=W(cO);C.prototype.visitDurationSecond=W(UT);C.prototype.visitDurationMillisecond=W(PT);C.prototype.visitDurationMicrosecond=W(VT);C.prototype.visitDurationNanosecond=W(jT);C.prototype.visitFixedSizeList=W(uO);C.prototype.visitMap=W(nO);ze=new C});var ws,Uo,Co,Hh,yr,Jh,Yh,lc=p(()=>{ht();tc();hi();ar();ws=Symbol.for("keys"),Uo=Symbol.for("vals"),Co=Symbol.for("kKeysAsStrings"),Hh=Symbol.for("_kKeysAsStrings"),yr=class{constructor(e){return this[ws]=new B([e.children[0]]).memoize(),this[Uo]=e.children[1],new Proxy(this,new Yh)}get[Co](){return this[Hh]||(this[Hh]=Array.from(this[ws].toArray(),String))}[Symbol.iterator](){return new Jh(this[ws],this[Uo])}get size(){return this[ws].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[ws],t=this[Uo],n={};for(let s=-1,i=e.length;++s<i;)n[e.get(s)]=ze.visit(t,s);return n}toString(){return`{${[...this].map(([e,t])=>`${Rr(e)}: ${Rr(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Jh=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),ze.visit(this.vals,e)]})}},Yh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Co]}has(e,t){return e[Co].includes(t)}getOwnPropertyDescriptor(e,t){if(e[Co].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Co].indexOf(t);if(n!==-1){let s=ze.visit(Reflect.get(e,Uo),n);return Reflect.set(e,t,s),s}}set(e,t,n){let s=e[Co].indexOf(t);return s!==-1?(nt.visit(Reflect.get(e,Uo),s,n),Reflect.set(e,t,n)):Reflect.has(e,t)?Reflect.set(e,t,n):!1}};Object.defineProperties(yr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ws]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Uo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Hh]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var Qh={};J(Qh,{clampRange:()=>fc,createElementComparator:()=>xs,wrapIndex:()=>pi});function fc(r,e,t,n){let{length:s=0}=r,i=typeof e!="number"?0:e,o=typeof t!="number"?s:t;return i<0&&(i=(i%s+s)%s),o<0&&(o=(o%s+s)%s),o<i&&(GT=i,i=o,o=GT),o>s&&(o=s),n?n(r,i,o):[i,o]}function xs(r){if(typeof r!=="object"||r===null)return zT(r)?zT:t=>t===r;if(r instanceof Date){let t=r.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(r)?t=>t?rh(r,t):!1:r instanceof Map?fO(r):Array.isArray(r)?lO(r):r instanceof B?dO(r):hO(r,!0)}function lO(r){let e=[];for(let t=-1,n=r.length;++t<n;)e[t]=xs(r[t]);return ul(e)}function fO(r){let e=-1,t=[];for(let n of r.values())t[++e]=xs(n);return ul(t)}function dO(r){let e=[];for(let t=-1,n=r.length;++t<n;)e[t]=xs(r.get(t));return ul(e)}function hO(r,e=!1){let t=Object.keys(r);if(!e&&t.length===0)return()=>!1;let n=[];for(let s=-1,i=t.length;++s<i;)n[s]=xs(r[t[s]]);return ul(n,t)}function ul(r,e){return t=>{if(!t||typeof t!="object")return!1;switch(t.constructor){case Array:return pO(r,t);case Map:return WT(r,t,t.keys());case yr:case en:case Object:case void 0:return WT(r,t,e||Object.keys(t))}return t instanceof B?mO(r,t):!1}}function pO(r,e){let t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e[n]))return!1;return!0}function mO(r,e){let t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e.get(n)))return!1;return!0}function WT(r,e,t){let n=t[Symbol.iterator](),s=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),i=e instanceof Map?e.values():Object.values(e)[Symbol.iterator](),o=0,a=r.length,c=i.next(),u=n.next(),l=s.next();for(;o<a&&!u.done&&!l.done&&!c.done&&!(u.value!==l.value||!r[o](c.value));++o,u=n.next(),l=s.next(),c=i.next());return o===a&&u.done&&l.done&&c.done?!0:(n.return&&n.return(),s.return&&s.return(),i.return&&i.return(),!1)}var GT,pi,zT,Po=p(()=>{ht();lc();cl();Ke();pi=(r,e)=>r<0?e+r:r,zT=r=>r!==r});var Zh={};J(Zh,{BitIterator:()=>tn,getBit:()=>fl,getBool:()=>Vo,packBools:()=>bi,popcnt_array:()=>$T,popcnt_bit_range:()=>dc,popcnt_uint32:()=>ll,setBool:()=>bO,truncateBitmap:()=>mi});function Vo(r,e,t,n){return(t&1<<n)!==0}function fl(r,e,t,n){return(t&1<<n)>>n}function bO(r,e,t){return t?!!(r[e>>3]|=1<<e%8)||!0:!(r[e>>3]&=~(1<<e%8))&&!1}function mi(r,e,t){let n=t.byteLength+7&-8;if(r>0||t.byteLength<n){let s=new Uint8Array(n);return s.set(r%8===0?t.subarray(r>>3):bi(new tn(t,r,e,null,Vo)).subarray(0,n)),s}return t}function bi(r){let e=[],t=0,n=0,s=0;for(let o of r)o&&(s|=1<<n),++n===8&&(e[t++]=s,s=n=0);(t===0||n>0)&&(e[t++]=s);let i=new Uint8Array(e.length+7&-8);return i.set(e),i}function dc(r,e,t){if(t-e<=0)return 0;if(t-e<8){let i=0;for(let o of new tn(r,e,t-e,r,fl))i+=o;return i}let n=t>>3<<3,s=e+(e%8===0?0:8-e%8);return dc(r,e,s)+dc(r,n,t)+$T(r,s>>3,n-s>>3)}function $T(r,e,t){let n=0,s=Math.trunc(e),i=new DataView(r.buffer,r.byteOffset,r.byteLength),o=t===void 0?r.byteLength:s+t;for(;o-s>=4;)n+=ll(i.getUint32(s)),s+=4;for(;o-s>=2;)n+=ll(i.getUint16(s)),s+=2;for(;o-s>=1;)n+=ll(i.getUint8(s)),s+=1;return n}function ll(r){let e=Math.trunc(r);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}var tn,gi=p(()=>{tn=class{constructor(e,t,n,s,i){this.bytes=e,this.length=n,this.context=s,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}});function D(r){return yO.visit(r)}var gO,qT,G,ep,yO,wr=p(()=>{ht();Me();we();gi();we();Vt();Ke();gO=-1,qT=Symbol.for("apache-arrow/Data"),G=class r{static isData(e){return e?.[qT]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return E.isSparseUnion(e)?this.children.some(t=>t.nullable):E.isDenseUnion(e)?this.children.some(t=>t.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:s,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),s&&(e+=s.byteLength),i&&(e+=i.byteLength),e+=this.variadicBuffers.reduce((o,a)=>{var c;return o+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((o,a)=>o+a.byteLength,e)}get nullCount(){if(E.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let e=this._nullCount,t;return e<=gO&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-dc(t,this.offset,this.offset+this.length)),e}constructor(e,t,n,s,i,o=[],a,c=[]){var u;this.type=e,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(t||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let l;i instanceof r?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets,this.variadicBuffers=i.variadicBuffers):(this.stride=or(e),i&&((l=i[0])&&(this.valueOffsets=l),(l=i[1])&&(this.values=l),(l=i[2])&&(this.nullBitmap=l),(l=i[3])&&(this.typeIds=l)),this.variadicBuffers=c),(u=this.variadicBuffers)!==null&&u!==void 0||(this.variadicBuffers=[])}getValid(e){let{type:t}=this;if(E.isUnion(t)){let n=t,s=this.typeIds[e],i=n.typeIdToChildIndex[s],o=this.children[i],a=this.valueOffsets,c=n.mode===he.Dense&&a?Number(a[e]):e;return o.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+e;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(e,t){let n,{type:s}=this;if(E.isUnion(s)){let i=s,o=this.typeIds[e],a=i.typeIdToChildIndex[o],c=this.children[a],u=this.valueOffsets,l=i.mode===he.Dense&&u?Number(u[e]):e;n=c.getValid(l),c.setValid(l,t)}else{let{nullBitmap:i}=this,{offset:o,length:a}=this,c=o+e,u=1<<c%8,l=c>>3;(!i||i.byteLength<=l)&&(i=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(i.set(mi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:i})):Object.assign(this,{nullBitmap:i,_nullCount:0}));let f=i[l];n=(f&u)!==0,i[l]=t?f|u:f&~u}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(e=this.type,t=this.offset,n=this.length,s=this._nullCount,i=this,o=this.children,a=this.variadicBuffers){return new r(e,t,n,s,i,o,this.dictionary,a)}slice(e,t){let{stride:n,typeId:s,children:i}=this,o=+(this._nullCount===0)-1,a=s===16?n:1,c=this._sliceBuffers(e,t,n,s);return this.clone(this.type,this.offset+e,t,o,c,i.length===0||this.valueOffsets?i:this._sliceChildren(i,a*e,a*t),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===w.Null)return this.clone(this.type,0,e,0,this.buffers,this.children,this.variadicBuffers);let{length:t,nullCount:n}=this,s=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);s[t>>3]=(1<<t-(t&-8))-1,n>0&&s.set(mi(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[re.VALIDITY]=s,this.clone(this.type,0,e,n+(e-t),i,this.children,this.variadicBuffers)}_sliceBuffers(e,t,n,s){let i,{buffers:o}=this;if((i=o[re.TYPE])&&(o[re.TYPE]=i.subarray(e,e+t)),E.isBinaryView(this.type)||E.isUtf8View(this.type)){let a=Z.ELEMENT_WIDTH;(i=o[re.DATA])&&(o[re.DATA]=i.subarray(e*a,(e+t)*a))}else(i=o[re.OFFSET])&&(o[re.OFFSET]=i.subarray(e,e+t+1))||(i=o[re.DATA])&&(o[re.DATA]=s===6?i:i.subarray(n*e,n*(e+t)));return o}_sliceChildren(e,t,n){return e.map(s=>s.slice(t,n))}};G.prototype.children=Object.freeze([]);G.prototype[qT]=!0;Object.defineProperty(G,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===G&&G.isData(e)}});ep=class r extends R{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{["type"]:t,["offset"]:n=0,["length"]:s=0}=e;return new G(t,n,s,s)}visitBool(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length>>3,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitInt(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitFloat(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitUtf8(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=ui(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitUtf8View(e){var t;let{["type"]:n,["offset"]:s=0}=e,i=ee(n.ArrayType,e.views),o=k(e.nullBitmap),a=(e.variadicBuffers||[]).map(l=>k(l)),c=(t=e.length)!==null&&t!==void 0?t:Math.trunc(i.length/St.ELEMENT_WIDTH),u=e.nullBitmap?-1:0;return new G(n,s,c,u,[void 0,i,o],[],void 0,a)}visitLargeUtf8(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=Pa(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitBinary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=ui(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitBinaryView(e){var t;let{["type"]:n,["offset"]:s=0}=e,i=ee(n.ArrayType,e.views),o=k(e.nullBitmap),a=(e.variadicBuffers||[]).map(l=>k(l)),c=(t=e.length)!==null&&t!==void 0?t:Math.trunc(i.length/Z.ELEMENT_WIDTH),u=e.nullBitmap?-1:0;return new G(n,s,c,u,[void 0,i,o],[],void 0,a)}visitLargeBinary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=Pa(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitFixedSizeBinary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitDate(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitTimestamp(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitTime(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitDecimal(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitList(e){let{["type"]:t,["offset"]:n=0,["child"]:s}=e,i=k(e.nullBitmap),o=ui(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,void 0,i],[s])}visitLargeList(e){let{["type"]:t,["offset"]:n=0,["child"]:s}=e,i=k(e.nullBitmap),o=Pa(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,void 0,i],[s])}visitStruct(e){let{["type"]:t,["offset"]:n=0,["children"]:s=[]}=e,i=k(e.nullBitmap),{length:o=s.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,void 0,i],s)}visitUnion(e){let{["type"]:t,["offset"]:n=0,["children"]:s=[]}=e,i=ee(t.ArrayType,e.typeIds),{["length"]:o=i.length,["nullCount"]:a=-1}=e;if(E.isSparseUnion(t))return new G(t,n,o,a,[void 0,void 0,void 0,i],s);let c=ui(e.valueOffsets);return new G(t,n,o,a,[c,void 0,void 0,i],s)}visitDictionary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.indices.ArrayType,e.data),{["dictionary"]:o=new B([new r().visit({type:t.dictionary})])}=e,{["length"]:a=i.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[void 0,i,s],[],o)}visitInterval(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitDuration(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitFixedSizeList(e){let{["type"]:t,["offset"]:n=0,["child"]:s=new r().visit({type:t.valueType})}=e,i=k(e.nullBitmap),{["length"]:o=s.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,void 0,i],[s])}visitMap(e){let{["type"]:t,["offset"]:n=0,["child"]:s=new r().visit({type:t.childType})}=e,i=k(e.nullBitmap),o=ui(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,void 0,i],[s])}},yO=new ep});function KT(r){return r.some(e=>e.nullable)}function dl(r){return r.reduce((e,t)=>e+t.nullCount,0)}function hl(r){return r.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(r.length+1))}function pl(r,e,t,n){let s=[];for(let i=-1,o=r.length;++i<o;){let a=r[i],c=e[i],{length:u}=a;if(c>=n)break;if(t>=c+u)continue;if(c>=t&&c+u<=n){s.push(a);continue}let l=Math.max(0,t-c),f=Math.min(n-c,u);s.push(a.slice(l,f-l))}return s.length===0&&s.push(r[0].slice(0,0)),s}function tp(r,e,t,n){let s=0,i=0,o=e.length-1;do{if(s>=o-1)return t<e[o]?n(r,s,t-e[s]):null;i=s+Math.trunc((o-s)*.5),t<e[i]?o=i:s=i}while(s<o)}function pc(r,e){return r.getValid(e)}function jo(r){function e(t,n,s){return r(t[n],s)}return function(t){let n=this.data;return tp(n,this._offsets,t,e)}}function ml(r){let e;function t(n,s,i){return r(n[s],i,e)}return function(n,s){let i=this.data;e=s;let o=tp(i,this._offsets,n,t);return e=void 0,o}}function bl(r){let e;function t(n,s,i){let o=i,a=0,c=0;for(let u=s-1,l=n.length;++u<l;){let f=n[u];if(~(a=r(f,e,o)))return c+a;o=0,c+=f.length}return-1}return function(n,s){e=n;let i=this.data,o=typeof s!="number"?t(i,0,0):tp(i,this._offsets,s,t);return e=void 0,o}}var hc,gl=p(()=>{hc=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function wO(r,e){return e===null&&r.length>0?0:-1}function xO(r,e){let{nullBitmap:t}=r;if(!t||r.nullCount<=0)return-1;let n=0;for(let s of new tn(t,r.offset+(e||0),r.length,t,Vo)){if(!s)return n;++n}return-1}function X(r,e,t){if(e===void 0)return-1;if(e===null)switch(r.typeId){case w.Union:break;case w.Dictionary:break;default:return xO(r,t)}let n=ze.getVisitFn(r),s=xs(e);for(let i=(t||0)-1,o=r.length;++i<o;)if(s(n(r,i)))return i;return-1}function XT(r,e,t){let n=ze.getVisitFn(r),s=xs(e);for(let i=(t||0)-1,o=r.length;++i<o;)if(s(n(r,i)))return i;return-1}var U,yi,yl=p(()=>{Me();Vt();hi();gi();Po();U=class extends R{};U.prototype.visitNull=wO;U.prototype.visitBool=X;U.prototype.visitInt=X;U.prototype.visitInt8=X;U.prototype.visitInt16=X;U.prototype.visitInt32=X;U.prototype.visitInt64=X;U.prototype.visitUint8=X;U.prototype.visitUint16=X;U.prototype.visitUint32=X;U.prototype.visitUint64=X;U.prototype.visitFloat=X;U.prototype.visitFloat16=X;U.prototype.visitFloat32=X;U.prototype.visitFloat64=X;U.prototype.visitUtf8=X;U.prototype.visitLargeUtf8=X;U.prototype.visitUtf8View=X;U.prototype.visitBinary=X;U.prototype.visitLargeBinary=X;U.prototype.visitBinaryView=X;U.prototype.visitFixedSizeBinary=X;U.prototype.visitDate=X;U.prototype.visitDateDay=X;U.prototype.visitDateMillisecond=X;U.prototype.visitTimestamp=X;U.prototype.visitTimestampSecond=X;U.prototype.visitTimestampMillisecond=X;U.prototype.visitTimestampMicrosecond=X;U.prototype.visitTimestampNanosecond=X;U.prototype.visitTime=X;U.prototype.visitTimeSecond=X;U.prototype.visitTimeMillisecond=X;U.prototype.visitTimeMicrosecond=X;U.prototype.visitTimeNanosecond=X;U.prototype.visitDecimal=X;U.prototype.visitList=X;U.prototype.visitLargeList=X;U.prototype.visitStruct=X;U.prototype.visitUnion=X;U.prototype.visitDenseUnion=XT;U.prototype.visitSparseUnion=XT;U.prototype.visitDictionary=X;U.prototype.visitInterval=X;U.prototype.visitIntervalDayTime=X;U.prototype.visitIntervalYearMonth=X;U.prototype.visitIntervalMonthDayNano=X;U.prototype.visitDuration=X;U.prototype.visitDurationSecond=X;U.prototype.visitDurationMillisecond=X;U.prototype.visitDurationMicrosecond=X;U.prototype.visitDurationNanosecond=X;U.prototype.visitFixedSizeList=X;U.prototype.visitMap=X;yi=new U});function $(r){let{type:e}=r;if(r.nullCount===0&&r.stride===1&&(E.isInt(e)&&e.bitWidth!==64||E.isTime(e)&&e.bitWidth!==64||E.isFloat(e)&&e.precision!==le.HALF))return new hc(r.data.length,n=>{let s=r.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let t=0;return new hc(r.data.length,n=>{let i=r.data[n].length,o=r.slice(t,t+i);return t+=i,new rp(o)})}var P,rp,Go,wl=p(()=>{Vt();Me();we();gl();P=class extends R{};rp=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};P.prototype.visitNull=$;P.prototype.visitBool=$;P.prototype.visitInt=$;P.prototype.visitInt8=$;P.prototype.visitInt16=$;P.prototype.visitInt32=$;P.prototype.visitInt64=$;P.prototype.visitUint8=$;P.prototype.visitUint16=$;P.prototype.visitUint32=$;P.prototype.visitUint64=$;P.prototype.visitFloat=$;P.prototype.visitFloat16=$;P.prototype.visitFloat32=$;P.prototype.visitFloat64=$;P.prototype.visitUtf8=$;P.prototype.visitLargeUtf8=$;P.prototype.visitUtf8View=$;P.prototype.visitBinary=$;P.prototype.visitLargeBinary=$;P.prototype.visitBinaryView=$;P.prototype.visitFixedSizeBinary=$;P.prototype.visitDate=$;P.prototype.visitDateDay=$;P.prototype.visitDateMillisecond=$;P.prototype.visitTimestamp=$;P.prototype.visitTimestampSecond=$;P.prototype.visitTimestampMillisecond=$;P.prototype.visitTimestampMicrosecond=$;P.prototype.visitTimestampNanosecond=$;P.prototype.visitTime=$;P.prototype.visitTimeSecond=$;P.prototype.visitTimeMillisecond=$;P.prototype.visitTimeMicrosecond=$;P.prototype.visitTimeNanosecond=$;P.prototype.visitDecimal=$;P.prototype.visitList=$;P.prototype.visitLargeList=$;P.prototype.visitStruct=$;P.prototype.visitUnion=$;P.prototype.visitDenseUnion=$;P.prototype.visitSparseUnion=$;P.prototype.visitDictionary=$;P.prototype.visitInterval=$;P.prototype.visitIntervalDayTime=$;P.prototype.visitIntervalYearMonth=$;P.prototype.visitIntervalMonthDayNano=$;P.prototype.visitDuration=$;P.prototype.visitDurationSecond=$;P.prototype.visitDurationMillisecond=$;P.prototype.visitDurationMicrosecond=$;P.prototype.visitDurationNanosecond=$;P.prototype.visitFixedSizeList=$;P.prototype.visitMap=$;Go=new P});function rn(r){if(r){if(r instanceof G)return new B([r]);if(r instanceof B)return new B(r.data);if(r.type instanceof E)return new B([D(r)]);if(Array.isArray(r))return new B(r.flatMap(e=>TO(e)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let e={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new B([D(Object.assign(Object.assign({},e),{type:new Zt}))]);if(r instanceof Int16Array)return new B([D(Object.assign(Object.assign({},e),{type:new er}))]);if(r instanceof Int32Array)return new B([D(Object.assign(Object.assign({},e),{type:new Pe}))]);if(r instanceof BigInt64Array)return new B([D(Object.assign(Object.assign({},e),{type:new tr}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new B([D(Object.assign(Object.assign({},e),{type:new rr}))]);if(r instanceof Uint16Array)return new B([D(Object.assign(Object.assign({},e),{type:new nr}))]);if(r instanceof Uint32Array)return new B([D(Object.assign(Object.assign({},e),{type:new vt}))]);if(r instanceof BigUint64Array)return new B([D(Object.assign(Object.assign({},e),{type:new Nr}))]);if(r instanceof Float32Array)return new B([D(Object.assign(Object.assign({},e),{type:new It}))]);if(r instanceof Float64Array)return new B([D(Object.assign(Object.assign({},e),{type:new sr}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function TO(r){return r instanceof G?[r]:r instanceof B?r.data:rn(r).data}var HT,JT,YT,QT,B,xl,ht=p(()=>{Me();Po();we();wr();gl();hi();ar();yl();wl();we();JT=Symbol.for("apache-arrow/Vector"),YT={},QT={},B=class r{static isVector(e){return e?.[JT]===!0}constructor(e){var t,n,s;let i=e[0]instanceof r?e.flatMap(a=>a.data):e;if(i.length===0||i.some(a=>!(a instanceof G)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(t=i[0])===null||t===void 0?void 0:t.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:u}=YT[o.typeId],l=i[0];this.isValid=f=>pc(l,f),this.get=f=>a(l,f),this.set=(f,d)=>c(l,f,d),this.indexOf=f=>u(l,f),this._offsets=[0,l.length];break}default:Object.setPrototypeOf(this,QT[o.typeId]),this._offsets=hl(i);break}this.data=i,this.type=o,this.stride=or(o),this.numChildren=(s=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return KT(this.data)}get nullCount(){return dl(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${w[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(pi(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return Go.visit(this)}concat(...e){return new r(this.data.concat(e.flatMap(t=>t.data).flat(Number.POSITIVE_INFINITY)))}slice(e,t){return new r(fc(this,e,t,({data:n,_offsets:s},i,o)=>pl(n,s,i,o)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:s,ArrayType:i}=this;switch(e.typeId){case w.Int:case w.Float:case w.Decimal:case w.Time:case w.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*s);default:return t.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*s),o.offset),o.offset+=c*s,o),{array:new i(n*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)===null||t===void 0?void 0:t.findIndex(n=>n.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new r(this.data.map(({children:t})=>t[e])):null}get isMemoized(){return E.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(E.isDictionary(this.type)){let e=new xl(this.data[0].dictionary),t=this.data.map(n=>{let s=n.clone();return s.dictionary=e,s});return new r(t)}return new xl(this)}unmemoize(){if(E.isDictionary(this.type)&&this.isMemoized){let e=this.data[0].dictionary.unmemoize(),t=this.data.map(n=>{let s=n.clone();return s.dictionary=e,s});return new r(t)}return this}};HT=Symbol.toStringTag;B[HT]=(r=>{r.type=E.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0,r[JT]=!0;let e=Object.keys(w).map(t=>w[t]).filter(t=>typeof t=="number"&&t!==w.NONE);for(let t of e){let n=ze.getVisitFnByTypeId(t),s=nt.getVisitFnByTypeId(t),i=yi.getVisitFnByTypeId(t);YT[t]={get:n,set:s,indexOf:i},QT[t]=Object.create(r,{isValid:{value:jo(pc)},get:{value:jo(ze.getVisitFnByTypeId(t))},set:{value:ml(nt.getVisitFnByTypeId(t))},indexOf:{value:bl(yi.getVisitFnByTypeId(t))}})}return"Vector"})(B.prototype);Object.defineProperty(B,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===B&&B.isVector(e)}});xl=class r extends B{constructor(e){super(e.data);let t=this.get,n=this.set,s=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=i[o];if(a!==void 0)return a;let c=t.call(this,o);return i[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),i[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new B(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function ZT(r){if(!r||r.length<=0)return function(s){return!0};let e="",t=r.filter(n=>n===n);return t.length>0&&(e=`
12
+ `:s}else t+=n}return t}readDelimitedValue(e){this.offset++;let t=this.offset;for(;this.offset<this.source.length&&this.source[this.offset]!==e;)this.offset++;let n=this.source.slice(t,this.offset);return this.offset++,n}}});function jx(r){let e=new DataView(r),t=FF(e),n=e.getUint16(t+10,!0),s=e.getUint32(t+16,!0),i=s,o=new Map,a=new TextDecoder,c=0;for(let u=0;u<n;u++){if(s+46>t)throw new Error("USDZ archive contains a truncated ZIP central-directory entry.");if(e.getUint32(s,!0)!==33639248)throw new Error("USDZ archive contains an invalid ZIP central-directory entry.");let l=e.getUint16(s+10,!0),f=e.getUint32(s+20,!0),d=e.getUint32(s+24,!0),h=e.getUint16(s+28,!0),m=e.getUint16(s+30,!0),b=e.getUint16(s+32,!0),g=e.getUint32(s+42,!0);if(s+46+h+m+b>t)throw new Error("USDZ archive contains a truncated ZIP filename or extra field.");let y=a.decode(new Uint8Array(r,s+46,h));if(l!==0)throw new Error(`USDZ entry "${y}" is compressed; USDZ requires stored ZIP entries.`);if(g+30>i||f!==d)throw new Error(`USDZ entry "${y}" has invalid stored ZIP bounds.`);if(e.getUint32(g,!0)!==67324752)throw new Error(`USDZ entry "${y}" has an invalid local ZIP header.`);let x=e.getUint16(g+26,!0),T=e.getUint16(g+28,!0),_=g+30+x+T;if((e.getUint16(s+8,!0)|e.getUint16(g+6,!0))&1)throw new Error(`USDZ entry "${y}" is encrypted.`);if(_+f>i||e.getUint16(g+8,!0)!==0||a.decode(new Uint8Array(r,g+30,x))!==y||o.has(y))throw new Error(`USDZ entry "${y}" has invalid or duplicate stored ZIP data.`);if(c+=f,c>r.byteLength)throw new Error("USDZ archive exceeds its stored data budget.");o.set(y,r.slice(_,_+f)),s+=46+h+m+b}return o}function FF(r){let e=Math.max(0,r.byteLength-65557);for(let t=r.byteLength-22;t>=e;t--)if(r.getUint32(t,!0)===101010256)return t;throw new Error("USDZ archive does not contain a ZIP end-of-central-directory record.")}var Gx=p(()=>{"use strict"});async function vh(r,e={},t){let n=RF(e.core?.baseUrl,t?.url),s={fetch:async o=>{let a=await(t?.fetch||fetch)(o);if(!(a instanceof Response))throw new Error(`OpenUSD reference "${o}" did not return an HTTP response.`);if(!a.ok)throw new Error(`Unable to load OpenUSD reference "${o}": ${a.status}.`);return a},cache:new Map,archiveFiles:new Map,layers:new Set,options:{...e,usd:{...NF,...e.usd}}},i;if(VF(r)){let o=jx(r),a=o.keys().next().value;if(!a||!/\.(?:usd[ac]?)$/i.test(a))throw new Error("USDZ archive has no supported USD root layer.");let c="https://usd.archive/",u=Object.create(null);for(let[f,d]of o){let h=new URL(f,c);if(f.startsWith("/")||/^[a-z][a-z\d+.-]*:/i.test(f)||f.includes("\\")||/[\u0000-\u001f\u007f]/.test(f)||f.trim()!==f||f.split("/").some(m=>{let b=m.replace(/%2e/gi,".");return b==="."||b===".."})||h.origin!==new URL(c).origin||h.search||h.hash||u[h.href])throw new Error(`USDZ entry "${f}" has an ambiguous package URL.`);s.archiveFiles.set(h.href,d),u[h.href]=DF(f,d)}let l=new URL(a,c).href;i=xh(o.get(a),l),i.format="usdz",i.assets=u}else i=xh(r,n);return i.url&&($x(i,i.url),s.layers.add(i.url)),s.options.usd?.compose!==!1&&(i.rootPrims=await Th(i.rootPrims,i.url,{},s,0)),i.layers=Array.from(s.layers),n&&(i.url=n),i}function DF(r,e){let t=r.slice(r.lastIndexOf(".")+1).toLowerCase(),n=t==="png"?"image/png":/^(?:jpe?g)$/.test(t)?"image/jpeg":void 0;return n?{path:r,data:e,mimeType:n}:{path:r,data:e}}function RF(r,e){let t=Wx(r);return t||Wx(e)||r||e}function Wx(r){try{return r?new URL(r).href:void 0}catch{return}}function kF(r,e){try{return new URL(r,e).href}catch{let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?`${e.slice(0,t+1)}${r}`:r}}function xh(r,e){return zx.decode(r.slice(0,8))===OF?Nx(r,e):Px(zx.decode(r),e)}function $x(r,e){let t=[...r.rootPrims];for(;t.length;){let n=t.pop();for(let s of Object.values(n.attributes))s.sourceUrl=e;for(let s of n.children)t.push(s);if("variants"in n)for(let s of Object.values(n.variants))for(let i of Object.values(s))t.push(i)}}async function Th(r,e,t,n,s){if(s>(n.options.usd?.maxReferenceDepth??12))throw new Error("OpenUSD reference composition exceeded the configured depth limit.");let i=[];for(let o of r){if(o.specifier==="class")continue;let c={...PF(o.metadata.variants),...t,...n.options.usd?.variantSelections},u=o.sourceUrl||e,l=Wa(o);for(let[d,h]of Object.entries(l.variants)){let m=c[d]||Object.keys(h)[0],b=h[m];b&&(l=Ah(l,{...l,attributes:b.attributes,metadata:b.metadata,children:b.children,variants:{}}))}let f=Kx(l);if(n.options.usd?.loadReferences!==!1&&f.length>0)for(let d of f){if(!u)throw new Error("OpenUSD references require a source URL or options.core.baseUrl.");let h=kF(d.assetPath,u),m=await CF(h,n),b=UF(m,d.primPath),g=await Th(b,h,c,n,s+1);for(let y of g)l=Ah(Hx(y,l.path),l)}l.children=await Th(l.children,u,c,n,s),i.push(l)}return i}async function CF(r,e){let t=e.cache.get(r);return t||(t=(async()=>{let s=e.archiveFiles.get(r);if(!s){let o;try{o=await e.fetch(r)}catch(a){throw new Error(`Unable to fetch USD layer "${r}": ${String(a)}`)}s=o.arrayBuffer()}let i=xh(await s,r);return $x(i,r),e.layers.add(r),i})(),e.cache.set(r,t)),t}function UF(r,e){let t=e||r.metadata.defaultPrim;if(typeof t!="string")return r.rootPrims;let n=t.startsWith("/")?t:`/${t}`,s=qx(r.rootPrims,n);return s?[s]:[]}function qx(r,e){for(let t of r){if(t.path===e)return t;let n=qx(t.children,e);if(n)return n}}function Kx(r){let e=[];for(let t of[r.metadata.references,r.metadata.payload,r.metadata.payloads])Array.isArray(t)?e.push(...t.filter(_h)):_h(t)&&e.push(t);return e}function PF(r){return!r||typeof r!="object"||Array.isArray(r)||_h(r)?{}:Object.fromEntries(Object.entries(r).filter(e=>typeof e[1]=="string"))}function _h(r){return!!(r&&typeof r=="object"&&!Array.isArray(r)&&"assetPath"in r)}function Wa(r){return{...r,attributes:{...r.attributes},metadata:{...r.metadata},variants:{...r.variants},children:r.children.map(Wa)}}function Hx(r,e){let t=Wa(r);return t.path=e,t.children=t.children.map(n=>Hx(n,`${e}/${n.name}`)),t}function Ah(r,e){let t=r.children.map(Wa);for(let n of e.children){let s=t.findIndex(i=>i.name===n.name);s>=0?t[s]=Ah(t[s],n):t.push(Wa(n))}return{...r,...e,sourceUrl:Kx(e).length>0?e.sourceUrl:r.sourceUrl||e.sourceUrl,type:e.type||r.type,attributes:{...r.attributes,...e.attributes},metadata:{...r.metadata,...e.metadata},variants:{...r.variants,...e.variants},children:t}}function VF(r){return r.byteLength>=4&&new DataView(r).getUint32(0,!0)===MF}var zx,OF,MF,NF,Xx=p(()=>{"use strict";Ux();Vx();Gx();zx=new TextDecoder,OF="PXR-USDC",MF=67324752;NF={compose:!0,loadReferences:!0,maxReferenceDepth:12,variantSelections:{}}});async function zF(r,e,t){return vh(new TextEncoder().encode(r).buffer,e,t)}var KP,jF,GF,Jx=p(()=>{"use strict";Xx();Ih();({preload:KP,...jF}=$a),GF={...jF,parse:vh,parseText:zF}});var Yx={};J(Yx,{USDLoaderWithParser:()=>GF});var Qx=p(()=>{"use strict";Jx()});async function $F(){let{USDLoaderWithParser:r}=await Promise.resolve().then(()=>(Qx(),Yx));return r}var WF,$a,Ih=p(()=>{"use strict";WF="5.0.0-beta.8";$a={dataType:null,batchType:null,name:"Universal Scene Description",id:"usd",module:"scene",version:WF,extensions:["usd","usda","usdc","usdz"],mimeTypes:["model/vnd.usd","model/vnd.usda","model/vnd.usdc","model/vnd.usdz+zip"],text:!0,binary:!0,tests:["#usda","PXR-USDC","PK"],options:{usd:{compose:!0,loadReferences:!0,maxReferenceDepth:12,variantSelections:{}}},preload:$F}});var Zx,eT=p(()=>{"use strict";Zx={name:"OBJ",id:"obj",module:"scene",encoding:"text",format:"obj",extensions:["obj"],mimeTypes:["text/plain"]}});var Wu=p(()=>{});function rT(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t}function F(r,e,t,n){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(l){try{u(n.next(l))}catch(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}function u(l){l.done?i(l.value):s(l.value).then(a,c)}u((n=n.apply(r,e||[])).next())})}function tT(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(r){return this instanceof Y?(this.v=r,this):new Y(r)}function _t(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(h){return function(m){return Promise.resolve(m).then(h,f)}}function a(h,m){n[h]&&(s[h]=function(b){return new Promise(function(g,y){i.push([h,b,g,y])>1||c(h,b)})},m&&(s[h]=m(s[h])))}function c(h,m){try{u(n[h](m))}catch(b){d(i[0][3],b)}}function u(h){h.value instanceof Y?Promise.resolve(h.value.v).then(l,f):d(i[0][2],h)}function l(h){c("next",h)}function f(h){c("throw",h)}function d(h,m){h(m),i.shift(),i.length&&c(i[0][0],i[0][1])}}function Bo(r){var e,t;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=r[s]?function(o){return(t=!t)?{value:Y(r[s](o)),done:!1}:i?i(o):o}:i}}function Xt(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof tT=="function"?tT(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=r[i]&&function(o){return new Promise(function(a,c){o=r[i](o),s(a,c,o.done,o.value)})}}function s(i,o,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},o)}}var kt=p(()=>{});var nT,Fo,qF,Jt,wn=p(()=>{nT=new TextDecoder("utf-8"),Fo=nT.decode.bind(nT),qF=new TextEncoder,Jt=r=>qF.encode(r)});var KF,sT,qe,At,Yt,Fr,br,$u,qu,Ku,Hu,Xu,iT,qa,oT,Ju,aT,es=p(()=>{KF=r=>typeof r=="number",sT=r=>typeof r=="boolean",qe=r=>typeof r=="function",At=r=>r!=null&&Object(r)===r,Yt=r=>At(r)&&qe(r.then),Fr=r=>At(r)&&qe(r[Symbol.iterator]),br=r=>At(r)&&qe(r[Symbol.asyncIterator]),$u=r=>At(r)&&At(r.schema),qu=r=>At(r)&&"done"in r&&"value"in r,Ku=r=>At(r)&&qe(r.stat)&&KF(r.fd),Hu=r=>At(r)&&qa(r.body),Xu=r=>"_getDOMStream"in r&&"_getNodeStream"in r,iT=r=>At(r)&&qe(r.abort)&&qe(r.getWriter)&&!Xu(r),qa=r=>At(r)&&qe(r.cancel)&&qe(r.getReader)&&!Xu(r),oT=r=>At(r)&&qe(r.end)&&qe(r.write)&&sT(r.writable)&&!Xu(r),Ju=r=>At(r)&&qe(r.read)&&qe(r.pipe)&&sT(r.readable)&&!Xu(r),aT=r=>At(r)&&qe(r.clear)&&qe(r.bytes)&&qe(r.position)&&qe(r.setPosition)&&qe(r.capacity)&&qe(r.getBufferIdentifier)&&qe(r.createLong)});var Oh={};J(Oh,{compareArrayLike:()=>Fh,joinUint8Arrays:()=>Qt,memcpy:()=>Ka,rebaseValueOffsets:()=>Yu,toArrayBufferView:()=>ee,toArrayBufferViewAsyncIterator:()=>Or,toArrayBufferViewIterator:()=>Jr,toBigInt64Array:()=>Ha,toBigUint64Array:()=>ZF,toFloat32Array:()=>eO,toFloat32ArrayAsyncIterator:()=>bO,toFloat32ArrayIterator:()=>cO,toFloat64Array:()=>tO,toFloat64ArrayAsyncIterator:()=>gO,toFloat64ArrayIterator:()=>uO,toInt16Array:()=>JF,toInt16ArrayAsyncIterator:()=>dO,toInt16ArrayIterator:()=>sO,toInt32Array:()=>pi,toInt32ArrayAsyncIterator:()=>hO,toInt32ArrayIterator:()=>iO,toInt8Array:()=>XF,toInt8ArrayAsyncIterator:()=>fO,toInt8ArrayIterator:()=>nO,toUint16Array:()=>YF,toUint16ArrayAsyncIterator:()=>pO,toUint16ArrayIterator:()=>oO,toUint32Array:()=>QF,toUint32ArrayAsyncIterator:()=>mO,toUint32ArrayIterator:()=>aO,toUint8Array:()=>k,toUint8ArrayAsyncIterator:()=>Bh,toUint8ArrayIterator:()=>Lh,toUint8ClampedArray:()=>rO,toUint8ClampedArrayAsyncIterator:()=>yO,toUint8ClampedArrayIterator:()=>lO});function HF(r){let e=r[0]?[r[0]]:[],t,n,s,i;for(let o,a,c=0,u=0,l=r.length;++c<l;){if(o=e[u],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(e[++u]=a);continue}if({byteOffset:t,byteLength:s}=o,{byteOffset:n,byteLength:i}=a,t+s<n||n+i<t){a&&(e[++u]=a);continue}e[u]=new Uint8Array(o.buffer,t,n-t+i)}return e}function Ka(r,e,t=0,n=e.byteLength){let s=r.byteLength,i=new Uint8Array(r.buffer,r.byteOffset,s),o=new Uint8Array(e.buffer,e.byteOffset,Math.min(n,s));return i.set(o,t),r}function Qt(r,e){let t=HF(r),n=t.reduce((l,f)=>l+f.byteLength,0),s,i,o,a=0,c=-1,u=Math.min(e||Number.POSITIVE_INFINITY,n);for(let l=t.length;++c<l;){if(s=t[c],i=s.subarray(0,Math.min(s.length,u-a)),u<=a+i.length){i.length<s.length?t[c]=s.subarray(i.length):i.length===s.length&&c++,o?Ka(o,i,a):o=i;break}Ka(o||(o=new Uint8Array(u)),i,a),a+=i.length}return[o||new Uint8Array(0),t.slice(c),n-(o?o.byteLength:0)]}function ee(r,e){let t=qu(e)?e.value:e;return t instanceof r?r===Uint8Array?new r(t.buffer,t.byteOffset,t.byteLength):t:t?(typeof t=="string"&&(t=Jt(t)),t instanceof ArrayBuffer?new r(t):t instanceof Eh?new r(t):aT(t)?ee(r,t.bytes()):ArrayBuffer.isView(t)?t.byteLength<=0?new r(0):new r(t.buffer,t.byteOffset,t.byteLength/r.BYTES_PER_ELEMENT):r.from(t)):new r(0)}function*Jr(r,e){let t=function*(s){yield s},n=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Eh?t(e):Fr(e)?e:t(e);return yield*Sh((function*(s){let i=null;do i=s.next(yield ee(r,i));while(!i.done)})(n[Symbol.iterator]())),new r}function Or(r,e){return _t(this,arguments,function*(){if(Yt(e))return yield Y(yield Y(yield*Bo(Xt(Or(r,yield Y(e))))));let n=function(o){return _t(this,arguments,function*(){yield yield Y(yield Y(o))})},s=function(o){return _t(this,arguments,function*(){yield Y(yield*Bo(Xt(Sh((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(o[Symbol.iterator]())))))})},i=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Eh?n(e):Fr(e)?s(e):br(e)?e:n(e);return yield Y(yield*Bo(Xt(Sh((function(o){return _t(this,arguments,function*(){let a=null;do a=yield Y(o.next(yield yield Y(ee(r,a))));while(!a.done)})})(i[Symbol.asyncIterator]()))))),yield Y(new r)})}function Yu(r,e,t){if(r!==0){t=t.slice(0,e);let n=typeof t[0]=="bigint"?BigInt(r):r;for(let s=-1,i=t.length;++s<i;)t[s]+=n}return t.subarray(0,e)}function Fh(r,e){let t=0,n=r.length;if(n!==e.length)return!1;if(n>0)do if(r[t]!==e[t])return!1;while(++t<n);return!0}var Eh,XF,JF,pi,Ha,k,YF,QF,ZF,eO,tO,rO,Sh,nO,sO,iO,Lh,oO,aO,cO,uO,lO,fO,dO,hO,Bh,pO,mO,bO,gO,yO,Ke=p(()=>{kt();wn();es();Eh=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;XF=r=>ee(Int8Array,r),JF=r=>ee(Int16Array,r),pi=r=>ee(Int32Array,r),Ha=r=>ee(BigInt64Array,r),k=r=>ee(Uint8Array,r),YF=r=>ee(Uint16Array,r),QF=r=>ee(Uint32Array,r),ZF=r=>ee(BigUint64Array,r),eO=r=>ee(Float32Array,r),tO=r=>ee(Float64Array,r),rO=r=>ee(Uint8ClampedArray,r),Sh=r=>(r.next(),r);nO=r=>Jr(Int8Array,r),sO=r=>Jr(Int16Array,r),iO=r=>Jr(Int32Array,r),Lh=r=>Jr(Uint8Array,r),oO=r=>Jr(Uint16Array,r),aO=r=>Jr(Uint32Array,r),cO=r=>Jr(Float32Array,r),uO=r=>Jr(Float64Array,r),lO=r=>Jr(Uint8ClampedArray,r);fO=r=>Or(Int8Array,r),dO=r=>Or(Int16Array,r),hO=r=>Or(Int32Array,r),Bh=r=>Or(Uint8Array,r),pO=r=>Or(Uint16Array,r),mO=r=>Or(Uint32Array,r),bO=r=>Or(Float32Array,r),gO=r=>Or(Float64Array,r),yO=r=>Or(Uint8ClampedArray,r)});function*wO(r){let e,t=!1,n=[],s,i,o,a=0;function c(){return i==="peek"?Qt(n,o)[0]:([s,n,a]=Qt(n,o),s)}({cmd:i,size:o}=(yield null)||{cmd:"read",size:0});let u=Lh(r)[Symbol.iterator]();try{do if({done:e,value:s}=Number.isNaN(o-a)?u.next():u.next(o-a),!e&&s.byteLength>0&&(n.push(s),a+=s.byteLength),e||o<=a)do({cmd:i,size:o}=yield c());while(o<a);while(!e)}catch(l){t=!0,typeof u.throw=="function"&&u.throw(l)}finally{t===!1&&typeof u.return=="function"&&u.return(null)}return null}function xO(r){return _t(this,arguments,function*(){let t,n=!1,s=[],i,o,a,c=0;function u(){return o==="peek"?Qt(s,a)[0]:([i,s,c]=Qt(s,a),i)}({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0});let l=Bh(r)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(a-c)?yield Y(l.next()):yield Y(l.next(a-c)),!t&&i.byteLength>0&&(s.push(i),c+=i.byteLength),t||a<=c)do({cmd:o,size:a}=yield yield Y(u()));while(a<c);while(!t)}catch(f){n=!0,typeof l.throw=="function"&&(yield Y(l.throw(f)))}finally{n===!1&&typeof l.return=="function"&&(yield Y(l.return(new Uint8Array(0))))}return yield Y(null)})}function TO(r){return _t(this,arguments,function*(){let t=!1,n=!1,s=[],i,o,a,c=0;function u(){return o==="peek"?Qt(s,a)[0]:([i,s,c]=Qt(s,a),i)}({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0});let l=new Dh(r);try{do if({done:t,value:i}=Number.isNaN(a-c)?yield Y(l.read()):yield Y(l.read(a-c)),!t&&i.byteLength>0&&(s.push(k(i)),c+=i.byteLength),t||a<=c)do({cmd:o,size:a}=yield yield Y(u()));while(a<c);while(!t)}catch(f){n=!0,yield Y(l.cancel(f))}finally{n===!1?yield Y(l.cancel()):r.locked&&l.releaseLock()}return yield Y(null)})}function _O(r){return _t(this,arguments,function*(){let t=[],n="error",s=!1,i=null,o,a,c=0,u=[],l;function f(){return o==="peek"?Qt(u,a)[0]:([l,u,c]=Qt(u,a),l)}if({cmd:o,size:a}=(yield yield Y(null))||{cmd:"read",size:0},r.isTTY)return yield yield Y(new Uint8Array(0)),yield Y(null);try{t[0]=Mh(r,"end"),t[1]=Mh(r,"error");do{if(t[2]=Mh(r,"readable"),[n,i]=yield Y(Promise.race(t.map(h=>h[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-c)?(l=k(r.read(a-c)),l.byteLength<a-c&&(l=k(r.read()))):l=k(r.read()),l.byteLength>0&&(u.push(l),c+=l.byteLength)),s||a<=c)do({cmd:o,size:a}=yield yield Y(f()));while(a<c)}while(!s)}finally{yield Y(d(t,n==="error"?i:null))}return yield Y(null);function d(h,m){return l=u=null,new Promise((b,g)=>{for(let[y,x]of h)r.off(y,x);try{let y=r.destroy;y&&y.call(r,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):b()}})}})}var Qe,Qu,Dh,Mh,Xa=p(()=>{kt();Ke();Qe={fromIterable(r){return Qu(wO(r))},fromAsyncIterable(r){return Qu(xO(r))},fromDOMStream(r){return Qu(TO(r))},fromNodeStream(r){return Qu(_O(r))},toDOMStream(r,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,e){throw new Error('"toNodeStream" not available in this environment')}},Qu=r=>(r.next(),r);Dh=class{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return F(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return F(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};let t=yield this.reader.read();return!t.done&&(t.value=k(t)),t})}},Mh=(r,e)=>{let t=s=>n([e,s]),n;return[e,t,new Promise(s=>(n=s)&&r.once(e,t))]}});var ge,Zu=p(()=>{(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(ge||(ge={}))});var he,Rh=p(()=>{(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(he||(he={}))});var le,kh=p(()=>{(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(le||(le={}))});var ye,Nh=p(()=>{(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(ye||(ye={}))});var L,Ja=p(()=>{(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(L||(L={}))});var ae,Ch=p(()=>{(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(ae||(ae={}))});var el=p(()=>{});var Yr,tl,rl,Oo,Uh=p(()=>{Yr=new Int32Array(2),tl=new Float32Array(Yr.buffer),rl=new Float64Array(Yr.buffer),Oo=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var Ya,Ph=p(()=>{(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Ya||(Ya={}))});var Ze,Vh=p(()=>{el();Ph();Uh();Ze=class r{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new r(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Yr[0]=this.readInt32(e),tl[0]}readFloat64(e){return Yr[Oo?0:1]=this.readInt32(e),Yr[Oo?1:0]=this.readInt32(e+4),rl[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){tl[0]=t,this.writeInt32(e,Yr[0])}writeFloat64(e,t){rl[0]=t,this.writeInt32(e,Yr[Oo?0:1]),this.writeInt32(e+4,Yr[Oo?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let s=this.bytes_.subarray(e,e+n);return t===Ya.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let s=0;s<t;++s){let i=e(s);i!==null&&n.push(i)}return n}createObjList(e,t){let n=[];for(let s=0;s<t;++s){let i=e(s);i!==null&&n.push(i.unpack())}return n}}});var mi,cT=p(()=>{Vh();el();mi=class r{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;e?t=e:t=1024,this.bb=Ze.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);let n=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<n+e+t;){let s=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(n)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=t<<1,s=Ze.allocate(n);return s.setPosition(n-t),s.bytes().set(e.bytes(),n-t),s}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);let s=2;this.addInt16(e-this.object_start);let i=(n+s)*2;this.addInt16(i);let o=0,a=this.space;e:for(t=0;t<this.vtables.length;t++){let c=this.bb.capacity()-this.vtables[t];if(i==this.bb.readInt16(c)){for(let u=2;u<i;u+=2)if(this.bb.readInt16(a+u)!=this.bb.readInt16(c+u))continue e;o=this.vtables[t];break}}return o?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,o-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let s=n?4:0;if(t){let i=t;if(this.prep(this.minalign,8+s),i.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=3;o>=0;o--)this.writeInt8(i.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(e),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,s=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(s)&&this.bb.readInt16(s+t)!=0))throw new TypeError("FlatBuffers: field "+t+" must be set")}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return e instanceof Uint8Array?t=e:t=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let s=e[n];if(s!==null)t.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}}});var ce=p(()=>{el();Uh();cT();Vh();Ph()});var bi,jh=p(()=>{(function(r){r[r.BUFFER=0]="BUFFER"})(bi||(bi={}))});var et,Mo=p(()=>{(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(et||(et={}))});var xn,Gh=p(()=>{ce();jh();Mo();xn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):et.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):bi.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,et.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,bi.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,t,n){return r.startBodyCompression(e),r.addCodec(e,t),r.addMethod(e,n),r.endBodyCompression(e)}}});var Do,zh=p(()=>{Do=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}}});var Ro,Wh=p(()=>{Ro=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}}});var ot,$h=p(()=>{ce();Gh();zh();Wh();ot=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ro).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Do).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}buffersLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){let t=this.bb.__offset(this.bb_pos,10);return t?(e||new xn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}variadicBufferCounts(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}variadicBufferCountsLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startRecordBatch(e){e.startObject(5)}static addLength(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static addVariadicBufferCounts(e,t){e.addFieldOffset(4,t,0)}static createVariadicBufferCountsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startVariadicBufferCountsVector(e,t){e.startVector(8,t,8)}static endRecordBatch(e){return e.endObject()}}});var Tn,uT=p(()=>{ce();$h();Tn=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new ot).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}}});var ts,qh=p(()=>{(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(ts||(ts={}))});var Qa,lT=p(()=>{(function(r){r[r.DenseArray=0]="DenseArray"})(Qa||(Qa={}))});var Dr,sl=p(()=>{ce();Dr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(e,t,n){return r.startInt(e),r.addBitWidth(e,t),r.addIsSigned(e,n),r.endInt(e)}}});var Qr,Kh=p(()=>{ce();lT();sl();Qr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Dr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):Qa.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,Qa.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}}});var Me,ko=p(()=>{ce();Me=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(e,t,n){return r.startKeyValue(e),r.addKey(e,t),r.addValue(e,n),r.endKeyValue(e)}}});var Za,fT=p(()=>{ce();Za=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return r.startBinary(e),r.endBinary(e)}}});var ec,dT=p(()=>{ce();ec=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinaryView(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinaryView(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startBinaryView(e){e.startObject(0)}static endBinaryView(e){return e.endObject()}static createBinaryView(e){return r.startBinaryView(e),r.endBinaryView(e)}}});var tc,hT=p(()=>{ce();tc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return r.startBool(e),r.endBool(e)}}});var rs,Hh=p(()=>{ce();Nh();rs=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ye.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ye.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,t){return r.startDate(e),r.addUnit(e,t),r.endDate(e)}}});var Zr,Xh=p(()=>{ce();Zr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(e,t,n,s){return r.startDecimal(e),r.addPrecision(e,t),r.addScale(e,n),r.addBitWidth(e,s),r.endDecimal(e)}}});var ns,Jh=p(()=>{ce();Ja();ns=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDuration(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):L.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,L.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(e,t){return r.startDuration(e),r.addUnit(e,t),r.endDuration(e)}}});var ss,Yh=p(()=>{ce();ss=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(e,t){return r.startFixedSizeBinary(e),r.addByteWidth(e,t),r.endFixedSizeBinary(e)}}});var is,Qh=p(()=>{ce();is=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(e,t){return r.startFixedSizeList(e),r.addListSize(e,t),r.endFixedSizeList(e)}}});var os,Zh=p(()=>{ce();kh();os=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):le.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,le.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,t){return r.startFloatingPoint(e),r.addPrecision(e,t),r.endFloatingPoint(e)}}});var as,ep=p(()=>{ce();Ch();as=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ae.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ae.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,t){return r.startInterval(e),r.addUnit(e,t),r.endInterval(e)}}});var rc,pT=p(()=>{ce();rc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeBinary(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(e){return r.startLargeBinary(e),r.endLargeBinary(e)}}});var nc,mT=p(()=>{ce();nc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeList(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(e){return r.startLargeList(e),r.endLargeList(e)}}});var sc,bT=p(()=>{ce();sc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeUtf8(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(e){return r.startLargeUtf8(e),r.endLargeUtf8(e)}}});var ic,gT=p(()=>{ce();ic=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return r.startList(e),r.endList(e)}}});var cs,tp=p(()=>{ce();cs=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(e,t){return r.startMap(e),r.addKeysSorted(e,t),r.endMap(e)}}});var oc,yT=p(()=>{ce();oc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return r.startNull(e),r.endNull(e)}}});var ac,wT=p(()=>{ce();ac=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return r.startStruct_(e),r.endStruct_(e)}}});var _n,rp=p(()=>{ce();Ja();_n=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):L.MILLISECOND}bitWidth(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,L.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(e,t,n){return r.startTime(e),r.addUnit(e,t),r.addBitWidth(e,n),r.endTime(e)}}});var An,np=p(()=>{ce();Ja();An=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):L.SECOND}timezone(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,L.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,t,n){return r.startTimestamp(e),r.addUnit(e,t),r.addTimezone(e,n),r.endTimestamp(e)}}});var Rr,sp=p(()=>{ce();Rh();Rr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):he.Sparse}typeIds(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,he.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(e,t,n){return r.startUnion(e),r.addMode(e,t),r.addTypeIds(e,n),r.endUnion(e)}}});var cc,xT=p(()=>{ce();cc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return r.startUtf8(e),r.endUtf8(e)}}});var uc,TT=p(()=>{ce();uc=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8View(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8View(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8View(e){e.startObject(0)}static endUtf8View(e){return e.endObject()}static createUtf8View(e){return r.startUtf8View(e),r.endUtf8View(e)}}});var z,il=p(()=>{(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded",r[r.BinaryView=23]="BinaryView",r[r.Utf8View=24]="Utf8View",r[r.ListView=25]="ListView",r[r.LargeListView=26]="LargeListView"})(z||(z={}))});var at,ip=p(()=>{ce();Kh();ko();il();at=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):z.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new Qr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(e,t){let n=this.bb.__offset(this.bb_pos,14);return n?(t||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new Me).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,z.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}}});var Nt,op=p(()=>{ce();qh();ip();ko();Nt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ts.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Me).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,ts.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static createSchema(e,t,n,s,i){return r.startSchema(e),r.addEndianness(e,t),r.addFields(e,n),r.addCustomMetadata(e,s),r.addFeatures(e,i),r.endSchema(e)}}});var se,ol=p(()=>{(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(se||(se={}))});var w,re,De=p(()=>{Zu();Rh();kh();Nh();Ja();Ch();ol();(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.BinaryView=23]="BinaryView",r[r.Utf8View=24]="Utf8View",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond",r[r.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(w||(w={}));(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(re||(re={}))});var ap={};J(ap,{valueToString:()=>kr});function kr(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(e=>kr(e))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(e,t)=>typeof t=="bigint"?`${t}`:t)}var lc=p(()=>{});function te(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function cp(r,e){return te(r/e)+te(r%e)/te(e)}var en=p(()=>{});var fp={};J(fp,{BN:()=>gi,bigNumToBigInt:()=>AT,bigNumToNumber:()=>lp,bigNumToString:()=>Uo,isArrowBigNumSymbol:()=>_T});function Nr(r,...e){return e.length===0?Object.setPrototypeOf(ee(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}function No(...r){return Nr.apply(this,r)}function Co(...r){return Nr.apply(this,r)}function fc(...r){return Nr.apply(this,r)}function lp(r,e){let{buffer:t,byteOffset:n,byteLength:s,signed:i}=r,o=new BigUint64Array(t,n,s/8),a=i&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),u=0;if(a){for(let l of o)c|=(l^vO)*(BigInt(1)<<BigInt(64*u++));c*=BigInt(-1),c-=BigInt(1)}else for(let l of o)c|=l*(BigInt(1)<<BigInt(64*u++));if(typeof e=="number"&&e>0){let l=BigInt("1".padEnd(e+1,"0")),f=c/l,d=a?-(c%l):c%l,h=te(f),m=`${d}`.padStart(e,"0");return+`${a&&h===0?"-":""}${h}.${m}`}return te(c)}function Uo(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return up(r);let e=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return up(r);e=e.slice();let n=1;for(let i=0;i<e.length;i++){let o=e[i],a=~o+n;e[i]=a,n&=o===0?1:0}return`-${up(e)}`}function AT(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Uo(r)}function up(r){let e="",t=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),i=-1,o=n.length-1;do{for(t[0]=n[i=0];i<o;)n[i++]=t[1]=t[0]/10,t[0]=(t[0]-t[1]*10<<16)+n[i];n[i]=t[1]=t[0]/10,t[0]=t[0]-t[1]*10,e=`${t[0]}${e}`}while(s[0]||s[1]||s[2]||s[3]);return e??"0"}var _T,AO,vO,gi,al=p(()=>{Ke();en();_T=Symbol.for("isArrowBigNum");Nr.prototype[_T]=!0;Nr.prototype.toJSON=function(){return`"${Uo(this)}"`};Nr.prototype.valueOf=function(r){return lp(this,r)};Nr.prototype.toString=function(){return Uo(this)};Nr.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return lp(this);case"string":return Uo(this);case"default":return AT(this)}return Uo(this)};Object.setPrototypeOf(No.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Co.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(fc.prototype,Object.create(Uint32Array.prototype));Object.assign(No.prototype,Nr.prototype,{constructor:No,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Co.prototype,Nr.prototype,{constructor:Co,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(fc.prototype,Nr.prototype,{constructor:fc,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});AO=BigInt(4294967296)*BigInt(4294967296),vO=AO-BigInt(1);gi=class r{static new(e,t){switch(t){case!0:return new No(e);case!1:return new Co(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new No(e)}return e.byteLength===16?new fc(e):new Co(e)}static signed(e){return new No(e)}static unsigned(e){return new Co(e)}static decimal(e){return new fc(e)}constructor(e,t){return r.new(e,t)}}});function or(r){let e=r;switch(r.typeId){case w.Decimal:return r.bitWidth/32;case w.Interval:return e.unit===ae.MONTH_DAY_NANO?4:1+e.unit;case w.BinaryView:case w.Utf8View:return 16;case w.FixedSizeList:return e.listSize;case w.FixedSizeBinary:return e.byteWidth;default:return 1}}var vT,IT,ST,ET,LT,BT,FT,OT,MT,DT,RT,kT,NT,CT,UT,PT,VT,jT,GT,zT,WT,$T,qT,KT,HT,XT,E,Ce,Oe,Zt,er,Pe,tr,rr,nr,vt,Cr,ct,Ur,It,sr,Ct,Z,Pr,ut,St,Vr,lt,Ut,Et,us,ls,tt,fs,ds,hs,ps,rt,ms,tn,bs,gs,ft,ys,ws,dc,Lt,hc,pc,mc,bc,je,ir,pe,Bt,vn,xs,Pt,Fe,dt,IO,Ge,we=p(()=>{en();De();XT=Symbol.for("apache-arrow/DataType"),E=class r{static isDataType(e){return e?.[XT]===!0}static isNull(e){return e?.typeId===w.Null}static isInt(e){return e?.typeId===w.Int}static isFloat(e){return e?.typeId===w.Float}static isBinary(e){return e?.typeId===w.Binary}static isBinaryView(e){return e?.typeId===w.BinaryView}static isLargeBinary(e){return e?.typeId===w.LargeBinary}static isUtf8(e){return e?.typeId===w.Utf8}static isUtf8View(e){return e?.typeId===w.Utf8View}static isLargeUtf8(e){return e?.typeId===w.LargeUtf8}static isBool(e){return e?.typeId===w.Bool}static isDecimal(e){return e?.typeId===w.Decimal}static isDate(e){return e?.typeId===w.Date}static isTime(e){return e?.typeId===w.Time}static isTimestamp(e){return e?.typeId===w.Timestamp}static isInterval(e){return e?.typeId===w.Interval}static isDuration(e){return e?.typeId===w.Duration}static isList(e){return e?.typeId===w.List}static isLargeList(e){return e?.typeId===w.LargeList}static isStruct(e){return e?.typeId===w.Struct}static isUnion(e){return e?.typeId===w.Union}static isFixedSizeBinary(e){return e?.typeId===w.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===w.FixedSizeList}static isMap(e){return e?.typeId===w.Map}static isDictionary(e){return e?.typeId===w.Dictionary}static isDenseUnion(e){return r.isUnion(e)&&e.mode===he.Dense}static isSparseUnion(e){return r.isUnion(e)&&e.mode===he.Sparse}constructor(e){this.typeId=e}};vT=Symbol.toStringTag;E[vT]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[XT]=!0,r[Symbol.toStringTag]="DataType"))(E.prototype);Ce=class extends E{constructor(){super(w.Null)}toString(){return"Null"}};IT=Symbol.toStringTag;Ce[IT]=(r=>r[Symbol.toStringTag]="Null")(Ce.prototype);Oe=class extends E{constructor(e,t){super(w.Int),this.isSigned=e,this.bitWidth=t}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};ST=Symbol.toStringTag;Oe[ST]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Oe.prototype);Zt=class extends Oe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},er=class extends Oe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Pe=class extends Oe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},tr=class extends Oe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},rr=class extends Oe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},nr=class extends Oe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},vt=class extends Oe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Cr=class extends Oe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Zt.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(er.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Pe.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(tr.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(rr.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(nr.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(vt.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Cr.prototype,"ArrayType",{value:BigUint64Array});ct=class extends E{constructor(e){super(w.Float),this.precision=e}get ArrayType(){switch(this.precision){case le.HALF:return Uint16Array;case le.SINGLE:return Float32Array;case le.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};ET=Symbol.toStringTag;ct[ET]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ct.prototype);Ur=class extends ct{constructor(){super(le.HALF)}},It=class extends ct{constructor(){super(le.SINGLE)}},sr=class extends ct{constructor(){super(le.DOUBLE)}};Object.defineProperty(Ur.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(It.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(sr.prototype,"ArrayType",{value:Float64Array});Ct=class extends E{constructor(){super(w.Binary)}toString(){return"Binary"}};LT=Symbol.toStringTag;Ct[LT]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Ct.prototype);Z=class extends E{constructor(){super(w.BinaryView)}toString(){return"BinaryView"}};BT=Symbol.toStringTag;Z.ELEMENT_WIDTH=16;Z.INLINE_CAPACITY=12;Z.LENGTH_OFFSET=0;Z.INLINE_OFFSET=4;Z.BUFFER_INDEX_OFFSET=8;Z.BUFFER_OFFSET_OFFSET=12;Z[BT]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="BinaryView"))(Z.prototype);Pr=class extends E{constructor(){super(w.LargeBinary)}toString(){return"LargeBinary"}};FT=Symbol.toStringTag;Pr[FT]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Pr.prototype);ut=class extends E{constructor(){super(w.Utf8)}toString(){return"Utf8"}};OT=Symbol.toStringTag;ut[OT]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(ut.prototype);St=class extends E{constructor(){super(w.Utf8View)}toString(){return"Utf8View"}};MT=Symbol.toStringTag;St.ELEMENT_WIDTH=Z.ELEMENT_WIDTH;St.INLINE_CAPACITY=Z.INLINE_CAPACITY;St[MT]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8View"))(St.prototype);Vr=class extends E{constructor(){super(w.LargeUtf8)}toString(){return"LargeUtf8"}};DT=Symbol.toStringTag;Vr[DT]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Vr.prototype);lt=class extends E{constructor(){super(w.Bool)}toString(){return"Bool"}};RT=Symbol.toStringTag;lt[RT]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(lt.prototype);Ut=class extends E{constructor(e,t,n=128){super(w.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};kT=Symbol.toStringTag;Ut[kT]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Ut.prototype);Et=class extends E{constructor(e){super(w.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${ye[this.unit]}>`}get ArrayType(){return this.unit===ye.DAY?Int32Array:BigInt64Array}};NT=Symbol.toStringTag;Et[NT]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Et.prototype);us=class extends Et{constructor(){super(ye.DAY)}},ls=class extends Et{constructor(){super(ye.MILLISECOND)}},tt=class extends E{constructor(e,t){super(w.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${L[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};CT=Symbol.toStringTag;tt[CT]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(tt.prototype);fs=class extends tt{constructor(){super(L.SECOND,32)}},ds=class extends tt{constructor(){super(L.MILLISECOND,32)}},hs=class extends tt{constructor(){super(L.MICROSECOND,64)}},ps=class extends tt{constructor(){super(L.NANOSECOND,64)}},rt=class extends E{constructor(e,t){super(w.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${L[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};UT=Symbol.toStringTag;rt[UT]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(rt.prototype);ms=class extends rt{constructor(e){super(L.SECOND,e)}},tn=class extends rt{constructor(e){super(L.MILLISECOND,e)}},bs=class extends rt{constructor(e){super(L.MICROSECOND,e)}},gs=class extends rt{constructor(e){super(L.NANOSECOND,e)}},ft=class extends E{constructor(e){super(w.Interval),this.unit=e}toString(){return`Interval<${ae[this.unit]}>`}};PT=Symbol.toStringTag;ft[PT]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(ft.prototype);ys=class extends ft{constructor(){super(ae.DAY_TIME)}},ws=class extends ft{constructor(){super(ae.YEAR_MONTH)}},dc=class extends ft{constructor(){super(ae.MONTH_DAY_NANO)}},Lt=class extends E{constructor(e){super(w.Duration),this.unit=e}toString(){return`Duration<${L[this.unit]}>`}};VT=Symbol.toStringTag;Lt[VT]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Lt.prototype);hc=class extends Lt{constructor(){super(L.SECOND)}},pc=class extends Lt{constructor(){super(L.MILLISECOND)}},mc=class extends Lt{constructor(){super(L.MICROSECOND)}},bc=class extends Lt{constructor(){super(L.NANOSECOND)}},je=class extends E{constructor(e){super(w.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};jT=Symbol.toStringTag;je[jT]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(je.prototype);ir=class extends E{constructor(e){super(w.LargeList),this.children=[e]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};GT=Symbol.toStringTag;ir[GT]=(r=>(r.children=null,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeList"))(ir.prototype);pe=class extends E{constructor(e){super(w.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};zT=Symbol.toStringTag;pe[zT]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(pe.prototype);Bt=class extends E{constructor(e,t,n){super(w.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((s,i,o)=>(s[i]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}};WT=Symbol.toStringTag;Bt[WT]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Bt.prototype);vn=class extends Bt{constructor(e,t){super(he.Dense,e,t)}},xs=class extends Bt{constructor(e,t){super(he.Sparse,e,t)}},Pt=class extends E{constructor(e){super(w.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};$T=Symbol.toStringTag;Pt[$T]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Pt.prototype);Fe=class extends E{constructor(e,t){super(w.FixedSizeList),this.listSize=e,this.children=[t]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};qT=Symbol.toStringTag;Fe[qT]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Fe.prototype);dt=class extends E{constructor(e,t=!1){var n,s,i;if(super(w.Map),this.children=[e],this.keysSorted=t,e&&(e.name="entries",!((n=e?.type)===null||n===void 0)&&n.children)){let o=(s=e?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(i=e?.type)===null||i===void 0?void 0:i.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};KT=Symbol.toStringTag;dt[KT]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(dt.prototype);IO=(r=>()=>++r)(-1),Ge=class extends E{constructor(e,t,n,s){super(w.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=s||!1,this.id=n==null?IO():te(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};HT=Symbol.toStringTag;Ge[HT]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ge.prototype)});function SO(r,e,t=!0){return typeof e=="number"?Po(r,e,t):typeof e=="string"&&e in w?Po(r,w[e],t):e&&e instanceof E?Po(r,YT(e),t):e?.type&&e.type instanceof E?Po(r,YT(e.type),t):Po(r,w.NONE,t)}function Po(r,e,t=!0){let n=null;switch(e){case w.Null:n=r.visitNull;break;case w.Bool:n=r.visitBool;break;case w.Int:n=r.visitInt;break;case w.Int8:n=r.visitInt8||r.visitInt;break;case w.Int16:n=r.visitInt16||r.visitInt;break;case w.Int32:n=r.visitInt32||r.visitInt;break;case w.Int64:n=r.visitInt64||r.visitInt;break;case w.Uint8:n=r.visitUint8||r.visitInt;break;case w.Uint16:n=r.visitUint16||r.visitInt;break;case w.Uint32:n=r.visitUint32||r.visitInt;break;case w.Uint64:n=r.visitUint64||r.visitInt;break;case w.Float:n=r.visitFloat;break;case w.Float16:n=r.visitFloat16||r.visitFloat;break;case w.Float32:n=r.visitFloat32||r.visitFloat;break;case w.Float64:n=r.visitFloat64||r.visitFloat;break;case w.Utf8:n=r.visitUtf8;break;case w.LargeUtf8:n=r.visitLargeUtf8;break;case w.Utf8View:n=r.visitUtf8View||r.visitUtf8;break;case w.Binary:n=r.visitBinary;break;case w.LargeBinary:n=r.visitLargeBinary;break;case w.BinaryView:n=r.visitBinaryView||r.visitBinary;break;case w.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case w.Date:n=r.visitDate;break;case w.DateDay:n=r.visitDateDay||r.visitDate;break;case w.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case w.Timestamp:n=r.visitTimestamp;break;case w.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case w.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case w.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case w.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case w.Time:n=r.visitTime;break;case w.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case w.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case w.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case w.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case w.Decimal:n=r.visitDecimal;break;case w.List:n=r.visitList;break;case w.LargeList:n=r.visitLargeList;break;case w.Struct:n=r.visitStruct;break;case w.Union:n=r.visitUnion;break;case w.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case w.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case w.Dictionary:n=r.visitDictionary;break;case w.Interval:n=r.visitInterval;break;case w.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case w.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case w.IntervalMonthDayNano:n=r.visitIntervalMonthDayNano||r.visitInterval;break;case w.Duration:n=r.visitDuration;break;case w.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case w.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case w.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case w.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case w.FixedSizeList:n=r.visitFixedSizeList;break;case w.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!t)return()=>null;throw new Error(`Unrecognized type '${w[e]}'`)}function YT(r){switch(r.typeId){case w.Null:return w.Null;case w.Int:{let{bitWidth:e,isSigned:t}=r;switch(e){case 8:return t?w.Int8:w.Uint8;case 16:return t?w.Int16:w.Uint16;case 32:return t?w.Int32:w.Uint32;case 64:return t?w.Int64:w.Uint64}return w.Int}case w.Float:switch(r.precision){case le.HALF:return w.Float16;case le.SINGLE:return w.Float32;case le.DOUBLE:return w.Float64}return w.Float;case w.Binary:return w.Binary;case w.LargeBinary:return w.LargeBinary;case w.BinaryView:return w.BinaryView;case w.Utf8:return w.Utf8;case w.LargeUtf8:return w.LargeUtf8;case w.Utf8View:return w.Utf8View;case w.Bool:return w.Bool;case w.Decimal:return w.Decimal;case w.Time:switch(r.unit){case L.SECOND:return w.TimeSecond;case L.MILLISECOND:return w.TimeMillisecond;case L.MICROSECOND:return w.TimeMicrosecond;case L.NANOSECOND:return w.TimeNanosecond}return w.Time;case w.Timestamp:switch(r.unit){case L.SECOND:return w.TimestampSecond;case L.MILLISECOND:return w.TimestampMillisecond;case L.MICROSECOND:return w.TimestampMicrosecond;case L.NANOSECOND:return w.TimestampNanosecond}return w.Timestamp;case w.Date:switch(r.unit){case ye.DAY:return w.DateDay;case ye.MILLISECOND:return w.DateMillisecond}return w.Date;case w.Interval:switch(r.unit){case ae.DAY_TIME:return w.IntervalDayTime;case ae.YEAR_MONTH:return w.IntervalYearMonth;case ae.MONTH_DAY_NANO:return w.IntervalMonthDayNano}return w.Interval;case w.Duration:switch(r.unit){case L.SECOND:return w.DurationSecond;case L.MILLISECOND:return w.DurationMillisecond;case L.MICROSECOND:return w.DurationMicrosecond;case L.NANOSECOND:return w.DurationNanosecond}return w.Duration;case w.Map:return w.Map;case w.List:return w.List;case w.LargeList:return w.LargeList;case w.Struct:return w.Struct;case w.Union:switch(r.mode){case he.Dense:return w.DenseUnion;case he.Sparse:return w.SparseUnion}return w.Union;case w.FixedSizeBinary:return w.FixedSizeBinary;case w.FixedSizeList:return w.FixedSizeList;case w.Dictionary:return w.Dictionary}throw new Error(`Unrecognized type '${w[r.typeId]}'`)}var R,Vt=p(()=>{De();we();R=class{visitMany(e,...t){return e.map((n,s)=>this.visit(n,...t.map(i=>i[s])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return SO(this,e,t)}getVisitFnByTypeId(e,t=!0){return Po(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitUtf8View(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitBinaryView(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitLargeList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};R.prototype.visitInt8=null;R.prototype.visitInt16=null;R.prototype.visitInt32=null;R.prototype.visitInt64=null;R.prototype.visitUint8=null;R.prototype.visitUint16=null;R.prototype.visitUint32=null;R.prototype.visitUint64=null;R.prototype.visitFloat16=null;R.prototype.visitFloat32=null;R.prototype.visitFloat64=null;R.prototype.visitDateDay=null;R.prototype.visitDateMillisecond=null;R.prototype.visitTimestampSecond=null;R.prototype.visitTimestampMillisecond=null;R.prototype.visitTimestampMicrosecond=null;R.prototype.visitTimestampNanosecond=null;R.prototype.visitTimeSecond=null;R.prototype.visitTimeMillisecond=null;R.prototype.visitTimeMicrosecond=null;R.prototype.visitTimeNanosecond=null;R.prototype.visitDenseUnion=null;R.prototype.visitSparseUnion=null;R.prototype.visitIntervalDayTime=null;R.prototype.visitIntervalYearMonth=null;R.prototype.visitIntervalMonthDayNano=null;R.prototype.visitDuration=null;R.prototype.visitDurationSecond=null;R.prototype.visitDurationMillisecond=null;R.prototype.visitDurationMicrosecond=null;R.prototype.visitDurationNanosecond=null});var dp={};J(dp,{float64ToUint16:()=>gc,uint16ToFloat64:()=>cl});function cl(r){let e=(r&31744)>>10,t=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(e){case 31:return n*(t?Number.NaN:1/0);case 0:return n*(t?6103515625e-14*t:0)}return n*Math.pow(2,e-15)*(1+t)}function gc(r){if(r!==r)return 32256;QT[0]=r;let e=(Vo[1]&2147483648)>>16&65535,t=Vo[1]&2146435072,n=0;return t>=1089470464?Vo[0]>0?t=31744:(t=(t&2080374784)>>16,n=(Vo[1]&1048575)>>10):t<=1056964608?(n=1048576+(Vo[1]&1048575),n=1048576+(n<<(t>>20)-998)>>21,t=0):(t=t-1056964608>>10,n=(Vo[1]&1048575)+512>>10),e|t|n&65535}var QT,Vo,yc=p(()=>{QT=new Float64Array(1),Vo=new Uint32Array(QT.buffer)});function q(r){return(e,t,n)=>{if(e.setValid(t,n!=null))return r(e,t,n)}}var j,EO,ZT,LO,In,hp,e0,BO,ul,ll,pp,t0,FO,r0,OO,n0,MO,mp,fl,dl,hl,pl,bp,ml,bl,gl,yl,gp,yp,s0,DO,RO,kO,NO,CO,UO,PO,i0,o0,VO,wp,wl,xl,Tl,_l,Al,vl,Il,xp,jO,nt,ar=p(()=>{ht();Vt();en();wn();yc();De();we();j=class extends R{};EO=(r,e,t)=>{r[e]=Math.floor(t/864e5)},ZT=(r,e,t,n)=>{if(t+1<e.length){let s=te(e[t]),i=te(e[t+1]);r.set(n.subarray(0,i-s),s)}},LO=({offset:r,values:e},t,n)=>{let s=r+t;n?e[s>>3]|=1<<s%8:e[s>>3]&=~(1<<s%8)},In=({values:r},e,t)=>{r[e]=t},hp=({values:r},e,t)=>{r[e]=t},e0=({values:r},e,t)=>{r[e]=gc(t)},BO=(r,e,t)=>{switch(r.type.precision){case le.HALF:return e0(r,e,t);case le.SINGLE:case le.DOUBLE:return hp(r,e,t)}},ul=({values:r},e,t)=>{EO(r,e,t.valueOf())},ll=({values:r},e,t)=>{r[e]=BigInt(t)},pp=({stride:r,values:e},t,n)=>{e.set(n.subarray(0,r),r*t)},t0=({values:r,valueOffsets:e},t,n)=>ZT(r,e,t,n),FO=r=>{let e=r.variadicBuffers;return(!Array.isArray(e)||Object.isFrozen(e))&&(e=Array.from(e),r.variadicBuffers=e),e},r0=(r,e,t)=>{var n,s,i,o;let a=r.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=Z.ELEMENT_WIDTH,u=e*c,l=u+c;if(u<0||l>a.length)throw new RangeError(`BinaryView index ${e} out of bounds`);a.fill(0,u,l);let f=new DataView(a.buffer,a.byteOffset+u,c),d=t.length;if(f.setInt32(Z.LENGTH_OFFSET,d,!0),d<=Z.INLINE_CAPACITY){a.set(t,u+Z.INLINE_OFFSET);return}let h=((n=t[0])!==null&&n!==void 0?n:0)|((s=t[1])!==null&&s!==void 0?s:0)<<8|((i=t[2])!==null&&i!==void 0?i:0)<<16|((o=t[3])!==null&&o!==void 0?o:0)<<24;f.setUint32(Z.INLINE_OFFSET,h>>>0,!0);let m=FO(r),b=t.slice(),g=m.push(b)-1;f.setInt32(Z.BUFFER_INDEX_OFFSET,g,!0),f.setInt32(Z.BUFFER_OFFSET_OFFSET,0,!0)},OO=(r,e,t)=>{let n=t instanceof Uint8Array?t:new Uint8Array(t);r0(r,e,n)},n0=({values:r,valueOffsets:e},t,n)=>ZT(r,e,t,Jt(n)),MO=(r,e,t)=>{let n=Jt(t);r0(r,e,n)},mp=(r,e,t)=>{r.type.unit===ye.DAY?ul(r,e,t):ll(r,e,t)},fl=({values:r},e,t)=>{r[e]=BigInt(t/1e3)},dl=({values:r},e,t)=>{r[e]=BigInt(t)},hl=({values:r},e,t)=>{r[e]=BigInt(t*1e3)},pl=({values:r},e,t)=>{r[e]=BigInt(t*1e6)},bp=(r,e,t)=>{switch(r.type.unit){case L.SECOND:return fl(r,e,t);case L.MILLISECOND:return dl(r,e,t);case L.MICROSECOND:return hl(r,e,t);case L.NANOSECOND:return pl(r,e,t)}},ml=({values:r},e,t)=>{r[e]=t},bl=({values:r},e,t)=>{r[e]=t},gl=({values:r},e,t)=>{r[e]=t},yl=({values:r},e,t)=>{r[e]=t},gp=(r,e,t)=>{switch(r.type.unit){case L.SECOND:return ml(r,e,t);case L.MILLISECOND:return bl(r,e,t);case L.MICROSECOND:return gl(r,e,t);case L.NANOSECOND:return yl(r,e,t)}},yp=({values:r,stride:e},t,n)=>{r.set(n.subarray(0,e),e*t)},s0=(r,e,t)=>{let n=r.children[0],s=r.valueOffsets,i=nt.getVisitFn(n),o=te(s[e]),a=te(s[e+1]);if(Array.isArray(t))for(let c=-1,u=o;u<a;)i(n,u++,t[++c]);else for(let c=-1,u=o;u<a;)i(n,u++,t.get(++c))},DO=(r,e,t)=>{let n=r.children[0],{valueOffsets:s}=r,i=nt.getVisitFn(n),{[e]:o,[e+1]:a}=s,c=t instanceof Map?t.entries():Object.entries(t);for(let u of c)if(i(n,o,u),++o>=a)break},RO=(r,e)=>(t,n,s,i)=>n&&t(n,r,e[i]),kO=(r,e)=>(t,n,s,i)=>n&&t(n,r,e.get(i)),NO=(r,e)=>(t,n,s,i)=>n&&t(n,r,e.get(s.name)),CO=(r,e)=>(t,n,s,i)=>n&&t(n,r,e[s.name]),UO=(r,e,t)=>{let n=r.type.children.map(i=>nt.getVisitFn(i.type)),s=t instanceof Map?NO(e,t):t instanceof B?kO(e,t):Array.isArray(t)?RO(e,t):CO(e,t);r.type.children.forEach((i,o)=>s(n[o],r.children[o],i,o))},PO=(r,e,t)=>{r.type.mode===he.Dense?i0(r,e,t):o0(r,e,t)},i0=(r,e,t)=>{let n=r.type.typeIdToChildIndex[r.typeIds[e]],s=r.children[n];nt.visit(s,r.valueOffsets[e],t)},o0=(r,e,t)=>{let n=r.type.typeIdToChildIndex[r.typeIds[e]],s=r.children[n];nt.visit(s,e,t)},VO=(r,e,t)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[e],t)},wp=(r,e,t)=>{switch(r.type.unit){case ae.YEAR_MONTH:return xl(r,e,t);case ae.DAY_TIME:return wl(r,e,t);case ae.MONTH_DAY_NANO:return Tl(r,e,t)}},wl=({values:r},e,t)=>{r.set(t.subarray(0,2),2*e)},xl=({values:r},e,t)=>{r[e]=t[0]*12+t[1]%12},Tl=({values:r,stride:e},t,n)=>{r.set(n.subarray(0,e),e*t)},_l=({values:r},e,t)=>{r[e]=t},Al=({values:r},e,t)=>{r[e]=t},vl=({values:r},e,t)=>{r[e]=t},Il=({values:r},e,t)=>{r[e]=t},xp=(r,e,t)=>{switch(r.type.unit){case L.SECOND:return _l(r,e,t);case L.MILLISECOND:return Al(r,e,t);case L.MICROSECOND:return vl(r,e,t);case L.NANOSECOND:return Il(r,e,t)}},jO=(r,e,t)=>{let{stride:n}=r,s=r.children[0],i=nt.getVisitFn(s);if(Array.isArray(t))for(let o=-1,a=e*n;++o<n;)i(s,a+o,t[o]);else for(let o=-1,a=e*n;++o<n;)i(s,a+o,t.get(o))};j.prototype.visitBool=q(LO);j.prototype.visitInt=q(In);j.prototype.visitInt8=q(In);j.prototype.visitInt16=q(In);j.prototype.visitInt32=q(In);j.prototype.visitInt64=q(In);j.prototype.visitUint8=q(In);j.prototype.visitUint16=q(In);j.prototype.visitUint32=q(In);j.prototype.visitUint64=q(In);j.prototype.visitFloat=q(BO);j.prototype.visitFloat16=q(e0);j.prototype.visitFloat32=q(hp);j.prototype.visitFloat64=q(hp);j.prototype.visitUtf8=q(n0);j.prototype.visitLargeUtf8=q(n0);j.prototype.visitUtf8View=q(MO);j.prototype.visitBinary=q(t0);j.prototype.visitLargeBinary=q(t0);j.prototype.visitBinaryView=q(OO);j.prototype.visitFixedSizeBinary=q(pp);j.prototype.visitDate=q(mp);j.prototype.visitDateDay=q(ul);j.prototype.visitDateMillisecond=q(ll);j.prototype.visitTimestamp=q(bp);j.prototype.visitTimestampSecond=q(fl);j.prototype.visitTimestampMillisecond=q(dl);j.prototype.visitTimestampMicrosecond=q(hl);j.prototype.visitTimestampNanosecond=q(pl);j.prototype.visitTime=q(gp);j.prototype.visitTimeSecond=q(ml);j.prototype.visitTimeMillisecond=q(bl);j.prototype.visitTimeMicrosecond=q(gl);j.prototype.visitTimeNanosecond=q(yl);j.prototype.visitDecimal=q(yp);j.prototype.visitList=q(s0);j.prototype.visitLargeList=q(s0);j.prototype.visitStruct=q(UO);j.prototype.visitUnion=q(PO);j.prototype.visitDenseUnion=q(i0);j.prototype.visitSparseUnion=q(o0);j.prototype.visitDictionary=q(VO);j.prototype.visitInterval=q(wp);j.prototype.visitIntervalDayTime=q(wl);j.prototype.visitIntervalYearMonth=q(xl);j.prototype.visitIntervalMonthDayNano=q(Tl);j.prototype.visitDuration=q(xp);j.prototype.visitDurationSecond=q(_l);j.prototype.visitDurationMillisecond=q(Al);j.prototype.visitDurationMicrosecond=q(vl);j.prototype.visitDurationNanosecond=q(Il);j.prototype.visitFixedSizeList=q(jO);j.prototype.visitMap=q(DO);nt=new j});var jr,jo,rn,Tp,_p,GO,Sl=p(()=>{lc();yi();ar();jr=Symbol.for("parent"),jo=Symbol.for("rowIndex"),rn=class{constructor(e,t){return this[jr]=e,this[jo]=t,new Proxy(this,GO)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[jo],t=this[jr],n=t.type.children,s={};for(let i=-1,o=n.length;++i<o;)s[n[i].name]=ze.visit(t.children[i],e);return s}toString(){return`{${[...this].map(([e,t])=>`${kr(e)}: ${kr(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Tp(this[jr],this[jo])}},Tp=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,ze.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(rn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[jr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[jo]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});_p=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[jr].type.children.map(t=>t.name)}has(e,t){return e[jr].type.children.some(n=>n.name===t)}getOwnPropertyDescriptor(e,t){if(e[jr].type.children.some(n=>n.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[jr].type.children.findIndex(s=>s.name===t);if(n!==-1){let s=ze.visit(e[jr].children[n],e[jo]);return Reflect.set(e,t,s),s}}set(e,t,n){let s=e[jr].type.children.findIndex(i=>i.name===t);return s!==-1?(nt.visit(e[jr].children[s],e[jo],n),Reflect.set(e,t,n)):Reflect.has(e,t)||typeof t=="symbol"?Reflect.set(e,t,n):!1}},GO=new _p});function W(r){return(e,t)=>e.getValid(t)?r(e,t):null}var C,zO,Go,WO,$O,a0,qO,c0,u0,Ts,KO,l0,HO,f0,d0,XO,h0,JO,YO,QO,ZO,p0,m0,b0,g0,eM,y0,w0,x0,T0,tM,rM,_0,nM,sM,iM,A0,v0,oM,aM,I0,S0,E0,L0,B0,F0,O0,cM,uM,ze,yi=p(()=>{al();ht();Vt();wc();Sl();en();wn();yc();De();C=class extends R{};zO=(r,e)=>864e5*r[e],Go=16,WO=12,$O=(r,e)=>null,a0=(r,e,t)=>{if(t+1>=e.length)return null;let n=te(e[t]),s=te(e[t+1]);return r.subarray(n,s)},qO=({offset:r,values:e},t)=>{let n=r+t;return(e[n>>3]&1<<n%8)!==0},c0=({values:r},e)=>zO(r,e),u0=({values:r},e)=>te(r[e]),Ts=({stride:r,values:e},t)=>e[r*t],KO=({stride:r,values:e},t)=>cl(e[r*t]),l0=({values:r},e)=>r[e],HO=({stride:r,values:e},t)=>e.subarray(r*t,r*(t+1)),f0=({values:r,valueOffsets:e},t)=>a0(r,e,t),d0=(r,e)=>{var t;let n=r.values;if(!n)throw new Error("BinaryView data is missing view buffer");let s=e*Go,i=s+Go;if(s<0||i>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Go} bytes, got ${Math.max(0,n.length-s)}`);let o=n.subarray(s,i);if(o.length<Go)throw new Error(`BinaryView data buffer is too short: expected ${Go} bytes, got ${o.length}`);let a=new DataView(n.buffer,o.byteOffset,Go),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=WO)return o.subarray(4,4+c);let u=a.getInt32(8,!0),l=a.getInt32(12,!0),f=(t=r.variadicBuffers)===null||t===void 0?void 0:t[u];if(!f)throw new Error(`BinaryView variadic buffer ${u} is missing`);return f.subarray(l,l+c)},XO=(r,e)=>d0(r,e),h0=({values:r,valueOffsets:e},t)=>{let n=a0(r,e,t);return n!==null?Fo(n):null},JO=(r,e)=>{let t=d0(r,e);return Fo(t)},YO=({values:r},e)=>r[e],QO=({type:r,values:e},t)=>r.precision!==le.HALF?e[t]:cl(e[t]),ZO=(r,e)=>r.type.unit===ye.DAY?c0(r,e):u0(r,e),p0=({values:r},e)=>1e3*te(r[e]),m0=({values:r},e)=>te(r[e]),b0=({values:r},e)=>cp(r[e],BigInt(1e3)),g0=({values:r},e)=>cp(r[e],BigInt(1e6)),eM=(r,e)=>{switch(r.type.unit){case L.SECOND:return p0(r,e);case L.MILLISECOND:return m0(r,e);case L.MICROSECOND:return b0(r,e);case L.NANOSECOND:return g0(r,e)}},y0=({values:r},e)=>r[e],w0=({values:r},e)=>r[e],x0=({values:r},e)=>r[e],T0=({values:r},e)=>r[e],tM=(r,e)=>{switch(r.type.unit){case L.SECOND:return y0(r,e);case L.MILLISECOND:return w0(r,e);case L.MICROSECOND:return x0(r,e);case L.NANOSECOND:return T0(r,e)}},rM=({values:r,stride:e},t)=>gi.decimal(r.subarray(e*t,e*(t+1))),_0=(r,e)=>{let{valueOffsets:t,stride:n,children:s}=r,i=te(t[e*n]),o=te(t[e*n+1]),c=s[0].slice(i,o-i);return new B([c])},nM=(r,e)=>{let{valueOffsets:t,children:n}=r,{[e]:s,[e+1]:i}=t,o=n[0];return new yr(o.slice(s,i-s))},sM=(r,e)=>new rn(r,e),iM=(r,e)=>r.type.mode===he.Dense?A0(r,e):v0(r,e),A0=(r,e)=>{let t=r.type.typeIdToChildIndex[r.typeIds[e]],n=r.children[t];return ze.visit(n,r.valueOffsets[e])},v0=(r,e)=>{let t=r.type.typeIdToChildIndex[r.typeIds[e]],n=r.children[t];return ze.visit(n,e)},oM=(r,e)=>{var t;return(t=r.dictionary)===null||t===void 0?void 0:t.get(r.values[e])},aM=(r,e)=>r.type.unit===ae.MONTH_DAY_NANO?E0(r,e):r.type.unit===ae.DAY_TIME?I0(r,e):S0(r,e),I0=({values:r},e)=>r.subarray(2*e,2*(e+1)),S0=({values:r},e)=>{let t=r[e],n=new Int32Array(2);return n[0]=Math.trunc(t/12),n[1]=Math.trunc(t%12),n},E0=({values:r},e)=>r.subarray(4*e,4*(e+1)),L0=({values:r},e)=>r[e],B0=({values:r},e)=>r[e],F0=({values:r},e)=>r[e],O0=({values:r},e)=>r[e],cM=(r,e)=>{switch(r.type.unit){case L.SECOND:return L0(r,e);case L.MILLISECOND:return B0(r,e);case L.MICROSECOND:return F0(r,e);case L.NANOSECOND:return O0(r,e)}},uM=(r,e)=>{let{stride:t,children:n}=r,i=n[0].slice(e*t,t);return new B([i])};C.prototype.visitNull=W($O);C.prototype.visitBool=W(qO);C.prototype.visitInt=W(YO);C.prototype.visitInt8=W(Ts);C.prototype.visitInt16=W(Ts);C.prototype.visitInt32=W(Ts);C.prototype.visitInt64=W(l0);C.prototype.visitUint8=W(Ts);C.prototype.visitUint16=W(Ts);C.prototype.visitUint32=W(Ts);C.prototype.visitUint64=W(l0);C.prototype.visitFloat=W(QO);C.prototype.visitFloat16=W(KO);C.prototype.visitFloat32=W(Ts);C.prototype.visitFloat64=W(Ts);C.prototype.visitUtf8=W(h0);C.prototype.visitLargeUtf8=W(h0);C.prototype.visitUtf8View=W(JO);C.prototype.visitBinary=W(f0);C.prototype.visitLargeBinary=W(f0);C.prototype.visitBinaryView=W(XO);C.prototype.visitFixedSizeBinary=W(HO);C.prototype.visitDate=W(ZO);C.prototype.visitDateDay=W(c0);C.prototype.visitDateMillisecond=W(u0);C.prototype.visitTimestamp=W(eM);C.prototype.visitTimestampSecond=W(p0);C.prototype.visitTimestampMillisecond=W(m0);C.prototype.visitTimestampMicrosecond=W(b0);C.prototype.visitTimestampNanosecond=W(g0);C.prototype.visitTime=W(tM);C.prototype.visitTimeSecond=W(y0);C.prototype.visitTimeMillisecond=W(w0);C.prototype.visitTimeMicrosecond=W(x0);C.prototype.visitTimeNanosecond=W(T0);C.prototype.visitDecimal=W(rM);C.prototype.visitList=W(_0);C.prototype.visitLargeList=W(_0);C.prototype.visitStruct=W(sM);C.prototype.visitUnion=W(iM);C.prototype.visitDenseUnion=W(A0);C.prototype.visitSparseUnion=W(v0);C.prototype.visitDictionary=W(oM);C.prototype.visitInterval=W(aM);C.prototype.visitIntervalDayTime=W(I0);C.prototype.visitIntervalYearMonth=W(S0);C.prototype.visitIntervalMonthDayNano=W(E0);C.prototype.visitDuration=W(cM);C.prototype.visitDurationSecond=W(L0);C.prototype.visitDurationMillisecond=W(B0);C.prototype.visitDurationMicrosecond=W(F0);C.prototype.visitDurationNanosecond=W(O0);C.prototype.visitFixedSizeList=W(uM);C.prototype.visitMap=W(nM);ze=new C});var _s,Wo,zo,Ap,yr,vp,Ip,wc=p(()=>{ht();lc();yi();ar();_s=Symbol.for("keys"),Wo=Symbol.for("vals"),zo=Symbol.for("kKeysAsStrings"),Ap=Symbol.for("_kKeysAsStrings"),yr=class{constructor(e){return this[_s]=new B([e.children[0]]).memoize(),this[Wo]=e.children[1],new Proxy(this,new Ip)}get[zo](){return this[Ap]||(this[Ap]=Array.from(this[_s].toArray(),String))}[Symbol.iterator](){return new vp(this[_s],this[Wo])}get size(){return this[_s].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[_s],t=this[Wo],n={};for(let s=-1,i=e.length;++s<i;)n[e.get(s)]=ze.visit(t,s);return n}toString(){return`{${[...this].map(([e,t])=>`${kr(e)}: ${kr(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},vp=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),ze.visit(this.vals,e)]})}},Ip=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[zo]}has(e,t){return e[zo].includes(t)}getOwnPropertyDescriptor(e,t){if(e[zo].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[zo].indexOf(t);if(n!==-1){let s=ze.visit(Reflect.get(e,Wo),n);return Reflect.set(e,t,s),s}}set(e,t,n){let s=e[zo].indexOf(t);return s!==-1?(nt.visit(Reflect.get(e,Wo),s,n),Reflect.set(e,t,n)):Reflect.has(e,t)?Reflect.set(e,t,n):!1}};Object.defineProperties(yr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_s]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ap]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var Sp={};J(Sp,{clampRange:()=>xc,createElementComparator:()=>As,wrapIndex:()=>wi});function xc(r,e,t,n){let{length:s=0}=r,i=typeof e!="number"?0:e,o=typeof t!="number"?s:t;return i<0&&(i=(i%s+s)%s),o<0&&(o=(o%s+s)%s),o<i&&(M0=i,i=o,o=M0),o>s&&(o=s),n?n(r,i,o):[i,o]}function As(r){if(typeof r!=="object"||r===null)return D0(r)?D0:t=>t===r;if(r instanceof Date){let t=r.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(r)?t=>t?Fh(r,t):!1:r instanceof Map?fM(r):Array.isArray(r)?lM(r):r instanceof B?dM(r):hM(r,!0)}function lM(r){let e=[];for(let t=-1,n=r.length;++t<n;)e[t]=As(r[t]);return El(e)}function fM(r){let e=-1,t=[];for(let n of r.values())t[++e]=As(n);return El(t)}function dM(r){let e=[];for(let t=-1,n=r.length;++t<n;)e[t]=As(r.get(t));return El(e)}function hM(r,e=!1){let t=Object.keys(r);if(!e&&t.length===0)return()=>!1;let n=[];for(let s=-1,i=t.length;++s<i;)n[s]=As(r[t[s]]);return El(n,t)}function El(r,e){return t=>{if(!t||typeof t!="object")return!1;switch(t.constructor){case Array:return pM(r,t);case Map:return R0(r,t,t.keys());case yr:case rn:case Object:case void 0:return R0(r,t,e||Object.keys(t))}return t instanceof B?mM(r,t):!1}}function pM(r,e){let t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e[n]))return!1;return!0}function mM(r,e){let t=r.length;if(e.length!==t)return!1;for(let n=-1;++n<t;)if(!r[n](e.get(n)))return!1;return!0}function R0(r,e,t){let n=t[Symbol.iterator](),s=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),i=e instanceof Map?e.values():Object.values(e)[Symbol.iterator](),o=0,a=r.length,c=i.next(),u=n.next(),l=s.next();for(;o<a&&!u.done&&!l.done&&!c.done&&!(u.value!==l.value||!r[o](c.value));++o,u=n.next(),l=s.next(),c=i.next());return o===a&&u.done&&l.done&&c.done?!0:(n.return&&n.return(),s.return&&s.return(),i.return&&i.return(),!1)}var M0,wi,D0,$o=p(()=>{ht();wc();Sl();Ke();wi=(r,e)=>r<0?e+r:r,D0=r=>r!==r});var Ep={};J(Ep,{BitIterator:()=>nn,getBit:()=>Bl,getBool:()=>qo,packBools:()=>Ti,popcnt_array:()=>k0,popcnt_bit_range:()=>Tc,popcnt_uint32:()=>Ll,setBool:()=>bM,truncateBitmap:()=>xi});function qo(r,e,t,n){return(t&1<<n)!==0}function Bl(r,e,t,n){return(t&1<<n)>>n}function bM(r,e,t){return t?!!(r[e>>3]|=1<<e%8)||!0:!(r[e>>3]&=~(1<<e%8))&&!1}function xi(r,e,t){let n=t.byteLength+7&-8;if(r>0||t.byteLength<n){let s=new Uint8Array(n);return s.set(r%8===0?t.subarray(r>>3):Ti(new nn(t,r,e,null,qo)).subarray(0,n)),s}return t}function Ti(r){let e=[],t=0,n=0,s=0;for(let o of r)o&&(s|=1<<n),++n===8&&(e[t++]=s,s=n=0);(t===0||n>0)&&(e[t++]=s);let i=new Uint8Array(e.length+7&-8);return i.set(e),i}function Tc(r,e,t){if(t-e<=0)return 0;if(t-e<8){let i=0;for(let o of new nn(r,e,t-e,r,Bl))i+=o;return i}let n=t>>3<<3,s=e+(e%8===0?0:8-e%8);return Tc(r,e,s)+Tc(r,n,t)+k0(r,s>>3,n-s>>3)}function k0(r,e,t){let n=0,s=Math.trunc(e),i=new DataView(r.buffer,r.byteOffset,r.byteLength),o=t===void 0?r.byteLength:s+t;for(;o-s>=4;)n+=Ll(i.getUint32(s)),s+=4;for(;o-s>=2;)n+=Ll(i.getUint16(s)),s+=2;for(;o-s>=1;)n+=Ll(i.getUint8(s)),s+=1;return n}function Ll(r){let e=Math.trunc(r);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}var nn,_i=p(()=>{nn=class{constructor(e,t,n,s,i){this.bytes=e,this.length=n,this.context=s,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}});function D(r){return yM.visit(r)}var gM,N0,G,Lp,yM,wr=p(()=>{ht();De();we();_i();we();Vt();Ke();gM=-1,N0=Symbol.for("apache-arrow/Data"),G=class r{static isData(e){return e?.[N0]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return E.isSparseUnion(e)?this.children.some(t=>t.nullable):E.isDenseUnion(e)?this.children.some(t=>t.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:s,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),s&&(e+=s.byteLength),i&&(e+=i.byteLength),e+=this.variadicBuffers.reduce((o,a)=>{var c;return o+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((o,a)=>o+a.byteLength,e)}get nullCount(){if(E.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let e=this._nullCount,t;return e<=gM&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-Tc(t,this.offset,this.offset+this.length)),e}constructor(e,t,n,s,i,o=[],a,c=[]){var u;this.type=e,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(t||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let l;i instanceof r?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets,this.variadicBuffers=i.variadicBuffers):(this.stride=or(e),i&&((l=i[0])&&(this.valueOffsets=l),(l=i[1])&&(this.values=l),(l=i[2])&&(this.nullBitmap=l),(l=i[3])&&(this.typeIds=l)),this.variadicBuffers=c),(u=this.variadicBuffers)!==null&&u!==void 0||(this.variadicBuffers=[])}getValid(e){let{type:t}=this;if(E.isUnion(t)){let n=t,s=this.typeIds[e],i=n.typeIdToChildIndex[s],o=this.children[i],a=this.valueOffsets,c=n.mode===he.Dense&&a?Number(a[e]):e;return o.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+e;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(e,t){let n,{type:s}=this;if(E.isUnion(s)){let i=s,o=this.typeIds[e],a=i.typeIdToChildIndex[o],c=this.children[a],u=this.valueOffsets,l=i.mode===he.Dense&&u?Number(u[e]):e;n=c.getValid(l),c.setValid(l,t)}else{let{nullBitmap:i}=this,{offset:o,length:a}=this,c=o+e,u=1<<c%8,l=c>>3;(!i||i.byteLength<=l)&&(i=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(i.set(xi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:i})):Object.assign(this,{nullBitmap:i,_nullCount:0}));let f=i[l];n=(f&u)!==0,i[l]=t?f|u:f&~u}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(e=this.type,t=this.offset,n=this.length,s=this._nullCount,i=this,o=this.children,a=this.variadicBuffers){return new r(e,t,n,s,i,o,this.dictionary,a)}slice(e,t){let{stride:n,typeId:s,children:i}=this,o=+(this._nullCount===0)-1,a=s===16?n:1,c=this._sliceBuffers(e,t,n,s);return this.clone(this.type,this.offset+e,t,o,c,i.length===0||this.valueOffsets?i:this._sliceChildren(i,a*e,a*t),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===w.Null)return this.clone(this.type,0,e,0,this.buffers,this.children,this.variadicBuffers);let{length:t,nullCount:n}=this,s=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);s[t>>3]=(1<<t-(t&-8))-1,n>0&&s.set(xi(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[re.VALIDITY]=s,this.clone(this.type,0,e,n+(e-t),i,this.children,this.variadicBuffers)}_sliceBuffers(e,t,n,s){let i,{buffers:o}=this;if((i=o[re.TYPE])&&(o[re.TYPE]=i.subarray(e,e+t)),E.isBinaryView(this.type)||E.isUtf8View(this.type)){let a=Z.ELEMENT_WIDTH;(i=o[re.DATA])&&(o[re.DATA]=i.subarray(e*a,(e+t)*a))}else(i=o[re.OFFSET])&&(o[re.OFFSET]=i.subarray(e,e+t+1))||(i=o[re.DATA])&&(o[re.DATA]=s===6?i:i.subarray(n*e,n*(e+t)));return o}_sliceChildren(e,t,n){return e.map(s=>s.slice(t,n))}};G.prototype.children=Object.freeze([]);G.prototype[N0]=!0;Object.defineProperty(G,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===G&&G.isData(e)}});Lp=class r extends R{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{["type"]:t,["offset"]:n=0,["length"]:s=0}=e;return new G(t,n,s,s)}visitBool(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length>>3,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitInt(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitFloat(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitUtf8(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=pi(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitUtf8View(e){var t;let{["type"]:n,["offset"]:s=0}=e,i=ee(n.ArrayType,e.views),o=k(e.nullBitmap),a=(e.variadicBuffers||[]).map(l=>k(l)),c=(t=e.length)!==null&&t!==void 0?t:Math.trunc(i.length/St.ELEMENT_WIDTH),u=e.nullBitmap?-1:0;return new G(n,s,c,u,[void 0,i,o],[],void 0,a)}visitLargeUtf8(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=Ha(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitBinary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=pi(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitBinaryView(e){var t;let{["type"]:n,["offset"]:s=0}=e,i=ee(n.ArrayType,e.views),o=k(e.nullBitmap),a=(e.variadicBuffers||[]).map(l=>k(l)),c=(t=e.length)!==null&&t!==void 0?t:Math.trunc(i.length/Z.ELEMENT_WIDTH),u=e.nullBitmap?-1:0;return new G(n,s,c,u,[void 0,i,o],[],void 0,a)}visitLargeBinary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.data),i=k(e.nullBitmap),o=Ha(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,s,i])}visitFixedSizeBinary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitDate(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitTimestamp(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitTime(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitDecimal(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitList(e){let{["type"]:t,["offset"]:n=0,["child"]:s}=e,i=k(e.nullBitmap),o=pi(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,void 0,i],[s])}visitLargeList(e){let{["type"]:t,["offset"]:n=0,["child"]:s}=e,i=k(e.nullBitmap),o=Ha(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,void 0,i],[s])}visitStruct(e){let{["type"]:t,["offset"]:n=0,["children"]:s=[]}=e,i=k(e.nullBitmap),{length:o=s.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,void 0,i],s)}visitUnion(e){let{["type"]:t,["offset"]:n=0,["children"]:s=[]}=e,i=ee(t.ArrayType,e.typeIds),{["length"]:o=i.length,["nullCount"]:a=-1}=e;if(E.isSparseUnion(t))return new G(t,n,o,a,[void 0,void 0,void 0,i],s);let c=pi(e.valueOffsets);return new G(t,n,o,a,[c,void 0,void 0,i],s)}visitDictionary(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.indices.ArrayType,e.data),{["dictionary"]:o=new B([new r().visit({type:t.dictionary})])}=e,{["length"]:a=i.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[void 0,i,s],[],o)}visitInterval(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitDuration(e){let{["type"]:t,["offset"]:n=0}=e,s=k(e.nullBitmap),i=ee(t.ArrayType,e.data),{["length"]:o=i.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,i,s])}visitFixedSizeList(e){let{["type"]:t,["offset"]:n=0,["child"]:s=new r().visit({type:t.valueType})}=e,i=k(e.nullBitmap),{["length"]:o=s.length/or(t),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new G(t,n,o,a,[void 0,void 0,i],[s])}visitMap(e){let{["type"]:t,["offset"]:n=0,["child"]:s=new r().visit({type:t.childType})}=e,i=k(e.nullBitmap),o=pi(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new G(t,n,a,c,[o,void 0,i],[s])}},yM=new Lp});function C0(r){return r.some(e=>e.nullable)}function Fl(r){return r.reduce((e,t)=>e+t.nullCount,0)}function Ol(r){return r.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(r.length+1))}function Ml(r,e,t,n){let s=[];for(let i=-1,o=r.length;++i<o;){let a=r[i],c=e[i],{length:u}=a;if(c>=n)break;if(t>=c+u)continue;if(c>=t&&c+u<=n){s.push(a);continue}let l=Math.max(0,t-c),f=Math.min(n-c,u);s.push(a.slice(l,f-l))}return s.length===0&&s.push(r[0].slice(0,0)),s}function Bp(r,e,t,n){let s=0,i=0,o=e.length-1;do{if(s>=o-1)return t<e[o]?n(r,s,t-e[s]):null;i=s+Math.trunc((o-s)*.5),t<e[i]?o=i:s=i}while(s<o)}function Ac(r,e){return r.getValid(e)}function Ko(r){function e(t,n,s){return r(t[n],s)}return function(t){let n=this.data;return Bp(n,this._offsets,t,e)}}function Dl(r){let e;function t(n,s,i){return r(n[s],i,e)}return function(n,s){let i=this.data;e=s;let o=Bp(i,this._offsets,n,t);return e=void 0,o}}function Rl(r){let e;function t(n,s,i){let o=i,a=0,c=0;for(let u=s-1,l=n.length;++u<l;){let f=n[u];if(~(a=r(f,e,o)))return c+a;o=0,c+=f.length}return-1}return function(n,s){e=n;let i=this.data,o=typeof s!="number"?t(i,0,0):Bp(i,this._offsets,s,t);return e=void 0,o}}var _c,kl=p(()=>{_c=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function wM(r,e){return e===null&&r.length>0?0:-1}function xM(r,e){let{nullBitmap:t}=r;if(!t||r.nullCount<=0)return-1;let n=0;for(let s of new nn(t,r.offset+(e||0),r.length,t,qo)){if(!s)return n;++n}return-1}function H(r,e,t){if(e===void 0)return-1;if(e===null)switch(r.typeId){case w.Union:break;case w.Dictionary:break;default:return xM(r,t)}let n=ze.getVisitFn(r),s=As(e);for(let i=(t||0)-1,o=r.length;++i<o;)if(s(n(r,i)))return i;return-1}function U0(r,e,t){let n=ze.getVisitFn(r),s=As(e);for(let i=(t||0)-1,o=r.length;++i<o;)if(s(n(r,i)))return i;return-1}var U,Ai,Nl=p(()=>{De();Vt();yi();_i();$o();U=class extends R{};U.prototype.visitNull=wM;U.prototype.visitBool=H;U.prototype.visitInt=H;U.prototype.visitInt8=H;U.prototype.visitInt16=H;U.prototype.visitInt32=H;U.prototype.visitInt64=H;U.prototype.visitUint8=H;U.prototype.visitUint16=H;U.prototype.visitUint32=H;U.prototype.visitUint64=H;U.prototype.visitFloat=H;U.prototype.visitFloat16=H;U.prototype.visitFloat32=H;U.prototype.visitFloat64=H;U.prototype.visitUtf8=H;U.prototype.visitLargeUtf8=H;U.prototype.visitUtf8View=H;U.prototype.visitBinary=H;U.prototype.visitLargeBinary=H;U.prototype.visitBinaryView=H;U.prototype.visitFixedSizeBinary=H;U.prototype.visitDate=H;U.prototype.visitDateDay=H;U.prototype.visitDateMillisecond=H;U.prototype.visitTimestamp=H;U.prototype.visitTimestampSecond=H;U.prototype.visitTimestampMillisecond=H;U.prototype.visitTimestampMicrosecond=H;U.prototype.visitTimestampNanosecond=H;U.prototype.visitTime=H;U.prototype.visitTimeSecond=H;U.prototype.visitTimeMillisecond=H;U.prototype.visitTimeMicrosecond=H;U.prototype.visitTimeNanosecond=H;U.prototype.visitDecimal=H;U.prototype.visitList=H;U.prototype.visitLargeList=H;U.prototype.visitStruct=H;U.prototype.visitUnion=H;U.prototype.visitDenseUnion=U0;U.prototype.visitSparseUnion=U0;U.prototype.visitDictionary=H;U.prototype.visitInterval=H;U.prototype.visitIntervalDayTime=H;U.prototype.visitIntervalYearMonth=H;U.prototype.visitIntervalMonthDayNano=H;U.prototype.visitDuration=H;U.prototype.visitDurationSecond=H;U.prototype.visitDurationMillisecond=H;U.prototype.visitDurationMicrosecond=H;U.prototype.visitDurationNanosecond=H;U.prototype.visitFixedSizeList=H;U.prototype.visitMap=H;Ai=new U});function $(r){let{type:e}=r;if(r.nullCount===0&&r.stride===1&&(E.isInt(e)&&e.bitWidth!==64||E.isTime(e)&&e.bitWidth!==64||E.isFloat(e)&&e.precision!==le.HALF))return new _c(r.data.length,n=>{let s=r.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let t=0;return new _c(r.data.length,n=>{let i=r.data[n].length,o=r.slice(t,t+i);return t+=i,new Fp(o)})}var P,Fp,Ho,Cl=p(()=>{Vt();De();we();kl();P=class extends R{};Fp=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};P.prototype.visitNull=$;P.prototype.visitBool=$;P.prototype.visitInt=$;P.prototype.visitInt8=$;P.prototype.visitInt16=$;P.prototype.visitInt32=$;P.prototype.visitInt64=$;P.prototype.visitUint8=$;P.prototype.visitUint16=$;P.prototype.visitUint32=$;P.prototype.visitUint64=$;P.prototype.visitFloat=$;P.prototype.visitFloat16=$;P.prototype.visitFloat32=$;P.prototype.visitFloat64=$;P.prototype.visitUtf8=$;P.prototype.visitLargeUtf8=$;P.prototype.visitUtf8View=$;P.prototype.visitBinary=$;P.prototype.visitLargeBinary=$;P.prototype.visitBinaryView=$;P.prototype.visitFixedSizeBinary=$;P.prototype.visitDate=$;P.prototype.visitDateDay=$;P.prototype.visitDateMillisecond=$;P.prototype.visitTimestamp=$;P.prototype.visitTimestampSecond=$;P.prototype.visitTimestampMillisecond=$;P.prototype.visitTimestampMicrosecond=$;P.prototype.visitTimestampNanosecond=$;P.prototype.visitTime=$;P.prototype.visitTimeSecond=$;P.prototype.visitTimeMillisecond=$;P.prototype.visitTimeMicrosecond=$;P.prototype.visitTimeNanosecond=$;P.prototype.visitDecimal=$;P.prototype.visitList=$;P.prototype.visitLargeList=$;P.prototype.visitStruct=$;P.prototype.visitUnion=$;P.prototype.visitDenseUnion=$;P.prototype.visitSparseUnion=$;P.prototype.visitDictionary=$;P.prototype.visitInterval=$;P.prototype.visitIntervalDayTime=$;P.prototype.visitIntervalYearMonth=$;P.prototype.visitIntervalMonthDayNano=$;P.prototype.visitDuration=$;P.prototype.visitDurationSecond=$;P.prototype.visitDurationMillisecond=$;P.prototype.visitDurationMicrosecond=$;P.prototype.visitDurationNanosecond=$;P.prototype.visitFixedSizeList=$;P.prototype.visitMap=$;Ho=new P});function sn(r){if(r){if(r instanceof G)return new B([r]);if(r instanceof B)return new B(r.data);if(r.type instanceof E)return new B([D(r)]);if(Array.isArray(r))return new B(r.flatMap(e=>TM(e)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let e={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new B([D(Object.assign(Object.assign({},e),{type:new Zt}))]);if(r instanceof Int16Array)return new B([D(Object.assign(Object.assign({},e),{type:new er}))]);if(r instanceof Int32Array)return new B([D(Object.assign(Object.assign({},e),{type:new Pe}))]);if(r instanceof BigInt64Array)return new B([D(Object.assign(Object.assign({},e),{type:new tr}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new B([D(Object.assign(Object.assign({},e),{type:new rr}))]);if(r instanceof Uint16Array)return new B([D(Object.assign(Object.assign({},e),{type:new nr}))]);if(r instanceof Uint32Array)return new B([D(Object.assign(Object.assign({},e),{type:new vt}))]);if(r instanceof BigUint64Array)return new B([D(Object.assign(Object.assign({},e),{type:new Cr}))]);if(r instanceof Float32Array)return new B([D(Object.assign(Object.assign({},e),{type:new It}))]);if(r instanceof Float64Array)return new B([D(Object.assign(Object.assign({},e),{type:new sr}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function TM(r){return r instanceof G?[r]:r instanceof B?r.data:sn(r).data}var P0,V0,j0,G0,B,Ul,ht=p(()=>{De();$o();we();wr();kl();yi();ar();Nl();Cl();we();V0=Symbol.for("apache-arrow/Vector"),j0={},G0={},B=class r{static isVector(e){return e?.[V0]===!0}constructor(e){var t,n,s;let i=e[0]instanceof r?e.flatMap(a=>a.data):e;if(i.length===0||i.some(a=>!(a instanceof G)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(t=i[0])===null||t===void 0?void 0:t.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:u}=j0[o.typeId],l=i[0];this.isValid=f=>Ac(l,f),this.get=f=>a(l,f),this.set=(f,d)=>c(l,f,d),this.indexOf=f=>u(l,f),this._offsets=[0,l.length];break}default:Object.setPrototypeOf(this,G0[o.typeId]),this._offsets=Ol(i);break}this.data=i,this.type=o,this.stride=or(o),this.numChildren=(s=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return C0(this.data)}get nullCount(){return Fl(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${w[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(wi(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return Ho.visit(this)}concat(...e){return new r(this.data.concat(e.flatMap(t=>t.data).flat(Number.POSITIVE_INFINITY)))}slice(e,t){return new r(xc(this,e,t,({data:n,_offsets:s},i,o)=>Ml(n,s,i,o)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:s,ArrayType:i}=this;switch(e.typeId){case w.Int:case w.Float:case w.Decimal:case w.Time:case w.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*s);default:return t.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*s),o.offset),o.offset+=c*s,o),{array:new i(n*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)===null||t===void 0?void 0:t.findIndex(n=>n.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new r(this.data.map(({children:t})=>t[e])):null}get isMemoized(){return E.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(E.isDictionary(this.type)){let e=new Ul(this.data[0].dictionary),t=this.data.map(n=>{let s=n.clone();return s.dictionary=e,s});return new r(t)}return new Ul(this)}unmemoize(){if(E.isDictionary(this.type)&&this.isMemoized){let e=this.data[0].dictionary.unmemoize(),t=this.data.map(n=>{let s=n.clone();return s.dictionary=e,s});return new r(t)}return this}};P0=Symbol.toStringTag;B[P0]=(r=>{r.type=E.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0,r[V0]=!0;let e=Object.keys(w).map(t=>w[t]).filter(t=>typeof t=="number"&&t!==w.NONE);for(let t of e){let n=ze.getVisitFnByTypeId(t),s=nt.getVisitFnByTypeId(t),i=Ai.getVisitFnByTypeId(t);j0[t]={get:n,set:s,indexOf:i},G0[t]=Object.create(r,{isValid:{value:Ko(Ac)},get:{value:Ko(ze.getVisitFnByTypeId(t))},set:{value:Dl(nt.getVisitFnByTypeId(t))},indexOf:{value:Rl(Ai.getVisitFnByTypeId(t))}})}return"Vector"})(B.prototype);Object.defineProperty(B,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===B&&B.isVector(e)}});Ul=class r extends B{constructor(e){super(e.data);let t=this.get,n=this.set,s=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=i[o];if(a!==void 0)return a;let c=t.call(this,o);return i[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),i[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new B(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function z0(r){if(!r||r.length<=0)return function(s){return!0};let e="",t=r.filter(n=>n===n);return t.length>0&&(e=`
13
13
  switch (x) {${t.map(n=>`
14
- case ${_O(n)}:`).join("")}
14
+ case ${_M(n)}:`).join("")}
15
15
  return false;
16
16
  }`),r.length!==t.length&&(e=`if (x !== x) return false;
17
17
  ${e}`),new Function("x",`${e}
18
- return true;`)}function _O(r){return typeof r!="bigint"?Rr(r):`${Rr(r)}n`}var e0=p(()=>{tc()});function np(r,e){let t=Math.ceil(r)*e-1;return(t-t%64+64||64)/e}function t0(r,e=0){return r.length>=e?r.subarray(0,e):Ua(new r.constructor(e),r,0)}var jt,vn,zo,Ts,jr=p(()=>{Ke();jt=class{constructor(e,t=0,n=1){this.length=Math.ceil(t/n),this.buffer=new e(this.length),this.stride=n,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(e,t){return this}append(e){return this.set(this.length,e)}reserve(e){if(e>0){this.length+=e;let t=this.stride,n=this.length*t,s=this.buffer.length;n>=s&&this._resize(s===0?np(n*1,this.BYTES_PER_ELEMENT):np(n*2,this.BYTES_PER_ELEMENT))}return this}flush(e=this.length){e=np(e*this.stride,this.BYTES_PER_ELEMENT);let t=t0(this.buffer,e);return this.clear(),t}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(e){return this.buffer=t0(this.buffer,e)}},vn=class extends jt{last(){return this.get(this.length-1)}get(e){return this.buffer[e]}set(e,t){return this.reserve(e-this.length+1),this.buffer[e*this.stride]=t,this}},zo=class extends vn{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(e){return this.buffer[e>>3]>>e%8&1}set(e,t){let{buffer:n}=this.reserve(e-this.length+1),s=e>>3,i=e%8,o=n[s]>>i&1;return t?o===0&&(n[s]|=1<<i,++this.numValid):o===1&&(n[s]&=~(1<<i),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ts=class extends vn{constructor(e){super(e.OffsetArrayType,1,1)}append(e){return this.set(this.length-1,e)}set(e,t){let n=this.length-1,s=this.reserve(e-n+1).buffer;return n<e++&&n>=0&&s.fill(s[n],n,e),s[e]=s[e-1]+t,this}flush(e=this.length-1){return e>this.length&&this.set(e-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(e+1)}}});var Te,We,pt,Se=p(()=>{ht();wr();lc();we();e0();jr();Te=class{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e){throw new Error('"throughDOM" not available in this environment')}constructor({type:e,nullValues:t}){this.length=0,this.finished=!1,this.type=e,this.children=[],this.nullValues=t,this.stride=or(e),this._nulls=new zo,t&&t.length>0&&(this._isValid=ZT(t))}toVector(){return new B([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let e=0,{_offsets:t,_values:n,_nulls:s,_typeIds:i,children:o}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),s&&(e+=s.byteLength),i&&(e+=i.byteLength),o.reduce((a,c)=>a+c.byteLength,e)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let e=0;return this._offsets&&(e+=this._offsets.reservedByteLength),this._values&&(e+=this._values.reservedByteLength),this._nulls&&(e+=this._nulls.reservedByteLength),this._typeIds&&(e+=this._typeIds.reservedByteLength),this.children.reduce((t,n)=>t+n.reservedByteLength,e)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(e){return this.set(this.length,e)}isValid(e){return this._isValid(e)}set(e,t){return this.setValid(e,this.isValid(t))&&this.setValue(e,t),this}setValue(e,t){this._setValue(this,e,t)}setValid(e,t){return this.length=this._nulls.set(e,+t).length,t}addChild(e,t=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(e){return this.children[e]||null}flush(){let e,t,n,s,{type:i,length:o,nullCount:a,_typeIds:c,_offsets:u,_values:l,_nulls:f}=this;(t=c?.flush(o))?s=u?.flush(o):(s=u?.flush(o))?e=l?.flush(u.last()):e=l?.flush(o),a>0&&(n=f?.flush(o));let d=this.children.map(h=>h.flush());return this.clear(),D({type:i,length:o,nullCount:a,children:d,child:d[0],data:e,typeIds:t,nullBitmap:n,valueOffsets:s})}finish(){this.finished=!0;for(let e of this.children)e.finish();return this}clear(){var e,t,n,s;this.length=0,(e=this._nulls)===null||e===void 0||e.clear(),(t=this._values)===null||t===void 0||t.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let i of this.children)i.clear();return this}};Te.prototype.length=1;Te.prototype.stride=1;Te.prototype.children=null;Te.prototype.finished=!1;Te.prototype.nullValues=null;Te.prototype._isValid=()=>!0;We=class extends Te{constructor(e){super(e),this._values=new vn(this.ArrayType,0,this.stride)}setValue(e,t){let n=this._values;return n.reserve(e-n.length+1),super.setValue(e,t)}},pt=class extends Te{constructor(e){super(e),this._pendingLength=0,this._offsets=new Ts(e.type)}setValue(e,t){let n=this._pending||(this._pending=new Map),s=n.get(e);s&&(this._pendingLength-=s.length),this._pendingLength+=t instanceof yr?t[ws].length:t.length,n.set(e,t)}setValid(e,t){return super.setValid(e,t)?!0:((this._pending||(this._pending=new Map)).set(e,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let e=this._pending,t=this._pendingLength;return this._pendingLength=0,this._pending=void 0,e&&e.size>0&&this._flushPending(e,t),this}}});var wi,sp=p(()=>{wi=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,t,n,s){return e.prep(8,24),e.writeInt64(BigInt(s??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}}});var cr,r0=p(()=>{ce();sp();Bo();ku();Mh();cr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ge.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Nt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new wi).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new wi).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Oe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,ge.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}}});function Tl(r,e){return new Map([...r||new Map,...e||new Map])}function ip(r,e=new Map){for(let t=-1,n=r.length;++t<n;){let i=r[t].type;if(E.isDictionary(i)){if(!e.has(i.id))e.set(i.id,i.dictionary);else if(e.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&ip(i.children,e)}return e}var n0,s0,Q,O,mt=p(()=>{Me();we();n0=Symbol.for("apache-arrow/Schema"),s0=Symbol.for("apache-arrow/Field"),Q=class r{static isSchema(e){return e?.[n0]===!0}constructor(e=[],t,n,s=ge.V5){this.fields=e||[],this.metadata=t||new Map,n||(n=ip(this.fields)),this.dictionaries=n,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(", ")} }>`}select(e){let t=new Set(e),n=this.fields.filter(s=>t.has(s.name));return new r(n,this.metadata)}selectAt(e){let t=e.map(n=>this.fields[n]).filter(Boolean);return new r(t,this.metadata)}assign(...e){let t=e[0]instanceof r?e[0]:Array.isArray(e[0])?new r(e[0]):new r(e),n=[...this.fields],s=Tl(Tl(new Map,this.metadata),t.metadata),i=t.fields.filter(a=>{let c=n.findIndex(u=>u.name===a.name);return~c?(n[c]=a.clone({metadata:Tl(Tl(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=ip(i,new Map);return new r([...n,...i],s,new Map([...this.dictionaries,...o]))}};Q.prototype.fields=null;Q.prototype.metadata=null;Q.prototype.dictionaries=null;Q.prototype[n0]=!0;Object.defineProperty(Q,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===Q&&Q.isSchema(e)}});O=class r{static isField(e){return e?.[s0]===!0}static new(...e){let[t,n,s,i]=e;return e[0]&&typeof e[0]=="object"&&({name:t}=e[0],n===void 0&&(n=e[0].type),s===void 0&&(s=e[0].nullable),i===void 0&&(i=e[0].metadata)),new r(`${t}`,n,s,i)}constructor(e,t,n=!1,s){this.name=e,this.type=t,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[t,n,s,i]=e;return!e[0]||typeof e[0]!="object"?[t=this.name,n=this.type,s=this.nullable,i=this.metadata]=e:{name:t=this.name,type:n=this.type,nullable:s=this.nullable,metadata:i=this.metadata}=e[0],r.new(t,n,s,i)}};O.prototype.type=null;O.prototype.name=null;O.prototype.nullable=null;O.prototype.metadata=null;O.prototype[s0]=!0;Object.defineProperty(O,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===O&&O.isField(e)}})});var AO,vO,In,op,Gr,ap=p(()=>{sp();r0();ce();mt();Me();Ke();Qr();AO=li,vO=Ze,In=class{static decode(e){e=new vO(k(e));let t=cr.getRootAsFooter(e),n=Q.decode(t.schema(),new Map,t.version());return new op(n,t)}static encode(e){let t=new AO,n=Q.encode(t,e.schema);cr.startRecordBatchesVector(t,e.numRecordBatches);for(let o of[...e.recordBatches()].slice().reverse())Gr.encode(t,o);let s=t.endVector();cr.startDictionariesVector(t,e.numDictionaries);for(let o of[...e.dictionaryBatches()].slice().reverse())Gr.encode(t,o);let i=t.endVector();return cr.startFooter(t),cr.addSchema(t,n),cr.addVersion(t,ge.V5),cr.addRecordBatches(t,s),cr.addDictionaries(t,i),cr.finishFooterBuffer(t,cr.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=ge.V5,n,s){this.schema=e,this.version=t,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},op=class extends In{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return Gr.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return Gr.decode(t)}return null}},Gr=class r{static decode(e){return new r(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,t){let{metaDataLength:n}=t,s=BigInt(t.offset),i=BigInt(t.bodyLength);return wi.createBlock(e,s,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=te(n),this.bodyLength=te(t)}}});var ur,i0=p(()=>{ce();Bo();Gu();ku();ur=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ge.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):se.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Oe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,ge.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,se.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt("0"))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(e,t,n,s,i,o){return r.startMessage(e),r.addVersion(e,t),r.addHeaderType(e,n),r.addHeader(e,s),r.addBodyLength(e,i),r.addCustomMetadata(e,o),r.endMessage(e)}}});var cp,_l,o0=p(()=>{Vt();Lx();Vu();Ih();Tx();_x();vx();Ax();Fx();Ox();Sx();Th();xh();Lh();Bh();Sh();_h();Ex();Ix();Bx();Fh();wh();Ah();vh();Eh();cp=class extends R{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return Ya.startNull(t),Ya.endNull(t)}visitInt(e,t){return Mr.startInt(t),Mr.addBitWidth(t,e.bitWidth),Mr.addIsSigned(t,e.isSigned),Mr.endInt(t)}visitFloat(e,t){return ns.startFloatingPoint(t),ns.addPrecision(t,e.precision),ns.endFloatingPoint(t)}visitBinary(e,t){return Wa.startBinary(t),Wa.endBinary(t)}visitBinaryView(e,t){return $a.startBinaryView(t),$a.endBinaryView(t)}visitLargeBinary(e,t){return Ka.startLargeBinary(t),Ka.endLargeBinary(t)}visitBool(e,t){return qa.startBool(t),qa.endBool(t)}visitUtf8(e,t){return Za.startUtf8(t),Za.endUtf8(t)}visitUtf8View(e,t){return ec.startUtf8View(t),ec.endUtf8View(t)}visitLargeUtf8(e,t){return Ha.startLargeUtf8(t),Ha.endLargeUtf8(t)}visitDecimal(e,t){return Yr.startDecimal(t),Yr.addScale(t,e.scale),Yr.addPrecision(t,e.precision),Yr.addBitWidth(t,e.bitWidth),Yr.endDecimal(t)}visitDate(e,t){return Zn.startDate(t),Zn.addUnit(t,e.unit),Zn.endDate(t)}visitTime(e,t){return xn.startTime(t),xn.addUnit(t,e.unit),xn.addBitWidth(t,e.bitWidth),xn.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return Tn.startTimestamp(t),Tn.addUnit(t,e.unit),n!==void 0&&Tn.addTimezone(t,n),Tn.endTimestamp(t)}visitInterval(e,t){return ss.startInterval(t),ss.addUnit(t,e.unit),ss.endInterval(t)}visitDuration(e,t){return es.startDuration(t),es.addUnit(t,e.unit),es.endDuration(t)}visitList(e,t){return Ja.startList(t),Ja.endList(t)}visitLargeList(e,t){return Xa.startLargeList(t),Xa.endLargeList(t)}visitStruct(e,t){return Qa.startStruct_(t),Qa.endStruct_(t)}visitUnion(e,t){Dr.startTypeIdsVector(t,e.typeIds.length);let n=Dr.createTypeIdsVector(t,e.typeIds);return Dr.startUnion(t),Dr.addMode(t,e.mode),Dr.addTypeIds(t,n),Dr.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return Jr.startDictionaryEncoding(t),Jr.addId(t,BigInt(e.id)),Jr.addIsOrdered(t,e.isOrdered),n!==void 0&&Jr.addIndexType(t,n),Jr.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return ts.startFixedSizeBinary(t),ts.addByteWidth(t,e.byteWidth),ts.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return rs.startFixedSizeList(t),rs.addListSize(t,e.listSize),rs.endFixedSizeList(t)}visitMap(e,t){return is.startMap(t),is.addKeysSorted(t,e.keysSorted),is.endMap(t)}},_l=new cp});function l0(r,e=new Map){return new Q(IO(r,e),Al(r.metadata),e)}function up(r){return new $e(r.count,d0(r.columns),h0(r.columns),null,p0(r.columns))}function f0(r){return new bt(up(r.data),r.id,r.isDelta)}function IO(r,e){return(r.fields||[]).filter(Boolean).map(t=>O.fromJSON(t,e))}function a0(r,e){return(r.children||[]).filter(Boolean).map(t=>O.fromJSON(t,e))}function d0(r){return(r||[]).reduce((e,t)=>[...e,new xr(t.count,SO(t.VALIDITY)),...d0(t.children)],[])}function h0(r,e=[]){for(let t=-1,n=(r||[]).length;++t<n;){let s=r[t];if(s.VALIDITY&&e.push(new Ce(e.length,s.VALIDITY.length)),s.TYPE_ID&&e.push(new Ce(e.length,s.TYPE_ID.length)),s.OFFSET&&e.push(new Ce(e.length,s.OFFSET.length)),s.DATA&&e.push(new Ce(e.length,s.DATA.length)),s.VIEWS&&e.push(new Ce(e.length,s.VIEWS.length)),s.VARIADIC_DATA_BUFFERS)for(let i of s.VARIADIC_DATA_BUFFERS)e.push(new Ce(e.length,i.length));e=h0(s.children,e)}return e}function SO(r){return(r||[]).reduce((e,t)=>e+ +(t===0),0)}function p0(r){return(r||[]).reduce((e,t)=>[...e,...t.VARIADIC_DATA_BUFFERS?[t.VARIADIC_DATA_BUFFERS.length]:[],...p0(t.children)],[])}function m0(r,e){let t,n,s,i,o,a;return!e||!(i=r.dictionary)?(o=u0(r,a0(r,e)),s=new O(r.name,o,r.nullable,Al(r.metadata))):e.has(t=i.id)?(n=(n=i.indexType)?c0(n):new Pe,a=new Ge(e.get(t),n,t,i.isOrdered),s=new O(r.name,a,r.nullable,Al(r.metadata))):(n=(n=i.indexType)?c0(n):new Pe,e.set(t,o=u0(r,a0(r,e))),a=new Ge(o,n,t,i.isOrdered),s=new O(r.name,a,r.nullable,Al(r.metadata))),s||null}function Al(r=[]){return new Map(r.map(({key:e,value:t})=>[e,t]))}function c0(r){return new Fe(r.isSigned,r.bitWidth)}function u0(r,e){let t=r.type.name;switch(t){case"NONE":return new Ne;case"null":return new Ne;case"binary":return new Ct;case"largebinary":return new Ur;case"binaryview":return new Z;case"utf8":return new ut;case"largeutf8":return new Pr;case"utf8view":return new St;case"bool":return new lt;case"list":return new je((e||[])[0]);case"largelist":return new ir((e||[])[0]);case"struct":return new pe(e||[]);case"struct_":return new pe(e||[])}switch(t){case"int":{let n=r.type;return new Fe(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ct(le[n.precision])}case"decimal":{let n=r.type;return new Ut(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Et(ye[n.unit])}case"time":{let n=r.type;return new tt(L[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new rt(L[n.unit],n.timezone)}case"interval":{let n=r.type;return new ft(ae[n.unit])}case"duration":{let n=r.type;return new Lt(L[n.unit])}case"union":{let n=r.type,[s,...i]=(n.mode+"").toLowerCase(),o=s.toUpperCase()+i.join("");return new Bt(he[o],n.typeIds||[],e||[])}case"fixedsizebinary":{let n=r.type;return new Pt(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Be(n.listSize,(e||[])[0])}case"map":{let n=r.type;return new dt((e||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var b0=p(()=>{mt();we();_s();Me()});function BO(r,e){return(()=>{switch(e){case se.Schema:return Q.fromJSON(r);case se.RecordBatch:return $e.fromJSON(r);case se.DictionaryBatch:return bt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${se[e]}, type: ${e} }`)})}function FO(r,e){return(()=>{switch(e){case se.Schema:return Q.decode(r.header(new Nt),new Map,r.version());case se.RecordBatch:return $e.decode(r.header(new ot),r.version());case se.DictionaryBatch:return bt.decode(r.header(new wn),r.version())}throw new Error(`Unrecognized Message type: { name: ${se[e]}, type: ${e} }`)})}function OO(r,e=new Map,t=ge.V5){let n=PO(r,e);return new Q(n,vl(r),e,t)}function MO(r,e=ge.V5){return new $e(r.length(),NO(r),CO(r,e),x0(r.compression()),UO(r))}function DO(r,e=ge.V5){return new bt($e.decode(r.data(),e),r.id(),r.isDelta())}function RO(r){return new Ce(r.offset(),r.length())}function kO(r){return new xr(r.length(),r.nullCount())}function NO(r){let e=[];for(let t,n=-1,s=-1,i=r.nodesLength();++n<i;)(t=r.nodes(n))&&(e[++s]=xr.decode(t));return e}function CO(r,e){let t=[];for(let n,s=-1,i=-1,o=r.buffersLength();++s<o;)(n=r.buffers(s))&&(e<ge.V4&&(n.bb_pos+=8*(s+1)),t[++i]=Ce.decode(n));return t}function UO(r){let e=[],t=Math.trunc(r.variadicBufferCountsLength());for(let n=0;n<t;++n)e.push(te(r.variadicBufferCounts(n)));return e}function PO(r,e){let t=[];for(let n,s=-1,i=-1,o=r.fieldsLength();++s<o;)(n=r.fields(s))&&(t[++i]=O.decode(n,e));return t}function g0(r,e){let t=[];for(let n,s=-1,i=-1,o=r.childrenLength();++s<o;)(n=r.children(s))&&(t[++i]=O.decode(n,e));return t}function VO(r,e){let t,n,s,i,o,a;return!e||!(a=r.dictionary())?(s=w0(r,g0(r,e)),n=new O(r.name(),s,r.nullable(),vl(r))):e.has(t=te(a.id()))?(i=(i=a.indexType())?y0(i):new Pe,o=new Ge(e.get(t),i,t,a.isOrdered()),n=new O(r.name(),o,r.nullable(),vl(r))):(i=(i=a.indexType())?y0(i):new Pe,e.set(t,s=w0(r,g0(r,e))),o=new Ge(s,i,t,a.isOrdered()),n=new O(r.name(),o,r.nullable(),vl(r))),n||null}function vl(r){let e=new Map;if(r)for(let t,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(t=r.customMetadata(s))&&(n=t.key())!=null&&e.set(n,t.value());return e}function jO(r){let e=new Map;for(let t,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(t=r.customMetadata(s))&&(n=t.key())!=null&&e.set(n,t.value());return e}function y0(r){return new Fe(r.isSigned(),r.bitWidth())}function w0(r,e){let t=r.typeType();switch(t){case z.NONE:return new Ne;case z.Null:return new Ne;case z.Binary:return new Ct;case z.LargeBinary:return new Ur;case z.BinaryView:return new Z;case z.Utf8:return new ut;case z.LargeUtf8:return new Pr;case z.Utf8View:return new St;case z.Bool:return new lt;case z.List:return new je((e||[])[0]);case z.LargeList:return new ir((e||[])[0]);case z.Struct_:return new pe(e||[])}switch(t){case z.Int:{let n=r.type(new Mr);return new Fe(n.isSigned(),n.bitWidth())}case z.FloatingPoint:{let n=r.type(new ns);return new ct(n.precision())}case z.Decimal:{let n=r.type(new Yr);return new Ut(n.scale(),n.precision(),n.bitWidth())}case z.Date:{let n=r.type(new Zn);return new Et(n.unit())}case z.Time:{let n=r.type(new xn);return new tt(n.unit(),n.bitWidth())}case z.Timestamp:{let n=r.type(new Tn);return new rt(n.unit(),n.timezone())}case z.Interval:{let n=r.type(new ss);return new ft(n.unit())}case z.Duration:{let n=r.type(new es);return new Lt(n.unit())}case z.Union:{let n=r.type(new Dr);return new Bt(n.mode(),n.typeIdsArray()||[],e||[])}case z.FixedSizeBinary:{let n=r.type(new ts);return new Pt(n.byteWidth())}case z.FixedSizeList:{let n=r.type(new rs);return new Be(n.listSize(),(e||[])[0])}case z.Map:{let n=r.type(new is);return new dt((e||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${z[t]}" (${t})`)}function x0(r){return r?new xi(r.codec(),r.method()):null}function GO(r,e){let t=e.fields.map(i=>O.encode(r,i));Nt.startFieldsVector(r,t.length);let n=Nt.createFieldsVector(r,t),s=e.metadata&&e.metadata.size>0?Nt.createCustomMetadataVector(r,[...e.metadata].map(([i,o])=>{let a=r.createString(`${i}`),c=r.createString(`${o}`);return Oe.startKeyValue(r),Oe.addKey(r,a),Oe.addValue(r,c),Oe.endKeyValue(r)})):-1;return Nt.startSchema(r),Nt.addFields(r,n),Nt.addEndianness(r,XO?Qn.Little:Qn.Big),s!==-1&&Nt.addCustomMetadata(r,s),Nt.endSchema(r)}function zO(r,e){let t=-1,n=-1,s=-1,i=e.type,o=e.typeId;E.isDictionary(i)?(o=i.dictionary.typeId,s=_l.visit(i,r),n=_l.visit(i.dictionary,r)):n=_l.visit(i,r);let a=(i.children||[]).map(l=>O.encode(r,l)),c=at.createChildrenVector(r,a),u=e.metadata&&e.metadata.size>0?at.createCustomMetadataVector(r,[...e.metadata].map(([l,f])=>{let d=r.createString(`${l}`),h=r.createString(`${f}`);return Oe.startKeyValue(r),Oe.addKey(r,d),Oe.addValue(r,h),Oe.endKeyValue(r)})):-1;return e.name&&(t=r.createString(e.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,o),at.addChildren(r,c),at.addNullable(r,!!e.nullable),t!==-1&&at.addName(r,t),s!==-1&&at.addDictionary(r,s),u!==-1&&at.addCustomMetadata(r,u),at.endField(r)}function WO(r,e){let t=e.nodes||[],n=e.buffers||[],s=e.variadicBufferCounts||[];ot.startNodesVector(r,t.length);for(let u of t.slice().reverse())xr.encode(r,u);let i=r.endVector();ot.startBuffersVector(r,n.length);for(let u of n.slice().reverse())Ce.encode(r,u);let o=r.endVector(),a=null;e.compression!==null&&(a=T0(r,e.compression));let c=-1;return s.length>0&&(c=ot.createVariadicBufferCountsVector(r,s.map(BigInt))),ot.startRecordBatch(r),ot.addLength(r,BigInt(e.length)),ot.addNodes(r,i),ot.addBuffers(r,o),e.compression!==null&&a&&ot.addCompression(r,a),c!==-1&&ot.addVariadicBufferCounts(r,c),ot.endRecordBatch(r)}function T0(r,e){return yn.startBodyCompression(r),yn.addCodec(r,e.type),yn.addMethod(r,e.method),yn.endBodyCompression(r)}function $O(r,e){let t=$e.encode(r,e.data);return wn.startDictionaryBatch(r),wn.addId(r,BigInt(e.id)),wn.addIsDelta(r,e.isDelta),wn.addData(r,t),wn.endDictionaryBatch(r)}function qO(r,e){return Lo.createFieldNode(r,BigInt(e.length),BigInt(e.nullCount))}function KO(r,e){return Eo.createBuffer(r,BigInt(e.offset),BigInt(e.length))}var EO,LO,gt,$e,bt,Ce,xr,xi,XO,_s=p(()=>{ce();Mh();Vu();gh();wx();mh();Oh();bh();ju();Bo();yh();Ih();Th();xh();Lh();Bh();Sh();_h();Fh();Ah();vh();Eh();i0();ph();hh();mt();Ke();Qr();Me();o0();b0();we();EO=li,LO=Ze,gt=class r{static fromJSON(e,t){let n=new r(0,ge.V5,t);return n._createHeader=BO(e,t),n}static decode(e){e=new LO(k(e));let t=ur.getRootAsMessage(e),n=t.bodyLength(),s=t.version(),i=t.headerType(),o=jO(t),a=new r(n,s,i,void 0,o);return a._createHeader=FO(t,i),a}static encode(e){let t=new EO,n=-1;e.isSchema()?n=Q.encode(t,e.header()):e.isRecordBatch()?n=$e.encode(t,e.header()):e.isDictionaryBatch()&&(n=bt.encode(t,e.header()));let s=e.metadata&&e.metadata.size>0?ur.createCustomMetadataVector(t,[...e.metadata].map(([i,o])=>{let a=t.createString(`${i}`),c=t.createString(`${o}`);return Oe.startKeyValue(t),Oe.addKey(t,a),Oe.addValue(t,c),Oe.endKeyValue(t)})):-1;return ur.startMessage(t),ur.addVersion(t,ge.V5),ur.addHeader(t,n),ur.addHeaderType(t,e.headerType),ur.addBodyLength(t,BigInt(e.bodyLength)),s!==-1&&ur.addCustomMetadata(t,s),ur.finishMessageBuffer(t,ur.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Q)return new r(0,ge.V5,se.Schema,e);if(e instanceof $e)return new r(t,ge.V5,se.RecordBatch,e,e.metadata);if(e instanceof bt)return new r(t,ge.V5,se.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===se.Schema}isRecordBatch(){return this.headerType===se.RecordBatch}isDictionaryBatch(){return this.headerType===se.DictionaryBatch}constructor(e,t,n,s,i){this._version=t,this._headerType=n,this.body=new Uint8Array(0),this._compression=s?.compression,s&&(this._createHeader=()=>s),this._bodyLength=te(e),this._metadata=i||new Map}},$e=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(e,t,n,s,i=[],o){this._nodes=t,this._buffers=n,this._length=te(e),this._compression=s,this._variadicBufferCounts=i,this._metadata=o||new Map}},bt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=te(t)}},Ce=class{constructor(e,t){this.offset=te(e),this.length=te(t)}},xr=class{constructor(e,t){this.length=te(e),this.nullCount=te(t)}},xi=class{constructor(e,t=fi.BUFFER){this.type=e,this.method=t}};O.encode=zO;O.decode=VO;O.fromJSON=m0;Q.encode=GO;Q.decode=OO;Q.fromJSON=l0;$e.encode=WO;$e.decode=MO;$e.fromJSON=up;bt.encode=$O;bt.decode=DO;bt.fromJSON=f0;xr.encode=qO;xr.decode=kO;Ce.encode=KO;Ce.decode=RO;xi.encode=T0;xi.decode=x0;XO=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})()});var Ee,mc,Ti,Il,bc=p(()=>{kt();Va();Ee=Object.freeze({done:!0,value:void 0}),mc=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ti=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Il=class extends Ti{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return F(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Ee);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Qe.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Qe.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return F(this,void 0,void 0,function*(){return yield this.abort(e),Ee})}return(e){return F(this,void 0,void 0,function*(){return yield this.close(),Ee})}read(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((t,n)=>{this.resolvers.push({resolve:t,reject:n})}):Promise.resolve(Ee)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var Tr,_r,Gt,lp,Sn,As=p(()=>{kt();Va();gn();bc();Ke();Yn();Tr=class extends Il{write(e){if((e=k(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?vo(this.toUint8Array(!0)):this.toUint8Array(!1).then(vo)}toUint8Array(e=!1){return e?Qt(this._values)[0]:F(this,void 0,void 0,function*(){var t,n,s,i;let o=[],a=0;try{for(var c=!0,u=Ht(this),l;l=yield u.next(),t=l.done,!t;c=!0){i=l.value,c=!1;let f=i;o.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!t&&(s=u.return)&&(yield s.call(u))}finally{if(n)throw n.error}}return Qt(o,a)[0]})}},_r=class{constructor(e){e&&(this.source=new lp(Qe.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Gt=class r{constructor(e){e instanceof r?this.source=e.source:e instanceof Tr?this.source=new Sn(Qe.fromAsyncIterable(e)):Mu(e)?this.source=new Sn(Qe.fromNodeStream(e)):Ca(e)?this.source=new Sn(Qe.fromDOMStream(e)):Fu(e)?this.source=new Sn(Qe.fromDOMStream(e.body)):Br(e)?this.source=new Sn(Qe.fromIterable(e)):Yt(e)?this.source=new Sn(Qe.fromAsyncIterable(e)):br(e)&&(this.source=new Sn(Qe.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},lp=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,t="read"){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Ee)}return(e){return Object.create(this.source.return&&this.source.return(e)||Ee)}},Sn=class{constructor(e){this.source=e,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}cancel(e){return F(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return F(this,arguments,void 0,function*(t,n="read"){return yield this.source.next({cmd:n,size:t})})}throw(e){return F(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||Ee;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return F(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||Ee;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}}});var gc,vs,fp=p(()=>{kt();As();Ke();gc=class extends _r{constructor(e,t){super(),this.position=0,this.buffer=k(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:s}=this;return t&&s<n?(typeof e!="number"&&(e=Number.POSITIVE_INFINITY),this.position=Math.min(n,s+Math.min(n-s,e)),t.subarray(s,this.position)):null}readAt(e,t){let n=this.buffer,s=Math.min(this.size,e+t);return n?n.subarray(e,s):new Uint8Array(t)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},vs=class extends Gt{constructor(e,t){super(),this.position=0,this._handle=e,typeof t=="number"?this.size=t:this._pending=F(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return F(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return F(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:s}=this;if(t&&s<n){typeof e!="number"&&(e=Number.POSITIVE_INFINITY);let i=s,o=0,a=0,c=Math.min(n,i+Math.min(n-i,e)),u=new Uint8Array(Math.max(0,(this.position=c)-i));for(;(i+=a)<c&&(o+=a)<u.byteLength;)({bytesRead:a}=yield t.read(u,o,u.byteLength-o,i));return u}return null})}readAt(e,t){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:s}=this;if(n&&e+t<s){let i=Math.min(s,e+t),o=new Uint8Array(i-e);return(yield n.read(o,0,t,e)).buffer}return new Uint8Array(t)})}close(){return F(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}}});var hp={};J(hp,{BaseInt64:()=>yc,Int128:()=>wc,Int64:()=>En,Uint64:()=>De});function Wo(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var $o,dp,yc,De,En,wc,pp=p(()=>{$o=8,dp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],yc=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),s=t[3]*n[3];this.buffer[0]=s&65535;let i=s>>>16;return s=t[2]*n[3],i+=s,s=t[3]*n[2]>>>0,i+=s,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<s?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Wo(this.buffer[1])} ${Wo(this.buffer[0])}`}},De=class r extends yc{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,t=new Uint32Array(2)){return r.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return r.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){let n=e.length,s=new r(t);for(let i=0;i<n;){let o=$o<n-i?$o:n-i,a=new r(new Uint32Array([Number.parseInt(e.slice(i,i+o),10),0])),c=new r(new Uint32Array([dp[o],0]));s.times(c),s.plus(a),i+=o}return s}static convertArray(e){let t=new Uint32Array(e.length*2);for(let n=-1,s=e.length;++n<s;)r.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new r(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new r(new Uint32Array(e.buffer)).plus(t)}},En=class r extends yc{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(e,t=new Uint32Array(2)){return r.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return r.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){let n=e.startsWith("-"),s=e.length,i=new r(t);for(let o=n?1:0;o<s;){let a=$o<s-o?$o:s-o,c=new r(new Uint32Array([Number.parseInt(e.slice(o,o+a),10),0])),u=new r(new Uint32Array([dp[a],0]));i.times(u),i.plus(c),o+=a}return n?i.negate():i}static convertArray(e){let t=new Uint32Array(e.length*2);for(let n=-1,s=e.length;++n<s;)r.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new r(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new r(new Uint32Array(e.buffer)).plus(t)}},wc=class r{constructor(e){this.buffer=e}high(){return new En(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new En(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){let t=new De(new Uint32Array([this.buffer[3],0])),n=new De(new Uint32Array([this.buffer[2],0])),s=new De(new Uint32Array([this.buffer[1],0])),i=new De(new Uint32Array([this.buffer[0],0])),o=new De(new Uint32Array([e.buffer[3],0])),a=new De(new Uint32Array([e.buffer[2],0])),c=new De(new Uint32Array([e.buffer[1],0])),u=new De(new Uint32Array([e.buffer[0],0])),l=De.multiply(i,u);this.buffer[0]=l.low();let f=new De(new Uint32Array([l.high(),0]));return l=De.multiply(s,u),f.plus(l),l=De.multiply(i,c),f.plus(l),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(l)?1:0,this.buffer[2]=f.high(),new De(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(De.multiply(n,u)).plus(De.multiply(s,c)).plus(De.multiply(i,a)),this.buffer[3]+=De.multiply(t,u).plus(De.multiply(n,c)).plus(De.multiply(s,a)).plus(De.multiply(i,o)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Wo(this.buffer[3])} ${Wo(this.buffer[2])} ${Wo(this.buffer[1])} ${Wo(this.buffer[0])}`}static multiply(e,t){return new r(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new r(new Uint32Array(e.buffer)).plus(t)}static from(e,t=new Uint32Array(4)){return r.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(4)){return r.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(4)){let n=e.startsWith("-"),s=e.length,i=new r(t);for(let o=n?1:0;o<s;){let a=$o<s-o?$o:s-o,c=new r(new Uint32Array([Number.parseInt(e.slice(o,o+a),10),0,0,0])),u=new r(new Uint32Array([dp[a],0,0,0]));i.times(u),i.plus(c),o+=a}return n?i.negate():i}static convertArray(e){let t=new Uint32Array(e.length*4);for(let n=-1,s=e.length;++n<s;)r.from(e[n],new Uint32Array(t.buffer,t.byteOffset+16*n,4));return t}}});var wp={};J(wp,{toIntervalDayTimeInt32Array:()=>mp,toIntervalDayTimeObjects:()=>gp,toIntervalMonthDayNanoInt32Array:()=>bp,toIntervalMonthDayNanoObjects:()=>yp});function mp(r){var e,t;let n=r.length,s=new Int32Array(n*2);for(let i=0,o=0;i<n;i++){let a=r[i];s[o++]=(e=a.days)!==null&&e!==void 0?e:0,s[o++]=(t=a.milliseconds)!==null&&t!==void 0?t:0}return s}function bp(r){var e,t;let n=r.length,s=new Int32Array(n*4);for(let i=0,o=0;i<n;i++){let a=r[i];s[o++]=(e=a.months)!==null&&e!==void 0?e:0,s[o++]=(t=a.days)!==null&&t!==void 0?t:0;let c=a.nanoseconds;if(c){let u=BigInt(c);s[o++]=Number(u&BigInt(4294967295))>>>0,s[o++]=Number(u>>BigInt(32))>>>0}else o+=2}return s}function gp(r){let e=r.length,t=new Array(e/2);for(let n=0,s=0;n<e;n+=2)t[s++]={days:r[n],milliseconds:r[n+1]};return t}function yp(r,e){let t=r.length,n=new Array(t/4);for(let s=0,i=0;s<t;s+=4){let o=BigInt(r[s+3])<<BigInt(32)|BigInt(r[s+2]>>>0);n[i++]={months:r[s],days:r[s+1],nanoseconds:e?`${o}`:o}}return n}var Sl=p(()=>{});function A0(r){let e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t>>1]=Number.parseInt(r.slice(t,t+2),16);return e}function HO(r){return A0(r.join(""))}function v0(r,e){let t=new Uint8Array(r.length*16),n=new DataView(t.buffer);for(let[s,i]of r.entries()){let o=s*16,a=i.SIZE;if(n.setInt32(o,a,!0),i.INLINED!==void 0){let c=e(i.INLINED);for(let u=0;u<c.length&&u<12;u++)t[o+4+u]=c[u]}else{let c=i.PREFIX_HEX;for(let u=0;u<8&&u<c.length;u+=2)t[o+4+(u>>1)]=Number.parseInt(c.slice(u,u+2),16);n.setInt32(o+8,i.BUFFER_INDEX,!0),n.setInt32(o+12,i.OFFSET,!0)}}return t}function JO(r){return v0(r,e=>{let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t})}function YO(r){return v0(r,e=>new TextEncoder().encode(e))}var qo,El,Ll,I0=p(()=>{wr();mt();we();Vt();gi();gn();pp();Me();Ke();Sl();qo=class extends R{constructor(e,t,n,s,i=ge.V5,o=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=s,this.metadataVersion=i,this.variadicBufferCounts=o}visit(e){return super.visit(e instanceof O?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return D({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitUtf8View(e,{length:t,nullCount:n}=this.nextFieldNode()){let s=this.readNullBitmap(e,n),i=this.readData(e),o=this.readVariadicBuffers(this.nextVariadicBufferCount());return D({type:e,length:t,nullCount:n,nullBitmap:s,views:i,variadicBuffers:o})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinaryView(e,{length:t,nullCount:n}=this.nextFieldNode()){let s=this.readNullBitmap(e,n),i=this.readData(e),o=this.readVariadicBuffers(this.nextVariadicBufferCount());return D({type:e,length:t,nullCount:n,nullBitmap:s,views:i,variadicBuffers:o})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitLargeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<ge.V5&&this.readNullBitmap(e,n),e.mode===he.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array(0)}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readVariadicBuffers(e){return Array.from({length:e},()=>this.readData(null))}nextVariadicBufferCount(){var e;return(e=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&e!==void 0?e:0}readDictionary(e){return this.dictionaries.get(e.id)}},El=class extends qo{constructor(e,t,n,s,i,o=[]){super(new Uint8Array(0),t,n,s,i,o),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array(0):bi(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return ee(Uint8Array,ee(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return ee(Uint8Array,ee(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;if(E.isTimestamp(e))return ee(Uint8Array,En.convertArray(n[t]));if((E.isInt(e)||E.isTime(e))&&e.bitWidth===64||E.isDuration(e))return ee(Uint8Array,En.convertArray(n[t]));if(E.isDate(e)&&e.unit===ye.MILLISECOND)return ee(Uint8Array,En.convertArray(n[t]));if(E.isDecimal(e))return ee(Uint8Array,wc.convertArray(n[t]));if(E.isBinary(e)||E.isLargeBinary(e)||E.isFixedSizeBinary(e))return HO(n[t]);if(E.isBinaryView(e))return JO(n[t]);if(E.isUtf8View(e))return YO(n[t]);if(E.isBool(e))return bi(n[t]);if(E.isUtf8(e)||E.isLargeUtf8(e))return Jt(n[t].join(""));if(E.isInterval(e))switch(e.unit){case ae.DAY_TIME:return mp(n[t]);case ae.MONTH_DAY_NANO:return bp(n[t]);default:break}return ee(Uint8Array,ee(e.ArrayType,n[t].map(s=>+s)))}readVariadicBuffers(e){let t=[];for(let n=0;n<e;n++){let{offset:s}=this.nextBufferRange(),i=this.sources[s];t.push(A0(i))}return t}};Ll=class extends qo{constructor(e,t,n,s,i,o=[]){super(new Uint8Array(0),t,n,s,i,o),this.bodyChunks=e}readData(e,t=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var Ln,Bl=p(()=>{jr();Se();Ke();Ln=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,k(t))}_flushPending(e,t){let n=this._offsets,s=this._values.reserve(t).buffer,i=0;for(let[o,a]of e)if(a===void 0)n.set(o,0);else{let c=a.length;s.set(a,i),n.set(o,c),i+=c}}}});var Bn,Fl=p(()=>{Ke();jr();Se();Bn=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,k(t))}_flushPending(e,t){let n=this._offsets,s=this._values.reserve(t).buffer,i=0;for(let[o,a]of e)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;s.set(a,i),n.set(o,BigInt(c)),i+=c}}}});var _i,xp=p(()=>{jr();Se();_i=class extends Te{constructor(e){super(e),this._values=new zo}setValue(e,t){this._values.set(e,+t)}}});var nn,Is,Ss,Tp=p(()=>{Se();ar();nn=class extends We{};nn.prototype._setValue=jh;Is=class extends nn{};Is.prototype._setValue=$u;Ss=class extends nn{};Ss.prototype._setValue=qu});var Es,_p=p(()=>{Se();ar();Es=class extends We{};Es.prototype._setValue=Wh});var Ai,Ap=p(()=>{we();Se();xc();Ai=class extends Te{constructor({type:e,nullValues:t,dictionaryHashFunction:n}){super({type:new Ge(e.dictionary,e.indices,e.id,e.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=zr({type:this.type.indices,nullValues:t}),this.dictionary=zr({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(e){return this.indices.isValid(e)}setValid(e,t){let n=this.indices;return t=n.setValid(e,t),this.length=n.length,t}setValue(e,t){let n=this._keysToIndices,s=this.valueToKey(t),i=n[s];return i===void 0&&(n[s]=i=this._dictionaryOffset+this.dictionary.append(t).length-1),this.indices.setValue(e,i)}flush(){let e=this.type,t=this._dictionary,n=this.dictionary.toVector(),s=this.indices.flush().clone(e);return s.dictionary=t?t.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(e){return typeof e=="string"?e:`${e}`}}});var Ls,vp=p(()=>{Se();ar();Ls=class extends We{};Ls.prototype._setValue=Vh});var vi,Ip=p(()=>{mt();Se();we();vi=class extends Te{setValue(e,t){let[n]=this.children,s=e*this.stride;for(let i=-1,o=this.stride;++i<o;)n.set(s+i,t[i])}setValid(e,t){return super.setValid(e,t)||this.children[0].setValid((e+1)*this.stride-1,!1),t}addChild(e,t="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(e);return this.type=new Be(this.type.listSize,new O(t,e.type,!0)),n}}});var sn,Ii,Si,Ei,Sp=p(()=>{uc();Se();sn=class extends We{setValue(e,t){this._values.set(e,t)}},Ii=class extends sn{setValue(e,t){super.setValue(e,cc(t))}},Si=class extends sn{},Ei=class extends sn{}});var Wr,Bs,Fs,Os,Ep=p(()=>{Se();ar();Wr=class extends We{};Wr.prototype._setValue=$h;Bs=class extends Wr{};Bs.prototype._setValue=tl;Fs=class extends Wr{};Fs.prototype._setValue=rl;Os=class extends Wr{};Os.prototype._setValue=nl});var Ar,Ms,Ds,Rs,ks,Lp=p(()=>{Se();ar();Ar=class extends We{};Ar.prototype._setValue=qh;Ms=class extends Ar{};Ms.prototype._setValue=sl;Ds=class extends Ar{};Ds.prototype._setValue=il;Rs=class extends Ar{};Rs.prototype._setValue=ol;ks=class extends Ar{};ks.prototype._setValue=al});var Ft,Li,Bi,Fi,Oi,Mi,Di,Ri,ki,Bp=p(()=>{Se();Ft=class extends We{setValue(e,t){this._values.set(e,t)}},Li=class extends Ft{},Bi=class extends Ft{},Fi=class extends Ft{},Oi=class extends Ft{},Mi=class extends Ft{},Di=class extends Ft{},Ri=class extends Ft{},ki=class extends Ft{}});var Ni,Fp=p(()=>{mt();we();jr();Se();Ni=class extends pt{constructor(e){super(e),this._offsets=new Ts(e.type)}addChild(e,t="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new je(new O(t,e.type,!0)),this.numChildren-1}_flushPending(e){let t=this._offsets,[n]=this.children;for(let[s,i]of e)if(typeof i>"u")t.set(s,0);else{let o=i,a=o.length,c=t.set(s,a).buffer[s];for(let u=-1;++u<a;)n.set(c+u,o[u])}}}});var Ci,Op=p(()=>{mt();we();jr();Qr();Se();Ci=class extends pt{constructor(e){super(e),this._offsets=new Ts(e.type)}addChild(e,t="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new ir(new O(t,e.type,!0)),this.numChildren-1}_flushPending(e){let t=this._offsets,[n]=this.children;for(let[s,i]of e)if(typeof i>"u")t.set(s,BigInt(0));else{let o=i,a=o.length,c=te(t.set(s,BigInt(a)).buffer[s]);for(let u=-1;++u<a;)n.set(c+u,o[u])}}}});var Ui,Mp=p(()=>{mt();we();Se();Ui=class extends pt{set(e,t){return super.set(e,t)}setValue(e,t){let n=t instanceof Map?t:new Map(Object.entries(t)),s=this._pending||(this._pending=new Map),i=s.get(e);i&&(this._pendingLength-=i.size),this._pendingLength+=n.size,s.set(e,n)}addChild(e,t=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new dt(new O(t,e.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(e){let t=this._offsets,[n]=this.children;for(let[s,i]of e)if(i===void 0)t.set(s,0);else{let{[s]:o,[s+1]:a}=t.set(s,i.size).buffer;for(let c of i.entries())if(n.set(o,c),++o>=a)break}}}});var Pi,Dp=p(()=>{Se();Pi=class extends Te{setValue(e,t){}setValid(e,t){return this.length=Math.max(e+1,this.length),t}}});var Vi,Rp=p(()=>{mt();Se();we();Vi=class extends Te{setValue(e,t){let{children:n,type:s}=this;switch(Array.isArray(t)||t.constructor){case!0:return s.children.forEach((i,o)=>n[o].set(e,t[o]));case Map:return s.children.forEach((i,o)=>n[o].set(e,t.get(i.name)));default:return s.children.forEach((i,o)=>n[o].set(e,t[i.name]))}}setValid(e,t){return super.setValid(e,t)||this.children.forEach(n=>n.setValid(e,t)),t}addChild(e,t=`${this.numChildren}`){let n=this.children.push(e);return this.type=new pe([...this.type.children,new O(t,e.type,!0)]),n}}});var vr,Ns,Cs,Us,Ps,kp=p(()=>{Se();ar();vr=class extends We{};vr.prototype._setValue=Gh;Ns=class extends vr{};Ns.prototype._setValue=Ku;Cs=class extends vr{};Cs.prototype._setValue=Xu;Us=class extends vr{};Us.prototype._setValue=Hu;Ps=class extends vr{};Ps.prototype._setValue=Ju});var Ir,Vs,js,Gs,zs,Np=p(()=>{Se();ar();Ir=class extends We{};Ir.prototype._setValue=zh;Vs=class extends Ir{};Vs.prototype._setValue=Yu;js=class extends Ir{};js.prototype._setValue=Qu;Gs=class extends Ir{};Gs.prototype._setValue=Zu;zs=class extends Ir{};zs.prototype._setValue=el});var Fn,ji,Gi,Cp=p(()=>{mt();jr();Se();we();Fn=class extends Te{constructor(e){super(e),this._typeIds=new vn(Int8Array,0,1),typeof e.valueToChildTypeId=="function"&&(this._valueToChildTypeId=e.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(e,t){return this.set(this.length,e,t)}set(e,t,n){return n===void 0&&(n=this._valueToChildTypeId(this,t,e)),this.setValue(e,t,n),this}setValue(e,t,n){this._typeIds.set(e,n);let s=this.type.typeIdToChildIndex[n],i=this.children[s];i?.set(e,t),this.length=Math.max(e+1,this.length)}addChild(e,t=`${this.children.length}`){let n=this.children.push(e),{type:{children:s,mode:i,typeIds:o}}=this,a=[...s,new O(t,e.type)];return this.type=new Bt(i,[...o,n],a),n}_valueToChildTypeId(e,t,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},ji=class extends Fn{},Gi=class extends Fn{constructor(e){super(e),this._offsets=new vn(Int32Array)}setValue(e,t,n){let s=this._typeIds.set(e,n).buffer[e],i=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(e,i.length).buffer[e];i?.set(o,t),this.length=Math.max(e+1,this.length)}}});var Ws,Up=p(()=>{gn();Bl();jr();Se();Ws=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,Jt(t))}_flushPending(e,t){}};Ws.prototype._flushPending=Ln.prototype._flushPending});var $s,Pp=p(()=>{gn();jr();Se();Fl();$s=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,Jt(t))}_flushPending(e,t){}};$s.prototype._flushPending=Bn.prototype._flushPending});var On,Ol=p(()=>{we();Se();jr();Ke();wr();On=class extends Te{constructor(e){super(e),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new jt(Uint8Array)}get byteLength(){let e=0;this._views&&(e+=this._views.byteLength),this._nulls&&(e+=this._nulls.byteLength);for(let t of this._variadicBuffers)e+=t.byteLength;return this._currentBuffer&&(e+=this._currentBuffer.byteLength),e}setValue(e,t){return this.writeBinaryValue(e,this.encodeValue(t))}writeBinaryValue(e,t){let n=t.length,s=(e+1)*Z.ELEMENT_WIDTH,i=this._views.length;s>i&&this._views.reserve(s-i);let o=this._views.buffer,a=e*Z.ELEMENT_WIDTH,c=new DataView(o.buffer,o.byteOffset+a,Z.ELEMENT_WIDTH);if(c.setInt32(Z.LENGTH_OFFSET,n,!0),n<=Z.INLINE_CAPACITY){o.set(t,a+Z.INLINE_OFFSET);for(let u=n;u<Z.INLINE_CAPACITY;u++)o[a+Z.INLINE_OFFSET+u]=0}else{let u=new DataView(t.buffer,t.byteOffset,Math.min(4,n));c.setUint32(Z.INLINE_OFFSET,u.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new jt(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(t,this._currentBufferOffset),c.setInt32(Z.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(Z.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(e){return k(e)}setValid(e,t){let n=(e+1)*Z.ELEMENT_WIDTH,s=this._views.length;n>s&&this._views.reserve(n-s);let i=super.setValid(e,t);if(!i){let o=this._views.buffer,a=e*Z.ELEMENT_WIDTH;for(let c=0;c<Z.ELEMENT_WIDTH;c++)o[a+c]=0}return i}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:e,length:t,nullCount:n,_views:s,_nulls:i}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let o=s.flush(t*Z.ELEMENT_WIDTH),a=n>0?i.flush(t):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),D({type:e,length:t,nullCount:n,nullBitmap:a,views:o,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var zi,Vp=p(()=>{Ol();gn();zi=class extends On{constructor(e){super(e)}setValue(e,t){return this.writeBinaryValue(e,Jt(t))}}});var jp,S0,E0=p(()=>{Vt();Bl();Fl();xp();Tp();_p();Ap();vp();Ip();Sp();Ep();Lp();Bp();Fp();Op();Mp();Dp();Rp();kp();Np();Cp();Up();Pp();Ol();Vp();jp=class extends R{visitNull(){return Pi}visitBool(){return _i}visitInt(){return Ft}visitInt8(){return Li}visitInt16(){return Bi}visitInt32(){return Fi}visitInt64(){return Oi}visitUint8(){return Mi}visitUint16(){return Di}visitUint32(){return Ri}visitUint64(){return ki}visitFloat(){return sn}visitFloat16(){return Ii}visitFloat32(){return Si}visitFloat64(){return Ei}visitUtf8(){return Ws}visitLargeUtf8(){return $s}visitBinary(){return Ln}visitLargeBinary(){return Bn}visitFixedSizeBinary(){return Ls}visitDate(){return nn}visitDateDay(){return Is}visitDateMillisecond(){return Ss}visitTimestamp(){return vr}visitTimestampSecond(){return Ns}visitTimestampMillisecond(){return Cs}visitTimestampMicrosecond(){return Us}visitTimestampNanosecond(){return Ps}visitTime(){return Ir}visitTimeSecond(){return Vs}visitTimeMillisecond(){return js}visitTimeMicrosecond(){return Gs}visitTimeNanosecond(){return zs}visitDecimal(){return Es}visitList(){return Ni}visitLargeList(){return Ci}visitStruct(){return Vi}visitUnion(){return Fn}visitDenseUnion(){return Gi}visitSparseUnion(){return ji}visitDictionary(){return Ai}visitInterval(){return Wr}visitIntervalDayTime(){return Bs}visitIntervalYearMonth(){return Fs}visitIntervalMonthDayNano(){return Os}visitDuration(){return Ar}visitDurationSecond(){return Ms}visitDurationMillisecond(){return Ds}visitDurationMicrosecond(){return Rs}visitDurationNanosecond(){return ks}visitFixedSizeList(){return vi}visitMap(){return Ui}visitBinaryView(){return On}visitUtf8View(){return zi}},S0=new jp});function Ot(r,e){return e instanceof r.constructor}function Mn(r,e){return r===e||Ot(r,e)}function Dn(r,e){return r===e||Ot(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function Ml(r,e){return r===e||Ot(r,e)&&r.precision===e.precision}function QO(r,e){return r===e||Ot(r,e)&&r.byteWidth===e.byteWidth}function Gp(r,e){return r===e||Ot(r,e)&&r.unit===e.unit}function Tc(r,e){return r===e||Ot(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function _c(r,e){return r===e||Ot(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function L0(r,e){return r===e||Ot(r,e)&&r.children.length===e.children.length&&on.compareManyFields(r.children,e.children)}function ZO(r,e){return r===e||Ot(r,e)&&r.children.length===e.children.length&&on.compareManyFields(r.children,e.children)}function zp(r,e){return r===e||Ot(r,e)&&r.mode===e.mode&&r.typeIds.every((t,n)=>t===e.typeIds[n])&&on.compareManyFields(r.children,e.children)}function eM(r,e){return r===e||Ot(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&on.visit(r.indices,e.indices)&&on.visit(r.dictionary,e.dictionary)}function Dl(r,e){return r===e||Ot(r,e)&&r.unit===e.unit}function Ac(r,e){return r===e||Ot(r,e)&&r.unit===e.unit}function tM(r,e){return r===e||Ot(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&on.compareManyFields(r.children,e.children)}function rM(r,e){return r===e||Ot(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&on.compareManyFields(r.children,e.children)}function Wi(r,e){return on.compareSchemas(r,e)}function B0(r,e){return on.compareFields(r,e)}function Rl(r,e){return on.visit(r,e)}var V,on,vc=p(()=>{Vt();V=class extends R{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((n,s)=>this.compareFields(n,t[s]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};V.prototype.visitNull=Mn;V.prototype.visitBool=Mn;V.prototype.visitInt=Dn;V.prototype.visitInt8=Dn;V.prototype.visitInt16=Dn;V.prototype.visitInt32=Dn;V.prototype.visitInt64=Dn;V.prototype.visitUint8=Dn;V.prototype.visitUint16=Dn;V.prototype.visitUint32=Dn;V.prototype.visitUint64=Dn;V.prototype.visitFloat=Ml;V.prototype.visitFloat16=Ml;V.prototype.visitFloat32=Ml;V.prototype.visitFloat64=Ml;V.prototype.visitUtf8=Mn;V.prototype.visitLargeUtf8=Mn;V.prototype.visitUtf8View=Mn;V.prototype.visitBinary=Mn;V.prototype.visitLargeBinary=Mn;V.prototype.visitBinaryView=Mn;V.prototype.visitFixedSizeBinary=QO;V.prototype.visitDate=Gp;V.prototype.visitDateDay=Gp;V.prototype.visitDateMillisecond=Gp;V.prototype.visitTimestamp=Tc;V.prototype.visitTimestampSecond=Tc;V.prototype.visitTimestampMillisecond=Tc;V.prototype.visitTimestampMicrosecond=Tc;V.prototype.visitTimestampNanosecond=Tc;V.prototype.visitTime=_c;V.prototype.visitTimeSecond=_c;V.prototype.visitTimeMillisecond=_c;V.prototype.visitTimeMicrosecond=_c;V.prototype.visitTimeNanosecond=_c;V.prototype.visitDecimal=Mn;V.prototype.visitList=L0;V.prototype.visitLargeList=L0;V.prototype.visitStruct=ZO;V.prototype.visitUnion=zp;V.prototype.visitDenseUnion=zp;V.prototype.visitSparseUnion=zp;V.prototype.visitDictionary=eM;V.prototype.visitInterval=Dl;V.prototype.visitIntervalDayTime=Dl;V.prototype.visitIntervalYearMonth=Dl;V.prototype.visitIntervalMonthDayNano=Dl;V.prototype.visitDuration=Ac;V.prototype.visitDurationSecond=Ac;V.prototype.visitDurationMillisecond=Ac;V.prototype.visitDurationMicrosecond=Ac;V.prototype.visitDurationNanosecond=Ac;V.prototype.visitFixedSizeList=tM;V.prototype.visitMap=rM;on=new V});function zr(r){let e=r.type,t=new(S0.getVisitFn(e)())(r);if(e.children&&e.children.length>0){let n=r.children||[],s={nullValues:r.nullValues},i=Array.isArray(n)?((o,a)=>n[a]||s):(({name:o})=>n[o]||s);for(let[o,a]of e.children.entries()){let{type:c}=a,u=i(a,o);t.children.push(zr(Object.assign(Object.assign({},u),{type:c})))}}return t}function Ko(r,e){if(r instanceof G||r instanceof B||r.type instanceof E||ArrayBuffer.isView(r))return rn(r);let t={type:e??kl(r),nullValues:[null]},n=[...Nl(t)(r)],s=n.length===1?n[0]:n.reduce((i,o)=>i.concat(o));return E.isDictionary(s.type)?s.memoize():s}function Wp(r){let e=Ko(r),t=new de(new Q(e.type.children),e.data[0]);return new me(t)}function kl(r){if(r.length===0)return new Ne;let e=0,t=0,n=0,s=0,i=0,o=0,a=0,c=0;for(let u of r){if(u==null){++e;continue}switch(typeof u){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++s;continue;case"string":++i;continue;case"object":Array.isArray(u)?++t:Object.prototype.toString.call(u)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(s+e===r.length)return new sr;if(i+e===r.length)return new Ge(new ut,new Pe);if(o+e===r.length)return new tr;if(a+e===r.length)return new lt;if(c+e===r.length)return new Zr;if(t+e===r.length){let u=r,l=kl(u[u.findIndex(f=>f!=null)]);if(u.every(f=>f==null||Rl(l,kl(f))))return new je(new O("",l,!0))}else if(n+e===r.length){let u=new Map;for(let l of r)for(let f of Object.keys(l))!u.has(f)&&l[f]!=null&&u.set(f,new O(f,kl([l[f]]),!0));return new pe([...u.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function Nl(r){let{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=e!=="bytes"?"length":"byteLength";return function*(s){let i=0,o=zr(r);for(let a of s)o.append(a)[n]>=t&&++i&&(yield o.toVector());(o.finish().length>0||i===0)&&(yield o.toVector())}}function $p(r){let{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=e!=="bytes"?"length":"byteLength";return function(s){return _t(this,arguments,function*(){var i,o,a,c;let u=0,l=zr(r);try{for(var f=!0,d=Ht(s),h;h=yield Y(d.next()),i=h.done,!i;f=!0){c=h.value,f=!1;let m=c;l.append(m)[n]>=t&&++u&&(yield yield Y(l.toVector()))}}catch(m){o={error:m}}finally{try{!f&&!i&&(a=d.return)&&(yield Y(a.call(d)))}finally{if(o)throw o.error}}(l.finish().length>0||u===0)&&(yield yield Y(l.toVector()))})}}var xc=p(()=>{kt();mt();we();wr();ht();E0();$i();Rn();vc()});function Cl(r,e){return nM(r,e.map(t=>t.data.concat()))}function nM(r,e){let t=[...r.fields],n=[],s={numBatches:e.reduce((f,d)=>Math.max(f,d.length),0)},i=0,o=0,a=-1,c=e.length,u,l=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)l[a]=u=e[a].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(l=sM(t,o,l,e,s),o>0&&(n[i++]=D({type:new pe(t),length:o,nullCount:0,children:l.slice()})))}return[r=r.assign(t),n.map(f=>new de(r,f))]}function sM(r,e,t,n,s){var i;let o=(e+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let u=t[a],l=u?.length;if(l>=e)l===e?t[a]=u:(t[a]=u.slice(0,e),s.numBatches=Math.max(s.numBatches,n[a].unshift(u.slice(e,l-e))));else{let f=r[a];r[a]=f.clone({nullable:!0}),t[a]=(i=u?._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:D({type:f.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)})}}return t}var F0=p(()=>{wr();we();Rn()});function qp(r){let e={},t=Object.entries(r);for(let[n,s]of t)e[n]=rn(s);return new me(e)}function Kp(r){let e={},t=Object.entries(r);for(let[n,s]of t)e[n]=Ko(s);return new me(e)}var O0,M0,me,$i=p(()=>{Me();wr();xc();ht();mt();we();vc();F0();gl();hi();ar();yl();wl();Po();Rn();M0=Symbol.for("apache-arrow/Table"),me=class r{static isTable(e){return e?.[M0]===!0}constructor(...e){var t,n;if(e.length===0)return this.batches=[],this.schema=new Q([]),this._offsets=[0],this;let s,i;e[0]instanceof Q&&(s=e.shift()),e.at(-1)instanceof Uint32Array&&(i=e.pop());let o=c=>{if(c){if(c instanceof de)return[c];if(c instanceof r)return c.batches;if(c instanceof G){if(c.type instanceof pe)return[new de(new Q(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){let u=Object.keys(c),l=u.map(h=>new B([c[h]])),f=s??new Q(u.map((h,m)=>new O(String(h),l[m].type,l[m].nullable))),[,d]=Cl(f,l);return d.length===0?[new de(c)]:d}}}return[]},a=e.flatMap(c=>o(c));if(s=(n=s??((t=a[0])===null||t===void 0?void 0:t.schema))!==null&&n!==void 0?n:new Q([]),!(s instanceof Q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof de))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Wi(s,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=i??hl(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=dl(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(pi(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?Go.visit(new B(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
18
+ return true;`)}function _M(r){return typeof r!="bigint"?kr(r):`${kr(r)}n`}var W0=p(()=>{lc()});function Op(r,e){let t=Math.ceil(r)*e-1;return(t-t%64+64||64)/e}function $0(r,e=0){return r.length>=e?r.subarray(0,e):Ka(new r.constructor(e),r,0)}var jt,Sn,Xo,vs,Gr=p(()=>{Ke();jt=class{constructor(e,t=0,n=1){this.length=Math.ceil(t/n),this.buffer=new e(this.length),this.stride=n,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(e,t){return this}append(e){return this.set(this.length,e)}reserve(e){if(e>0){this.length+=e;let t=this.stride,n=this.length*t,s=this.buffer.length;n>=s&&this._resize(s===0?Op(n*1,this.BYTES_PER_ELEMENT):Op(n*2,this.BYTES_PER_ELEMENT))}return this}flush(e=this.length){e=Op(e*this.stride,this.BYTES_PER_ELEMENT);let t=$0(this.buffer,e);return this.clear(),t}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(e){return this.buffer=$0(this.buffer,e)}},Sn=class extends jt{last(){return this.get(this.length-1)}get(e){return this.buffer[e]}set(e,t){return this.reserve(e-this.length+1),this.buffer[e*this.stride]=t,this}},Xo=class extends Sn{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(e){return this.buffer[e>>3]>>e%8&1}set(e,t){let{buffer:n}=this.reserve(e-this.length+1),s=e>>3,i=e%8,o=n[s]>>i&1;return t?o===0&&(n[s]|=1<<i,++this.numValid):o===1&&(n[s]&=~(1<<i),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},vs=class extends Sn{constructor(e){super(e.OffsetArrayType,1,1)}append(e){return this.set(this.length-1,e)}set(e,t){let n=this.length-1,s=this.reserve(e-n+1).buffer;return n<e++&&n>=0&&s.fill(s[n],n,e),s[e]=s[e-1]+t,this}flush(e=this.length-1){return e>this.length&&this.set(e-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(e+1)}}});var Te,We,pt,Se=p(()=>{ht();wr();wc();we();W0();Gr();Te=class{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e){throw new Error('"throughDOM" not available in this environment')}constructor({type:e,nullValues:t}){this.length=0,this.finished=!1,this.type=e,this.children=[],this.nullValues=t,this.stride=or(e),this._nulls=new Xo,t&&t.length>0&&(this._isValid=z0(t))}toVector(){return new B([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let e=0,{_offsets:t,_values:n,_nulls:s,_typeIds:i,children:o}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),s&&(e+=s.byteLength),i&&(e+=i.byteLength),o.reduce((a,c)=>a+c.byteLength,e)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let e=0;return this._offsets&&(e+=this._offsets.reservedByteLength),this._values&&(e+=this._values.reservedByteLength),this._nulls&&(e+=this._nulls.reservedByteLength),this._typeIds&&(e+=this._typeIds.reservedByteLength),this.children.reduce((t,n)=>t+n.reservedByteLength,e)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(e){return this.set(this.length,e)}isValid(e){return this._isValid(e)}set(e,t){return this.setValid(e,this.isValid(t))&&this.setValue(e,t),this}setValue(e,t){this._setValue(this,e,t)}setValid(e,t){return this.length=this._nulls.set(e,+t).length,t}addChild(e,t=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(e){return this.children[e]||null}flush(){let e,t,n,s,{type:i,length:o,nullCount:a,_typeIds:c,_offsets:u,_values:l,_nulls:f}=this;(t=c?.flush(o))?s=u?.flush(o):(s=u?.flush(o))?e=l?.flush(u.last()):e=l?.flush(o),a>0&&(n=f?.flush(o));let d=this.children.map(h=>h.flush());return this.clear(),D({type:i,length:o,nullCount:a,children:d,child:d[0],data:e,typeIds:t,nullBitmap:n,valueOffsets:s})}finish(){this.finished=!0;for(let e of this.children)e.finish();return this}clear(){var e,t,n,s;this.length=0,(e=this._nulls)===null||e===void 0||e.clear(),(t=this._values)===null||t===void 0||t.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let i of this.children)i.clear();return this}};Te.prototype.length=1;Te.prototype.stride=1;Te.prototype.children=null;Te.prototype.finished=!1;Te.prototype.nullValues=null;Te.prototype._isValid=()=>!0;We=class extends Te{constructor(e){super(e),this._values=new Sn(this.ArrayType,0,this.stride)}setValue(e,t){let n=this._values;return n.reserve(e-n.length+1),super.setValue(e,t)}},pt=class extends Te{constructor(e){super(e),this._pendingLength=0,this._offsets=new vs(e.type)}setValue(e,t){let n=this._pending||(this._pending=new Map),s=n.get(e);s&&(this._pendingLength-=s.length),this._pendingLength+=t instanceof yr?t[_s].length:t.length,n.set(e,t)}setValid(e,t){return super.setValid(e,t)?!0:((this._pending||(this._pending=new Map)).set(e,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let e=this._pending,t=this._pendingLength;return this._pendingLength=0,this._pending=void 0,e&&e.size>0&&this._flushPending(e,t),this}}});var vi,Mp=p(()=>{vi=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,t,n,s){return e.prep(8,24),e.writeInt64(BigInt(s??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}}});var cr,q0=p(()=>{ce();Mp();ko();Zu();op();cr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ge.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Nt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new vi).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new vi).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Me).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,ge.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}}});function Pl(r,e){return new Map([...r||new Map,...e||new Map])}function Dp(r,e=new Map){for(let t=-1,n=r.length;++t<n;){let i=r[t].type;if(E.isDictionary(i)){if(!e.has(i.id))e.set(i.id,i.dictionary);else if(e.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&Dp(i.children,e)}return e}var K0,H0,Q,O,mt=p(()=>{De();we();K0=Symbol.for("apache-arrow/Schema"),H0=Symbol.for("apache-arrow/Field"),Q=class r{static isSchema(e){return e?.[K0]===!0}constructor(e=[],t,n,s=ge.V5){this.fields=e||[],this.metadata=t||new Map,n||(n=Dp(this.fields)),this.dictionaries=n,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(", ")} }>`}select(e){let t=new Set(e),n=this.fields.filter(s=>t.has(s.name));return new r(n,this.metadata)}selectAt(e){let t=e.map(n=>this.fields[n]).filter(Boolean);return new r(t,this.metadata)}assign(...e){let t=e[0]instanceof r?e[0]:Array.isArray(e[0])?new r(e[0]):new r(e),n=[...this.fields],s=Pl(Pl(new Map,this.metadata),t.metadata),i=t.fields.filter(a=>{let c=n.findIndex(u=>u.name===a.name);return~c?(n[c]=a.clone({metadata:Pl(Pl(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Dp(i,new Map);return new r([...n,...i],s,new Map([...this.dictionaries,...o]))}};Q.prototype.fields=null;Q.prototype.metadata=null;Q.prototype.dictionaries=null;Q.prototype[K0]=!0;Object.defineProperty(Q,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===Q&&Q.isSchema(e)}});O=class r{static isField(e){return e?.[H0]===!0}static new(...e){let[t,n,s,i]=e;return e[0]&&typeof e[0]=="object"&&({name:t}=e[0],n===void 0&&(n=e[0].type),s===void 0&&(s=e[0].nullable),i===void 0&&(i=e[0].metadata)),new r(`${t}`,n,s,i)}constructor(e,t,n=!1,s){this.name=e,this.type=t,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[t,n,s,i]=e;return!e[0]||typeof e[0]!="object"?[t=this.name,n=this.type,s=this.nullable,i=this.metadata]=e:{name:t=this.name,type:n=this.type,nullable:s=this.nullable,metadata:i=this.metadata}=e[0],r.new(t,n,s,i)}};O.prototype.type=null;O.prototype.name=null;O.prototype.nullable=null;O.prototype.metadata=null;O.prototype[H0]=!0;Object.defineProperty(O,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===O&&O.isField(e)}})});var AM,vM,En,Rp,zr,kp=p(()=>{Mp();q0();ce();mt();De();Ke();en();AM=mi,vM=Ze,En=class{static decode(e){e=new vM(k(e));let t=cr.getRootAsFooter(e),n=Q.decode(t.schema(),new Map,t.version());return new Rp(n,t)}static encode(e){let t=new AM,n=Q.encode(t,e.schema);cr.startRecordBatchesVector(t,e.numRecordBatches);for(let o of[...e.recordBatches()].slice().reverse())zr.encode(t,o);let s=t.endVector();cr.startDictionariesVector(t,e.numDictionaries);for(let o of[...e.dictionaryBatches()].slice().reverse())zr.encode(t,o);let i=t.endVector();return cr.startFooter(t),cr.addSchema(t,n),cr.addVersion(t,ge.V5),cr.addRecordBatches(t,s),cr.addDictionaries(t,i),cr.finishFooterBuffer(t,cr.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=ge.V5,n,s){this.schema=e,this.version=t,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},Rp=class extends En{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return zr.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return zr.decode(t)}return null}},zr=class r{static decode(e){return new r(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,t){let{metaDataLength:n}=t,s=BigInt(t.offset),i=BigInt(t.bodyLength);return vi.createBlock(e,s,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=te(n),this.bodyLength=te(t)}}});var ur,X0=p(()=>{ce();ko();ol();Zu();ur=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new r).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+4),(t||new r).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ge.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):se.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Me).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,ge.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,se.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt("0"))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(e,t,n,s,i,o){return r.startMessage(e),r.addVersion(e,t),r.addHeaderType(e,n),r.addHeader(e,s),r.addBodyLength(e,i),r.addCustomMetadata(e,o),r.endMessage(e)}}});var Np,Vl,J0=p(()=>{Vt();yT();sl();Zh();fT();dT();pT();hT();xT();TT();bT();Xh();Hh();rp();np();ep();Jh();gT();mT();wT();sp();Kh();Yh();Qh();tp();Np=class extends R{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return oc.startNull(t),oc.endNull(t)}visitInt(e,t){return Dr.startInt(t),Dr.addBitWidth(t,e.bitWidth),Dr.addIsSigned(t,e.isSigned),Dr.endInt(t)}visitFloat(e,t){return os.startFloatingPoint(t),os.addPrecision(t,e.precision),os.endFloatingPoint(t)}visitBinary(e,t){return Za.startBinary(t),Za.endBinary(t)}visitBinaryView(e,t){return ec.startBinaryView(t),ec.endBinaryView(t)}visitLargeBinary(e,t){return rc.startLargeBinary(t),rc.endLargeBinary(t)}visitBool(e,t){return tc.startBool(t),tc.endBool(t)}visitUtf8(e,t){return cc.startUtf8(t),cc.endUtf8(t)}visitUtf8View(e,t){return uc.startUtf8View(t),uc.endUtf8View(t)}visitLargeUtf8(e,t){return sc.startLargeUtf8(t),sc.endLargeUtf8(t)}visitDecimal(e,t){return Zr.startDecimal(t),Zr.addScale(t,e.scale),Zr.addPrecision(t,e.precision),Zr.addBitWidth(t,e.bitWidth),Zr.endDecimal(t)}visitDate(e,t){return rs.startDate(t),rs.addUnit(t,e.unit),rs.endDate(t)}visitTime(e,t){return _n.startTime(t),_n.addUnit(t,e.unit),_n.addBitWidth(t,e.bitWidth),_n.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return An.startTimestamp(t),An.addUnit(t,e.unit),n!==void 0&&An.addTimezone(t,n),An.endTimestamp(t)}visitInterval(e,t){return as.startInterval(t),as.addUnit(t,e.unit),as.endInterval(t)}visitDuration(e,t){return ns.startDuration(t),ns.addUnit(t,e.unit),ns.endDuration(t)}visitList(e,t){return ic.startList(t),ic.endList(t)}visitLargeList(e,t){return nc.startLargeList(t),nc.endLargeList(t)}visitStruct(e,t){return ac.startStruct_(t),ac.endStruct_(t)}visitUnion(e,t){Rr.startTypeIdsVector(t,e.typeIds.length);let n=Rr.createTypeIdsVector(t,e.typeIds);return Rr.startUnion(t),Rr.addMode(t,e.mode),Rr.addTypeIds(t,n),Rr.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return Qr.startDictionaryEncoding(t),Qr.addId(t,BigInt(e.id)),Qr.addIsOrdered(t,e.isOrdered),n!==void 0&&Qr.addIndexType(t,n),Qr.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return ss.startFixedSizeBinary(t),ss.addByteWidth(t,e.byteWidth),ss.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return is.startFixedSizeList(t),is.addListSize(t,e.listSize),is.endFixedSizeList(t)}visitMap(e,t){return cs.startMap(t),cs.addKeysSorted(t,e.keysSorted),cs.endMap(t)}},Vl=new Np});function e_(r,e=new Map){return new Q(IM(r,e),jl(r.metadata),e)}function Cp(r){return new $e(r.count,r_(r.columns),n_(r.columns),null,s_(r.columns))}function t_(r){return new bt(Cp(r.data),r.id,r.isDelta)}function IM(r,e){return(r.fields||[]).filter(Boolean).map(t=>O.fromJSON(t,e))}function Y0(r,e){return(r.children||[]).filter(Boolean).map(t=>O.fromJSON(t,e))}function r_(r){return(r||[]).reduce((e,t)=>[...e,new xr(t.count,SM(t.VALIDITY)),...r_(t.children)],[])}function n_(r,e=[]){for(let t=-1,n=(r||[]).length;++t<n;){let s=r[t];if(s.VALIDITY&&e.push(new Ue(e.length,s.VALIDITY.length)),s.TYPE_ID&&e.push(new Ue(e.length,s.TYPE_ID.length)),s.OFFSET&&e.push(new Ue(e.length,s.OFFSET.length)),s.DATA&&e.push(new Ue(e.length,s.DATA.length)),s.VIEWS&&e.push(new Ue(e.length,s.VIEWS.length)),s.VARIADIC_DATA_BUFFERS)for(let i of s.VARIADIC_DATA_BUFFERS)e.push(new Ue(e.length,i.length));e=n_(s.children,e)}return e}function SM(r){return(r||[]).reduce((e,t)=>e+ +(t===0),0)}function s_(r){return(r||[]).reduce((e,t)=>[...e,...t.VARIADIC_DATA_BUFFERS?[t.VARIADIC_DATA_BUFFERS.length]:[],...s_(t.children)],[])}function i_(r,e){let t,n,s,i,o,a;return!e||!(i=r.dictionary)?(o=Z0(r,Y0(r,e)),s=new O(r.name,o,r.nullable,jl(r.metadata))):e.has(t=i.id)?(n=(n=i.indexType)?Q0(n):new Pe,a=new Ge(e.get(t),n,t,i.isOrdered),s=new O(r.name,a,r.nullable,jl(r.metadata))):(n=(n=i.indexType)?Q0(n):new Pe,e.set(t,o=Z0(r,Y0(r,e))),a=new Ge(o,n,t,i.isOrdered),s=new O(r.name,a,r.nullable,jl(r.metadata))),s||null}function jl(r=[]){return new Map(r.map(({key:e,value:t})=>[e,t]))}function Q0(r){return new Oe(r.isSigned,r.bitWidth)}function Z0(r,e){let t=r.type.name;switch(t){case"NONE":return new Ce;case"null":return new Ce;case"binary":return new Ct;case"largebinary":return new Pr;case"binaryview":return new Z;case"utf8":return new ut;case"largeutf8":return new Vr;case"utf8view":return new St;case"bool":return new lt;case"list":return new je((e||[])[0]);case"largelist":return new ir((e||[])[0]);case"struct":return new pe(e||[]);case"struct_":return new pe(e||[])}switch(t){case"int":{let n=r.type;return new Oe(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ct(le[n.precision])}case"decimal":{let n=r.type;return new Ut(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Et(ye[n.unit])}case"time":{let n=r.type;return new tt(L[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new rt(L[n.unit],n.timezone)}case"interval":{let n=r.type;return new ft(ae[n.unit])}case"duration":{let n=r.type;return new Lt(L[n.unit])}case"union":{let n=r.type,[s,...i]=(n.mode+"").toLowerCase(),o=s.toUpperCase()+i.join("");return new Bt(he[o],n.typeIds||[],e||[])}case"fixedsizebinary":{let n=r.type;return new Pt(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Fe(n.listSize,(e||[])[0])}case"map":{let n=r.type;return new dt((e||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var o_=p(()=>{mt();we();Is();De()});function BM(r,e){return(()=>{switch(e){case se.Schema:return Q.fromJSON(r);case se.RecordBatch:return $e.fromJSON(r);case se.DictionaryBatch:return bt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${se[e]}, type: ${e} }`)})}function FM(r,e){return(()=>{switch(e){case se.Schema:return Q.decode(r.header(new Nt),new Map,r.version());case se.RecordBatch:return $e.decode(r.header(new ot),r.version());case se.DictionaryBatch:return bt.decode(r.header(new Tn),r.version())}throw new Error(`Unrecognized Message type: { name: ${se[e]}, type: ${e} }`)})}function OM(r,e=new Map,t=ge.V5){let n=PM(r,e);return new Q(n,Gl(r),e,t)}function MM(r,e=ge.V5){return new $e(r.length(),NM(r),CM(r,e),l_(r.compression()),UM(r))}function DM(r,e=ge.V5){return new bt($e.decode(r.data(),e),r.id(),r.isDelta())}function RM(r){return new Ue(r.offset(),r.length())}function kM(r){return new xr(r.length(),r.nullCount())}function NM(r){let e=[];for(let t,n=-1,s=-1,i=r.nodesLength();++n<i;)(t=r.nodes(n))&&(e[++s]=xr.decode(t));return e}function CM(r,e){let t=[];for(let n,s=-1,i=-1,o=r.buffersLength();++s<o;)(n=r.buffers(s))&&(e<ge.V4&&(n.bb_pos+=8*(s+1)),t[++i]=Ue.decode(n));return t}function UM(r){let e=[],t=Math.trunc(r.variadicBufferCountsLength());for(let n=0;n<t;++n)e.push(te(r.variadicBufferCounts(n)));return e}function PM(r,e){let t=[];for(let n,s=-1,i=-1,o=r.fieldsLength();++s<o;)(n=r.fields(s))&&(t[++i]=O.decode(n,e));return t}function a_(r,e){let t=[];for(let n,s=-1,i=-1,o=r.childrenLength();++s<o;)(n=r.children(s))&&(t[++i]=O.decode(n,e));return t}function VM(r,e){let t,n,s,i,o,a;return!e||!(a=r.dictionary())?(s=u_(r,a_(r,e)),n=new O(r.name(),s,r.nullable(),Gl(r))):e.has(t=te(a.id()))?(i=(i=a.indexType())?c_(i):new Pe,o=new Ge(e.get(t),i,t,a.isOrdered()),n=new O(r.name(),o,r.nullable(),Gl(r))):(i=(i=a.indexType())?c_(i):new Pe,e.set(t,s=u_(r,a_(r,e))),o=new Ge(s,i,t,a.isOrdered()),n=new O(r.name(),o,r.nullable(),Gl(r))),n||null}function Gl(r){let e=new Map;if(r)for(let t,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(t=r.customMetadata(s))&&(n=t.key())!=null&&e.set(n,t.value());return e}function jM(r){let e=new Map;for(let t,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(t=r.customMetadata(s))&&(n=t.key())!=null&&e.set(n,t.value());return e}function c_(r){return new Oe(r.isSigned(),r.bitWidth())}function u_(r,e){let t=r.typeType();switch(t){case z.NONE:return new Ce;case z.Null:return new Ce;case z.Binary:return new Ct;case z.LargeBinary:return new Pr;case z.BinaryView:return new Z;case z.Utf8:return new ut;case z.LargeUtf8:return new Vr;case z.Utf8View:return new St;case z.Bool:return new lt;case z.List:return new je((e||[])[0]);case z.LargeList:return new ir((e||[])[0]);case z.Struct_:return new pe(e||[])}switch(t){case z.Int:{let n=r.type(new Dr);return new Oe(n.isSigned(),n.bitWidth())}case z.FloatingPoint:{let n=r.type(new os);return new ct(n.precision())}case z.Decimal:{let n=r.type(new Zr);return new Ut(n.scale(),n.precision(),n.bitWidth())}case z.Date:{let n=r.type(new rs);return new Et(n.unit())}case z.Time:{let n=r.type(new _n);return new tt(n.unit(),n.bitWidth())}case z.Timestamp:{let n=r.type(new An);return new rt(n.unit(),n.timezone())}case z.Interval:{let n=r.type(new as);return new ft(n.unit())}case z.Duration:{let n=r.type(new ns);return new Lt(n.unit())}case z.Union:{let n=r.type(new Rr);return new Bt(n.mode(),n.typeIdsArray()||[],e||[])}case z.FixedSizeBinary:{let n=r.type(new ss);return new Pt(n.byteWidth())}case z.FixedSizeList:{let n=r.type(new is);return new Fe(n.listSize(),(e||[])[0])}case z.Map:{let n=r.type(new cs);return new dt((e||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${z[t]}" (${t})`)}function l_(r){return r?new Ii(r.codec(),r.method()):null}function GM(r,e){let t=e.fields.map(i=>O.encode(r,i));Nt.startFieldsVector(r,t.length);let n=Nt.createFieldsVector(r,t),s=e.metadata&&e.metadata.size>0?Nt.createCustomMetadataVector(r,[...e.metadata].map(([i,o])=>{let a=r.createString(`${i}`),c=r.createString(`${o}`);return Me.startKeyValue(r),Me.addKey(r,a),Me.addValue(r,c),Me.endKeyValue(r)})):-1;return Nt.startSchema(r),Nt.addFields(r,n),Nt.addEndianness(r,HM?ts.Little:ts.Big),s!==-1&&Nt.addCustomMetadata(r,s),Nt.endSchema(r)}function zM(r,e){let t=-1,n=-1,s=-1,i=e.type,o=e.typeId;E.isDictionary(i)?(o=i.dictionary.typeId,s=Vl.visit(i,r),n=Vl.visit(i.dictionary,r)):n=Vl.visit(i,r);let a=(i.children||[]).map(l=>O.encode(r,l)),c=at.createChildrenVector(r,a),u=e.metadata&&e.metadata.size>0?at.createCustomMetadataVector(r,[...e.metadata].map(([l,f])=>{let d=r.createString(`${l}`),h=r.createString(`${f}`);return Me.startKeyValue(r),Me.addKey(r,d),Me.addValue(r,h),Me.endKeyValue(r)})):-1;return e.name&&(t=r.createString(e.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,o),at.addChildren(r,c),at.addNullable(r,!!e.nullable),t!==-1&&at.addName(r,t),s!==-1&&at.addDictionary(r,s),u!==-1&&at.addCustomMetadata(r,u),at.endField(r)}function WM(r,e){let t=e.nodes||[],n=e.buffers||[],s=e.variadicBufferCounts||[];ot.startNodesVector(r,t.length);for(let u of t.slice().reverse())xr.encode(r,u);let i=r.endVector();ot.startBuffersVector(r,n.length);for(let u of n.slice().reverse())Ue.encode(r,u);let o=r.endVector(),a=null;e.compression!==null&&(a=f_(r,e.compression));let c=-1;return s.length>0&&(c=ot.createVariadicBufferCountsVector(r,s.map(BigInt))),ot.startRecordBatch(r),ot.addLength(r,BigInt(e.length)),ot.addNodes(r,i),ot.addBuffers(r,o),e.compression!==null&&a&&ot.addCompression(r,a),c!==-1&&ot.addVariadicBufferCounts(r,c),ot.endRecordBatch(r)}function f_(r,e){return xn.startBodyCompression(r),xn.addCodec(r,e.type),xn.addMethod(r,e.method),xn.endBodyCompression(r)}function $M(r,e){let t=$e.encode(r,e.data);return Tn.startDictionaryBatch(r),Tn.addId(r,BigInt(e.id)),Tn.addIsDelta(r,e.isDelta),Tn.addData(r,t),Tn.endDictionaryBatch(r)}function qM(r,e){return Ro.createFieldNode(r,BigInt(e.length),BigInt(e.nullCount))}function KM(r,e){return Do.createBuffer(r,BigInt(e.offset),BigInt(e.length))}var EM,LM,gt,$e,bt,Ue,xr,Ii,HM,Is=p(()=>{ce();op();sl();$h();uT();zh();ip();Wh();il();ko();qh();Zh();Xh();Hh();rp();np();ep();Jh();sp();Yh();Qh();tp();X0();Gh();jh();mt();Ke();en();De();J0();o_();we();EM=mi,LM=Ze,gt=class r{static fromJSON(e,t){let n=new r(0,ge.V5,t);return n._createHeader=BM(e,t),n}static decode(e){e=new LM(k(e));let t=ur.getRootAsMessage(e),n=t.bodyLength(),s=t.version(),i=t.headerType(),o=jM(t),a=new r(n,s,i,void 0,o);return a._createHeader=FM(t,i),a}static encode(e){let t=new EM,n=-1;e.isSchema()?n=Q.encode(t,e.header()):e.isRecordBatch()?n=$e.encode(t,e.header()):e.isDictionaryBatch()&&(n=bt.encode(t,e.header()));let s=e.metadata&&e.metadata.size>0?ur.createCustomMetadataVector(t,[...e.metadata].map(([i,o])=>{let a=t.createString(`${i}`),c=t.createString(`${o}`);return Me.startKeyValue(t),Me.addKey(t,a),Me.addValue(t,c),Me.endKeyValue(t)})):-1;return ur.startMessage(t),ur.addVersion(t,ge.V5),ur.addHeader(t,n),ur.addHeaderType(t,e.headerType),ur.addBodyLength(t,BigInt(e.bodyLength)),s!==-1&&ur.addCustomMetadata(t,s),ur.finishMessageBuffer(t,ur.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Q)return new r(0,ge.V5,se.Schema,e);if(e instanceof $e)return new r(t,ge.V5,se.RecordBatch,e,e.metadata);if(e instanceof bt)return new r(t,ge.V5,se.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===se.Schema}isRecordBatch(){return this.headerType===se.RecordBatch}isDictionaryBatch(){return this.headerType===se.DictionaryBatch}constructor(e,t,n,s,i){this._version=t,this._headerType=n,this.body=new Uint8Array(0),this._compression=s?.compression,s&&(this._createHeader=()=>s),this._bodyLength=te(e),this._metadata=i||new Map}},$e=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(e,t,n,s,i=[],o){this._nodes=t,this._buffers=n,this._length=te(e),this._compression=s,this._variadicBufferCounts=i,this._metadata=o||new Map}},bt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=te(t)}},Ue=class{constructor(e,t){this.offset=te(e),this.length=te(t)}},xr=class{constructor(e,t){this.length=te(e),this.nullCount=te(t)}},Ii=class{constructor(e,t=bi.BUFFER){this.type=e,this.method=t}};O.encode=zM;O.decode=VM;O.fromJSON=i_;Q.encode=GM;Q.decode=OM;Q.fromJSON=e_;$e.encode=WM;$e.decode=MM;$e.fromJSON=Cp;bt.encode=$M;bt.decode=DM;bt.fromJSON=t_;xr.encode=qM;xr.decode=kM;Ue.encode=KM;Ue.decode=RM;Ii.encode=f_;Ii.decode=l_;HM=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})()});var Ee,vc,Si,zl,Ic=p(()=>{kt();Xa();Ee=Object.freeze({done:!0,value:void 0}),vc=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Si=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},zl=class extends Si{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return F(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Ee);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Qe.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Qe.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return F(this,void 0,void 0,function*(){return yield this.abort(e),Ee})}return(e){return F(this,void 0,void 0,function*(){return yield this.close(),Ee})}read(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((t,n)=>{this.resolvers.push({resolve:t,reject:n})}):Promise.resolve(Ee)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var Tr,_r,Gt,Up,Ln,Ss=p(()=>{kt();Xa();wn();Ic();Ke();es();Tr=class extends zl{write(e){if((e=k(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Fo(this.toUint8Array(!0)):this.toUint8Array(!1).then(Fo)}toUint8Array(e=!1){return e?Qt(this._values)[0]:F(this,void 0,void 0,function*(){var t,n,s,i;let o=[],a=0;try{for(var c=!0,u=Xt(this),l;l=yield u.next(),t=l.done,!t;c=!0){i=l.value,c=!1;let f=i;o.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!t&&(s=u.return)&&(yield s.call(u))}finally{if(n)throw n.error}}return Qt(o,a)[0]})}},_r=class{constructor(e){e&&(this.source=new Up(Qe.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Gt=class r{constructor(e){e instanceof r?this.source=e.source:e instanceof Tr?this.source=new Ln(Qe.fromAsyncIterable(e)):Ju(e)?this.source=new Ln(Qe.fromNodeStream(e)):qa(e)?this.source=new Ln(Qe.fromDOMStream(e)):Hu(e)?this.source=new Ln(Qe.fromDOMStream(e.body)):Fr(e)?this.source=new Ln(Qe.fromIterable(e)):Yt(e)?this.source=new Ln(Qe.fromAsyncIterable(e)):br(e)&&(this.source=new Ln(Qe.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Up=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,t="read"){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Ee)}return(e){return Object.create(this.source.return&&this.source.return(e)||Ee)}},Ln=class{constructor(e){this.source=e,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}cancel(e){return F(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return F(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return F(this,arguments,void 0,function*(t,n="read"){return yield this.source.next({cmd:n,size:t})})}throw(e){return F(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||Ee;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return F(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||Ee;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}}});var Sc,Es,Pp=p(()=>{kt();Ss();Ke();Sc=class extends _r{constructor(e,t){super(),this.position=0,this.buffer=k(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:s}=this;return t&&s<n?(typeof e!="number"&&(e=Number.POSITIVE_INFINITY),this.position=Math.min(n,s+Math.min(n-s,e)),t.subarray(s,this.position)):null}readAt(e,t){let n=this.buffer,s=Math.min(this.size,e+t);return n?n.subarray(e,s):new Uint8Array(t)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},Es=class extends Gt{constructor(e,t){super(),this.position=0,this._handle=e,typeof t=="number"?this.size=t:this._pending=F(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return F(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return F(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:s}=this;if(t&&s<n){typeof e!="number"&&(e=Number.POSITIVE_INFINITY);let i=s,o=0,a=0,c=Math.min(n,i+Math.min(n-i,e)),u=new Uint8Array(Math.max(0,(this.position=c)-i));for(;(i+=a)<c&&(o+=a)<u.byteLength;)({bytesRead:a}=yield t.read(u,o,u.byteLength-o,i));return u}return null})}readAt(e,t){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:s}=this;if(n&&e+t<s){let i=Math.min(s,e+t),o=new Uint8Array(i-e);return(yield n.read(o,0,t,e)).buffer}return new Uint8Array(t)})}close(){return F(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}}});var jp={};J(jp,{BaseInt64:()=>Ec,Int128:()=>Lc,Int64:()=>Bn,Uint64:()=>Re});function Jo(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Yo,Vp,Ec,Re,Bn,Lc,Gp=p(()=>{Yo=8,Vp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ec=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),s=t[3]*n[3];this.buffer[0]=s&65535;let i=s>>>16;return s=t[2]*n[3],i+=s,s=t[3]*n[2]>>>0,i+=s,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<s?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Jo(this.buffer[1])} ${Jo(this.buffer[0])}`}},Re=class r extends Ec{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,t=new Uint32Array(2)){return r.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return r.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){let n=e.length,s=new r(t);for(let i=0;i<n;){let o=Yo<n-i?Yo:n-i,a=new r(new Uint32Array([Number.parseInt(e.slice(i,i+o),10),0])),c=new r(new Uint32Array([Vp[o],0]));s.times(c),s.plus(a),i+=o}return s}static convertArray(e){let t=new Uint32Array(e.length*2);for(let n=-1,s=e.length;++n<s;)r.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new r(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new r(new Uint32Array(e.buffer)).plus(t)}},Bn=class r extends Ec{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(e,t=new Uint32Array(2)){return r.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return r.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){let n=e.startsWith("-"),s=e.length,i=new r(t);for(let o=n?1:0;o<s;){let a=Yo<s-o?Yo:s-o,c=new r(new Uint32Array([Number.parseInt(e.slice(o,o+a),10),0])),u=new r(new Uint32Array([Vp[a],0]));i.times(u),i.plus(c),o+=a}return n?i.negate():i}static convertArray(e){let t=new Uint32Array(e.length*2);for(let n=-1,s=e.length;++n<s;)r.from(e[n],new Uint32Array(t.buffer,t.byteOffset+2*n*4,2));return t}static multiply(e,t){return new r(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new r(new Uint32Array(e.buffer)).plus(t)}},Lc=class r{constructor(e){this.buffer=e}high(){return new Bn(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Bn(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){let t=new Re(new Uint32Array([this.buffer[3],0])),n=new Re(new Uint32Array([this.buffer[2],0])),s=new Re(new Uint32Array([this.buffer[1],0])),i=new Re(new Uint32Array([this.buffer[0],0])),o=new Re(new Uint32Array([e.buffer[3],0])),a=new Re(new Uint32Array([e.buffer[2],0])),c=new Re(new Uint32Array([e.buffer[1],0])),u=new Re(new Uint32Array([e.buffer[0],0])),l=Re.multiply(i,u);this.buffer[0]=l.low();let f=new Re(new Uint32Array([l.high(),0]));return l=Re.multiply(s,u),f.plus(l),l=Re.multiply(i,c),f.plus(l),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(l)?1:0,this.buffer[2]=f.high(),new Re(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Re.multiply(n,u)).plus(Re.multiply(s,c)).plus(Re.multiply(i,a)),this.buffer[3]+=Re.multiply(t,u).plus(Re.multiply(n,c)).plus(Re.multiply(s,a)).plus(Re.multiply(i,o)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Jo(this.buffer[3])} ${Jo(this.buffer[2])} ${Jo(this.buffer[1])} ${Jo(this.buffer[0])}`}static multiply(e,t){return new r(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new r(new Uint32Array(e.buffer)).plus(t)}static from(e,t=new Uint32Array(4)){return r.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(4)){return r.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(4)){let n=e.startsWith("-"),s=e.length,i=new r(t);for(let o=n?1:0;o<s;){let a=Yo<s-o?Yo:s-o,c=new r(new Uint32Array([Number.parseInt(e.slice(o,o+a),10),0,0,0])),u=new r(new Uint32Array([Vp[a],0,0,0]));i.times(u),i.plus(c),o+=a}return n?i.negate():i}static convertArray(e){let t=new Uint32Array(e.length*4);for(let n=-1,s=e.length;++n<s;)r.from(e[n],new Uint32Array(t.buffer,t.byteOffset+16*n,4));return t}}});var Kp={};J(Kp,{toIntervalDayTimeInt32Array:()=>zp,toIntervalDayTimeObjects:()=>$p,toIntervalMonthDayNanoInt32Array:()=>Wp,toIntervalMonthDayNanoObjects:()=>qp});function zp(r){var e,t;let n=r.length,s=new Int32Array(n*2);for(let i=0,o=0;i<n;i++){let a=r[i];s[o++]=(e=a.days)!==null&&e!==void 0?e:0,s[o++]=(t=a.milliseconds)!==null&&t!==void 0?t:0}return s}function Wp(r){var e,t;let n=r.length,s=new Int32Array(n*4);for(let i=0,o=0;i<n;i++){let a=r[i];s[o++]=(e=a.months)!==null&&e!==void 0?e:0,s[o++]=(t=a.days)!==null&&t!==void 0?t:0;let c=a.nanoseconds;if(c){let u=BigInt(c);s[o++]=Number(u&BigInt(4294967295))>>>0,s[o++]=Number(u>>BigInt(32))>>>0}else o+=2}return s}function $p(r){let e=r.length,t=new Array(e/2);for(let n=0,s=0;n<e;n+=2)t[s++]={days:r[n],milliseconds:r[n+1]};return t}function qp(r,e){let t=r.length,n=new Array(t/4);for(let s=0,i=0;s<t;s+=4){let o=BigInt(r[s+3])<<BigInt(32)|BigInt(r[s+2]>>>0);n[i++]={months:r[s],days:r[s+1],nanoseconds:e?`${o}`:o}}return n}var Wl=p(()=>{});function h_(r){let e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t>>1]=Number.parseInt(r.slice(t,t+2),16);return e}function XM(r){return h_(r.join(""))}function p_(r,e){let t=new Uint8Array(r.length*16),n=new DataView(t.buffer);for(let[s,i]of r.entries()){let o=s*16,a=i.SIZE;if(n.setInt32(o,a,!0),i.INLINED!==void 0){let c=e(i.INLINED);for(let u=0;u<c.length&&u<12;u++)t[o+4+u]=c[u]}else{let c=i.PREFIX_HEX;for(let u=0;u<8&&u<c.length;u+=2)t[o+4+(u>>1)]=Number.parseInt(c.slice(u,u+2),16);n.setInt32(o+8,i.BUFFER_INDEX,!0),n.setInt32(o+12,i.OFFSET,!0)}}return t}function JM(r){return p_(r,e=>{let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t})}function YM(r){return p_(r,e=>new TextEncoder().encode(e))}var Qo,$l,ql,m_=p(()=>{wr();mt();we();Vt();_i();wn();Gp();De();Ke();Wl();Qo=class extends R{constructor(e,t,n,s,i=ge.V5,o=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=s,this.metadataVersion=i,this.variadicBufferCounts=o}visit(e){return super.visit(e instanceof O?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return D({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitUtf8View(e,{length:t,nullCount:n}=this.nextFieldNode()){let s=this.readNullBitmap(e,n),i=this.readData(e),o=this.readVariadicBuffers(this.nextVariadicBufferCount());return D({type:e,length:t,nullCount:n,nullBitmap:s,views:i,variadicBuffers:o})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinaryView(e,{length:t,nullCount:n}=this.nextFieldNode()){let s=this.readNullBitmap(e,n),i=this.readData(e),o=this.readVariadicBuffers(this.nextVariadicBufferCount());return D({type:e,length:t,nullCount:n,nullBitmap:s,views:i,variadicBuffers:o})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitLargeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<ge.V5&&this.readNullBitmap(e,n),e.mode===he.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return D({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array(0)}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readVariadicBuffers(e){return Array.from({length:e},()=>this.readData(null))}nextVariadicBufferCount(){var e;return(e=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&e!==void 0?e:0}readDictionary(e){return this.dictionaries.get(e.id)}},$l=class extends Qo{constructor(e,t,n,s,i,o=[]){super(new Uint8Array(0),t,n,s,i,o),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array(0):Ti(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return ee(Uint8Array,ee(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return ee(Uint8Array,ee(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;if(E.isTimestamp(e))return ee(Uint8Array,Bn.convertArray(n[t]));if((E.isInt(e)||E.isTime(e))&&e.bitWidth===64||E.isDuration(e))return ee(Uint8Array,Bn.convertArray(n[t]));if(E.isDate(e)&&e.unit===ye.MILLISECOND)return ee(Uint8Array,Bn.convertArray(n[t]));if(E.isDecimal(e))return ee(Uint8Array,Lc.convertArray(n[t]));if(E.isBinary(e)||E.isLargeBinary(e)||E.isFixedSizeBinary(e))return XM(n[t]);if(E.isBinaryView(e))return JM(n[t]);if(E.isUtf8View(e))return YM(n[t]);if(E.isBool(e))return Ti(n[t]);if(E.isUtf8(e)||E.isLargeUtf8(e))return Jt(n[t].join(""));if(E.isInterval(e))switch(e.unit){case ae.DAY_TIME:return zp(n[t]);case ae.MONTH_DAY_NANO:return Wp(n[t]);default:break}return ee(Uint8Array,ee(e.ArrayType,n[t].map(s=>+s)))}readVariadicBuffers(e){let t=[];for(let n=0;n<e;n++){let{offset:s}=this.nextBufferRange(),i=this.sources[s];t.push(h_(i))}return t}};ql=class extends Qo{constructor(e,t,n,s,i,o=[]){super(new Uint8Array(0),t,n,s,i,o),this.bodyChunks=e}readData(e,t=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var Fn,Kl=p(()=>{Gr();Se();Ke();Fn=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,k(t))}_flushPending(e,t){let n=this._offsets,s=this._values.reserve(t).buffer,i=0;for(let[o,a]of e)if(a===void 0)n.set(o,0);else{let c=a.length;s.set(a,i),n.set(o,c),i+=c}}}});var On,Hl=p(()=>{Ke();Gr();Se();On=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,k(t))}_flushPending(e,t){let n=this._offsets,s=this._values.reserve(t).buffer,i=0;for(let[o,a]of e)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;s.set(a,i),n.set(o,BigInt(c)),i+=c}}}});var Ei,Hp=p(()=>{Gr();Se();Ei=class extends Te{constructor(e){super(e),this._values=new Xo}setValue(e,t){this._values.set(e,+t)}}});var on,Ls,Bs,Xp=p(()=>{Se();ar();on=class extends We{};on.prototype._setValue=mp;Ls=class extends on{};Ls.prototype._setValue=ul;Bs=class extends on{};Bs.prototype._setValue=ll});var Fs,Jp=p(()=>{Se();ar();Fs=class extends We{};Fs.prototype._setValue=yp});var Li,Yp=p(()=>{we();Se();Bc();Li=class extends Te{constructor({type:e,nullValues:t,dictionaryHashFunction:n}){super({type:new Ge(e.dictionary,e.indices,e.id,e.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Wr({type:this.type.indices,nullValues:t}),this.dictionary=Wr({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(e){return this.indices.isValid(e)}setValid(e,t){let n=this.indices;return t=n.setValid(e,t),this.length=n.length,t}setValue(e,t){let n=this._keysToIndices,s=this.valueToKey(t),i=n[s];return i===void 0&&(n[s]=i=this._dictionaryOffset+this.dictionary.append(t).length-1),this.indices.setValue(e,i)}flush(){let e=this.type,t=this._dictionary,n=this.dictionary.toVector(),s=this.indices.flush().clone(e);return s.dictionary=t?t.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(e){return typeof e=="string"?e:`${e}`}}});var Os,Qp=p(()=>{Se();ar();Os=class extends We{};Os.prototype._setValue=pp});var Bi,Zp=p(()=>{mt();Se();we();Bi=class extends Te{setValue(e,t){let[n]=this.children,s=e*this.stride;for(let i=-1,o=this.stride;++i<o;)n.set(s+i,t[i])}setValid(e,t){return super.setValid(e,t)||this.children[0].setValid((e+1)*this.stride-1,!1),t}addChild(e,t="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(e);return this.type=new Fe(this.type.listSize,new O(t,e.type,!0)),n}}});var an,Fi,Oi,Mi,em=p(()=>{yc();Se();an=class extends We{setValue(e,t){this._values.set(e,t)}},Fi=class extends an{setValue(e,t){super.setValue(e,gc(t))}},Oi=class extends an{},Mi=class extends an{}});var $r,Ms,Ds,Rs,tm=p(()=>{Se();ar();$r=class extends We{};$r.prototype._setValue=wp;Ms=class extends $r{};Ms.prototype._setValue=wl;Ds=class extends $r{};Ds.prototype._setValue=xl;Rs=class extends $r{};Rs.prototype._setValue=Tl});var Ar,ks,Ns,Cs,Us,rm=p(()=>{Se();ar();Ar=class extends We{};Ar.prototype._setValue=xp;ks=class extends Ar{};ks.prototype._setValue=_l;Ns=class extends Ar{};Ns.prototype._setValue=Al;Cs=class extends Ar{};Cs.prototype._setValue=vl;Us=class extends Ar{};Us.prototype._setValue=Il});var Ft,Di,Ri,ki,Ni,Ci,Ui,Pi,Vi,nm=p(()=>{Se();Ft=class extends We{setValue(e,t){this._values.set(e,t)}},Di=class extends Ft{},Ri=class extends Ft{},ki=class extends Ft{},Ni=class extends Ft{},Ci=class extends Ft{},Ui=class extends Ft{},Pi=class extends Ft{},Vi=class extends Ft{}});var ji,sm=p(()=>{mt();we();Gr();Se();ji=class extends pt{constructor(e){super(e),this._offsets=new vs(e.type)}addChild(e,t="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new je(new O(t,e.type,!0)),this.numChildren-1}_flushPending(e){let t=this._offsets,[n]=this.children;for(let[s,i]of e)if(typeof i>"u")t.set(s,0);else{let o=i,a=o.length,c=t.set(s,a).buffer[s];for(let u=-1;++u<a;)n.set(c+u,o[u])}}}});var Gi,im=p(()=>{mt();we();Gr();en();Se();Gi=class extends pt{constructor(e){super(e),this._offsets=new vs(e.type)}addChild(e,t="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new ir(new O(t,e.type,!0)),this.numChildren-1}_flushPending(e){let t=this._offsets,[n]=this.children;for(let[s,i]of e)if(typeof i>"u")t.set(s,BigInt(0));else{let o=i,a=o.length,c=te(t.set(s,BigInt(a)).buffer[s]);for(let u=-1;++u<a;)n.set(c+u,o[u])}}}});var zi,om=p(()=>{mt();we();Se();zi=class extends pt{set(e,t){return super.set(e,t)}setValue(e,t){let n=t instanceof Map?t:new Map(Object.entries(t)),s=this._pending||(this._pending=new Map),i=s.get(e);i&&(this._pendingLength-=i.size),this._pendingLength+=n.size,s.set(e,n)}addChild(e,t=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new dt(new O(t,e.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(e){let t=this._offsets,[n]=this.children;for(let[s,i]of e)if(i===void 0)t.set(s,0);else{let{[s]:o,[s+1]:a}=t.set(s,i.size).buffer;for(let c of i.entries())if(n.set(o,c),++o>=a)break}}}});var Wi,am=p(()=>{Se();Wi=class extends Te{setValue(e,t){}setValid(e,t){return this.length=Math.max(e+1,this.length),t}}});var $i,cm=p(()=>{mt();Se();we();$i=class extends Te{setValue(e,t){let{children:n,type:s}=this;switch(Array.isArray(t)||t.constructor){case!0:return s.children.forEach((i,o)=>n[o].set(e,t[o]));case Map:return s.children.forEach((i,o)=>n[o].set(e,t.get(i.name)));default:return s.children.forEach((i,o)=>n[o].set(e,t[i.name]))}}setValid(e,t){return super.setValid(e,t)||this.children.forEach(n=>n.setValid(e,t)),t}addChild(e,t=`${this.numChildren}`){let n=this.children.push(e);return this.type=new pe([...this.type.children,new O(t,e.type,!0)]),n}}});var vr,Ps,Vs,js,Gs,um=p(()=>{Se();ar();vr=class extends We{};vr.prototype._setValue=bp;Ps=class extends vr{};Ps.prototype._setValue=fl;Vs=class extends vr{};Vs.prototype._setValue=dl;js=class extends vr{};js.prototype._setValue=hl;Gs=class extends vr{};Gs.prototype._setValue=pl});var Ir,zs,Ws,$s,qs,lm=p(()=>{Se();ar();Ir=class extends We{};Ir.prototype._setValue=gp;zs=class extends Ir{};zs.prototype._setValue=ml;Ws=class extends Ir{};Ws.prototype._setValue=bl;$s=class extends Ir{};$s.prototype._setValue=gl;qs=class extends Ir{};qs.prototype._setValue=yl});var Mn,qi,Ki,fm=p(()=>{mt();Gr();Se();we();Mn=class extends Te{constructor(e){super(e),this._typeIds=new Sn(Int8Array,0,1),typeof e.valueToChildTypeId=="function"&&(this._valueToChildTypeId=e.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(e,t){return this.set(this.length,e,t)}set(e,t,n){return n===void 0&&(n=this._valueToChildTypeId(this,t,e)),this.setValue(e,t,n),this}setValue(e,t,n){this._typeIds.set(e,n);let s=this.type.typeIdToChildIndex[n],i=this.children[s];i?.set(e,t),this.length=Math.max(e+1,this.length)}addChild(e,t=`${this.children.length}`){let n=this.children.push(e),{type:{children:s,mode:i,typeIds:o}}=this,a=[...s,new O(t,e.type)];return this.type=new Bt(i,[...o,n],a),n}_valueToChildTypeId(e,t,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},qi=class extends Mn{},Ki=class extends Mn{constructor(e){super(e),this._offsets=new Sn(Int32Array)}setValue(e,t,n){let s=this._typeIds.set(e,n).buffer[e],i=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(e,i.length).buffer[e];i?.set(o,t),this.length=Math.max(e+1,this.length)}}});var Ks,dm=p(()=>{wn();Kl();Gr();Se();Ks=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,Jt(t))}_flushPending(e,t){}};Ks.prototype._flushPending=Fn.prototype._flushPending});var Hs,hm=p(()=>{wn();Gr();Se();Hl();Hs=class extends pt{constructor(e){super(e),this._values=new jt(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,t){return super.setValue(e,Jt(t))}_flushPending(e,t){}};Hs.prototype._flushPending=On.prototype._flushPending});var Dn,Xl=p(()=>{we();Se();Gr();Ke();wr();Dn=class extends Te{constructor(e){super(e),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new jt(Uint8Array)}get byteLength(){let e=0;this._views&&(e+=this._views.byteLength),this._nulls&&(e+=this._nulls.byteLength);for(let t of this._variadicBuffers)e+=t.byteLength;return this._currentBuffer&&(e+=this._currentBuffer.byteLength),e}setValue(e,t){return this.writeBinaryValue(e,this.encodeValue(t))}writeBinaryValue(e,t){let n=t.length,s=(e+1)*Z.ELEMENT_WIDTH,i=this._views.length;s>i&&this._views.reserve(s-i);let o=this._views.buffer,a=e*Z.ELEMENT_WIDTH,c=new DataView(o.buffer,o.byteOffset+a,Z.ELEMENT_WIDTH);if(c.setInt32(Z.LENGTH_OFFSET,n,!0),n<=Z.INLINE_CAPACITY){o.set(t,a+Z.INLINE_OFFSET);for(let u=n;u<Z.INLINE_CAPACITY;u++)o[a+Z.INLINE_OFFSET+u]=0}else{let u=new DataView(t.buffer,t.byteOffset,Math.min(4,n));c.setUint32(Z.INLINE_OFFSET,u.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new jt(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(t,this._currentBufferOffset),c.setInt32(Z.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(Z.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(e){return k(e)}setValid(e,t){let n=(e+1)*Z.ELEMENT_WIDTH,s=this._views.length;n>s&&this._views.reserve(n-s);let i=super.setValid(e,t);if(!i){let o=this._views.buffer,a=e*Z.ELEMENT_WIDTH;for(let c=0;c<Z.ELEMENT_WIDTH;c++)o[a+c]=0}return i}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:e,length:t,nullCount:n,_views:s,_nulls:i}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let o=s.flush(t*Z.ELEMENT_WIDTH),a=n>0?i.flush(t):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),D({type:e,length:t,nullCount:n,nullBitmap:a,views:o,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var Hi,pm=p(()=>{Xl();wn();Hi=class extends Dn{constructor(e){super(e)}setValue(e,t){return this.writeBinaryValue(e,Jt(t))}}});var mm,b_,g_=p(()=>{Vt();Kl();Hl();Hp();Xp();Jp();Yp();Qp();Zp();em();tm();rm();nm();sm();im();om();am();cm();um();lm();fm();dm();hm();Xl();pm();mm=class extends R{visitNull(){return Wi}visitBool(){return Ei}visitInt(){return Ft}visitInt8(){return Di}visitInt16(){return Ri}visitInt32(){return ki}visitInt64(){return Ni}visitUint8(){return Ci}visitUint16(){return Ui}visitUint32(){return Pi}visitUint64(){return Vi}visitFloat(){return an}visitFloat16(){return Fi}visitFloat32(){return Oi}visitFloat64(){return Mi}visitUtf8(){return Ks}visitLargeUtf8(){return Hs}visitBinary(){return Fn}visitLargeBinary(){return On}visitFixedSizeBinary(){return Os}visitDate(){return on}visitDateDay(){return Ls}visitDateMillisecond(){return Bs}visitTimestamp(){return vr}visitTimestampSecond(){return Ps}visitTimestampMillisecond(){return Vs}visitTimestampMicrosecond(){return js}visitTimestampNanosecond(){return Gs}visitTime(){return Ir}visitTimeSecond(){return zs}visitTimeMillisecond(){return Ws}visitTimeMicrosecond(){return $s}visitTimeNanosecond(){return qs}visitDecimal(){return Fs}visitList(){return ji}visitLargeList(){return Gi}visitStruct(){return $i}visitUnion(){return Mn}visitDenseUnion(){return Ki}visitSparseUnion(){return qi}visitDictionary(){return Li}visitInterval(){return $r}visitIntervalDayTime(){return Ms}visitIntervalYearMonth(){return Ds}visitIntervalMonthDayNano(){return Rs}visitDuration(){return Ar}visitDurationSecond(){return ks}visitDurationMillisecond(){return Ns}visitDurationMicrosecond(){return Cs}visitDurationNanosecond(){return Us}visitFixedSizeList(){return Bi}visitMap(){return zi}visitBinaryView(){return Dn}visitUtf8View(){return Hi}},b_=new mm});function Ot(r,e){return e instanceof r.constructor}function Rn(r,e){return r===e||Ot(r,e)}function kn(r,e){return r===e||Ot(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function Jl(r,e){return r===e||Ot(r,e)&&r.precision===e.precision}function QM(r,e){return r===e||Ot(r,e)&&r.byteWidth===e.byteWidth}function bm(r,e){return r===e||Ot(r,e)&&r.unit===e.unit}function Fc(r,e){return r===e||Ot(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function Oc(r,e){return r===e||Ot(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function y_(r,e){return r===e||Ot(r,e)&&r.children.length===e.children.length&&cn.compareManyFields(r.children,e.children)}function ZM(r,e){return r===e||Ot(r,e)&&r.children.length===e.children.length&&cn.compareManyFields(r.children,e.children)}function gm(r,e){return r===e||Ot(r,e)&&r.mode===e.mode&&r.typeIds.every((t,n)=>t===e.typeIds[n])&&cn.compareManyFields(r.children,e.children)}function e2(r,e){return r===e||Ot(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&cn.visit(r.indices,e.indices)&&cn.visit(r.dictionary,e.dictionary)}function Yl(r,e){return r===e||Ot(r,e)&&r.unit===e.unit}function Mc(r,e){return r===e||Ot(r,e)&&r.unit===e.unit}function t2(r,e){return r===e||Ot(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&cn.compareManyFields(r.children,e.children)}function r2(r,e){return r===e||Ot(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&cn.compareManyFields(r.children,e.children)}function Xi(r,e){return cn.compareSchemas(r,e)}function w_(r,e){return cn.compareFields(r,e)}function Ql(r,e){return cn.visit(r,e)}var V,cn,Dc=p(()=>{Vt();V=class extends R{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((n,s)=>this.compareFields(n,t[s]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};V.prototype.visitNull=Rn;V.prototype.visitBool=Rn;V.prototype.visitInt=kn;V.prototype.visitInt8=kn;V.prototype.visitInt16=kn;V.prototype.visitInt32=kn;V.prototype.visitInt64=kn;V.prototype.visitUint8=kn;V.prototype.visitUint16=kn;V.prototype.visitUint32=kn;V.prototype.visitUint64=kn;V.prototype.visitFloat=Jl;V.prototype.visitFloat16=Jl;V.prototype.visitFloat32=Jl;V.prototype.visitFloat64=Jl;V.prototype.visitUtf8=Rn;V.prototype.visitLargeUtf8=Rn;V.prototype.visitUtf8View=Rn;V.prototype.visitBinary=Rn;V.prototype.visitLargeBinary=Rn;V.prototype.visitBinaryView=Rn;V.prototype.visitFixedSizeBinary=QM;V.prototype.visitDate=bm;V.prototype.visitDateDay=bm;V.prototype.visitDateMillisecond=bm;V.prototype.visitTimestamp=Fc;V.prototype.visitTimestampSecond=Fc;V.prototype.visitTimestampMillisecond=Fc;V.prototype.visitTimestampMicrosecond=Fc;V.prototype.visitTimestampNanosecond=Fc;V.prototype.visitTime=Oc;V.prototype.visitTimeSecond=Oc;V.prototype.visitTimeMillisecond=Oc;V.prototype.visitTimeMicrosecond=Oc;V.prototype.visitTimeNanosecond=Oc;V.prototype.visitDecimal=Rn;V.prototype.visitList=y_;V.prototype.visitLargeList=y_;V.prototype.visitStruct=ZM;V.prototype.visitUnion=gm;V.prototype.visitDenseUnion=gm;V.prototype.visitSparseUnion=gm;V.prototype.visitDictionary=e2;V.prototype.visitInterval=Yl;V.prototype.visitIntervalDayTime=Yl;V.prototype.visitIntervalYearMonth=Yl;V.prototype.visitIntervalMonthDayNano=Yl;V.prototype.visitDuration=Mc;V.prototype.visitDurationSecond=Mc;V.prototype.visitDurationMillisecond=Mc;V.prototype.visitDurationMicrosecond=Mc;V.prototype.visitDurationNanosecond=Mc;V.prototype.visitFixedSizeList=t2;V.prototype.visitMap=r2;cn=new V});function Wr(r){let e=r.type,t=new(b_.getVisitFn(e)())(r);if(e.children&&e.children.length>0){let n=r.children||[],s={nullValues:r.nullValues},i=Array.isArray(n)?((o,a)=>n[a]||s):(({name:o})=>n[o]||s);for(let[o,a]of e.children.entries()){let{type:c}=a,u=i(a,o);t.children.push(Wr(Object.assign(Object.assign({},u),{type:c})))}}return t}function Zo(r,e){if(r instanceof G||r instanceof B||r.type instanceof E||ArrayBuffer.isView(r))return sn(r);let t={type:e??Zl(r),nullValues:[null]},n=[...ef(t)(r)],s=n.length===1?n[0]:n.reduce((i,o)=>i.concat(o));return E.isDictionary(s.type)?s.memoize():s}function ym(r){let e=Zo(r),t=new de(new Q(e.type.children),e.data[0]);return new me(t)}function Zl(r){if(r.length===0)return new Ce;let e=0,t=0,n=0,s=0,i=0,o=0,a=0,c=0;for(let u of r){if(u==null){++e;continue}switch(typeof u){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++s;continue;case"string":++i;continue;case"object":Array.isArray(u)?++t:Object.prototype.toString.call(u)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(s+e===r.length)return new sr;if(i+e===r.length)return new Ge(new ut,new Pe);if(o+e===r.length)return new tr;if(a+e===r.length)return new lt;if(c+e===r.length)return new tn;if(t+e===r.length){let u=r,l=Zl(u[u.findIndex(f=>f!=null)]);if(u.every(f=>f==null||Ql(l,Zl(f))))return new je(new O("",l,!0))}else if(n+e===r.length){let u=new Map;for(let l of r)for(let f of Object.keys(l))!u.has(f)&&l[f]!=null&&u.set(f,new O(f,Zl([l[f]]),!0));return new pe([...u.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function ef(r){let{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=e!=="bytes"?"length":"byteLength";return function*(s){let i=0,o=Wr(r);for(let a of s)o.append(a)[n]>=t&&++i&&(yield o.toVector());(o.finish().length>0||i===0)&&(yield o.toVector())}}function wm(r){let{["queueingStrategy"]:e="count"}=r,{["highWaterMark"]:t=e!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=e!=="bytes"?"length":"byteLength";return function(s){return _t(this,arguments,function*(){var i,o,a,c;let u=0,l=Wr(r);try{for(var f=!0,d=Xt(s),h;h=yield Y(d.next()),i=h.done,!i;f=!0){c=h.value,f=!1;let m=c;l.append(m)[n]>=t&&++u&&(yield yield Y(l.toVector()))}}catch(m){o={error:m}}finally{try{!f&&!i&&(a=d.return)&&(yield Y(a.call(d)))}finally{if(o)throw o.error}}(l.finish().length>0||u===0)&&(yield yield Y(l.toVector()))})}}var Bc=p(()=>{kt();mt();we();wr();ht();g_();Ji();Nn();Dc()});function tf(r,e){return n2(r,e.map(t=>t.data.concat()))}function n2(r,e){let t=[...r.fields],n=[],s={numBatches:e.reduce((f,d)=>Math.max(f,d.length),0)},i=0,o=0,a=-1,c=e.length,u,l=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)l[a]=u=e[a].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(l=s2(t,o,l,e,s),o>0&&(n[i++]=D({type:new pe(t),length:o,nullCount:0,children:l.slice()})))}return[r=r.assign(t),n.map(f=>new de(r,f))]}function s2(r,e,t,n,s){var i;let o=(e+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let u=t[a],l=u?.length;if(l>=e)l===e?t[a]=u:(t[a]=u.slice(0,e),s.numBatches=Math.max(s.numBatches,n[a].unshift(u.slice(e,l-e))));else{let f=r[a];r[a]=f.clone({nullable:!0}),t[a]=(i=u?._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:D({type:f.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)})}}return t}var x_=p(()=>{wr();we();Nn()});function xm(r){let e={},t=Object.entries(r);for(let[n,s]of t)e[n]=sn(s);return new me(e)}function Tm(r){let e={},t=Object.entries(r);for(let[n,s]of t)e[n]=Zo(s);return new me(e)}var T_,__,me,Ji=p(()=>{De();wr();Bc();ht();mt();we();Dc();x_();kl();yi();ar();Nl();Cl();$o();Nn();__=Symbol.for("apache-arrow/Table"),me=class r{static isTable(e){return e?.[__]===!0}constructor(...e){var t,n;if(e.length===0)return this.batches=[],this.schema=new Q([]),this._offsets=[0],this;let s,i;e[0]instanceof Q&&(s=e.shift()),e.at(-1)instanceof Uint32Array&&(i=e.pop());let o=c=>{if(c){if(c instanceof de)return[c];if(c instanceof r)return c.batches;if(c instanceof G){if(c.type instanceof pe)return[new de(new Q(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){let u=Object.keys(c),l=u.map(h=>new B([c[h]])),f=s??new Q(u.map((h,m)=>new O(String(h),l[m].type,l[m].nullable))),[,d]=tf(f,l);return d.length===0?[new de(c)]:d}}}return[]},a=e.flatMap(c=>o(c));if(s=(n=s??((t=a[0])===null||t===void 0?void 0:t.schema))!==null&&n!==void 0?n:new Q([]),!(s instanceof Q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof de))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Xi(s,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=i??Ol(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Fl(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(wi(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?Ho.visit(new B(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
19
19
  ${this.toArray().join(`,
20
20
  `)}
21
- ]`}concat(...e){let t=this.schema,n=this.data.concat(e.flatMap(({data:s})=>s));return new r(t,n.map(s=>new de(t,s)))}slice(e,t){let n=this.schema;[e,t]=fc({length:this.numRows},e,t);let s=pl(this.data,this._offsets,e,t);return new r(n,s.map(i=>new de(n,i)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(n=>n.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],s=D({type:n,length:0,nullCount:0});t.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new B(t)}return null}setChild(e,t){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===e),t)}setChildAt(e,t){let n=this.schema,s=[...this.batches];if(e>-1&&e<this.numCols){t||(t=new B([D({type:new Ne,length:this.numRows})]));let i=n.fields.slice(),o=i[e].clone({type:t.type}),a=this.schema.fields.map((c,u)=>this.getChildAt(u));[i[e],a[e]]=[o,t],[n,s]=Cl(n,a)}return new r(n,s)}select(e){let t=this.schema.fields.reduce((n,s,i)=>n.set(s.name,i),new Map);return this.selectAt(e.map(n=>t.get(n)).filter(n=>n>-1))}selectAt(e){let t=this.schema.selectAt(e),n=this.batches.map(s=>s.selectAt(e));return new r(t,n)}assign(e){let t=this.schema.fields,[n,s]=e.schema.fields.reduce((a,c,u)=>{let[l,f]=a,d=t.findIndex(h=>h.name===c.name);return~d?f[d]=u:l.push(u),a},[[],[]]),i=this.schema.assign(e.schema),o=[...t.map((a,c)=>[c,s[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):e.getChildAt(c)),...n.map(a=>e.getChildAt(a))].filter(Boolean);return new r(...Cl(i,o))}};O0=Symbol.toStringTag;me[O0]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r[M0]=!0,r.isValid=jo(pc),r.get=jo(ze.getVisitFn(w.Struct)),r.set=ml(nt.getVisitFn(w.Struct)),r.indexOf=bl(yi.getVisitFn(w.Struct)),"Table"))(me.prototype);Object.defineProperty(me,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===me&&me.isTable(e)}})});function D0(r,e,t=e.reduce((n,s)=>Math.max(n,s.length),0)){var n;let s=[...r.fields],i=[...e],o=(t+63&-64)>>3;for(let[a,c]of r.fields.entries()){let u=e[a];(!u||u.length!==t)&&(s[a]=c.clone({nullable:!0}),i[a]=(n=u?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:D({type:c.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)}))}return[r.assign(s),D({type:new pe(s),length:t,children:i})]}function N0(r,e,t=new Map){var n,s;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===e?.length)for(let i=-1,o=r.length;++i<o;){let{type:a}=r[i],c=e[i];for(let u of[c,...((s=c?.dictionary)===null||s===void 0?void 0:s.data)||[]])N0(a.children,u?.children,t);if(E.isDictionary(a)){let{id:u}=a;if(!t.has(u))c?.dictionary&&t.set(u,c.dictionary);else if(t.get(u)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return t}var R0,k0,de,qi,Rn=p(()=>{wr();$i();ht();mt();we();Po();hi();ar();yl();wl();k0=Symbol.for("apache-arrow/RecordBatch"),de=class r{static isRecordBatch(e){return e?.[k0]===!0}constructor(...e){switch(e.length){case 3:case 2:{if([this.schema]=e,!(this.schema instanceof Q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=D({nullCount:0,type:new pe(this.schema.fields),children:this.schema.fields.map(t=>D({type:t.type,nullCount:0}))}),this._metadata=new Map]=e,!(this.data instanceof G))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=D0(this.schema,this.data.children,this.data.length);break}case 1:{let[t]=e,{fields:n,children:s,length:i}=Object.keys(t).reduce((c,u,l)=>(c.children[l]=t[u],c.length=Math.max(c.length,t[u].length),c.fields[l]=O.new({name:u,type:t[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new Q(n),a=D({type:new pe(n),length:i,children:s,nullCount:0});[this.schema,this.data]=D0(o,a.children,i),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=N0(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return ze.visit(this.data,e)}at(e){return this.get(pi(e,this.numRows))}set(e,t){return nt.visit(this.data,e,t)}indexOf(e,t){return yi.visit(this.data,e,t)}[Symbol.iterator](){return Go.visit(new B([this.data]))}toArray(){return[...this]}concat(...e){return new me(this.schema,[this,...e])}slice(e,t){let[n]=new B([this.data]).slice(e,t).data;return new r(this.schema,n,this._metadata)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)===null||t===void 0?void 0:t.findIndex(n=>n.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new B([this.data.children[e]]):null}setChild(e,t){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===e),t)}setChildAt(e,t){let n=this.schema,s=this.data;if(e>-1&&e<this.numCols){t||(t=new B([D({type:new Ne,length:this.numRows})]));let i=n.fields.slice(),o=s.children.slice(),a=i[e].clone({type:t.type});[i[e],o[e]]=[a,t.data[0]],n=new Q(i,new Map(this.schema.metadata)),s=D({type:new pe(i),length:s.length,children:o})}return new r(n,s,this._metadata)}select(e){let t=this.schema.select(e),n=new pe(t.fields),s=[];for(let i of e){let o=this.schema.fields.findIndex(a=>a.name===i);~o&&(s[o]=this.data.children[o])}return new r(t,D({type:n,length:this.numRows,children:s}),this._metadata)}selectAt(e){let t=this.schema.selectAt(e),n=e.map(i=>this.data.children[i]).filter(Boolean),s=D({type:new pe(t.fields),length:this.numRows,children:n});return new r(t,s,this._metadata)}};R0=Symbol.toStringTag;de[R0]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r[k0]=!0,"RecordBatch"))(de.prototype);Object.defineProperty(de,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===de&&de.isRecordBatch(e)}});qi=class extends de{constructor(e,t){let n=e.fields.map(i=>D({type:i.type})),s=D({type:new pe(e.fields),length:0,nullCount:0,children:n});super(e,s,t||new Map)}}});function Pl(r,e=0){for(let t=-1,n=Xo.length;++t<n;)if(Xo[t]!==r[e+t])return!1;return!0}var Hp,Jp,C0,U0,qs,Ki,Xi,Ul,Xp,Xo,Ho,Yp,P0,Vl=p(()=>{kt();Me();ce();_s();Yn();fp();Ke();As();bc();Hp=r=>`Expected ${se[r]} Message in stream, but was null or length 0.`,Jp=r=>`Header pointer of flatbuffer-encoded ${se[r]} Message is null or length 0.`,C0=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,U0=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`,qs=class{constructor(e){this.source=e instanceof _r?e:new _r(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done?Ee:e.value===-1&&(e=this.readMetadataLength()).done?Ee:(e=this.readMetadata(e.value)).done?Ee:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Hp(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);let t=k(this.source.read(e));if(t.byteLength<e)throw new Error(U0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=se.Schema,n=this.readMessage(t),s=n?.header();if(e&&!s)throw new Error(Jp(t));return s}readMetadataLength(){let e=this.source.read(Ul),t=e&&new Ze(e),n=t?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(e){let t=this.source.read(e);if(!t)return Ee;if(t.byteLength<e)throw new Error(C0(e,t.byteLength));return{done:!1,value:gt.decode(t)}}},Ki=class{constructor(e,t){this.source=e instanceof Gt?e:Bu(e)?new vs(e,t):new Gt(e)}[Symbol.asyncIterator](){return this}next(){return F(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done?Ee:e.value===-1&&(e=yield this.readMetadataLength()).done?Ee:(e=yield this.readMetadata(e.value)).done?Ee:e})}throw(e){return F(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return F(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return F(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Hp(e));return t.value})}readMessageBody(e){return F(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);let t=k(yield this.source.read(e));if(t.byteLength<e)throw new Error(U0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return F(this,arguments,void 0,function*(e=!1){let t=se.Schema,n=yield this.readMessage(t),s=n?.header();if(e&&!s)throw new Error(Jp(t));return s})}readMetadataLength(){return F(this,void 0,void 0,function*(){let e=yield this.source.read(Ul),t=e&&new Ze(e),n=t?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(e){return F(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return Ee;if(t.byteLength<e)throw new Error(C0(e,t.byteLength));return{done:!1,value:gt.decode(t)}})}},Xi=class extends qs{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof mc?e:new mc(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gt.fromJSON(e.schema,se.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:gt.fromJSON(t,se.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:gt.fromJSON(t,se.RecordBatch)}}return this._body=[],Ee}readMessageBody(e){return t(this._body);function t(n){return(n||[]).reduce((s,i)=>[...s,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...i.VIEWS&&[i.VIEWS]||[],...i.VARIADIC_DATA_BUFFERS||[],...t(i.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Hp(e));return t.value}readSchema(){let e=se.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw new Error(Jp(e));return n}},Ul=4,Xp="ARROW1",Xo=new Uint8Array(Xp.length);for(let r=0;r<Xp.length;r+=1)Xo[r]=Xp.codePointAt(r);Ho=Xo.length,Yp=Ho+Ul,P0=Ho*2+Ul});var Qp,Zp,V0,j0=p(()=>{So();Qp=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)&&this._hasValidVersion(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.LZ4_FRAME_MAGIC.every((t,n)=>e[n]===t)}_hasValidVersion(e){return(e[4]&192)>>6===1}},Zp=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.ZSTD_MAGIC.every((t,n)=>e[n]===t)}},V0={[et.LZ4_FRAME]:new Qp,[et.ZSTD]:new Zp}});var em,Ks,jl=p(()=>{So();j0();em=class{constructor(){this.registry={}}set(e,t){if(t?.encode&&typeof t.encode=="function"&&!V0[e].isValidCodecEncode(t))throw new Error(`Encoder for ${et[e]} is not valid.`);this.registry[e]=t}get(e){var t;return((t=this.registry)===null||t===void 0?void 0:t[e])||null}},Ks=new em});function $0(r,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:r.autoDestroy}function*G0(r){let e=Mt.from(r);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function z0(r){return _t(this,arguments,function*(){let t=yield Y(Mt.from(r));try{if(!(yield Y(t.open({autoDestroy:!1}))).closed)do yield yield Y(t);while(!(yield Y(t.reset().open())).closed)}finally{yield Y(t.cancel())}})}function oM(r){return new $r(new rm(r))}function aM(r){let e=r.peek(Ho+7&-8);return e&&e.byteLength>=4?Pl(e)?new Nn(new zl(r.read())):new $r(new Yo(r)):new $r(new Yo((function*(){})()))}function cM(r){return F(this,void 0,void 0,function*(){let e=yield r.peek(Ho+7&-8);return e&&e.byteLength>=4?Pl(e)?new Nn(new zl(yield r.read())):new kn(new Qo(r)):new kn(new Qo((function(){return _t(this,arguments,function*(){})})()))})}function uM(r){return F(this,void 0,void 0,function*(){let{size:e}=yield r.stat(),t=new vs(r,e);return e>=P0&&Pl(yield t.readAt(0,Ho+7&-8))?new Jo(new tm(t)):new kn(new Qo(t))})}var Mt,$r,kn,Nn,Jo,Gl,Yo,Qo,zl,tm,rm,Ic=p(()=>{kt();wr();ht();we();Me();ap();Va();_s();As();fp();I0();Rn();bc();Vl();Yn();jl();Qr();ce();Mt=class r extends Ti{constructor(e){super(),this._impl=e}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){let t=this._impl.open(e);return Yt(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Qe.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Qe.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof r?e:Eu(e)?oM(e):Bu(e)?uM(e):Yt(e)?F(this,void 0,void 0,function*(){return yield r.from(yield e)}):Fu(e)||Ca(e)||Mu(e)||br(e)?cM(new Gt(e)):aM(new _r(e))}static readAll(e){return e instanceof r?e.isSync()?G0(e):z0(e):Eu(e)||ArrayBuffer.isView(e)||Br(e)||Lu(e)?G0(e):z0(e)}},$r=class extends Mt{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return _t(this,arguments,function*(){yield Y(yield*Ao(Ht(this[Symbol.iterator]())))})}},kn=class extends Mt{constructor(e){super(e),this._impl=e}readAll(){return F(this,void 0,void 0,function*(){var e,t,n,s;let i=new Array;try{for(var o=!0,a=Ht(this),c;c=yield a.next(),e=c.done,!e;o=!0){s=c.value,o=!1;let u=s;i.push(u)}}catch(u){t={error:u}}finally{try{!o&&!e&&(n=a.return)&&(yield n.call(a))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Nn=class extends $r{constructor(e){super(e),this._impl=e}},Jo=class extends kn{constructor(e){super(e),this._impl=e}},Gl=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t,n){let s;if(e.compression!=null){let o=Ks.get(e.compression.type);if(o?.decode&&typeof o.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(e,t,o);s=this._loadCompressedVectors(e,a,this.schema.fields),e=new $e(e.length,e.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else s=this._loadVectors(e,t,this.schema.fields);let i=D({type:new pe(this.schema.fields),length:e.length,children:s});return new de(this.schema,i,n)}_loadDictionaryBatch(e,t){let{id:n,isDelta:s}=e,{dictionaries:i,schema:o}=this,a=i.get(n),c=o.dictionaries.get(n),u;if(e.data.compression!=null){let l=Ks.get(e.data.compression.type);if(l?.decode&&typeof l.decode=="function"){let{decommpressedBody:f,buffers:d}=this._decompressBuffers(e.data,t,l);u=this._loadCompressedVectors(e.data,f,[c]),e=new bt(new $e(e.data.length,e.data.nodes,d,null,e.data.variadicBufferCounts),n,s)}else throw new Error("Dictionary batch is compressed but codec not found")}else u=this._loadVectors(e.data,t,[c]);return(a&&s?a.concat(new B(u)):new B(u)).memoize()}_loadVectors(e,t,n){return new qo(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(e,t,n){return new Ll(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_decompressBuffers(e,t,n){let s=[],i=[],o=0;for(let{offset:a,length:c}of e.buffers){if(c===0){s.push(new Uint8Array(0)),i.push(new Ce(o,0));continue}let u=new Ze(t.subarray(a,a+c)),l=te(u.readInt64(0)),f=u.bytes().subarray(8),d=l===-1?f:n.decode(f);s.push(d);let h=(o+7&-8)-o;o+=h,i.push(new Ce(o,d.length)),o+=d.length}return{decommpressedBody:s,buffers:i}}},Yo=class extends Gl{constructor(e,t){super(t),this._reader=Eu(e)?new Xi(this._handle=e):new qs(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=$0(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Ee}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Ee}next(){if(this.closed)return Ee;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),s=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),s=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new qi(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},Qo=class extends Gl{constructor(e,t){super(t),this._reader=new Ki(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return F(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return F(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=$0(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Ee})}return(e){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Ee})}next(){return F(this,void 0,void 0,function*(){if(this.closed)return Ee;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),s=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),s=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new qi(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return F(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},zl=class extends Yo{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof gc?e:new gc(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();let n=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(n&&this._handle.seek(n.offset)){let s=this._reader.readMessage(se.RecordBatch);if(s?.isRecordBatch()){let i=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,o,s.metadata)}}return null}_readDictionaryBatch(e){var t;let n=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(n&&this._handle.seek(n.offset)){let s=this._reader.readMessage(se.DictionaryBatch);if(s?.isDictionaryBatch()){let i=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}}_readFooter(){let{_handle:e}=this,t=e.size-Yp,n=e.readInt32(t),s=e.readAt(t-n,n);return In.decode(s)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(e)}return null}},tm=class extends Qo{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]!="number"?t.shift():void 0,s=t[0]instanceof Map?t.shift():void 0;super(e instanceof vs?e:new vs(e,n),s)}isFile(){return!0}isAsync(){return!0}open(e){let t=Object.create(null,{open:{get:()=>super.open}});return F(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return F(this,void 0,void 0,function*(){var t;if(this.closed)return null;this._footer||(yield this.open());let n=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(n&&(yield this._handle.seek(n.offset))){let s=yield this._reader.readMessage(se.RecordBatch);if(s?.isRecordBatch()){let i=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,o,s.metadata)}}return null})}_readDictionaryBatch(e){return F(this,void 0,void 0,function*(){var t;let n=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(n&&(yield this._handle.seek(n.offset))){let s=yield this._reader.readMessage(se.DictionaryBatch);if(s?.isDictionaryBatch()){let i=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}})}_readFooter(){return F(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Yp,n=yield e.readInt32(t),s=yield e.readAt(t-n,n);return In.decode(s)})}_readNextMessageAndValidate(e){return F(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}},rm=class extends Yo{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new El(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}}});function lr(r){let e=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Ce(this._byteLength,e)),this._byteLength+=e,this}function lM(r){var e;let{type:t,length:n,typeIds:s,valueOffsets:i}=r;if(lr.call(this,s),t.mode===he.Sparse)return nm.call(this,r);if(t.mode===he.Dense){if(r.offset<=0)return lr.call(this,i),nm.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let u,l,f=-1;++f<n;)(u=s[f])!==void 0&&((l=a[u])===void 0&&(l=a[u]=i[f]),o[f]=i[f]-l,c[u]=((e=c[u])!==null&&e!==void 0?e:0)+1);lr.call(this,o),this.visitMany(r.children.map((u,l)=>{let f=t.typeIds[l],d=a[f],h=c[f];return u.slice(d,Math.min(n,h))}))}}return this}function fM(r){let e;return r.nullCount>=r.length?lr.call(this,new Uint8Array(r.length+7>>3)):(e=r.values)instanceof Uint8Array?lr.call(this,mi(r.offset,r.length,e)):lr.call(this,bi(r.values))}function Cn(r){return lr.call(this,r.values.subarray(0,r.length*r.stride))}function Wl(r){let{length:e,values:t,valueOffsets:n}=r,s=te(n[0]),i=te(n[e]),o=Math.min(i-s,t.byteLength-s);return lr.call(this,Du(-s,e+1,n)),lr.call(this,t.subarray(s,s+o)),this}function q0(r){let{offset:e,length:t,stride:n,values:s,variadicBuffers:i=[]}=r;if(!s)throw new Error("BinaryView data is missing view buffer");let o=e*n,a=o+t*n;lr.call(this,s.subarray(o,a));for(let c of i)lr.call(this,c);return this._variadicBufferCounts.push(i.length),this}function $l(r){let{length:e,valueOffsets:t}=r;if(t){let n=te(t[0]),s=te(t[e]);return lr.call(this,Du(-n,e+1,t)),this.visit(r.children[0].slice(n,s-n))}return this.visit(r.children[0])}function nm(r){return this.visitMany(r.type.children.map((e,t)=>r.children[t]).filter(Boolean))[0]}var Le,K0=p(()=>{ht();Vt();Me();Rn();Ke();gi();_s();we();Qr();Le=class r extends R{static assemble(...e){let t=s=>s.flatMap(i=>Array.isArray(i)?t(i):i instanceof de?i.data.children:i.data),n=new r;return n.visitMany(t(e)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(e){if(e instanceof B)return this.visitMany(e.data),this;let{type:t}=e;if(!E.isDictionary(t)){let{length:n}=e;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(E.isUnion(t))this.nodes.push(new xr(n,0));else{let{nullCount:s}=e;E.isNull(t)||lr.call(this,s<=0?new Uint8Array(0):mi(e.offset,n,e.nullBitmap)),this.nodes.push(new xr(n,s))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};Le.prototype.visitBool=fM;Le.prototype.visitInt=Cn;Le.prototype.visitFloat=Cn;Le.prototype.visitUtf8=Wl;Le.prototype.visitLargeUtf8=Wl;Le.prototype.visitUtf8View=q0;Le.prototype.visitBinary=Wl;Le.prototype.visitLargeBinary=Wl;Le.prototype.visitBinaryView=q0;Le.prototype.visitFixedSizeBinary=Cn;Le.prototype.visitDate=Cn;Le.prototype.visitTimestamp=Cn;Le.prototype.visitTime=Cn;Le.prototype.visitDecimal=Cn;Le.prototype.visitList=$l;Le.prototype.visitLargeList=$l;Le.prototype.visitStruct=nm;Le.prototype.visitUnion=lM;Le.prototype.visitInterval=Cn;Le.prototype.visitDuration=Cn;Le.prototype.visitFixedSizeList=$l;Le.prototype.visitMap=$l});var ql,X0=p(()=>{Vt();ju();Me();ql=class extends R{visit(e){return e==null?void 0:super.visit(e)}visitNull({typeId:e}){return{name:z[e].toLowerCase()}}visitInt({typeId:e,bitWidth:t,isSigned:n}){return{name:z[e].toLowerCase(),bitWidth:t,isSigned:n}}visitFloat({typeId:e,precision:t}){return{name:z[e].toLowerCase(),precision:le[t]}}visitBinary({typeId:e}){return{name:z[e].toLowerCase()}}visitLargeBinary({typeId:e}){return{name:z[e].toLowerCase()}}visitBinaryView({typeId:e}){return{name:z[e].toLowerCase()}}visitBool({typeId:e}){return{name:z[e].toLowerCase()}}visitUtf8({typeId:e}){return{name:z[e].toLowerCase()}}visitLargeUtf8({typeId:e}){return{name:z[e].toLowerCase()}}visitUtf8View({typeId:e}){return{name:z[e].toLowerCase()}}visitDecimal({typeId:e,scale:t,precision:n,bitWidth:s}){return{name:z[e].toLowerCase(),scale:t,precision:n,bitWidth:s}}visitDate({typeId:e,unit:t}){return{name:z[e].toLowerCase(),unit:ye[t]}}visitTime({typeId:e,unit:t,bitWidth:n}){return{name:z[e].toLowerCase(),unit:L[t],bitWidth:n}}visitTimestamp({typeId:e,timezone:t,unit:n}){return{name:z[e].toLowerCase(),unit:L[n],timezone:t}}visitInterval({typeId:e,unit:t}){return{name:z[e].toLowerCase(),unit:ae[t]}}visitDuration({typeId:e,unit:t}){return{name:z[e].toLocaleLowerCase(),unit:L[t]}}visitList({typeId:e}){return{name:z[e].toLowerCase()}}visitLargeList({typeId:e}){return{name:z[e].toLowerCase()}}visitStruct({typeId:e}){return{name:z[e].toLowerCase()}}visitUnion({typeId:e,mode:t,typeIds:n}){return{name:z[e].toLowerCase(),mode:he[t].toUpperCase(),typeIds:[...n]}}visitDictionary(e){return this.visit(e.dictionary)}visitFixedSizeBinary({typeId:e,byteWidth:t}){return{name:z[e].toLowerCase(),byteWidth:t}}visitFixedSizeList({typeId:e,listSize:t}){return{name:z[e].toLowerCase(),listSize:t}}visitMap({typeId:e,keysSorted:t}){return{name:z[e].toLowerCase(),keysSorted:t}}}});function*sm(r){for(let e of r)yield e.reduce((t,n)=>`${t}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Un(r,e){let t=new Uint32Array(r.buffer,r.byteOffset,r.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,s=t.length/e;++n<s;)yield`${di.new(t.subarray((n+0)*e,(n+1)*e),!1)}`}function H0(r,e){let n=r.values,s=new DataView(n.buffer,n.byteOffset,n.byteLength),i=n.byteLength/16,o=d=>Array.from(d).map(h=>("0"+(h&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:i},(d,h)=>{let m=h*16,b=s.getInt32(m,!0);return[m,b]}).map(([d,h])=>h>12?{SIZE:h,PREFIX_HEX:o(n.subarray(d+4,d+8)),BUFFER_INDEX:s.getInt32(d+8,!0),OFFSET:s.getInt32(d+12,!0)}:{SIZE:h,INLINED:e(n.subarray(d+4,d+4+h))}),c=[...new Set(a.map(d=>d.BUFFER_INDEX).filter(d=>d!==void 0))],u=c.map(d=>o(r.variadicBuffers[d])),l=new Map(c.map((d,h)=>[d,h]));return{VIEWS:a.map(d=>d.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},d),{BUFFER_INDEX:l.get(d.BUFFER_INDEX)}):d),VARIADIC_DATA_BUFFERS:u}}var Sc,J0=p(()=>{zu();ht();Vt();Me();Me();gi();Sl();we();Sc=class r extends R{static assemble(...e){let t=new r;return e.map(({schema:n,data:s})=>t.visitMany(n.fields,s.children))}visit({name:e},t){let{length:n}=t,{offset:s,nullCount:i,nullBitmap:o}=t,a=E.isDictionary(t.type)?t.type.indices:t.type,c=Object.assign([],t.buffers,{[re.VALIDITY]:void 0});return Object.assign({name:e,count:n,VALIDITY:E.isNull(a)||E.isUnion(a)?void 0:i<=0?Array.from({length:n},()=>1):[...new tn(o,s,n,null,fl)]},super.visit(t.clone(a,s,n,0,c)))}visitNull(){return{}}visitBool({values:e,offset:t,length:n}){return{DATA:[...new tn(e,t,n,null,Vo)]}}visitInt(e){return{DATA:e.type.bitWidth<64?[...e.values]:[...Un(e.values,2)]}}visitFloat(e){return{DATA:[...e.values]}}visitUtf8(e){return{DATA:[...new B([e])],OFFSET:[...e.valueOffsets]}}visitLargeUtf8(e){return{DATA:[...new B([e])],OFFSET:[...Un(e.valueOffsets,2)]}}visitBinary(e){return{DATA:[...sm(new B([e]))],OFFSET:[...e.valueOffsets]}}visitLargeBinary(e){return{DATA:[...sm(new B([e]))],OFFSET:[...Un(e.valueOffsets,2)]}}visitBinaryView(e){return H0(e,t=>Array.from(t).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(e){return H0(e,t=>Array.from(t).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(e){return{DATA:[...sm(new B([e]))]}}visitDate(e){return{DATA:e.type.unit===ye.DAY?[...e.values]:[...Un(e.values,2)]}}visitTimestamp(e){return{DATA:[...Un(e.values,2)]}}visitTime(e){return{DATA:e.type.unit<L.MICROSECOND?[...e.values]:[...Un(e.values,2)]}}visitDecimal(e){return{DATA:[...Un(e.values,4)]}}visitList(e){return{OFFSET:[...e.valueOffsets],children:this.visitMany(e.type.children,e.children)}}visitLargeList(e){return{OFFSET:[...Un(e.valueOffsets,2)],children:this.visitMany(e.type.children,e.children)}}visitStruct(e){return{children:this.visitMany(e.type.children,e.children)}}visitUnion(e){return{TYPE_ID:[...e.typeIds],OFFSET:e.type.mode===he.Dense?[...e.valueOffsets]:void 0,children:this.visitMany(e.type.children,e.children)}}visitInterval(e){switch(e.type.unit){case ae.YEAR_MONTH:return{DATA:[...e.values]};case ae.DAY_TIME:return{DATA:gp(e.values)};case ae.MONTH_DAY_NANO:return{DATA:yp(e.values,!0)}}}visitDuration(e){return{DATA:[...Un(e.values,2)]}}visitFixedSizeList(e){return{children:this.visitMany(e.type.children,e.children)}}visitMap(e){return{OFFSET:[...e.valueOffsets],children:this.visitMany(e.type.children,e.children)}}}});function im(r,e){let t=e;e instanceof me&&(t=e.batches,r.reset(void 0,e.schema));for(let n of t)r.write(n);return r.finish()}function om(r,e){return F(this,void 0,void 0,function*(){var t,n,s,i,o,a,c;try{for(t=!0,n=Ht(e);s=yield n.next(),i=s.done,!i;t=!0){c=s.value,t=!1;let u=c;r.write(u)}}catch(u){o={error:u}}finally{try{!t&&!i&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function Y0({name:r,type:e,nullable:t}){let n=new ql;return{name:r,nullable:t,type:n.visit(e),children:(e.children||[]).map(s=>Y0(s)),dictionary:E.isDictionary(e)?{id:e.id,isOrdered:e.isOrdered,indexType:n.visit(e.indices)}:void 0}}function dM(r,e,t=!1){let[n]=Sc.assemble(new de({[e]:r}));return JSON.stringify({id:e,isDelta:t,data:{count:r.length,columns:n}},null,2)}function hM(r){let[e]=Sc.assemble(r);return JSON.stringify({count:r.numRows,columns:e},null,2)}var an,Pn,Vn,Ec,Kl=p(()=>{kt();$i();Vl();ht();we();_s();_s();ap();Me();vc();As();K0();X0();J0();Ke();Rn();bc();Yn();So();jl();ce();an=class extends Ti{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}constructor(e){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Tr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,At(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1,e.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(et).includes(e.compressionType))this._compression=new xi(e.compressionType);else{let t=Object.values(et).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${e.compressionType} Available types: ${t.join(", ")}`)}}else this._compression=null}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Yt(e)?e.then(t=>this.writeAll(t)):br(e)?om(this,e):im(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,t=null){return e===this._sink||e instanceof Tr?this._sink=e:(this._sink=new Tr,e&&mx(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&bx(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!t||!Wi(t,this._schema))&&(t==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=t,this._writeSchema(t))),this}write(e){let t=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof me&&!(t=e.schema))return this.finish()&&void 0;if(e instanceof de&&!(t=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(t&&!Wi(t,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof de?e instanceof qi||this._writeRecordBatch(e):e instanceof me?this.writeAll(e.batches):Br(e)&&this.writeAll(e)}_writeMessage(e,t=8){let n=t-1,s=gt.encode(e),i=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=i+o+n&~n,c=a-i-o;return e.headerType===se.RecordBatch?this._recordBatchBlocks.push(new Gr(a,e.bodyLength,this._position)):e.headerType===se.DictionaryBatch&&this._dictionaryBlocks.push(new Gr(a,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),i>0&&this._write(s),this._writePadding(c)}_write(e){if(this._started){let t=k(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(gt.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Xo)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}=this._assembleRecordBatch(e),a=new $e(e.numRows,n,s,this._compression,o,e.metadata),c=gt.from(a,t);return this._writeDictionaries(e)._writeMessage(c)._writeBodyBuffers(i)}_assembleRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}=Le.assemble(e);return this._compression!=null&&({byteLength:t,bufferRegions:s,buffers:i}=this._compressBodyBuffers(i)),{byteLength:t,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}}_compressBodyBuffers(e){let t=Ks.get(this._compression.type);if(!t?.encode||typeof t.encode!="function")throw new Error(`Codec for compression type "${et[this._compression.type]}" has invalid encode method`);let n=0,s=[],i=[];for(let a of e){let c=k(a);if(c.length===0){s.push(new Uint8Array(0),new Uint8Array(0)),i.push(new Ce(n,0));continue}let u=t.encode(c),l=u.length<c.length,f=l?u:c,d=l?f.length:-1,h=new Ze(new Uint8Array(8));h.writeInt64(0,BigInt(d)),s.push(h.bytes(),new Uint8Array(f));let m=(n+7&-8)-n;n+=m;let b=8+f.length;i.push(new Ce(n,b)),n+=b}let o=(n+7&-8)-n;return n+=o,{byteLength:n,bufferRegions:i,buffers:s}}_writeDictionaryBatch(e,t,n=!1){let{byteLength:s,nodes:i,bufferRegions:o,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new B([e])),u=new $e(e.length,i,o,this._compression,c),l=new bt(u,t,n),f=gt.from(l,s);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(e){let t=this._compression!=null?2:1,n=new Array(t);for(let s=0;s<e.length;s+=t){let i=0;for(let a=-1;++a<t;)n[a]=e[s+a],i+=n[a].byteLength;if(i===0)continue;for(let a of n)this._write(a);let o=(i+7&-8)-i;o>0&&this._writePadding(o)}return this}_writeDictionaries(e){var t,n;for(let[s,i]of e.dictionaries){let o=(t=i?.data)!==null&&t!==void 0?t:[],a=this._seenDictionaries.get(s),c=(n=this._dictionaryDeltaOffsets.get(s))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(let[u,l]of o.entries())this._writeDictionaryBatch(l,s,u>0);else if(c<o.length)for(let u of o.slice(c))this._writeDictionaryBatch(u,s,!0);this._seenDictionaries.set(s,i),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},Pn=class r extends an{static writeAll(e,t){let n=new r(t);return Yt(e)?e.then(s=>n.writeAll(s)):br(e)?om(n,e):im(n,e)}},Vn=class r extends an{static writeAll(e,t){let n=new r(t);return Yt(e)?e.then(s=>n.writeAll(s)):br(e)?om(n,e):im(n,e)}constructor(e){super(e),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,t,n=!1){if(!n&&this._seenDictionaries.has(t))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(e,t,n)}_writeFooter(e){let t=In.encode(new In(e,ge.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}},Ec=class r extends an{static writeAll(e){return new r().writeAll(e)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(e){return this}_writeSchema(e){return this._write(`{
22
- "schema": ${JSON.stringify({fields:e.fields.map(t=>Y0(t))},null,2)}`)}_writeDictionaries(e){return e.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(e),this}_writeDictionaryBatch(e,t,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
23
- `),this._write(dM(e,t,n)),this._dictionaryBlocks.push(new Gr(0,0,0)),this}_writeRecordBatch(e){return this._writeDictionaries(e),this._recordBatches.push(e),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
21
+ ]`}concat(...e){let t=this.schema,n=this.data.concat(e.flatMap(({data:s})=>s));return new r(t,n.map(s=>new de(t,s)))}slice(e,t){let n=this.schema;[e,t]=xc({length:this.numRows},e,t);let s=Ml(this.data,this._offsets,e,t);return new r(n,s.map(i=>new de(n,i)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(n=>n.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],s=D({type:n,length:0,nullCount:0});t.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new B(t)}return null}setChild(e,t){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===e),t)}setChildAt(e,t){let n=this.schema,s=[...this.batches];if(e>-1&&e<this.numCols){t||(t=new B([D({type:new Ce,length:this.numRows})]));let i=n.fields.slice(),o=i[e].clone({type:t.type}),a=this.schema.fields.map((c,u)=>this.getChildAt(u));[i[e],a[e]]=[o,t],[n,s]=tf(n,a)}return new r(n,s)}select(e){let t=this.schema.fields.reduce((n,s,i)=>n.set(s.name,i),new Map);return this.selectAt(e.map(n=>t.get(n)).filter(n=>n>-1))}selectAt(e){let t=this.schema.selectAt(e),n=this.batches.map(s=>s.selectAt(e));return new r(t,n)}assign(e){let t=this.schema.fields,[n,s]=e.schema.fields.reduce((a,c,u)=>{let[l,f]=a,d=t.findIndex(h=>h.name===c.name);return~d?f[d]=u:l.push(u),a},[[],[]]),i=this.schema.assign(e.schema),o=[...t.map((a,c)=>[c,s[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):e.getChildAt(c)),...n.map(a=>e.getChildAt(a))].filter(Boolean);return new r(...tf(i,o))}};T_=Symbol.toStringTag;me[T_]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r[__]=!0,r.isValid=Ko(Ac),r.get=Ko(ze.getVisitFn(w.Struct)),r.set=Dl(nt.getVisitFn(w.Struct)),r.indexOf=Rl(Ai.getVisitFn(w.Struct)),"Table"))(me.prototype);Object.defineProperty(me,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===me&&me.isTable(e)}})});function A_(r,e,t=e.reduce((n,s)=>Math.max(n,s.length),0)){var n;let s=[...r.fields],i=[...e],o=(t+63&-64)>>3;for(let[a,c]of r.fields.entries()){let u=e[a];(!u||u.length!==t)&&(s[a]=c.clone({nullable:!0}),i[a]=(n=u?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:D({type:c.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)}))}return[r.assign(s),D({type:new pe(s),length:t,children:i})]}function S_(r,e,t=new Map){var n,s;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===e?.length)for(let i=-1,o=r.length;++i<o;){let{type:a}=r[i],c=e[i];for(let u of[c,...((s=c?.dictionary)===null||s===void 0?void 0:s.data)||[]])S_(a.children,u?.children,t);if(E.isDictionary(a)){let{id:u}=a;if(!t.has(u))c?.dictionary&&t.set(u,c.dictionary);else if(t.get(u)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return t}var v_,I_,de,Yi,Nn=p(()=>{wr();Ji();ht();mt();we();$o();yi();ar();Nl();Cl();I_=Symbol.for("apache-arrow/RecordBatch"),de=class r{static isRecordBatch(e){return e?.[I_]===!0}constructor(...e){switch(e.length){case 3:case 2:{if([this.schema]=e,!(this.schema instanceof Q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=D({nullCount:0,type:new pe(this.schema.fields),children:this.schema.fields.map(t=>D({type:t.type,nullCount:0}))}),this._metadata=new Map]=e,!(this.data instanceof G))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=A_(this.schema,this.data.children,this.data.length);break}case 1:{let[t]=e,{fields:n,children:s,length:i}=Object.keys(t).reduce((c,u,l)=>(c.children[l]=t[u],c.length=Math.max(c.length,t[u].length),c.fields[l]=O.new({name:u,type:t[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new Q(n),a=D({type:new pe(n),length:i,children:s,nullCount:0});[this.schema,this.data]=A_(o,a.children,i),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=S_(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return ze.visit(this.data,e)}at(e){return this.get(wi(e,this.numRows))}set(e,t){return nt.visit(this.data,e,t)}indexOf(e,t){return Ai.visit(this.data,e,t)}[Symbol.iterator](){return Ho.visit(new B([this.data]))}toArray(){return[...this]}concat(...e){return new me(this.schema,[this,...e])}slice(e,t){let[n]=new B([this.data]).slice(e,t).data;return new r(this.schema,n,this._metadata)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)===null||t===void 0?void 0:t.findIndex(n=>n.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new B([this.data.children[e]]):null}setChild(e,t){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===e),t)}setChildAt(e,t){let n=this.schema,s=this.data;if(e>-1&&e<this.numCols){t||(t=new B([D({type:new Ce,length:this.numRows})]));let i=n.fields.slice(),o=s.children.slice(),a=i[e].clone({type:t.type});[i[e],o[e]]=[a,t.data[0]],n=new Q(i,new Map(this.schema.metadata)),s=D({type:new pe(i),length:s.length,children:o})}return new r(n,s,this._metadata)}select(e){let t=this.schema.select(e),n=new pe(t.fields),s=[];for(let i of e){let o=this.schema.fields.findIndex(a=>a.name===i);~o&&(s[o]=this.data.children[o])}return new r(t,D({type:n,length:this.numRows,children:s}),this._metadata)}selectAt(e){let t=this.schema.selectAt(e),n=e.map(i=>this.data.children[i]).filter(Boolean),s=D({type:new pe(t.fields),length:this.numRows,children:n});return new r(t,s,this._metadata)}};v_=Symbol.toStringTag;de[v_]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r[I_]=!0,"RecordBatch"))(de.prototype);Object.defineProperty(de,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===de&&de.isRecordBatch(e)}});Yi=class extends de{constructor(e,t){let n=e.fields.map(i=>D({type:i.type})),s=D({type:new pe(e.fields),length:0,nullCount:0,children:n});super(e,s,t||new Map)}}});function nf(r,e=0){for(let t=-1,n=ea.length;++t<n;)if(ea[t]!==r[e+t])return!1;return!0}var Am,vm,E_,L_,Xs,Qi,Zi,rf,_m,ea,ta,Im,B_,sf=p(()=>{kt();De();ce();Is();es();Pp();Ke();Ss();Ic();Am=r=>`Expected ${se[r]} Message in stream, but was null or length 0.`,vm=r=>`Header pointer of flatbuffer-encoded ${se[r]} Message is null or length 0.`,E_=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,L_=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`,Xs=class{constructor(e){this.source=e instanceof _r?e:new _r(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done?Ee:e.value===-1&&(e=this.readMetadataLength()).done?Ee:(e=this.readMetadata(e.value)).done?Ee:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Am(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);let t=k(this.source.read(e));if(t.byteLength<e)throw new Error(L_(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=se.Schema,n=this.readMessage(t),s=n?.header();if(e&&!s)throw new Error(vm(t));return s}readMetadataLength(){let e=this.source.read(rf),t=e&&new Ze(e),n=t?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(e){let t=this.source.read(e);if(!t)return Ee;if(t.byteLength<e)throw new Error(E_(e,t.byteLength));return{done:!1,value:gt.decode(t)}}},Qi=class{constructor(e,t){this.source=e instanceof Gt?e:Ku(e)?new Es(e,t):new Gt(e)}[Symbol.asyncIterator](){return this}next(){return F(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done?Ee:e.value===-1&&(e=yield this.readMetadataLength()).done?Ee:(e=yield this.readMetadata(e.value)).done?Ee:e})}throw(e){return F(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return F(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return F(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Am(e));return t.value})}readMessageBody(e){return F(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);let t=k(yield this.source.read(e));if(t.byteLength<e)throw new Error(L_(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return F(this,arguments,void 0,function*(e=!1){let t=se.Schema,n=yield this.readMessage(t),s=n?.header();if(e&&!s)throw new Error(vm(t));return s})}readMetadataLength(){return F(this,void 0,void 0,function*(){let e=yield this.source.read(rf),t=e&&new Ze(e),n=t?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(e){return F(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return Ee;if(t.byteLength<e)throw new Error(E_(e,t.byteLength));return{done:!1,value:gt.decode(t)}})}},Zi=class extends Xs{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof vc?e:new vc(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gt.fromJSON(e.schema,se.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:gt.fromJSON(t,se.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:gt.fromJSON(t,se.RecordBatch)}}return this._body=[],Ee}readMessageBody(e){return t(this._body);function t(n){return(n||[]).reduce((s,i)=>[...s,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...i.VIEWS&&[i.VIEWS]||[],...i.VARIADIC_DATA_BUFFERS||[],...t(i.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(Am(e));return t.value}readSchema(){let e=se.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw new Error(vm(e));return n}},rf=4,_m="ARROW1",ea=new Uint8Array(_m.length);for(let r=0;r<_m.length;r+=1)ea[r]=_m.codePointAt(r);ta=ea.length,Im=ta+rf,B_=ta*2+rf});var Sm,Em,F_,O_=p(()=>{Mo();Sm=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)&&this._hasValidVersion(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.LZ4_FRAME_MAGIC.every((t,n)=>e[n]===t)}_hasValidVersion(e){return(e[4]&192)>>6===1}},Em=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.ZSTD_MAGIC.every((t,n)=>e[n]===t)}},F_={[et.LZ4_FRAME]:new Sm,[et.ZSTD]:new Em}});var Lm,Js,of=p(()=>{Mo();O_();Lm=class{constructor(){this.registry={}}set(e,t){if(t?.encode&&typeof t.encode=="function"&&!F_[e].isValidCodecEncode(t))throw new Error(`Encoder for ${et[e]} is not valid.`);this.registry[e]=t}get(e){var t;return((t=this.registry)===null||t===void 0?void 0:t[e])||null}},Js=new Lm});function k_(r,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:r.autoDestroy}function*M_(r){let e=Mt.from(r);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function D_(r){return _t(this,arguments,function*(){let t=yield Y(Mt.from(r));try{if(!(yield Y(t.open({autoDestroy:!1}))).closed)do yield yield Y(t);while(!(yield Y(t.reset().open())).closed)}finally{yield Y(t.cancel())}})}function o2(r){return new qr(new Fm(r))}function a2(r){let e=r.peek(ta+7&-8);return e&&e.byteLength>=4?nf(e)?new Un(new cf(r.read())):new qr(new na(r)):new qr(new na((function*(){})()))}function c2(r){return F(this,void 0,void 0,function*(){let e=yield r.peek(ta+7&-8);return e&&e.byteLength>=4?nf(e)?new Un(new cf(yield r.read())):new Cn(new sa(r)):new Cn(new sa((function(){return _t(this,arguments,function*(){})})()))})}function u2(r){return F(this,void 0,void 0,function*(){let{size:e}=yield r.stat(),t=new Es(r,e);return e>=B_&&nf(yield t.readAt(0,ta+7&-8))?new ra(new Bm(t)):new Cn(new sa(t))})}var Mt,qr,Cn,Un,ra,af,na,sa,cf,Bm,Fm,Rc=p(()=>{kt();wr();ht();we();De();kp();Xa();Is();Ss();Pp();m_();Nn();Ic();sf();es();of();en();ce();Mt=class r extends Si{constructor(e){super(),this._impl=e}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){let t=this._impl.open(e);return Yt(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Qe.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Qe.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof r?e:$u(e)?o2(e):Ku(e)?u2(e):Yt(e)?F(this,void 0,void 0,function*(){return yield r.from(yield e)}):Hu(e)||qa(e)||Ju(e)||br(e)?c2(new Gt(e)):a2(new _r(e))}static readAll(e){return e instanceof r?e.isSync()?M_(e):D_(e):$u(e)||ArrayBuffer.isView(e)||Fr(e)||qu(e)?M_(e):D_(e)}},qr=class extends Mt{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return _t(this,arguments,function*(){yield Y(yield*Bo(Xt(this[Symbol.iterator]())))})}},Cn=class extends Mt{constructor(e){super(e),this._impl=e}readAll(){return F(this,void 0,void 0,function*(){var e,t,n,s;let i=new Array;try{for(var o=!0,a=Xt(this),c;c=yield a.next(),e=c.done,!e;o=!0){s=c.value,o=!1;let u=s;i.push(u)}}catch(u){t={error:u}}finally{try{!o&&!e&&(n=a.return)&&(yield n.call(a))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Un=class extends qr{constructor(e){super(e),this._impl=e}},ra=class extends Cn{constructor(e){super(e),this._impl=e}},af=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t,n){let s;if(e.compression!=null){let o=Js.get(e.compression.type);if(o?.decode&&typeof o.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(e,t,o);s=this._loadCompressedVectors(e,a,this.schema.fields),e=new $e(e.length,e.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else s=this._loadVectors(e,t,this.schema.fields);let i=D({type:new pe(this.schema.fields),length:e.length,children:s});return new de(this.schema,i,n)}_loadDictionaryBatch(e,t){let{id:n,isDelta:s}=e,{dictionaries:i,schema:o}=this,a=i.get(n),c=o.dictionaries.get(n),u;if(e.data.compression!=null){let l=Js.get(e.data.compression.type);if(l?.decode&&typeof l.decode=="function"){let{decommpressedBody:f,buffers:d}=this._decompressBuffers(e.data,t,l);u=this._loadCompressedVectors(e.data,f,[c]),e=new bt(new $e(e.data.length,e.data.nodes,d,null,e.data.variadicBufferCounts),n,s)}else throw new Error("Dictionary batch is compressed but codec not found")}else u=this._loadVectors(e.data,t,[c]);return(a&&s?a.concat(new B(u)):new B(u)).memoize()}_loadVectors(e,t,n){return new Qo(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(e,t,n){return new ql(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_decompressBuffers(e,t,n){let s=[],i=[],o=0;for(let{offset:a,length:c}of e.buffers){if(c===0){s.push(new Uint8Array(0)),i.push(new Ue(o,0));continue}let u=new Ze(t.subarray(a,a+c)),l=te(u.readInt64(0)),f=u.bytes().subarray(8),d=l===-1?f:n.decode(f);s.push(d);let h=(o+7&-8)-o;o+=h,i.push(new Ue(o,d.length)),o+=d.length}return{decommpressedBody:s,buffers:i}}},na=class extends af{constructor(e,t){super(t),this._reader=$u(e)?new Zi(this._handle=e):new Xs(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=k_(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Ee}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Ee}next(){if(this.closed)return Ee;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),s=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),s=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Yi(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},sa=class extends af{constructor(e,t){super(t),this._reader=new Qi(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return F(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return F(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=k_(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Ee})}return(e){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Ee})}next(){return F(this,void 0,void 0,function*(){if(this.closed)return Ee;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),s=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),s=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Yi(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return F(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},cf=class extends na{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof Sc?e:new Sc(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();let n=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(n&&this._handle.seek(n.offset)){let s=this._reader.readMessage(se.RecordBatch);if(s?.isRecordBatch()){let i=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,o,s.metadata)}}return null}_readDictionaryBatch(e){var t;let n=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(n&&this._handle.seek(n.offset)){let s=this._reader.readMessage(se.DictionaryBatch);if(s?.isDictionaryBatch()){let i=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}}_readFooter(){let{_handle:e}=this,t=e.size-Im,n=e.readInt32(t),s=e.readAt(t-n,n);return En.decode(s)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(e)}return null}},Bm=class extends sa{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]!="number"?t.shift():void 0,s=t[0]instanceof Map?t.shift():void 0;super(e instanceof Es?e:new Es(e,n),s)}isFile(){return!0}isAsync(){return!0}open(e){let t=Object.create(null,{open:{get:()=>super.open}});return F(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return F(this,void 0,void 0,function*(){var t;if(this.closed)return null;this._footer||(yield this.open());let n=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(n&&(yield this._handle.seek(n.offset))){let s=yield this._reader.readMessage(se.RecordBatch);if(s?.isRecordBatch()){let i=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,o,s.metadata)}}return null})}_readDictionaryBatch(e){return F(this,void 0,void 0,function*(){var t;let n=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(n&&(yield this._handle.seek(n.offset))){let s=yield this._reader.readMessage(se.DictionaryBatch);if(s?.isDictionaryBatch()){let i=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,o);this.dictionaries.set(i.id,a)}}})}_readFooter(){return F(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Im,n=yield e.readInt32(t),s=yield e.readAt(t-n,n);return En.decode(s)})}_readNextMessageAndValidate(e){return F(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}},Fm=class extends na{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new $l(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}}});function lr(r){let e=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Ue(this._byteLength,e)),this._byteLength+=e,this}function l2(r){var e;let{type:t,length:n,typeIds:s,valueOffsets:i}=r;if(lr.call(this,s),t.mode===he.Sparse)return Om.call(this,r);if(t.mode===he.Dense){if(r.offset<=0)return lr.call(this,i),Om.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let u,l,f=-1;++f<n;)(u=s[f])!==void 0&&((l=a[u])===void 0&&(l=a[u]=i[f]),o[f]=i[f]-l,c[u]=((e=c[u])!==null&&e!==void 0?e:0)+1);lr.call(this,o),this.visitMany(r.children.map((u,l)=>{let f=t.typeIds[l],d=a[f],h=c[f];return u.slice(d,Math.min(n,h))}))}}return this}function f2(r){let e;return r.nullCount>=r.length?lr.call(this,new Uint8Array(r.length+7>>3)):(e=r.values)instanceof Uint8Array?lr.call(this,xi(r.offset,r.length,e)):lr.call(this,Ti(r.values))}function Pn(r){return lr.call(this,r.values.subarray(0,r.length*r.stride))}function uf(r){let{length:e,values:t,valueOffsets:n}=r,s=te(n[0]),i=te(n[e]),o=Math.min(i-s,t.byteLength-s);return lr.call(this,Yu(-s,e+1,n)),lr.call(this,t.subarray(s,s+o)),this}function N_(r){let{offset:e,length:t,stride:n,values:s,variadicBuffers:i=[]}=r;if(!s)throw new Error("BinaryView data is missing view buffer");let o=e*n,a=o+t*n;lr.call(this,s.subarray(o,a));for(let c of i)lr.call(this,c);return this._variadicBufferCounts.push(i.length),this}function lf(r){let{length:e,valueOffsets:t}=r;if(t){let n=te(t[0]),s=te(t[e]);return lr.call(this,Yu(-n,e+1,t)),this.visit(r.children[0].slice(n,s-n))}return this.visit(r.children[0])}function Om(r){return this.visitMany(r.type.children.map((e,t)=>r.children[t]).filter(Boolean))[0]}var Le,C_=p(()=>{ht();Vt();De();Nn();Ke();_i();Is();we();en();Le=class r extends R{static assemble(...e){let t=s=>s.flatMap(i=>Array.isArray(i)?t(i):i instanceof de?i.data.children:i.data),n=new r;return n.visitMany(t(e)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(e){if(e instanceof B)return this.visitMany(e.data),this;let{type:t}=e;if(!E.isDictionary(t)){let{length:n}=e;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(E.isUnion(t))this.nodes.push(new xr(n,0));else{let{nullCount:s}=e;E.isNull(t)||lr.call(this,s<=0?new Uint8Array(0):xi(e.offset,n,e.nullBitmap)),this.nodes.push(new xr(n,s))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};Le.prototype.visitBool=f2;Le.prototype.visitInt=Pn;Le.prototype.visitFloat=Pn;Le.prototype.visitUtf8=uf;Le.prototype.visitLargeUtf8=uf;Le.prototype.visitUtf8View=N_;Le.prototype.visitBinary=uf;Le.prototype.visitLargeBinary=uf;Le.prototype.visitBinaryView=N_;Le.prototype.visitFixedSizeBinary=Pn;Le.prototype.visitDate=Pn;Le.prototype.visitTimestamp=Pn;Le.prototype.visitTime=Pn;Le.prototype.visitDecimal=Pn;Le.prototype.visitList=lf;Le.prototype.visitLargeList=lf;Le.prototype.visitStruct=Om;Le.prototype.visitUnion=l2;Le.prototype.visitInterval=Pn;Le.prototype.visitDuration=Pn;Le.prototype.visitFixedSizeList=lf;Le.prototype.visitMap=lf});var ff,U_=p(()=>{Vt();il();De();ff=class extends R{visit(e){return e==null?void 0:super.visit(e)}visitNull({typeId:e}){return{name:z[e].toLowerCase()}}visitInt({typeId:e,bitWidth:t,isSigned:n}){return{name:z[e].toLowerCase(),bitWidth:t,isSigned:n}}visitFloat({typeId:e,precision:t}){return{name:z[e].toLowerCase(),precision:le[t]}}visitBinary({typeId:e}){return{name:z[e].toLowerCase()}}visitLargeBinary({typeId:e}){return{name:z[e].toLowerCase()}}visitBinaryView({typeId:e}){return{name:z[e].toLowerCase()}}visitBool({typeId:e}){return{name:z[e].toLowerCase()}}visitUtf8({typeId:e}){return{name:z[e].toLowerCase()}}visitLargeUtf8({typeId:e}){return{name:z[e].toLowerCase()}}visitUtf8View({typeId:e}){return{name:z[e].toLowerCase()}}visitDecimal({typeId:e,scale:t,precision:n,bitWidth:s}){return{name:z[e].toLowerCase(),scale:t,precision:n,bitWidth:s}}visitDate({typeId:e,unit:t}){return{name:z[e].toLowerCase(),unit:ye[t]}}visitTime({typeId:e,unit:t,bitWidth:n}){return{name:z[e].toLowerCase(),unit:L[t],bitWidth:n}}visitTimestamp({typeId:e,timezone:t,unit:n}){return{name:z[e].toLowerCase(),unit:L[n],timezone:t}}visitInterval({typeId:e,unit:t}){return{name:z[e].toLowerCase(),unit:ae[t]}}visitDuration({typeId:e,unit:t}){return{name:z[e].toLocaleLowerCase(),unit:L[t]}}visitList({typeId:e}){return{name:z[e].toLowerCase()}}visitLargeList({typeId:e}){return{name:z[e].toLowerCase()}}visitStruct({typeId:e}){return{name:z[e].toLowerCase()}}visitUnion({typeId:e,mode:t,typeIds:n}){return{name:z[e].toLowerCase(),mode:he[t].toUpperCase(),typeIds:[...n]}}visitDictionary(e){return this.visit(e.dictionary)}visitFixedSizeBinary({typeId:e,byteWidth:t}){return{name:z[e].toLowerCase(),byteWidth:t}}visitFixedSizeList({typeId:e,listSize:t}){return{name:z[e].toLowerCase(),listSize:t}}visitMap({typeId:e,keysSorted:t}){return{name:z[e].toLowerCase(),keysSorted:t}}}});function*Mm(r){for(let e of r)yield e.reduce((t,n)=>`${t}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Vn(r,e){let t=new Uint32Array(r.buffer,r.byteOffset,r.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,s=t.length/e;++n<s;)yield`${gi.new(t.subarray((n+0)*e,(n+1)*e),!1)}`}function P_(r,e){let n=r.values,s=new DataView(n.buffer,n.byteOffset,n.byteLength),i=n.byteLength/16,o=d=>Array.from(d).map(h=>("0"+(h&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:i},(d,h)=>{let m=h*16,b=s.getInt32(m,!0);return[m,b]}).map(([d,h])=>h>12?{SIZE:h,PREFIX_HEX:o(n.subarray(d+4,d+8)),BUFFER_INDEX:s.getInt32(d+8,!0),OFFSET:s.getInt32(d+12,!0)}:{SIZE:h,INLINED:e(n.subarray(d+4,d+4+h))}),c=[...new Set(a.map(d=>d.BUFFER_INDEX).filter(d=>d!==void 0))],u=c.map(d=>o(r.variadicBuffers[d])),l=new Map(c.map((d,h)=>[d,h]));return{VIEWS:a.map(d=>d.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},d),{BUFFER_INDEX:l.get(d.BUFFER_INDEX)}):d),VARIADIC_DATA_BUFFERS:u}}var kc,V_=p(()=>{al();ht();Vt();De();De();_i();Wl();we();kc=class r extends R{static assemble(...e){let t=new r;return e.map(({schema:n,data:s})=>t.visitMany(n.fields,s.children))}visit({name:e},t){let{length:n}=t,{offset:s,nullCount:i,nullBitmap:o}=t,a=E.isDictionary(t.type)?t.type.indices:t.type,c=Object.assign([],t.buffers,{[re.VALIDITY]:void 0});return Object.assign({name:e,count:n,VALIDITY:E.isNull(a)||E.isUnion(a)?void 0:i<=0?Array.from({length:n},()=>1):[...new nn(o,s,n,null,Bl)]},super.visit(t.clone(a,s,n,0,c)))}visitNull(){return{}}visitBool({values:e,offset:t,length:n}){return{DATA:[...new nn(e,t,n,null,qo)]}}visitInt(e){return{DATA:e.type.bitWidth<64?[...e.values]:[...Vn(e.values,2)]}}visitFloat(e){return{DATA:[...e.values]}}visitUtf8(e){return{DATA:[...new B([e])],OFFSET:[...e.valueOffsets]}}visitLargeUtf8(e){return{DATA:[...new B([e])],OFFSET:[...Vn(e.valueOffsets,2)]}}visitBinary(e){return{DATA:[...Mm(new B([e]))],OFFSET:[...e.valueOffsets]}}visitLargeBinary(e){return{DATA:[...Mm(new B([e]))],OFFSET:[...Vn(e.valueOffsets,2)]}}visitBinaryView(e){return P_(e,t=>Array.from(t).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(e){return P_(e,t=>Array.from(t).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(e){return{DATA:[...Mm(new B([e]))]}}visitDate(e){return{DATA:e.type.unit===ye.DAY?[...e.values]:[...Vn(e.values,2)]}}visitTimestamp(e){return{DATA:[...Vn(e.values,2)]}}visitTime(e){return{DATA:e.type.unit<L.MICROSECOND?[...e.values]:[...Vn(e.values,2)]}}visitDecimal(e){return{DATA:[...Vn(e.values,4)]}}visitList(e){return{OFFSET:[...e.valueOffsets],children:this.visitMany(e.type.children,e.children)}}visitLargeList(e){return{OFFSET:[...Vn(e.valueOffsets,2)],children:this.visitMany(e.type.children,e.children)}}visitStruct(e){return{children:this.visitMany(e.type.children,e.children)}}visitUnion(e){return{TYPE_ID:[...e.typeIds],OFFSET:e.type.mode===he.Dense?[...e.valueOffsets]:void 0,children:this.visitMany(e.type.children,e.children)}}visitInterval(e){switch(e.type.unit){case ae.YEAR_MONTH:return{DATA:[...e.values]};case ae.DAY_TIME:return{DATA:$p(e.values)};case ae.MONTH_DAY_NANO:return{DATA:qp(e.values,!0)}}}visitDuration(e){return{DATA:[...Vn(e.values,2)]}}visitFixedSizeList(e){return{children:this.visitMany(e.type.children,e.children)}}visitMap(e){return{OFFSET:[...e.valueOffsets],children:this.visitMany(e.type.children,e.children)}}}});function Dm(r,e){let t=e;e instanceof me&&(t=e.batches,r.reset(void 0,e.schema));for(let n of t)r.write(n);return r.finish()}function Rm(r,e){return F(this,void 0,void 0,function*(){var t,n,s,i,o,a,c;try{for(t=!0,n=Xt(e);s=yield n.next(),i=s.done,!i;t=!0){c=s.value,t=!1;let u=c;r.write(u)}}catch(u){o={error:u}}finally{try{!t&&!i&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function j_({name:r,type:e,nullable:t}){let n=new ff;return{name:r,nullable:t,type:n.visit(e),children:(e.children||[]).map(s=>j_(s)),dictionary:E.isDictionary(e)?{id:e.id,isOrdered:e.isOrdered,indexType:n.visit(e.indices)}:void 0}}function d2(r,e,t=!1){let[n]=kc.assemble(new de({[e]:r}));return JSON.stringify({id:e,isDelta:t,data:{count:r.length,columns:n}},null,2)}function h2(r){let[e]=kc.assemble(r);return JSON.stringify({count:r.numRows,columns:e},null,2)}var un,jn,Gn,Nc,df=p(()=>{kt();Ji();sf();ht();we();Is();Is();kp();De();Dc();Ss();C_();U_();V_();Ke();Nn();Ic();es();Mo();of();ce();un=class extends Si{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}constructor(e){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Tr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,At(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1,e.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(et).includes(e.compressionType))this._compression=new Ii(e.compressionType);else{let t=Object.values(et).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${e.compressionType} Available types: ${t.join(", ")}`)}}else this._compression=null}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Yt(e)?e.then(t=>this.writeAll(t)):br(e)?Rm(this,e):Dm(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,t=null){return e===this._sink||e instanceof Tr?this._sink=e:(this._sink=new Tr,e&&iT(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&oT(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!t||!Xi(t,this._schema))&&(t==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=t,this._writeSchema(t))),this}write(e){let t=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof me&&!(t=e.schema))return this.finish()&&void 0;if(e instanceof de&&!(t=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(t&&!Xi(t,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof de?e instanceof Yi||this._writeRecordBatch(e):e instanceof me?this.writeAll(e.batches):Fr(e)&&this.writeAll(e)}_writeMessage(e,t=8){let n=t-1,s=gt.encode(e),i=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=i+o+n&~n,c=a-i-o;return e.headerType===se.RecordBatch?this._recordBatchBlocks.push(new zr(a,e.bodyLength,this._position)):e.headerType===se.DictionaryBatch&&this._dictionaryBlocks.push(new zr(a,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),i>0&&this._write(s),this._writePadding(c)}_write(e){if(this._started){let t=k(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(gt.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ea)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}=this._assembleRecordBatch(e),a=new $e(e.numRows,n,s,this._compression,o,e.metadata),c=gt.from(a,t);return this._writeDictionaries(e)._writeMessage(c)._writeBodyBuffers(i)}_assembleRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}=Le.assemble(e);return this._compression!=null&&({byteLength:t,bufferRegions:s,buffers:i}=this._compressBodyBuffers(i)),{byteLength:t,nodes:n,bufferRegions:s,buffers:i,variadicBufferCounts:o}}_compressBodyBuffers(e){let t=Js.get(this._compression.type);if(!t?.encode||typeof t.encode!="function")throw new Error(`Codec for compression type "${et[this._compression.type]}" has invalid encode method`);let n=0,s=[],i=[];for(let a of e){let c=k(a);if(c.length===0){s.push(new Uint8Array(0),new Uint8Array(0)),i.push(new Ue(n,0));continue}let u=t.encode(c),l=u.length<c.length,f=l?u:c,d=l?f.length:-1,h=new Ze(new Uint8Array(8));h.writeInt64(0,BigInt(d)),s.push(h.bytes(),new Uint8Array(f));let m=(n+7&-8)-n;n+=m;let b=8+f.length;i.push(new Ue(n,b)),n+=b}let o=(n+7&-8)-n;return n+=o,{byteLength:n,bufferRegions:i,buffers:s}}_writeDictionaryBatch(e,t,n=!1){let{byteLength:s,nodes:i,bufferRegions:o,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new B([e])),u=new $e(e.length,i,o,this._compression,c),l=new bt(u,t,n),f=gt.from(l,s);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(e){let t=this._compression!=null?2:1,n=new Array(t);for(let s=0;s<e.length;s+=t){let i=0;for(let a=-1;++a<t;)n[a]=e[s+a],i+=n[a].byteLength;if(i===0)continue;for(let a of n)this._write(a);let o=(i+7&-8)-i;o>0&&this._writePadding(o)}return this}_writeDictionaries(e){var t,n;for(let[s,i]of e.dictionaries){let o=(t=i?.data)!==null&&t!==void 0?t:[],a=this._seenDictionaries.get(s),c=(n=this._dictionaryDeltaOffsets.get(s))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(let[u,l]of o.entries())this._writeDictionaryBatch(l,s,u>0);else if(c<o.length)for(let u of o.slice(c))this._writeDictionaryBatch(u,s,!0);this._seenDictionaries.set(s,i),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},jn=class r extends un{static writeAll(e,t){let n=new r(t);return Yt(e)?e.then(s=>n.writeAll(s)):br(e)?Rm(n,e):Dm(n,e)}},Gn=class r extends un{static writeAll(e,t){let n=new r(t);return Yt(e)?e.then(s=>n.writeAll(s)):br(e)?Rm(n,e):Dm(n,e)}constructor(e){super(e),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,t,n=!1){if(!n&&this._seenDictionaries.has(t))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(e,t,n)}_writeFooter(e){let t=En.encode(new En(e,ge.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}},Nc=class r extends un{static writeAll(e){return new r().writeAll(e)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(e){return this}_writeSchema(e){return this._write(`{
22
+ "schema": ${JSON.stringify({fields:e.fields.map(t=>j_(t))},null,2)}`)}_writeDictionaries(e){return e.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(e),this}_writeDictionaryBatch(e,t,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
23
+ `),this._write(d2(e,t,n)),this._dictionaryBlocks.push(new zr(0,0,0)),this}_writeRecordBatch(e){return this._writeDictionaries(e),this._recordBatches.push(e),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
24
24
  "dictionaries": [
25
25
  `);for(let e of this._recordBatchesWithDictionaries)super._writeDictionaries(e);this._write(`
26
26
  ]`)}if(this._recordBatches.length>0){for(let e=-1,t=this._recordBatches.length;++e<t;)this._write(e===0?`,
27
27
  "batches": [
28
28
  `:`,
29
- `),this._write(hM(this._recordBatches[e])),this._recordBatchBlocks.push(new Gr(0,0,0));this._write(`
29
+ `),this._write(h2(this._recordBatches[e])),this._recordBatchBlocks.push(new zr(0,0,0));this._write(`
30
30
  ]`)}return this._schema&&this._write(`
31
- }`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function Q0(r,e){if(br(r))return mM(r,e);if(Br(r))return pM(r,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function pM(r,e){let t=null,n=e?.type==="bytes"||!1,s=e?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){i(o,t||(t=r[Symbol.iterator]()))},pull(o){t?i(o,t):o.close()},cancel(){t?.return&&t.return(),t=null}}),Object.assign({highWaterMark:n?s:void 0},e));function i(o,a){let c,u=null,l=o.desiredSize||null;for(;!(u=a.next(n?l:null)).done;)if(ArrayBuffer.isView(u.value)&&(c=k(u.value))&&(l!=null&&n&&(l=l-c.byteLength+1),u.value=c),o.enqueue(u.value),l!=null&&--l<=0)return;o.close()}}function mM(r,e){let t=null,n=e?.type==="bytes"||!1,s=e?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){return F(this,void 0,void 0,function*(){yield i(o,t||(t=r[Symbol.asyncIterator]()))})},pull(o){return F(this,void 0,void 0,function*(){t?yield i(o,t):o.close()})},cancel(){return F(this,void 0,void 0,function*(){t?.return&&(yield t.return()),t=null})}}),Object.assign({highWaterMark:n?s:void 0},e));function i(o,a){return F(this,void 0,void 0,function*(){let c,u=null,l=o.desiredSize||null;for(;!(u=yield a.next(n?l:null)).done;)if(ArrayBuffer.isView(u.value)&&(c=k(u.value))&&(l!=null&&n&&(l=l-c.byteLength+1),u.value=c),o.enqueue(u.value),l!=null&&--l<=0)return;o.close()})}}var Z0=p(()=>{kt();Ke();Yn()});function r_(r){return new am(r)}var am,e_,t_,n_=p(()=>{kt();xc();am=class{constructor(e){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:t,["writableStrategy"]:n,["queueingStrategy"]:s="count"}=e,i=dx(e,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=zr(i),this._getSize=s!=="bytes"?e_:t_;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},t),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:s!=="bytes"?e_:t_}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(e){let t=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(e)),this._bufferedSize-t}_maybeFlush(e,t){t!=null&&(this._bufferedSize>=t.desiredSize&&++this._numChunks&&this._enqueue(t,e.toVector()),e.finished&&((e.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(t,e.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(t,null)))}_enqueue(e,t){this._bufferedSize=0,this._controller=null,t==null?e.close():e.enqueue(t)}},e_=r=>{var e;return(e=r?.length)!==null&&e!==void 0?e:0},t_=r=>{var e;return(e=r?.byteLength)!==null&&e!==void 0?e:0}});function Xl(r,e){let t=new Tr,n=null,s=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield t.close()})},start(a){return F(this,void 0,void 0,function*(){yield o(a,n||(n=yield i()))})},pull(a){return F(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(t,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:s};function i(){return F(this,void 0,void 0,function*(){return yield(yield Mt.from(t)).open(e)})}function o(a,c){return F(this,void 0,void 0,function*(){let u=a.desiredSize,l=null;for(;!(l=yield c.next()).done;)if(a.enqueue(l.value),u!=null&&--u<=0)return;a.close()})}}var s_=p(()=>{kt();As();Ic()});function Hl(r,e){let t=new this(r),n=new Gt(t),s=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return F(this,void 0,void 0,function*(){yield i(o)})},start(o){return F(this,void 0,void 0,function*(){yield i(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},e));return{writable:new WritableStream(t,r),readable:s};function i(o){return F(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}var i_=p(()=>{kt();As()});function Zo(r){let e=Mt.from(r);return Yt(e)?e.then(t=>Zo(t)):e.isAsync()?e.readAll().then(t=>new me(t)):new me(e.readAll())}function Lc(r,e="stream",t=null){let n={compressionType:t};return(e==="stream"?Pn:Vn).writeAll(r,n).toUint8Array(!0)}var o_=p(()=>{$i();Yn();Ic();Kl()});var cm={};J(cm,{isArrowData:()=>Zl,isArrowDataType:()=>Ql,isArrowField:()=>Yl,isArrowRecordBatch:()=>tf,isArrowSchema:()=>Jl,isArrowTable:()=>rf,isArrowVector:()=>ef});function Jl(r){return Q.isSchema(r)}function Yl(r){return O.isField(r)}function Ql(r){return E.isDataType(r)}function Zl(r){return G.isData(r)}function ef(r){return B.isVector(r)}function tf(r){return de.isRecordBatch(r)}function rf(r){return me.isTable(r)}var um=p(()=>{mt();we();wr();ht();Rn();$i()});var a_,lm=p(()=>{Gu();So();Me();wr();we();$i();ht();Vt();mt();lc();cl();Se();xc();xp();Dp();Tp();_p();Ap();vp();Sp();Bp();Np();kp();Ep();Lp();Up();Vp();Pp();Bl();Ol();Fl();Fp();Op();Ip();Mp();Rp();Cp();As();Ic();Kl();o_();jl();Vl();_s();Rn();um();zu();pp();gi();uc();Ke();Po();tc();Sl();um();vc();a_=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ch),hp),Zh),Uh),nh),Qh),Dh),wp),cm),{compareSchemas:Wi,compareFields:B0,compareTypes:Rl})});var cn={};J(cn,{AsyncByteQueue:()=>Tr,AsyncByteStream:()=>Gt,AsyncMessageReader:()=>Ki,AsyncRecordBatchFileReader:()=>Jo,AsyncRecordBatchStreamReader:()=>kn,Binary:()=>Ct,BinaryBuilder:()=>Ln,BinaryView:()=>Z,BinaryViewBuilder:()=>On,Bool:()=>lt,BoolBuilder:()=>_i,BufferType:()=>re,Builder:()=>Te,ByteStream:()=>_r,CompressionType:()=>et,Data:()=>G,DataType:()=>E,DateBuilder:()=>nn,DateDay:()=>os,DateDayBuilder:()=>Is,DateMillisecond:()=>as,DateMillisecondBuilder:()=>Ss,DateUnit:()=>ye,Date_:()=>Et,Decimal:()=>Ut,DecimalBuilder:()=>Es,DenseUnion:()=>_n,DenseUnionBuilder:()=>Gi,Dictionary:()=>Ge,DictionaryBuilder:()=>Ai,Duration:()=>Lt,DurationBuilder:()=>Ar,DurationMicrosecond:()=>oc,DurationMicrosecondBuilder:()=>Rs,DurationMillisecond:()=>ic,DurationMillisecondBuilder:()=>Ds,DurationNanosecond:()=>ac,DurationNanosecondBuilder:()=>ks,DurationSecond:()=>sc,DurationSecondBuilder:()=>Ms,Field:()=>O,FixedSizeBinary:()=>Pt,FixedSizeBinaryBuilder:()=>Ls,FixedSizeList:()=>Be,FixedSizeListBuilder:()=>vi,Float:()=>ct,Float16:()=>Cr,Float16Builder:()=>Ii,Float32:()=>It,Float32Builder:()=>Si,Float64:()=>sr,Float64Builder:()=>Ei,FloatBuilder:()=>sn,Int:()=>Fe,Int16:()=>er,Int16Builder:()=>Bi,Int32:()=>Pe,Int32Builder:()=>Fi,Int64:()=>tr,Int64Builder:()=>Oi,Int8:()=>Zt,Int8Builder:()=>Li,IntBuilder:()=>Ft,Interval:()=>ft,IntervalBuilder:()=>Wr,IntervalDayTime:()=>ms,IntervalDayTimeBuilder:()=>Bs,IntervalMonthDayNano:()=>nc,IntervalMonthDayNanoBuilder:()=>Os,IntervalUnit:()=>ae,IntervalYearMonth:()=>bs,IntervalYearMonthBuilder:()=>Fs,JSONMessageReader:()=>Xi,LargeBinary:()=>Ur,LargeBinaryBuilder:()=>Bn,LargeList:()=>ir,LargeListBuilder:()=>Ci,LargeUtf8:()=>Pr,LargeUtf8Builder:()=>$s,List:()=>je,ListBuilder:()=>Ni,MapBuilder:()=>Ui,MapRow:()=>yr,Map_:()=>dt,Message:()=>gt,MessageHeader:()=>se,MessageReader:()=>qs,MetadataVersion:()=>ge,Null:()=>Ne,NullBuilder:()=>Pi,Precision:()=>le,RecordBatch:()=>de,RecordBatchFileReader:()=>Nn,RecordBatchFileWriter:()=>Vn,RecordBatchJSONWriter:()=>Ec,RecordBatchReader:()=>Mt,RecordBatchStreamReader:()=>$r,RecordBatchStreamWriter:()=>Pn,RecordBatchWriter:()=>an,Schema:()=>Q,SparseUnion:()=>gs,SparseUnionBuilder:()=>ji,Struct:()=>pe,StructBuilder:()=>Vi,StructRow:()=>en,Table:()=>me,Time:()=>tt,TimeBuilder:()=>Ir,TimeMicrosecond:()=>ls,TimeMicrosecondBuilder:()=>Gs,TimeMillisecond:()=>us,TimeMillisecondBuilder:()=>js,TimeNanosecond:()=>fs,TimeNanosecondBuilder:()=>zs,TimeSecond:()=>cs,TimeSecondBuilder:()=>Vs,TimeUnit:()=>L,Timestamp:()=>rt,TimestampBuilder:()=>vr,TimestampMicrosecond:()=>hs,TimestampMicrosecondBuilder:()=>Us,TimestampMillisecond:()=>Zr,TimestampMillisecondBuilder:()=>Cs,TimestampNanosecond:()=>ps,TimestampNanosecondBuilder:()=>Ps,TimestampSecond:()=>ds,TimestampSecondBuilder:()=>Ns,Type:()=>w,Uint16:()=>nr,Uint16Builder:()=>Di,Uint32:()=>vt,Uint32Builder:()=>Ri,Uint64:()=>Nr,Uint64Builder:()=>ki,Uint8:()=>rr,Uint8Builder:()=>Mi,Union:()=>Bt,UnionBuilder:()=>Fn,UnionMode:()=>he,Utf8:()=>ut,Utf8Builder:()=>Ws,Utf8View:()=>St,Utf8ViewBuilder:()=>zi,Vector:()=>B,Visitor:()=>R,builderThroughAsyncIterable:()=>$p,builderThroughIterable:()=>Nl,compressionRegistry:()=>Ks,isArrowData:()=>Zl,isArrowDataType:()=>Ql,isArrowField:()=>Yl,isArrowRecordBatch:()=>tf,isArrowSchema:()=>Jl,isArrowTable:()=>rf,isArrowVector:()=>ef,makeBuilder:()=>zr,makeData:()=>D,makeTable:()=>qp,makeVector:()=>rn,tableFromArrays:()=>Kp,tableFromIPC:()=>Zo,tableFromJSON:()=>Wp,tableToIPC:()=>Lc,util:()=>a_,vectorFromArray:()=>Ko});var jn=p(()=>{Va();Se();Ic();Kl();Z0();n_();s_();i_();lm();lm();Qe.toDOMStream=Q0;Te.throughDOM=r_;Mt.throughDOM=Xl;Nn.throughDOM=Xl;$r.throughDOM=Xl;an.throughDOM=Hl;Vn.throughDOM=Hl;Pn.throughDOM=Hl});function nf(r){return r.variadicBuffers??[]}function sf(r,e,t,n,s,i,o,a){return Reflect.construct(G,[r,e,t,n,s,i,o,a])}var fm=p(()=>{jn()});function c_(r,e={}){let t={...e,copies:new WeakMap};return bM(r)?wM(r,t):gM(r)?u_(r,t):yM(r)?l_(r,t):of(r,t)}function bM(r){return"batches"in r}function gM(r){return"schema"in r&&"data"in r&&!Array.isArray(r.data)}function yM(r){return"data"in r&&Array.isArray(r.data)}function wM(r,e){let t=r.batches.map(n=>u_(n,e));return new me(r.schema,t)}function u_(r,e){return new de(r.schema,of(r.data,e))}function of(r,e){let t=r.children.map(i=>of(i,e)),n=r.dictionary?l_(r.dictionary,e):void 0,s={[re.OFFSET]:Bc(r.buffers[re.OFFSET],e),[re.DATA]:Bc(r.buffers[re.DATA],e),[re.VALIDITY]:Bc(r.buffers[re.VALIDITY],e),[re.TYPE]:Bc(r.buffers[re.TYPE],e)};return sf(r.type,r.offset,r.length,r._nullCount,s,t,n,nf(r).map(i=>Bc(i,e)))}function l_(r,e){return new B(r.data.map(t=>of(t,e)))}function Bc(r,e){if(!xM(r)||e.copy==="none"||e.copy!=="all"&&r.byteOffset===0&&r.byteLength===r.buffer.byteLength)return r;let t=e.copies.get(r);return t||(t=r instanceof Uint8Array?new Uint8Array(r):r.slice(),e.copies.set(r,t)),t}function xM(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var dm=p(()=>{jn();fm()});var f_=p(()=>{});var d_=p(()=>{});var h_=p(()=>{});var p_=p(()=>{});function mm(r,e){let t=c_(r,e);return{transport:"arrow-js",version:1,schema:Lc(new me(t.schema,[])),metadataVersion:t.schema.metadataVersion,batches:t.batches.map(n=>hm(n.data))}}function bm(r){if(r.transport!=="arrow-js"||r.version!==1)throw new Error("Unsupported Arrow column-buffer transport protocol.");let e=Zo(r.schema).schema,t=new Q(e.fields,e.metadata,e.dictionaries,r.metadataVersion),n=new pe(t.fields),s=r.batches.map(i=>new de(t,pm(i,n)));return new me(t,s)}function hm(r){return{offset:r.offset,length:r.length,nullCount:r.nullCount,buffers:{[re.OFFSET]:r.buffers[re.OFFSET],[re.DATA]:r.buffers[re.DATA],[re.VALIDITY]:r.buffers[re.VALIDITY],[re.TYPE]:r.buffers[re.TYPE]},children:r.children.map(e=>hm(e)),variadicBuffers:nf(r),dictionary:r.dictionary?.data.map(e=>hm(e))}}function pm(r,e){let t=r.children.map((s,i)=>pm(s,e.children[i].type)),n=r.dictionary&&E.isDictionary(e)?new B(r.dictionary.map(s=>pm(s,e.dictionary))):void 0;return sf(e,r.offset,r.length,r.nullCount,r.buffers,t,n,r.variadicBuffers)}var m_=p(()=>{jn();fm();dm()});var b_=p(()=>{d_();f_();h_();p_();dm();m_()});var g_=p(()=>{b_()});function Hi(r){if(!y_(r))throw new Error("Workers require Arrow table output");let{data:e,...t}=r;return{...structuredClone(t),data:mm(e,{copy:"all"})}}function gm(r){if(!w_(r))throw new Error("Workers require Arrow column transport");return{...r,data:bm(r.data)}}function af(r,e){if(!y_(r))return r;let t=e,n=t?.core?.workerTransferBufferCopy??t?.workerTransferBufferCopy;return{...r,data:mm(r.data,n?{copy:n}:void 0)}}function cf(r){return w_(r)?{...r,data:bm(r.data)}:r}function y_(r){let e=r;return!!(e&&e.shape==="arrow-table"&&e.data&&typeof e.data=="object"&&"batches"in e.data)}function w_(r){let e=r;return!!(e&&e.shape==="arrow-table"&&e.data&&e.data.transport==="arrow-js"&&Array.isArray(e.data.batches))}var ea=p(()=>{"use strict";g_()});async function Xs(r,e,t,n){return n._parse(r,e,t,n)}var x_=p(()=>{"use strict"});function fr(r,e){if(!r)throw new Error(e||"loader assertion failed.")}var ym=p(()=>{"use strict"});var un,TM,_M,AM,vM,Gn,T_,IM,wm=p(()=>{"use strict";un={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},TM=un.self||un.window||un.global||{},_M=un.window||un.self||un.global||{},AM=un.global||un.self||un.window||{},vM=un.document||{},Gn=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),T_=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),IM=T_&&parseFloat(T_[1])||0});var __,A_=p(()=>{"use strict";__=r=>typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer});function Ji(r,e){return new Promise((t,n)=>{let s=!1;function i(a){s||(s=!0,n(a))}function o(a){if(!s){s=!0;try{t(e(a))}catch(c){n(c)}}}try{r(o,i)?.then(o,i)}catch(a){i(a)}})}var v_=p(()=>{"use strict"});function xm(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function Tm(r){return globalThis.loaders?.modules?.[r]||null}var _m=p(()=>{"use strict"});var I_,wq,xq,Am,S_=p(()=>{"use strict";I_="master",wq=`https://raw.githubusercontent.com/visgl/loaders.gl/${I_}/`,xq=`https://github.com/visgl/loaders.gl/raw/${I_}/`,Am="beta"});var E_=p(()=>{"use strict";S_()});function SM(){let r="5.0.0-beta.7";return globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version||=r,r}var L_,B_=p(()=>{"use strict";L_=SM()});function uf(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var vm=p(()=>{"use strict"});var ln,Sq,Eq,Lq,Bq,Xe,Yi,O_,F_,Fq,Fc=p(()=>{"use strict";ln={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Sq=ln.self||ln.window||ln.global||{},Eq=ln.window||ln.self||ln.global||{},Lq=ln.global||ln.self||ln.window||{},Bq=ln.document||{},Xe=typeof process!="object"||String(process)!=="[object process]"||process.browser,Yi=typeof importScripts=="function",O_=typeof window<"u"&&typeof window.orientation<"u",F_=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Fq=F_&&parseFloat(F_[1])||0});var lf,Im=p(()=>{lf="latest"});function EM(){return typeof __VERSION__>"u"?lf:__VERSION__}var Sm,M_=p(()=>{Im();Sm=EM()});function Qi(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var ff=p(()=>{});var fn,Nq,Cq,Uq,Pq,zt,R_,D_,Vq,ta=p(()=>{fn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Nq=fn.self||fn.window||fn.global||{},Cq=fn.window||fn.self||fn.global||{},Uq=fn.global||fn.self||fn.window||{},Pq=fn.document||{},zt=typeof process!="object"||String(process)!=="[object process]"||process.browser,R_=typeof window<"u"&&typeof window.orientation<"u",D_=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Vq=D_&&parseFloat(D_[1])||0});function k_(r){let e=new Error(r);return e.name="AbortError",e}var Oc,N_=p(()=>{Oc=class{constructor(e,t){this.isRunning=!0,this.isCancelled=!1,this.failed=!1,this.postMessageMs=0,this.complete=()=>{},this.processStarted=!1,this._resolve=()=>{},this._reject=()=>{},this.name=e,this.workerThread=t,this.completion=new Promise(n=>{this.complete=n}),this.result=new Promise((n,s)=>{this._resolve=n,this._reject=s})}postMessage(e,t,n){if(!this.isRunning||this.isCancelled)return;let s=performance.now();(e==="process"||e==="process-in-batches"||e==="preload")&&(this.processStarted=!0);try{this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t},n)}finally{this.postMessageMs+=performance.now()-s}}done(e){this.isRunning&&(this.isRunning=!1,this.executionMs=e?.executionMs,clearTimeout(this.cancellationTimer),this.complete(),this.isCancelled||this._resolve(e))}error(e){this.isRunning&&(this.isRunning=!1,this.failed=!0,this.sharedState?.snapshot.cancelled&&(this.isCancelled=!0),clearTimeout(this.cancellationTimer),this.complete(),this._reject(e))}cancel(e,t=1e3){if(!this.isRunning||this.isCancelled)return;if(!Number.isFinite(t)||t<0){this.abort(new RangeError("cancellationTimeout must be finite and nonnegative"));return}this.isCancelled=!0,this.sharedState?.cancel();let n=arguments.length?e:k_(`Worker job "${this.name}" was cancelled`);if(!this.processStarted){this.error(n);return}this._reject(n);try{this.workerThread.postMessage({source:"loaders.gl",type:"cancel",payload:{}},[]),this.cancellationTimer=setTimeout(()=>this.abort(e),t)}catch(s){this.abort(s)}}abort(e){this.isRunning&&(this.isCancelled=!0,this.sharedState?.cancel(),this.workerThread.destroy(),this.error(arguments.length?e:k_(`Worker job "${this.name}" was aborted`)))}}});var ra,zq,C_=p(()=>{ra=class{constructor(...e){let n=globalThis.process?.getBuiltinModule?.("node:worker_threads").Worker;if(n)return new n(...e)}terminate(){}},zq=globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort??null});function U_(r){if(Qi(r.source&&!r.url||!r.source&&r.url),r.url&&r.workerType==="module"){let t=globalThis.document?.baseURI??globalThis.location?.href;if(!t)return r.url;let n=new URL(r.url,t),s=globalThis.location?.origin;return/^https?:$/.test(n.protocol)&&n.origin!==s?Lm(`import ${JSON.stringify(n.href)};`):r.url}let e=Em.get(r.source||r.url);return e||(r.url&&(e=LM(r.url),Em.set(r.url,e)),r.source&&(e=Lm(r.source),Em.set(r.source,e))),Qi(e),e}function LM(r){if(!r.startsWith("http"))return r;let e=BM(r);return Lm(e)}function Lm(r){let e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function BM(r){return`try {
31
+ }`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function G_(r,e){if(br(r))return m2(r,e);if(Fr(r))return p2(r,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function p2(r,e){let t=null,n=e?.type==="bytes"||!1,s=e?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){i(o,t||(t=r[Symbol.iterator]()))},pull(o){t?i(o,t):o.close()},cancel(){t?.return&&t.return(),t=null}}),Object.assign({highWaterMark:n?s:void 0},e));function i(o,a){let c,u=null,l=o.desiredSize||null;for(;!(u=a.next(n?l:null)).done;)if(ArrayBuffer.isView(u.value)&&(c=k(u.value))&&(l!=null&&n&&(l=l-c.byteLength+1),u.value=c),o.enqueue(u.value),l!=null&&--l<=0)return;o.close()}}function m2(r,e){let t=null,n=e?.type==="bytes"||!1,s=e?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){return F(this,void 0,void 0,function*(){yield i(o,t||(t=r[Symbol.asyncIterator]()))})},pull(o){return F(this,void 0,void 0,function*(){t?yield i(o,t):o.close()})},cancel(){return F(this,void 0,void 0,function*(){t?.return&&(yield t.return()),t=null})}}),Object.assign({highWaterMark:n?s:void 0},e));function i(o,a){return F(this,void 0,void 0,function*(){let c,u=null,l=o.desiredSize||null;for(;!(u=yield a.next(n?l:null)).done;)if(ArrayBuffer.isView(u.value)&&(c=k(u.value))&&(l!=null&&n&&(l=l-c.byteLength+1),u.value=c),o.enqueue(u.value),l!=null&&--l<=0)return;o.close()})}}var z_=p(()=>{kt();Ke();es()});function q_(r){return new km(r)}var km,W_,$_,K_=p(()=>{kt();Bc();km=class{constructor(e){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:t,["writableStrategy"]:n,["queueingStrategy"]:s="count"}=e,i=rT(e,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Wr(i),this._getSize=s!=="bytes"?W_:$_;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},t),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:s!=="bytes"?W_:$_}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(e){let t=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(e)),this._bufferedSize-t}_maybeFlush(e,t){t!=null&&(this._bufferedSize>=t.desiredSize&&++this._numChunks&&this._enqueue(t,e.toVector()),e.finished&&((e.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(t,e.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(t,null)))}_enqueue(e,t){this._bufferedSize=0,this._controller=null,t==null?e.close():e.enqueue(t)}},W_=r=>{var e;return(e=r?.length)!==null&&e!==void 0?e:0},$_=r=>{var e;return(e=r?.byteLength)!==null&&e!==void 0?e:0}});function hf(r,e){let t=new Tr,n=null,s=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield t.close()})},start(a){return F(this,void 0,void 0,function*(){yield o(a,n||(n=yield i()))})},pull(a){return F(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(t,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:s};function i(){return F(this,void 0,void 0,function*(){return yield(yield Mt.from(t)).open(e)})}function o(a,c){return F(this,void 0,void 0,function*(){let u=a.desiredSize,l=null;for(;!(l=yield c.next()).done;)if(a.enqueue(l.value),u!=null&&--u<=0)return;a.close()})}}var H_=p(()=>{kt();Ss();Rc()});function pf(r,e){let t=new this(r),n=new Gt(t),s=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return F(this,void 0,void 0,function*(){yield i(o)})},start(o){return F(this,void 0,void 0,function*(){yield i(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},e));return{writable:new WritableStream(t,r),readable:s};function i(o){return F(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}var X_=p(()=>{kt();Ss()});function ia(r){let e=Mt.from(r);return Yt(e)?e.then(t=>ia(t)):e.isAsync()?e.readAll().then(t=>new me(t)):new me(e.readAll())}function Cc(r,e="stream",t=null){let n={compressionType:t};return(e==="stream"?jn:Gn).writeAll(r,n).toUint8Array(!0)}var J_=p(()=>{Ji();es();Rc();df()});var Nm={};J(Nm,{isArrowData:()=>yf,isArrowDataType:()=>gf,isArrowField:()=>bf,isArrowRecordBatch:()=>xf,isArrowSchema:()=>mf,isArrowTable:()=>Tf,isArrowVector:()=>wf});function mf(r){return Q.isSchema(r)}function bf(r){return O.isField(r)}function gf(r){return E.isDataType(r)}function yf(r){return G.isData(r)}function wf(r){return B.isVector(r)}function xf(r){return de.isRecordBatch(r)}function Tf(r){return me.isTable(r)}var Cm=p(()=>{mt();we();wr();ht();Nn();Ji()});var Y_,Um=p(()=>{ol();Mo();De();wr();we();Ji();ht();Vt();mt();wc();Sl();Se();Bc();Hp();am();Xp();Jp();Yp();Qp();em();nm();lm();um();tm();rm();dm();pm();hm();Kl();Xl();Hl();sm();im();Zp();om();cm();fm();Ss();Rc();df();J_();of();sf();Is();Nn();Cm();al();Gp();_i();yc();Ke();$o();lc();Wl();Cm();Dc();Y_=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},fp),jp),Ep),dp),Oh),Sp),ap),Kp),Nm),{compareSchemas:Xi,compareFields:w_,compareTypes:Ql})});var ln={};J(ln,{AsyncByteQueue:()=>Tr,AsyncByteStream:()=>Gt,AsyncMessageReader:()=>Qi,AsyncRecordBatchFileReader:()=>ra,AsyncRecordBatchStreamReader:()=>Cn,Binary:()=>Ct,BinaryBuilder:()=>Fn,BinaryView:()=>Z,BinaryViewBuilder:()=>Dn,Bool:()=>lt,BoolBuilder:()=>Ei,BufferType:()=>re,Builder:()=>Te,ByteStream:()=>_r,CompressionType:()=>et,Data:()=>G,DataType:()=>E,DateBuilder:()=>on,DateDay:()=>us,DateDayBuilder:()=>Ls,DateMillisecond:()=>ls,DateMillisecondBuilder:()=>Bs,DateUnit:()=>ye,Date_:()=>Et,Decimal:()=>Ut,DecimalBuilder:()=>Fs,DenseUnion:()=>vn,DenseUnionBuilder:()=>Ki,Dictionary:()=>Ge,DictionaryBuilder:()=>Li,Duration:()=>Lt,DurationBuilder:()=>Ar,DurationMicrosecond:()=>mc,DurationMicrosecondBuilder:()=>Cs,DurationMillisecond:()=>pc,DurationMillisecondBuilder:()=>Ns,DurationNanosecond:()=>bc,DurationNanosecondBuilder:()=>Us,DurationSecond:()=>hc,DurationSecondBuilder:()=>ks,Field:()=>O,FixedSizeBinary:()=>Pt,FixedSizeBinaryBuilder:()=>Os,FixedSizeList:()=>Fe,FixedSizeListBuilder:()=>Bi,Float:()=>ct,Float16:()=>Ur,Float16Builder:()=>Fi,Float32:()=>It,Float32Builder:()=>Oi,Float64:()=>sr,Float64Builder:()=>Mi,FloatBuilder:()=>an,Int:()=>Oe,Int16:()=>er,Int16Builder:()=>Ri,Int32:()=>Pe,Int32Builder:()=>ki,Int64:()=>tr,Int64Builder:()=>Ni,Int8:()=>Zt,Int8Builder:()=>Di,IntBuilder:()=>Ft,Interval:()=>ft,IntervalBuilder:()=>$r,IntervalDayTime:()=>ys,IntervalDayTimeBuilder:()=>Ms,IntervalMonthDayNano:()=>dc,IntervalMonthDayNanoBuilder:()=>Rs,IntervalUnit:()=>ae,IntervalYearMonth:()=>ws,IntervalYearMonthBuilder:()=>Ds,JSONMessageReader:()=>Zi,LargeBinary:()=>Pr,LargeBinaryBuilder:()=>On,LargeList:()=>ir,LargeListBuilder:()=>Gi,LargeUtf8:()=>Vr,LargeUtf8Builder:()=>Hs,List:()=>je,ListBuilder:()=>ji,MapBuilder:()=>zi,MapRow:()=>yr,Map_:()=>dt,Message:()=>gt,MessageHeader:()=>se,MessageReader:()=>Xs,MetadataVersion:()=>ge,Null:()=>Ce,NullBuilder:()=>Wi,Precision:()=>le,RecordBatch:()=>de,RecordBatchFileReader:()=>Un,RecordBatchFileWriter:()=>Gn,RecordBatchJSONWriter:()=>Nc,RecordBatchReader:()=>Mt,RecordBatchStreamReader:()=>qr,RecordBatchStreamWriter:()=>jn,RecordBatchWriter:()=>un,Schema:()=>Q,SparseUnion:()=>xs,SparseUnionBuilder:()=>qi,Struct:()=>pe,StructBuilder:()=>$i,StructRow:()=>rn,Table:()=>me,Time:()=>tt,TimeBuilder:()=>Ir,TimeMicrosecond:()=>hs,TimeMicrosecondBuilder:()=>$s,TimeMillisecond:()=>ds,TimeMillisecondBuilder:()=>Ws,TimeNanosecond:()=>ps,TimeNanosecondBuilder:()=>qs,TimeSecond:()=>fs,TimeSecondBuilder:()=>zs,TimeUnit:()=>L,Timestamp:()=>rt,TimestampBuilder:()=>vr,TimestampMicrosecond:()=>bs,TimestampMicrosecondBuilder:()=>js,TimestampMillisecond:()=>tn,TimestampMillisecondBuilder:()=>Vs,TimestampNanosecond:()=>gs,TimestampNanosecondBuilder:()=>Gs,TimestampSecond:()=>ms,TimestampSecondBuilder:()=>Ps,Type:()=>w,Uint16:()=>nr,Uint16Builder:()=>Ui,Uint32:()=>vt,Uint32Builder:()=>Pi,Uint64:()=>Cr,Uint64Builder:()=>Vi,Uint8:()=>rr,Uint8Builder:()=>Ci,Union:()=>Bt,UnionBuilder:()=>Mn,UnionMode:()=>he,Utf8:()=>ut,Utf8Builder:()=>Ks,Utf8View:()=>St,Utf8ViewBuilder:()=>Hi,Vector:()=>B,Visitor:()=>R,builderThroughAsyncIterable:()=>wm,builderThroughIterable:()=>ef,compressionRegistry:()=>Js,isArrowData:()=>yf,isArrowDataType:()=>gf,isArrowField:()=>bf,isArrowRecordBatch:()=>xf,isArrowSchema:()=>mf,isArrowTable:()=>Tf,isArrowVector:()=>wf,makeBuilder:()=>Wr,makeData:()=>D,makeTable:()=>xm,makeVector:()=>sn,tableFromArrays:()=>Tm,tableFromIPC:()=>ia,tableFromJSON:()=>ym,tableToIPC:()=>Cc,util:()=>Y_,vectorFromArray:()=>Zo});var zn=p(()=>{Xa();Se();Rc();df();z_();K_();H_();X_();Um();Um();Qe.toDOMStream=G_;Te.throughDOM=q_;Mt.throughDOM=hf;Un.throughDOM=hf;qr.throughDOM=hf;un.throughDOM=pf;Gn.throughDOM=pf;jn.throughDOM=pf});var _f=p(()=>{});function Uc(r){return r.variadicBuffers??[]}function Pc(r,e,t,n,s,i,o,a){return Reflect.construct(G,[r,e,t,n,s,i,o,a])}var Af=p(()=>{zn()});function Pm(r,e={}){let t={...e,copies:new WeakMap};return b2(r)?w2(r,t):g2(r)?Q_(r,t):y2(r)?Z_(r,t):vf(r,t)}function b2(r){return"batches"in r}function g2(r){return"schema"in r&&"data"in r&&!Array.isArray(r.data)}function y2(r){return"data"in r&&Array.isArray(r.data)}function w2(r,e){let t=r.batches.map(n=>Q_(n,e));return new me(r.schema,t)}function Q_(r,e){return new de(r.schema,vf(r.data,e))}function vf(r,e){let t=r.children.map(i=>vf(i,e)),n=r.dictionary?Z_(r.dictionary,e):void 0,s={[re.OFFSET]:Vc(r.buffers[re.OFFSET],e),[re.DATA]:Vc(r.buffers[re.DATA],e),[re.VALIDITY]:Vc(r.buffers[re.VALIDITY],e),[re.TYPE]:Vc(r.buffers[re.TYPE],e)};return Pc(r.type,r.offset,r.length,r._nullCount,s,t,n,Uc(r).map(i=>Vc(i,e)))}function Z_(r,e){return new B(r.data.map(t=>vf(t,e)))}function Vc(r,e){if(!x2(r)||e.copy==="none"||e.copy!=="all"&&r.byteOffset===0&&r.byteLength===r.buffer.byteLength)return r;let t=e.copies.get(r);return t||(t=r instanceof Uint8Array?new Uint8Array(r):r.slice(),e.copies.set(r,t)),t}function x2(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var If=p(()=>{zn();Af()});var eA=p(()=>{Af();If()});var Vm=p(()=>{Wu()});var jm=p(()=>{Wu();_f();eA();Vm()});var nA=p(()=>{Wu();jm()});var sA=p(()=>{_f()});function Wm(r,e){let t=Pm(r,e);return{transport:"arrow-js",version:1,schema:Cc(new me(t.schema,[])),metadataVersion:t.schema.metadataVersion,batches:t.batches.map(n=>Gm(n.data))}}function $m(r){if(r.transport!=="arrow-js"||r.version!==1)throw new Error("Unsupported Arrow column-buffer transport protocol.");let e=ia(r.schema).schema,t=new Q(e.fields,e.metadata,e.dictionaries,r.metadataVersion),n=new pe(t.fields),s=r.batches.map(i=>new de(t,zm(i,n)));return new me(t,s)}function Gm(r){return{offset:r.offset,length:r.length,nullCount:r.nullCount,buffers:{[re.OFFSET]:r.buffers[re.OFFSET],[re.DATA]:r.buffers[re.DATA],[re.VALIDITY]:r.buffers[re.VALIDITY],[re.TYPE]:r.buffers[re.TYPE]},children:r.children.map(e=>Gm(e)),variadicBuffers:Uc(r),dictionary:r.dictionary?.data.map(e=>Gm(e))}}function zm(r,e){let t=r.children.map((s,i)=>zm(s,e.children[i].type)),n=r.dictionary&&E.isDictionary(e)?new B(r.dictionary.map(s=>zm(s,e.dictionary))):void 0;return Pc(e,r.offset,r.length,r.nullCount,r.buffers,t,n,r.variadicBuffers)}var iA=p(()=>{zn();Af();If()});var oA=p(()=>{});var aA=p(()=>{jm();Vm();nA();_f();sA();If();iA();oA()});var cA=p(()=>{aA()});function eo(r){if(!uA(r))throw new Error("Workers require Arrow table output");let{data:e,...t}=r;return{...structuredClone(t),data:Wm(e,{copy:"all"})}}function qm(r){if(!lA(r))throw new Error("Workers require Arrow column transport");return{...r,data:$m(r.data)}}function Sf(r,e){if(!uA(r))return r;let t=e,n=t?.core?.workerTransferBufferCopy??t?.workerTransferBufferCopy;return{...r,data:Wm(r.data,n?{copy:n}:void 0)}}function Ef(r){return lA(r)?{...r,data:$m(r.data)}:r}function uA(r){let e=r;return!!(e&&e.shape==="arrow-table"&&e.data&&typeof e.data=="object"&&"batches"in e.data)}function lA(r){let e=r;return!!(e&&e.shape==="arrow-table"&&e.data&&e.data.transport==="arrow-js"&&Array.isArray(e.data.batches))}var oa=p(()=>{"use strict";cA()});async function Ys(r,e,t,n){return n._parse(r,e,t,n)}var fA=p(()=>{"use strict"});function fr(r,e){if(!r)throw new Error(e||"loader assertion failed.")}var Km=p(()=>{"use strict"});var fn,v2,I2,S2,E2,Wn,dA,L2,Hm=p(()=>{"use strict";fn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},v2=fn.self||fn.window||fn.global||{},I2=fn.window||fn.self||fn.global||{},S2=fn.global||fn.self||fn.window||{},E2=fn.document||{},Wn=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),dA=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),L2=dA&&parseFloat(dA[1])||0});var jc,B2,Lf,F2,O2,Xm=p(()=>{jc=globalThis,B2=globalThis.document||{},Lf=globalThis.process||{},F2=globalThis.console,O2=globalThis.navigator||{}});function Bf(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return!!(t&&t.indexOf("Electron")>=0)}var Ff=p(()=>{});function Qs(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Bf()}var Jm=p(()=>{Ff()});var hA=p(()=>{Jm();Ff();Xm()});var pA=p(()=>{});var Ym,Of=p(()=>{Xm();Jm();hA();Ff();pA();Ym="5.0.0"});function aa(r,e){if(!r)throw new Error(e||"Assertion failed")}var Qm=p(()=>{});function Mf(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return aa(Number.isFinite(e)&&e>=0),e}function Zm(r){let{logLevel:e,message:t}=r;r.logLevel=Mf(e);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return aa(s==="string"||s==="object"),Object.assign(r,{args:n},r.opts)}var Df=p(()=>{Qm()});var Zs,to,Gc=p(()=>{Df();Zs=()=>{},to=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...t){return this._log("warn",0,e,t,{once:!0})}error(e,...t){return this._log("error",0,e,t)}log(e,t,...n){return this._log("log",e,t,n)}info(e,t,...n){return this._log("info",e,t,n)}once(e,t,...n){return this._log("once",e,t,n,{once:!0})}_log(e,t,n,s,i={}){let o=Zm({logLevel:t,message:n,args:this._buildArgs(t,n,s),opts:i});return this._createLogFunction(e,o,i)}_buildArgs(e,t,n){return[e,t,...n]}_createLogFunction(e,t,n){if(!this._shouldLog(t.logLevel))return Zs;let s=this._getOnceTag(n.tag??t.tag??t.message);if((n.once||t.once)&&s!==void 0){if(this._onceCache.has(s))return Zs;this._onceCache.add(s)}return this._emit(e,t)}_shouldLog(e){return this.getLevel()>=Mf(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}}});function D2(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var zc,eb=p(()=>{zc=class{constructor(e,t,n="sessionStorage"){this.storage=D2(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}});function mA(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function tb(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var rb=p(()=>{});function bA(r){return typeof r!="string"?r:(r=r.toUpperCase(),Wc[r]||Wc.WHITE)}function nb(r,e,t){return!Qs&&typeof r=="string"&&(e&&(r=`\x1B[${bA(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${bA(t)+R2}m${r}\x1B[49m`)),r}var Wc,R2,Rf=p(()=>{Of();(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Wc||(Wc={}));R2=10});function sb(r,e=["constructor"]){let t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),s=r;for(let i of n){let o=s[i];typeof o=="function"&&(e.find(a=>i===a)||(s[i]=o.bind(r)))}}var ib=p(()=>{});var kf,Sr,$c=p(()=>{Of();kf=class{getHighResolutionTimer(){let e;if(Qs()&&jc.performance)e=jc?.performance?.now?.();else if("hrtime"in Lf){let t=Lf?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}getMemoryUsageMB(){let t=jc?.performance?.memory?.usedJSHeapSize;return t==null?null:Math.trunc(t/1024/1024)}},Sr=new kf;globalThis.Probe=kf;globalThis.probe=Sr});function k2(r,e,t){if(typeof e=="string"){let n=t.time?tb(mA(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=nb(e,t.color,t.background)}return e}function N2(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}var ca,ob,$n,ab=p(()=>{Of();Gc();eb();rb();Rf();ib();Qm();$c();Df();Df();ca={debug:Qs()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ob={enabled:!0,level:0},$n=class extends to{constructor({id:e}={id:""}){super({level:0}),this.VERSION=Ym,this._startTs=Sr.getHighResolutionTimer(),this._deltaTs=Sr.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new zc(`__probe-${this.id}__`,{[this.id]:ob}),this.timeStamp(`${this.id} started`),sb(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((Sr.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((Sr.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,t){this._updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e,...t){return this._log("warn",0,e,t,{method:ca.warn,once:!0})}error(e,...t){return this._log("error",0,e,t,{method:ca.error})}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t,...n){let s=Sr.getMemoryUsageMB();if(s!==null){let i=`${s}MB `;typeof t=="function"?t=()=>`${i}${t()}`:typeof t=="string"&&(t=`${i}${t}`)}return this._log("log",e,t,n,{method:ca.log,time:!0,once:!0})}log(e,t,...n){return this._log("log",e,t,n,{method:ca.debug})}info(e,t,...n){return this._log("info",e,t,n,{method:console.info})}once(e,t,...n){return this._log("once",e,t,n,{method:ca.debug||ca.info,once:!0})}table(e,t,n){return t?this._log("table",e,t,n&&[n]||[],{method:console.table||Zs,tag:N2(t)}):Zs}time(e,t){return this._log("time",e,t,[],{method:console.time?console.time:console.info})}timeEnd(e,t){return this._log("time",e,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,t){return this._log("time",e,t,[],{method:console.timeStamp||Zs})}group(e,t,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,t,[],{method:s})}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||Zs})}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,t){let n=t.method;aa(n),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=Sr.getHighResolutionTimer();let s=k2(this.id,t.message,t);return n.bind(console,s,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(ob),this._storage.config[this.id]}_updateConfiguration(e){let t=this._storage.config[this.id]||{...ob};this._storage.setConfiguration({[this.id]:{...t,...e}})}};$n.VERSION=Ym});var gA=p(()=>{Gc()});var yA=p(()=>{Gc()});var wA=p(()=>{$c()});var xA=p(()=>{$c();globalThis.probe||(globalThis.probe=Sr)});var QH,TA=p(()=>{ab();$c();ab();gA();Gc();yA();Rf();Rf();rb();ib();eb();wA();xA();QH=new $n({id:"@probe.gl/log"})});function U2(){let r=new $n({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=r,globalThis.loaders.version=C2,globalThis.probe||={},globalThis.probe.loaders=r,r}function qc(){}function Kr(r){let e=r?.core?.log!==void 0?r.core.log:r?.log;return e===null?P2:e||ua}var cb,C2,ua,ub,P2,Nf=p(()=>{"use strict";TA();cb="5.0.0-beta.8",C2=cb[0]>="0"&&cb[0]<="9"?`v${cb}`:"";ua=U2(),ub=class{log(){return qc}info(){return qc}once(){return qc}warn(){return qc}error(){return qc}};P2=new ub});var _A,AA=p(()=>{"use strict";_A=r=>typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer});function ro(r,e){return new Promise((t,n)=>{let s=!1;function i(a){s||(s=!0,n(a))}function o(a){if(!s){s=!0;try{t(e(a))}catch(c){n(c)}}}try{r(o,i)?.then(o,i)}catch(a){i(a)}})}var vA=p(()=>{"use strict"});function lb(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function fb(r){return globalThis.loaders?.modules?.[r]||null}var db=p(()=>{"use strict"});var IA,gX,yX,hb,SA=p(()=>{"use strict";IA="master",gX=`https://raw.githubusercontent.com/visgl/loaders.gl/${IA}/`,yX=`https://github.com/visgl/loaders.gl/raw/${IA}/`,hb="beta"});var EA=p(()=>{"use strict";SA()});function V2(){let r="5.0.0-beta.8";return globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version||=r,r}var LA,BA=p(()=>{"use strict";LA=V2()});function Cf(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var pb=p(()=>{"use strict"});var dn,vX,IX,SX,EX,He,no,OA,FA,LX,Kc=p(()=>{"use strict";dn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},vX=dn.self||dn.window||dn.global||{},IX=dn.window||dn.self||dn.global||{},SX=dn.global||dn.self||dn.window||{},EX=dn.document||{},He=typeof process!="object"||String(process)!=="[object process]"||process.browser,no=typeof importScripts=="function",OA=typeof window<"u"&&typeof window.orientation<"u",FA=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),LX=FA&&parseFloat(FA[1])||0});var Uf,mb=p(()=>{Uf="latest"});function j2(){return typeof __VERSION__>"u"?Uf:__VERSION__}var bb,MA=p(()=>{mb();bb=j2()});function so(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var Pf=p(()=>{});var hn,RX,kX,NX,CX,zt,RA,DA,UX,la=p(()=>{hn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},RX=hn.self||hn.window||hn.global||{},kX=hn.window||hn.self||hn.global||{},NX=hn.global||hn.self||hn.window||{},CX=hn.document||{},zt=typeof process!="object"||String(process)!=="[object process]"||process.browser,RA=typeof window<"u"&&typeof window.orientation<"u",DA=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),UX=DA&&parseFloat(DA[1])||0});function kA(r){let e=new Error(r);return e.name="AbortError",e}var Hc,NA=p(()=>{Hc=class{constructor(e,t){this.isRunning=!0,this.isCancelled=!1,this.failed=!1,this.postMessageMs=0,this.complete=()=>{},this.processStarted=!1,this._resolve=()=>{},this._reject=()=>{},this.name=e,this.workerThread=t,this.completion=new Promise(n=>{this.complete=n}),this.result=new Promise((n,s)=>{this._resolve=n,this._reject=s})}postMessage(e,t,n){if(!this.isRunning||this.isCancelled)return;let s=performance.now();(e==="process"||e==="process-in-batches"||e==="preload")&&(this.processStarted=!0);try{this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t},n)}finally{this.postMessageMs+=performance.now()-s}}done(e){this.isRunning&&(this.isRunning=!1,this.executionMs=e?.executionMs,clearTimeout(this.cancellationTimer),this.complete(),this.isCancelled||this._resolve(e))}error(e){this.isRunning&&(this.isRunning=!1,this.failed=!0,this.sharedState?.snapshot.cancelled&&(this.isCancelled=!0),clearTimeout(this.cancellationTimer),this.complete(),this._reject(e))}cancel(e,t=1e3){if(!this.isRunning||this.isCancelled)return;if(!Number.isFinite(t)||t<0){this.abort(new RangeError("cancellationTimeout must be finite and nonnegative"));return}this.isCancelled=!0,this.sharedState?.cancel();let n=arguments.length?e:kA(`Worker job "${this.name}" was cancelled`);if(!this.processStarted){this.error(n);return}this._reject(n);try{this.workerThread.postMessage({source:"loaders.gl",type:"cancel",payload:{}},[]),this.cancellationTimer=setTimeout(()=>this.abort(e),t)}catch(s){this.abort(s)}}abort(e){this.isRunning&&(this.isCancelled=!0,this.sharedState?.cancel(),this.workerThread.destroy(),this.error(arguments.length?e:kA(`Worker job "${this.name}" was aborted`)))}}});var fa,jX,CA=p(()=>{fa=class{constructor(...e){let n=globalThis.process?.getBuiltinModule?.("node:worker_threads").Worker;if(n)return new n(...e)}terminate(){}},jX=globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort??null});function UA(r){if(so(r.source&&!r.url||!r.source&&r.url),r.url&&r.workerType==="module"){let t=globalThis.document?.baseURI??globalThis.location?.href;if(!t)return r.url;let n=new URL(r.url,t),s=globalThis.location?.origin;return/^https?:$/.test(n.protocol)&&n.origin!==s?yb(`import ${JSON.stringify(n.href)};`):r.url}let e=gb.get(r.source||r.url);return e||(r.url&&(e=G2(r.url),gb.set(r.url,e)),r.source&&(e=yb(r.source),gb.set(r.source,e))),so(e),e}function G2(r){if(!r.startsWith("http"))return r;let e=z2(r);return yb(e)}function yb(r){let e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function z2(r){return`try {
32
32
  importScripts('${r}');
33
33
  } catch (error) {
34
34
  console.error(error);
35
35
  throw error;
36
- }`}var Em,P_=p(()=>{ff();Em=new Map});function yt(r,e=!0,t){let n=t||new Set,s=new Set;function i(o){if(!(!o||typeof o!="object"||s.has(o))){if(s.add(o),Bm(o))n.add(o);else if(ArrayBuffer.isView(o))Bm(o.buffer)&&n.add(o.buffer);else if(e&&typeof MessageChannel<"u"&&o instanceof MessageChannel)i(o.port1),i(o.port2);else if(e&&o instanceof Map)for(let[a,c]of o)i(a),i(c);else if(e&&o instanceof Set)for(let a of o)i(a);else if(e)for(let a of Object.keys(o))i(o[a])}}return i(r),t===void 0?Array.from(n):[]}function Bm(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function na(r){let e=new Map;function t(n){if(typeof n=="function"||n instanceof RegExp)return{};if(!n||typeof n!="object")return n;if(e.has(n))return e.get(n);if(ArrayBuffer.isView(n)||n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||n instanceof Date||typeof WebAssembly<"u"&&n instanceof WebAssembly.Module||Bm(n))return n;let s=n instanceof Map?new Map:n instanceof Set?new Set:Array.isArray(n)?[]:{};if(e.set(n,s),n instanceof Map)for(let[i,o]of n)s.set(t(i),t(o));else if(n instanceof Set)for(let i of n)s.add(t(i));else for(let i of Object.keys(n))Object.defineProperty(s,i,{value:t(n[i]),enumerable:!0,writable:!0,configurable:!0});return s}return r===null?{}:t(r)}var df=p(()=>{});var Fm,Sr,Mc=p(()=>{C_();ta();ff();P_();df();Fm=()=>{},Sr=class{static isSupported(){return typeof Worker<"u"&&zt||typeof ra<"u"&&!zt}constructor(e){this.terminated=!1,this.createdAt=performance.now(),this._loadableURL="";let{name:t,source:n,url:s,getUrl:i,loadWorker:o}=e;Qi(n||s||i||o),this.name=t,this.source=n,this.url=s,this.workerType=e.workerType??"classic",this.getUrl=i,this.loadWorker=o,this.onMessage=Fm,this.onError=c=>console.log(c);let a=performance.now();this.worker=zt?this._createBrowserWorker():this._createNodeWorker(),this.creationTimeMs=performance.now()-a}destroy(){return this.onMessage=Fm,this.onError=Fm,this.terminated?this.termination??Promise.resolve():(this.terminated=!0,this.termination=Promise.resolve(this.worker.terminate()).then(()=>{}).finally(()=>this.releaseModuleWorkerURL()),this.termination.catch(()=>{}),this.termination)}unref(){!zt&&typeof this.worker.unref=="function"&&this.worker.unref()}ref(){!zt&&typeof this.worker.ref=="function"&&this.worker.ref()}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||yt(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url||"built-in worker factory"}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){if(this.loadWorker)try{let t=this.loadWorker();if(t)return this._initializeBrowserWorker(t)}catch(t){if(!this.source&&!this.url&&!this.getUrl)throw t}let e=this.url||this.getUrl?.();this._loadableURL=U_({source:this.source,url:e,workerType:this.workerType}),this.workerType==="module"&&e&&this._loadableURL!==e&&this._loadableURL.startsWith("blob:")&&(this.ownedModuleWorkerURL=this._loadableURL);try{let t=new Worker(this._loadableURL,{name:this.name,type:this.workerType});return this._initializeBrowserWorker(t)}catch(t){throw this.releaseModuleWorkerURL(),t}}releaseModuleWorkerURL(){this.ownedModuleWorkerURL&&(URL.revokeObjectURL(this.ownedModuleWorkerURL),this.ownedModuleWorkerURL=void 0)}_initializeBrowserWorker(e){return e.onmessage=t=>{t.data?t.data.type==="ready"?this.startupTimeMs=performance.now()-this.createdAt:this.onMessage(t.data):this.onError(new Error("No data received"))},e.onerror=t=>{let n=this.onError,s=this._getErrorFromErrorEvent(t);this.destroy(),n(s)},e.onmessageerror=()=>{let t=this.onError;this.destroy(),t(new Error("Worker message could not be deserialized"))},e}_createNodeWorker(){let e;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,s=n.startsWith("file:")?new URL(n):n,i=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";e=new ra(s,{eval:!1,type:i})}else if(this.source)e=new ra(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",t=>{t?.type==="ready"?this.startupTimeMs=performance.now()-this.createdAt:this.onMessage(t)}),e.on("error",t=>{this.terminated=!0,this.onError(t)}),this.termination=new Promise(t=>e.on("exit",()=>t())),e.on("exit",t=>{this.terminated||(this.terminated=!0,this.onError(new Error(`Worker ${this.name} exited unexpectedly (code ${t})`)))}),e}}});var Hs,Om=p(()=>{ta();Mc();N_();Hs=class{get stats(){return{...this.totals,queuedJobs:this.jobQueue.length,activeJobs:this.activeJobs.size,queuedBytes:this.queuedBytes+this.reservedBytes,inFlightBytes:this.inFlightBytes,pendingAdmissions:this.admissions.length,reservations:this.reservations.size}}reserve(e,t={}){let{signal:n}=t;return n?.aborted?Promise.reject(n.reason):this.isDestroyed?Promise.reject(new Error("Worker pool was destroyed")):this.isClosing?Promise.reject(new Error("Worker pool is closing")):!Number.isSafeInteger(e)||e<0||e>this.maxQueuedBytes||e>this.maxInFlightBytes?Promise.reject(new RangeError("Reservation exceeds worker byte budgets")):this.maxQueuedJobs<1||this.admissions.length>=this.maxPendingAdmissions?Promise.reject(new RangeError("Worker admission queue is full")):new Promise((s,i)=>{let o=()=>{let c=this.admissions.indexOf(a);c>=0&&this.admissions.splice(c,1),a.cleanup(),i(n?.reason),this._admit()},a={inputBytes:e,resolve:s,reject:i,cleanup:()=>n?.removeEventListener("abort",o)};this.admissions.push(a),n?.addEventListener("abort",o,{once:!0}),this._admit()})}_admit(){for(;!this.isDestroyed&&!this.isClosing&&this.admissions.length;){let e=this.admissions[0];if(e.inputBytes>this.maxQueuedBytes||e.inputBytes>this.maxInFlightBytes){this.admissions.shift(),e.cleanup(),e.reject(new RangeError("Reservation exceeds worker byte budgets"));continue}if(this.jobQueue.length+this.reservations.size>=this.maxQueuedJobs||e.inputBytes>this.maxQueuedBytes-this.queuedBytes-this.reservedBytes)return;this.admissions.shift(),e.cleanup();let t={inputBytes:e.inputBytes,release:()=>{this.reservations.delete(t)&&(this.reservedBytes-=t.inputBytes,this._admit())}};this.reservations.add(t),this.reservedBytes+=t.inputBytes,this.totals.peakQueuedBytes=Math.max(this.totals.peakQueuedBytes,this.queuedBytes+this.reservedBytes),e.resolve(t)}}static isSupported(){return Sr.isSupported()}constructor(e){this.name="unnamed",this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.activeJobs=new Set,this.startingJobs=0,this.count=0,this.workers=new Set,this.queuedBytes=0,this.inFlightBytes=0,this.maxQueuedBytes=1/0,this.maxInFlightBytes=1/0,this.isDestroyed=!1,this.isClosing=!1,this.maxQueuedJobs=1/0,this.maxPendingAdmissions=128,this.priorityAgingMs=1e3,this.reservations=new Set,this.admissions=[],this.reservedBytes=0,this.totals={peakQueuedBytes:0,peakInFlightBytes:0,workersCreated:0,workerRestarts:0,completed:0,failed:0,cancelled:0},this.source=e.source,this.url=e.url,this.workerType=e.workerType,this.getUrl=e.getUrl,this.loadWorker=e.loadWorker,this.setProps(e)}close(e={}){if(this.closing)return this.closing;if(this.isDestroyed)return this.destroy();if(e.timeout!==void 0&&(!Number.isFinite(e.timeout)||e.timeout<0||e.timeout>2147483647))return Promise.reject(new RangeError("Close timeout must be between 0 and 2147483647 ms"));this.isClosing=!0;let t=new Error("Worker pool is closing");this.admissions.splice(0).forEach(o=>{o.cleanup(),o.reject(t)}),this.reservations.clear(),this.reservedBytes=0;let n,s=new Promise(o=>{this.onDrained=o}),i=e.timeout===void 0?s:Promise.race([s,new Promise(o=>{n=setTimeout(o,e.timeout)})]);return this.closing=i.then(async()=>{clearTimeout(n),await this.destroy()}),this._checkDrained(),this.closing}_checkDrained(){this.isClosing&&!this.jobQueue.length&&!this.activeJobs.size&&!this.startingJobs&&this.onDrained?.()}destroy(e=new Error("Worker pool was destroyed")){if(this.destruction)return this.destruction;let t=[...this.workers];this.isDestroyed=!0,this.onDrained?.(),this.activeJobs.forEach(s=>s.abort(e)),this.admissions.splice(0).forEach(s=>{s.cleanup(),s.reject(e)}),this.reservations.clear(),this.reservedBytes=0;let n=this.jobQueue.splice(0);return this.queuedBytes=0,n.forEach(s=>{s.removeAbortListener(),s.onReject(e)}),this.idleQueue.splice(0).forEach(s=>{s.destroy(),this.count--}),this.isDestroyed=!0,this.destruction=Promise.all(t.map(s=>s.destroy())).then(()=>{this.workers.clear()}),this.destruction.catch(()=>{}),this.destruction}setProps(e){for(let t of["maxQueuedBytes","maxInFlightBytes","maxQueuedJobs","maxPendingAdmissions"]){let n=e[t];if(n!==void 0&&(!(n>=0)||n!==1/0&&!Number.isSafeInteger(n)))throw new RangeError(`${t} must be a nonnegative safe integer or Infinity`)}if(e.priorityAgingMs!==void 0&&(!Number.isFinite(e.priorityAgingMs)||e.priorityAgingMs<=0))throw new RangeError("priorityAgingMs must be positive and finite");this.maxQueuedJobs=e.maxQueuedJobs??this.maxQueuedJobs,this.maxPendingAdmissions=e.maxPendingAdmissions??this.maxPendingAdmissions,this.priorityAgingMs=e.priorityAgingMs??this.priorityAgingMs,this.maxQueuedBytes=e.maxQueuedBytes??this.maxQueuedBytes,this.maxInFlightBytes=e.maxInFlightBytes??this.maxInFlightBytes,this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug);for(let t of[...this.jobQueue])t.inputBytes>this.maxInFlightBytes&&(this.jobQueue.splice(this.jobQueue.indexOf(t),1),this.queuedBytes-=t.inputBytes,t.removeAbortListener(),t.onReject(new RangeError("Worker job exceeds maxInFlightBytes")));this._admit(),this._startQueuedJob(),this._checkDrained()}get requiresInputBytes(){return this.maxQueuedBytes!==1/0||this.maxInFlightBytes!==1/0}async startJob(e,t=(o,a,c)=>o.done(c),n=(o,a)=>o.error(a),s,i={}){if(i.cancellationMode!==void 0&&!["terminate","cooperative"].includes(i.cancellationMode))throw new Error("Invalid worker cancellation mode");if(i.cancellationTimeout!==void 0&&(!Number.isFinite(i.cancellationTimeout)||i.cancellationTimeout<0))throw new RangeError("cancellationTimeout must be finite and nonnegative");if(s?.aborted)throw s.reason;if(this.isDestroyed)return Promise.reject(new Error("Worker pool was destroyed"));if(this.isClosing)return Promise.reject(new Error("Worker pool is closing"));let{inputBytes:o=0,priority:a=0}=i;if(!Number.isSafeInteger(o)||o<0||!Number.isFinite(a))throw new RangeError("Invalid worker scheduling inputBytes or priority");if(o>this.maxInFlightBytes)throw new RangeError("Worker job exceeds maxInFlightBytes");let c=i.admission;if(c&&(!this.reservations.has(c)||c.inputBytes!==o))throw new Error("Invalid or consumed worker admission");let u=!this.jobQueue.length&&this.activeJobs.size<this._getMaxConcurrency()&&this.inFlightBytes+o<=this.maxInFlightBytes;if(!c&&!u&&(this.jobQueue.length+this.reservations.size>=this.maxQueuedJobs||o>this.maxQueuedBytes-this.queuedBytes-this.reservedBytes))throw new RangeError("Worker queue exceeds maxQueuedBytes or maxQueuedJobs");c&&(this.reservations.delete(c),this.reservedBytes-=c.inputBytes);let l=new Promise((f,d)=>{let h=()=>{let g=this.jobQueue.indexOf(m);g>=0&&(this.jobQueue.splice(g,1),this.queuedBytes-=m.inputBytes,this._admit(),this._startQueuedJob(),m.removeAbortListener(),d(s?.reason),this._checkDrained())},m={name:e,inputBytes:o,priority:a,queuedAt:performance.now(),sharedState:i.sharedState,cancellationMode:i.cancellationMode,cancellationTimeout:i.cancellationTimeout,onMessage:t,onError:n,onStart:f,onReject:d,signal:s,removeAbortListener:()=>s?.removeEventListener("abort",h)},b=this.jobQueue.findIndex(g=>g.priority<a);return this.jobQueue.splice(b<0?this.jobQueue.length:b,0,m),this.queuedBytes+=o,u||(this.totals.peakQueuedBytes=Math.max(this.totals.peakQueuedBytes,this.queuedBytes+this.reservedBytes)),s?.addEventListener("abort",h,{once:!0}),this});return this._startQueuedJob(),await l}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=performance.now();if(this.jobQueue.sort((s,i)=>i.priority+Math.floor((e-i.queuedAt)/this.priorityAgingMs)-(s.priority+Math.floor((e-s.queuedAt)/this.priorityAgingMs))),this.jobQueue[0].inputBytes>this.maxInFlightBytes-this.inFlightBytes)return;let t;try{t=this._getAvailableWorker()}catch(s){let i=this.jobQueue.shift();i&&(this.queuedBytes-=i.inputBytes),this._admit(),i?.removeAbortListener(),i?.onReject(s),this._startQueuedJob(),this._checkDrained();return}if(!t)return;let n=this.jobQueue.shift();if(n){this.startingJobs++,this.queuedBytes-=n.inputBytes,this.inFlightBytes+=n.inputBytes,this.totals.peakInFlightBytes=Math.max(this.totals.peakInFlightBytes,this.inFlightBytes),this._admit();let s=performance.now();try{this.onDebug({message:"Starting job",name:n.name,workerThread:t,backlog:this.jobQueue.length})}catch{}if(this.isDestroyed||t.terminated){this.startingJobs--,this.inFlightBytes-=n.inputBytes,n.removeAbortListener(),n.onReject(new Error("Worker pool was destroyed before job start")),this.returnWorkerToQueue(t);return}let i=new Oc(n.name,t);i.sharedState=n.sharedState,n.removeAbortListener();let o=()=>{n.cancellationMode==="cooperative"?i.cancel(n.signal?.reason,n.cancellationTimeout):i.abort(n.signal?.reason)};n.signal?.addEventListener("abort",o,{once:!0}),n.signal?.aborted&&o(),this.activeJobs.add(i),this.startingJobs--,t.ref(),t.onMessage=a=>{try{i.isRunning&&n.onMessage(i,a.type,a.payload)}catch(c){i.abort(c)}},t.onError=a=>{try{n.onError(i,a)}catch(c){i.abort(c)}},i.result.catch(()=>{}),n.onStart(i),this._startQueuedJob();try{await i.completion}catch{}finally{n.signal?.removeEventListener("abort",o),this.activeJobs.delete(i),this.inFlightBytes-=n.inputBytes;let a=i.isCancelled?"cancelled":i.failed?"failed":"completed";this.totals[a]++;let c={name:i.name,outcome:a,queueWaitMs:s-n.queuedAt,durationMs:performance.now()-s,workerCreationMs:t.creationTimeMs,workerStartupMs:t.startupTimeMs,postMessageMs:i.postMessageMs,executionMs:i.executionMs,inputBytes:n.inputBytes};try{this.props.onMetrics?.(c),this.props.performanceMarks&&typeof performance.measure=="function"&&performance.measure(`math.gl.worker:${i.name}`,{start:n.queuedAt,end:performance.now(),detail:c})}catch{}this._admit(),this.returnWorkerToQueue(t)}}else this.returnWorkerToQueue(t)}returnWorkerToQueue(e){e.terminated||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.terminated&&!this.isDestroyed&&this.totals.workerRestarts++,e.terminated||e.destroy(),e.destroy().then(()=>this.workers.delete(e)),this.count--):(e.unref(),this.idleQueue.push(e)),this.isDestroyed||this._startQueuedJob(),this._checkDrained()}_getAvailableWorker(){for(;this.idleQueue.length>0;){let e=this.idleQueue.shift();if(e&&(e.terminated||this.count>this._getMaxConcurrency()))e.terminated&&this.totals.workerRestarts++,e.destroy().then(()=>this.workers.delete(e)),this.count--;else if(e)return e}if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;try{let t=new Sr({name:e,source:this.source,url:this.url,workerType:this.workerType,getUrl:this.getUrl,loadWorker:this.loadWorker});return this.totals.workersCreated++,this.workers.add(t),t}catch(t){throw this.count--,t}}return null}_getMaxConcurrency(){return R_?this.maxMobileConcurrency:this.maxConcurrency}}});function OM(r){let{name:e,source:t,url:n,urlKey:s,loadWorker:i,workerType:o}=r,a=t?`source:${t}`:"",c=n||s?`url:${n||s}`:"",u=i?`loadWorker:${MM(i)}`:"";return[e,a,c,u,`type:${o||"classic"}`].filter(Boolean).join("|")}function MM(r){let e=j_.get(r);return e||(e=FM++,j_.set(r,e)),e}var V_,j_,FM,sa,G_=p(()=>{Om();Mc();V_={maxQueuedJobs:1/0,maxPendingAdmissions:128,priorityAgingMs:1e3,onMetrics:()=>{},performanceMarks:!1,maxQueuedBytes:1/0,maxInFlightBytes:1/0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},j_=new WeakMap,FM=1,sa=class r{static isSupported(){return Sr.isSupported()}static getWorkerFarm(e={}){return r._workerFarm=r._workerFarm||new r({}),r._workerFarm.setProps(e),r._workerFarm}constructor(e){this.workerPools=new Map,this.props={...V_},this.setProps(e),this.workerPools=new Map}destroy(e){let t=[...this.workerPools.values()];return this.workerPools.clear(),Promise.all(t.map(n=>n.destroy(e))).then(()=>{})}setProps(e){let t={};for(let n of Object.keys(V_))e[n]!==void 0&&(t[n]=e[n]);this.props={...this.props,...t};for(let n of this.workerPools.values())n.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:t,source:n,url:s,getUrl:i,loadWorker:o,workerType:a}=e,c=OM(e),u=this.workerPools.get(c);return u||(u=new Hs({name:t,source:n,url:s,getUrl:i,loadWorker:o,workerType:a}),u.setProps(this._getWorkerPoolProps()),this.workerPools.set(c,u)),u}_getWorkerPoolProps(){return{maxQueuedJobs:this.props.maxQueuedJobs,maxPendingAdmissions:this.props.maxPendingAdmissions,priorityAgingMs:this.props.priorityAgingMs,onMetrics:this.props.onMetrics,performanceMarks:this.props.performanceMarks,maxQueuedBytes:this.props.maxQueuedBytes,maxInFlightBytes:this.props.maxInFlightBytes,maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}});var Dc,z_=p(()=>{Dc=class{constructor(){this._values=[],this._settlers=[],this._closed=!1}[Symbol.asyncIterator](){return this}push(e){return this.enqueue(e)}enqueue(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");let t=this._settlers.shift();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.push(e)}close(){for(;this._settlers.length>0;)this._settlers.shift().resolve({done:!0});this._closed=!0}next(){if(this._values.length>0){let e=this._values.shift();return e instanceof Error?Promise.reject(e):Promise.resolve({done:!1,value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0,value:void 0})}return new Promise((e,t)=>{this._settlers.push({resolve:e,reject:t})})}}});function Mm(r){let e=r.version!==Sm?` (worker-utils@${Sm})`:"";return`${r.name}@${r.version}${e}`}function Dm(r,e={}){let t=zt?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=$_(r,e),s=e._workerType||e?.core?._workerType;if(!n&&s==="test")if(zt)n=`modules/${r.module}/dist/${t}`;else{let i=r.module==="tasks"&&r.workerNode?.startsWith("worker-utils/")?"worker-utils/workers":"workers",o=r.workerSourceNode||`${i}/${r.id}-worker-node.ts`;n=`modules/${r.module}/src/${o}`}return n||null}function $_(r,e={}){return(e[r.id]||{}).workerUrl||(r.id==="compression"?e.workerUrl:null)||null}function Rm(r,e={}){let t=Dm(r,e),n=typeof r.worker=="string"?r.worker:null,s=t||n||km(r,!0);return Qi(s),s}function km(r,e=!1){let t=zt?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=r.version;n==="latest"&&(n=lf);let s=n?`@${n}`:"",o=`https://unpkg.com/${r.packageName||`@loaders.gl/${r.module}`}${s}/dist/${t}`;return e&&DM(r,o),o}function DM(r,e){if(r.version!=="latest")return;let t=`${r.module}:${r.id}`;W_.has(t)||(W_.add(t),console.warn(`loaders.gl: ${r.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${e} from CDN.`))}var W_,q_=p(()=>{ff();ta();M_();Im();W_=new Set});function K_(){let r=typeof globalThis.crossOriginIsolated=="boolean"?globalThis.crossOriginIsolated:void 0,e={workers:Sr.isSupported(),sharedMemory:!1,crossOriginIsolated:r};if(zt&&r!==!0)e.sharedMemoryUnavailableReason="cross-origin-isolation";else if(typeof SharedArrayBuffer>"u"||typeof Atomics>"u"||typeof structuredClone!="function")e.sharedMemoryUnavailableReason="unsupported";else try{let t=new SharedArrayBuffer(4),n=structuredClone(t);Atomics.store(new Int32Array(t),0,17),e.sharedMemory=Atomics.load(new Int32Array(n),0)===17,e.sharedMemory||(e.sharedMemoryUnavailableReason="blocked")}catch{e.sharedMemoryUnavailableReason="blocked"}return e}function RM(){if(!K_().sharedMemory)return null;let r=new Zi(new SharedArrayBuffer(16));return r.setProgress(0),r}function Nm(r){if(r.sharedState===void 0&&r.cancellationMode==="cooperative"){let e=RM();return e?{...r,sharedState:e.buffer}:r}if(r.sharedState){if(!K_().sharedMemory)throw new Error("Shared worker memory is unavailable");new Zi(r.sharedState).throwIfCancelled()}return r}var Zi,X_=p(()=>{Mc();ta();Zi=class{constructor(e){if(typeof SharedArrayBuffer>"u"||!(e instanceof SharedArrayBuffer)||e.byteLength!==16)throw new Error("Expected a 16-byte shared worker control buffer");this.buffer=e,this.values=new Int32Array(e)}get snapshot(){return{cancelled:Atomics.load(this.values,0)!==0,completed:Atomics.load(this.values,1),total:Atomics.load(this.values,2),revision:Atomics.load(this.values,3)}}cancel(){Atomics.store(this.values,0,1),Atomics.add(this.values,3,1),Atomics.notify(this.values,0)}throwIfCancelled(){if(Atomics.load(this.values,0)!==0){let e=new Error("Shared worker task was cancelled");throw e.name="AbortError",e}}setProgress(e,t=-1){if(!Number.isInteger(e)||e<0||e>2147483647||!Number.isInteger(t)||t<-1||t>2147483647)throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");Atomics.store(this.values,1,e),Atomics.store(this.values,2,t),Atomics.add(this.values,3,1)}}});function hf(r){let e=new Set,t=0;function n(s){if(!(!s||typeof s!="object"||e.has(s)))if(e.add(s),ArrayBuffer.isView(s))n(s.buffer);else if(s instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&s instanceof SharedArrayBuffer)t+=s.byteLength;else if(s instanceof Map)for(let[i,o]of s)n(i),n(o);else if(s instanceof Set)for(let i of s)n(i);else for(let i of Object.keys(s))n(s[i])}return n(r),t}var H_=p(()=>{});function Cm(r){if(r!==void 0&&r!=="copy"&&r!=="transfer")throw new Error("Invalid worker output ownership")}var J_=p(()=>{});async function Pm(r,e,t={},n={},s={}){if(Cm(t.outputOwnership),t.inputOwnership!==void 0&&!["copy","transfer","share"].includes(t.inputOwnership))throw new Error("Invalid worker input ownership");t=Nm(t),Y_(t.signal),Um(t,[e,Rc(t),s]);let i=Mm(r),o=t.workerPool??sa.getWorkerFarm(t).getWorkerPool(eA(r,t,i)),a=t.jobName||r.name,c=await o.startJob(a,tA.bind(null,n,t),void 0,t.signal,{inputBytes:hf([e,nA(t),s]),priority:t.priority,admission:t.admission,sharedState:t.sharedState?new Zi(t.sharedState):void 0,cancellationMode:t.cancellationMode,cancellationTimeout:t.cancellationTimeout});try{t.signal?.aborted&&!c.isCancelled&&c.abort(Q_(t.signal));let u=Rc(t),l=na(u),f=na(s);return c.isRunning&&c.postMessage("process",{input:e,options:l,context:f},t.inputOwnership==="copy"||t.inputOwnership==="share"?[]:void 0),(await c.result).result}catch(u){throw c.isCancelled||c.abort(u),u}}function Vm(r,e,t={},n={},s={}){if(Cm(t.outputOwnership),t.inputOwnership!==void 0&&!["copy","transfer","share"].includes(t.inputOwnership))throw new Error("Invalid worker input ownership");return kM(r,e,t,n,s)}async function*kM(r,e,t,n,s){t=Nm(t),Y_(t.signal);let i=Mm(r),o=t.workerPool??sa.getWorkerFarm(t).getWorkerPool(eA(r,t,i));Um(t,[Rc(t),s]);let a=hf([nA(t),s]),c=t.inputBytes??a;if(o.requiresInputBytes&&t.inputBytes===void 0)throw new Error("Byte-bounded batch sessions require inputBytes");if(!Number.isSafeInteger(c)||c<a)throw new RangeError("Batch inputBytes must cover options and context buffers");let u=new Dc,l=NM(e),f=!1,d=!1,h=!1,m=Promise.resolve(),b=new Error("Worker batch job failed"),g=()=>{!d&&!h&&(h=!0,CM(l))},y=()=>{f||(f=!0,u.close())},x=_=>{f||(f=!0,u.enqueue(b),u.close())},T=await o.startJob(t.jobName||r.name,(_,v,I)=>{if(!(_.isCancelled&&v!=="done"&&v!=="error"))switch(v){case"progress":rA(_,t,I);break;case"input-request":m=m.then(async()=>{if(!_.isRunning)return;let N=await l.next();if(_.isRunning)if(N.done)d=!0,_.postMessage("input-done",{});else{if(Um(t,N.value),t.inputBytes!==void 0&&hf(N.value)+a>c)throw new RangeError("Worker batch exceeds reserved inputBytes");_.postMessage("input-batch",{input:N.value},t.inputOwnership==="copy"||t.inputOwnership==="share"?[]:void 0)}}).catch(N=>{_.isCancelled||_.abort(N)});break;case"output-batch":u.push(I.result);break;case"done":_.done(I),y();break;case"error":{let N=new Error(I.error||"Worker batch processing failed");N.name=I.errorName||"Error",_.error(N),x(N);break}case"process":tA(n,t,_,v,I);break;default:{let N=new Error(`Unexpected worker batch message: ${v}`);_.error(N),x(N);break}}},void 0,t.signal,{inputBytes:c,priority:t.priority,admission:t.admission,sharedState:t.sharedState?new Zi(t.sharedState):void 0,cancellationMode:t.cancellationMode,cancellationTimeout:t.cancellationTimeout}).catch(_=>{throw g(),_});T.result.catch(_=>{x(_),g()});try{let _=Rc(t);T.isRunning&&T.postMessage("process-in-batches",{options:na(_),context:na(s)},t.inputOwnership==="copy"||t.inputOwnership==="share"?[]:void 0);try{for await(let v of u)yield v,T.isRunning&&T.postMessage("output-ack",{})}catch(v){throw v===b&&await T.result,v}await T.result}finally{T.isRunning&&!T.isCancelled&&T.abort(Z_("Worker batch iterator was closed")),g()}}function Y_(r){if(r?.aborted)throw Q_(r)}function Q_(r){return r?r.reason:Z_("Worker job was aborted")}function Z_(r){let e=new Error(r);return e.name="AbortError",e}function NM(r){return Symbol.asyncIterator in r?r[Symbol.asyncIterator]():(async function*(){yield*r})()}function CM(r){try{Promise.resolve(r.return?.()).catch(()=>{})}catch{}}function eA(r,e,t){if(e.source)return{name:t,source:e.source,workerType:e.workerType};let n=Dm(r,e);return n?{name:t,url:n,workerType:e.workerType}:zt&&r.loadWorker?{name:t,workerType:e.workerType,loadWorker:r.loadWorker,getUrl:()=>Rm(r,e),urlKey:km(r)}:{name:t,url:Rm(r,e),workerType:e.workerType}}async function tA(r,e,t,n,s){if(!(t.isCancelled&&n!=="done"&&n!=="error"))switch(n){case"progress":rA(t,e,s);break;case"done":t.done(s);break;case"error":let i=new Error(s.error);i.name=s.errorName||"Error",t.error(i);break;case"process":let{id:o,input:a,options:c}=s;try{if(!r.process){t.postMessage("error",{id:o,error:"Worker not set up to process on main thread"});return}let u=await r.process(a,{...c,signal:e.signal,onProgress:e.onProgress},void 0,s.context||{});t.postMessage("done",{id:o,result:u})}catch(u){let l=u instanceof Error?u.message:"unknown error";t.postMessage("error",{id:o,error:l})}break;default:console.warn(`process-on-worker: unknown message ${n}`)}}function rA(r,e,t){if(!(!r.isRunning||r.isCancelled||!t.progress))try{e.onProgress?.(t.progress)}catch(n){r.abort(n)}}function Rc(r){let{signal:e,onProgress:t,onMetrics:n,workerPool:s,admission:i,workerType:o,...a}=r;return a}function Um(r,e){if(r.inputOwnership==="share"&&yt(e).length)throw new Error("Share ownership requires SharedArrayBuffer storage; ordinary transferables are not allowed")}function nA(r){let{sharedState:e,...t}=Rc(r);return t}var sA=p(()=>{z_();G_();q_();df();X_();ta();H_();J_()});var UM,jm,FK,pf=p(()=>{Om();sA();df();UM={},jm=typeof __filename=="string"?__filename.replace(/\\/g,"/"):"",FK=jm?`file://${jm.startsWith("/")?"":"/"}${encodeURI(jm).replace(/#/g,"%23").replace(/\?/g,"%3F")}`:UM.url});function oA(r,e){if(!r.preload)return Promise.resolve();let t=Gm.get(r);return t||(t=Promise.resolve().then(()=>r.preload()).then(()=>{iA.add(r)}),Gm.set(r,t),t.catch(()=>Gm.delete(r))),PM(t,e)}function aA(r){return!r.preload||iA.has(r)}function PM(r,e){return e?new Promise((t,n)=>{let s=()=>{e.removeEventListener("abort",s),n(e.reason)};e.addEventListener("abort",s,{once:!0}),e.aborted&&s(),r.then(i=>{e.removeEventListener("abort",s),t(i)},i=>{e.removeEventListener("abort",s),n(i)})}):r}var Gm,iA,zm=p(()=>{Gm=new WeakMap,iA=new WeakSet});var kc,mf,Wm=p(()=>{kc=class extends Error{},mf=class{constructor(e){this.options=e,this.nextId=1,this.pending=new Map,this.incoming=new Map}request(e,t,n,s=[]){if(this.failure)return Promise.reject(this.failure.reason);if(n?.aborted)return Promise.reject(n.reason);let i=this.nextId++;return new Promise((o,a)=>{let c=()=>{let u=this.pending.get(i);u&&(this.pending.delete(i),u.cleanup(),a(n?.reason),this.send({source:"math.gl/tasks",kind:"cancel",id:i}))};this.pending.set(i,{resolve:o,reject:a,cleanup:()=>n?.removeEventListener("abort",c)}),n?.addEventListener("abort",c,{once:!0}),this.send({source:"math.gl/tasks",kind:"request",id:i,operation:e,value:t},s)})}emit(e,t,n=[]){if(this.failure)throw this.failure.reason;this.send({source:"math.gl/tasks",kind:"event",id:0,operation:e,value:t},n)}receive(e){if(!(this.failure||e?.source!=="math.gl/tasks")){if(e.kind==="failure"){let t=new Error(e.error?.message??"Task channel failed");this.close(t),this.options.onFailure?.(t)}else if(e.kind==="result"||e.kind==="error"){let t=this.pending.get(e.id);if(!t)return;if(this.pending.delete(e.id),t.cleanup(),e.kind==="result")t.resolve(e.value);else{let n=new kc(e.error?.message??"Task request failed");n.name=e.error?.name??"Error",t.reject(n)}}else if(e.kind==="cancel")this.incoming.get(e.id)?.abort(new DOMException("Task request cancelled","AbortError"));else if(e.kind==="event")try{this.options.handleEvent?.(e.operation,e.value)}catch(t){this.fail(t)}else if(e.kind==="request"){if(this.incoming.has(e.id)){this.fail(new Error("Duplicate task request identifier"));return}let t=new AbortController;this.incoming.set(e.id,t),Promise.resolve().then(()=>(t.signal.throwIfAborted(),this.options.handleRequest(e.operation,e.value,t.signal))).then(n=>{!t.signal.aborted&&!this.failure&&this.send({source:"math.gl/tasks",kind:"result",id:e.id,value:n},this.options.getResultTransferList?.(n,e.value))}).catch(n=>{!t.signal.aborted&&!this.failure&&this.send({source:"math.gl/tasks",kind:"error",id:e.id,error:{name:n instanceof Error?n.name:"Error",message:n instanceof Error?n.message:String(n)}})}).finally(()=>this.incoming.delete(e.id))}}}close(e=new Error("Task channel closed")){if(!this.failure){this.failure={reason:e};for(let t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear();for(let t of this.incoming.values())t.abort(e);this.incoming.clear()}}send(e,t=[]){if(!this.failure)try{this.options.send(e,t)}catch(n){this.fail(n)}}fail(e){if(!this.failure){this.close(e);try{this.options.send({source:"math.gl/tasks",kind:"failure",id:0,error:{name:e instanceof Error?e.name:"Error",message:e instanceof Error?e.message:String(e)}},[])}catch{}this.options.onFailure?.(e)}}}});function dn(r){if(!r||typeof r!="object"||Object.getPrototypeOf(r)!==Object.prototype)throw new TypeError("Task payloads must be plain objects with named fields")}function wt(r,e="copy"){if(dn(r),!["copy","transfer","share"].includes(e))throw new TypeError("Invalid input ownership");let t=yt(r);if(e==="share"&&t.length)throw new TypeError("Share requires shared storage");return structuredClone(r,{transfer:e==="transfer"?t:[]})}function Nc(r,e={}){let t=e.signal??new AbortController().signal;return{state:r,signal:t,requestHost:async(n,s,i)=>{if(t.throwIfAborted(),!e.requestHost)throw new Error("No host request handler configured");return e.requestHost(n,s,i)},emitHost:(n,s)=>{t.throwIfAborted(),e.emitHost?.(n,s)},throwIfAborted:()=>{t.throwIfAborted(),e.throwIfAborted?.()},reportProgress:n=>e.reportProgress?.({...n,phase:n.phase??"process",unit:n.unit??"items"})}}function gf(r){return{signal:r.signal,reportProgress:e=>r.onProgress?.(e)}}var bf,$m=p(()=>{pf();zm();bf=class{constructor(e){this.task=e,this.initialized=!1}async initialize(e,t={}){if(this.initialized)throw new Error("Task is already initialized");return dn(e),await oA(this.task,t.signal),t.signal?.throwIfAborted(),this.state=await this.task.initialize?.(e,Nc(void 0,t)),this.initialized=!0,{}}async destroy(){if(this.initialized){this.initialized=!1;let e=this.state;this.state=void 0,this.task.initialize&&await this.task.destroy?.(e)}return{}}async process(e,t,n={}){if(!this.initialized)throw new Error("Task is not initialized");if(!this.task.process)throw new Error("Task has no atomic processor");dn(e);let s=await this.task.process(e,t,Nc(this.state,n));return dn(s),s}async*stream(e,t,n={}){if(!this.initialized)throw new Error("Task is not initialized");if(!this.task.processInBatches)throw new Error("Task has no streaming processor");for await(let s of this.task.processInBatches(e,t,Nc(this.state,n)))dn(s),yield s}}});function cA(r,e,t={}){if(!aA(r))throw new Error("Preload task on the main thread before runTaskSync");if("execution"in t)throw new TypeError("runTaskSync always runs on the calling thread");if(!r.process)throw new TypeError("Task has no atomic processor");for(let f of[r.initialize,r.process,r.destroy])if(f&&Object.prototype.toString.call(f)==="[object AsyncFunction]")throw new TypeError("runTaskSync requires synchronous lifecycle hooks");if(t.outputOwnership&&!["copy","transfer"].includes(t.outputOwnership))throw new TypeError("Invalid output ownership");let n=Nc(void 0,gf(t));n.throwIfAborted();let s=t.options??{};if(t.inputOwnership==="transfer"){let f=new Set(yt(s));if(yt(e).some(d=>f.has(d)))throw new Error("Transferred input aliases reusable options; use inputOwnership: copy")}let i=wt(s),o=wt(t.initialization??{},t.initializationOwnership),a=!1,c,u=!1,l;try{let f=r.initialize?.(o,n);if(qm(f))throw Promise.resolve(f).then(m=>r.destroy?.(m)).catch(()=>{}),new TypeError("runTaskSync initialize returned a promise");n.state=f,a=!0,n.throwIfAborted();let d=wt(e,t.inputOwnership),h=r.process(d,i,n);if(qm(h))throw a=!1,Promise.resolve(h).catch(()=>{}).then(()=>{if(r.initialize)return r.destroy?.(n.state)}).catch(()=>{}),new TypeError("runTaskSync process returned a promise");dn(h),n.throwIfAborted(),l=wt(h,t.outputOwnership??"transfer")}catch(f){u=!0,c=f}finally{if(a&&r.initialize)try{let f=r.destroy?.(n.state);if(qm(f))throw Promise.resolve(f).catch(()=>{}),new TypeError("runTaskSync destroy returned a promise")}catch(f){throw u?new AggregateError([c,f],"Task processing and destruction failed"):f}}if(u)throw c;return l}function qm(r){return!!(r&&(typeof r=="object"||typeof r=="function")&&typeof r.then=="function")}var uA=p(()=>{zm();pf();$m()});var yf,lA=p(()=>{yf=class{constructor(e){if(this.maxConcurrency=e,this.pending=[],this.active=0,this.exclusive=!1,this.closed=!1,this.idleWaiters=new Set,!Number.isSafeInteger(e)||e<1)throw new RangeError("maxConcurrency must be a positive safe integer")}run(e,t,n){return this.closed?Promise.reject(new Error("Task operation queue is closed")):e!=="parallel"&&e!=="exclusive"?Promise.reject(new TypeError("Invalid operation mode")):n?.aborted?Promise.reject(n.reason):new Promise((s,i)=>{let o=()=>{let c=this.pending.indexOf(a);c>=0&&(this.pending.splice(c,1),a.cancel(n?.reason),this.pump())},a={mode:e,cancel:c=>{n?.removeEventListener("abort",o),i(c)},start:()=>{n?.removeEventListener("abort",o),this.active++,e==="exclusive"&&(this.exclusive=!0),Promise.resolve().then(()=>(n?.throwIfAborted(),t())).then(s,i).finally(()=>{this.active--,e==="exclusive"&&(this.exclusive=!1),this.pump()})}};this.pending.push(a),n?.addEventListener("abort",o,{once:!0}),n?.aborted?o():this.pump()})}cancelPending(e){this.closed=!0;for(let t of this.pending.splice(0))t.cancel(e);this.pump()}close(){return this.closed=!0,this.whenIdle()}whenIdle(){return!this.active&&!this.pending.length?Promise.resolve():new Promise(e=>this.idleWaiters.add(e))}pump(){for(;!this.exclusive&&this.pending.length&&this.active<this.maxConcurrency;){let e=this.pending[0];if(e.mode==="exclusive"&&this.active||(this.pending.shift(),e.start(),e.mode==="exclusive"))break}if(!this.active&&!this.pending.length){for(let e of this.idleWaiters)e();this.idleWaiters.clear()}}}});var wf,fA=p(()=>{Mc();Wm();wf=class{constructor(e,t,n){this.thread=new Sr({name:e,url:t.url?.toString(),loadWorker:t.create,workerType:"module"}),this.channel=new mf({...n,send:(s,i)=>this.thread.postMessage({source:"loaders.gl/tasks",type:"task-channel",payload:s},i)}),this.thread.onMessage=s=>{s?.type==="task-channel"&&this.channel.receive(s.payload)},this.thread.onError=s=>{this.channel.close(s),n.onFailure?.(s)}}async destroy(e){this.channel.close(e),await this.thread.destroy()}}});async function VM(r,e){let t;try{t=await e()}catch(n){try{await r.close()}catch(s){throw new AggregateError([n,s],"Task processing and destruction failed")}throw n}return await r.close(),t}async function*Xm(r,e){let t=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator](),n=!1,s=!1;try{for(;;){let i=await new Promise((o,a)=>{let c=()=>e?.removeEventListener("abort",u),u=()=>{c(),a(e?.reason)};if(e?.addEventListener("abort",u,{once:!0}),e?.aborted){u();return}try{s=!0,Promise.resolve(t.next()).then(l=>{s=!1,c(),o(l)},l=>{s=!1,c(),a(l)})}catch(l){s=!1,c(),a(l)}});if(i.done){n=!0;return}yield i.value}}finally{if(!n)if(s)try{Promise.resolve(t.return?.()).catch(()=>{})}catch{}else await t.return?.()}}function dA(r,e,t){if(t==="transfer"){let n=new Set(yt(e));if(yt(r).some(s=>n.has(s)))throw new Error("Transferred input aliases reusable options; use inputOwnership: copy")}}var Km,Cc,hA=p(()=>{pf();$m();uA();lA();fA();Wm();Km=class{constructor(e,t,n){this.task=e,this.release=t,this.initializationControls=n,this.nextProgressId=1,this.progressCallbacks=new Map,this.callbackFailures=new Map,this.closed=!1,this.finalized=!1,this.streams=new Set,this.invalid=!1,this.controller=new AbortController;let s=n;this.runtime=new bf(e);let i=s.operationConcurrency??1,o=e.concurrency?.maxConcurrency??1;if(!Number.isSafeInteger(o)||o<1||!Number.isSafeInteger(i)||i<1||i>o)throw new RangeError("Task concurrency must be between 1 and the task maximum");this.operationQueue=new yf(i),this.concurrent=i>1;let a=s.execution??"auto";if(!["auto","main-thread","worker"].includes(a))throw new TypeError("Invalid execution mode");if(a==="worker"&&!e.worker)throw new Error("Task has no worker");if(a!=="main-thread"&&e.worker){let c=e.worker;if(!!c.url==!!c.create)throw new Error("Supply exactly one worker URL or factory");if(this.concurrent||s.onRequest||s.onEvent){this.workerChannel=new wf(e.id,c,{handleRequest:async(u,l,f)=>{if(u==="task:next-input"){if(!this.channelInputs)throw new Error("No active task stream");return this.channelInputs.next()}if(!s.onRequest)throw new Error("No host request handler configured");let d=l;if(u!=="task:host-request")throw new Error("Unknown host request");return s.onRequest(d.operation,d.payload,f)},getResultTransferList:(u,l)=>l.outputOwnership==="transfer"?yt(u):[],handleEvent:(u,l)=>{let{id:f}=l;try{if(u==="task:progress"){let d=l;(this.progressCallbacks.get(d.id)??this.streamProgress)?.(d.progress)}else if(u==="task:host-event"){let d=l;s.onEvent?.(d.operation,d.payload)}}catch(d){(this.progressCallbacks.has(f)||this.streamProgressId===f)&&(this.callbackFailures.has(f)||this.callbackFailures.set(f,{reason:d}))}},onFailure:u=>{this.invalid=!0,this.operationQueue.cancelPending(u),this.controller.abort(u)}});return}this.pool=new Hs({name:e.id,url:c.url?.toString(),loadWorker:c.create,workerType:"module",maxConcurrency:1,maxMobileConcurrency:1}),this.descriptor={id:e.id,name:e.id,module:"tasks",version:"prototype",options:{},worker:c.url?.toString()??!0,loadWorker:c.create,workerInBatches:c.capabilities.streaming}}}async initialize(e,t){try{dn(e),await this.enqueue(()=>this.invoke("initialize",e,{},t))}catch(n){throw await this.terminate(n),n}}runTask(e,...t){if(this.invalid)return Promise.reject(new Error("Initialized task is invalid; initialize a new instance"));if(this.closed)return Promise.reject(new Error("Initialized task is closed"));let n=t[0]?.timeout;if(n!==void 0&&(!Number.isSafeInteger(n)||n<0||n>4294967295))return Promise.reject(new RangeError("Invalid task timeout"));let s=n===void 0?void 0:AbortSignal.timeout(n),i=s&&t[0]?.signal?AbortSignal.any([s,t[0].signal]):s??t[0]?.signal,o={...t[0],signal:i},a=this.task.concurrency?.getSchedulingMode?.(e)??"exclusive";return this.operationQueue.run(a,async()=>{i?.throwIfAborted(),this.checkCapability("atomic");let c=()=>{this.concurrent&&(this.invalid=!0,this.operationQueue.cancelPending(i?.reason),this.controller.abort(i?.reason))};i?.addEventListener("abort",c,{once:!0});try{return await this.invoke("process",e,t[0]?.options??{},o)}finally{i?.removeEventListener("abort",c)}},i)}runTasks(e,...t){return this.serialStream(async function*(n){n.checkCapability("atomic");for await(let s of Xm(e,n.controls(t[0]).signal))yield await n.invoke("process",s,t[0]?.options??{},t[0])},t[0]?.signal)}runTaskInBatches(e,...t){return this.serialStream(async function*(n){n.checkCapability("streaming");let s=n.controls(t[0]),i=wt(t[0]?.options??{});async function*o(){for await(let c of Xm(e,s.signal))s.signal?.throwIfAborted(),dA(c,t[0]?.options??{},s.inputOwnership),yield wt(c,s.inputOwnership)}let a=!1;try{if(n.workerChannel){n.channelInputs=o()[Symbol.asyncIterator](),n.streamProgress=s.onProgress;try{for(await n.invoke("stream-open",{},i,s);;){let c=await n.invoke("stream-next",{},{},s);if(c.done)break;yield c.value}}finally{try{n.invalid||await n.invoke("stream-close",{},{},s)}finally{await n.channelInputs.return?.(),n.channelInputs=void 0,n.streamProgress=void 0,n.streamProgressId!==void 0&&n.callbackFailures.delete(n.streamProgressId),n.streamProgressId=void 0}}}else if(n.pool)await n.invoke("stream-options",{},i,s),yield*Vm(n.descriptor,o(),{...n.workerOptions(s),inputOwnership:"transfer",workerInBatches:!0});else for await(let c of n.runtime.stream(o(),i,n.runtimeContext(s)))s.signal?.throwIfAborted(),yield wt(c,s.outputOwnership??"transfer");a=!0}catch(c){throw n.workerChannel&&(n.invalid=!0,n.operationQueue.cancelPending(c),n.controller.abort(c),await n.workerChannel.destroy(c)),n.pool&&(n.invalid=!0,await n.pool.destroy(c)),c}finally{if(n.pool&&!a&&(n.invalid=!0),n.workerChannel&&!a&&!n.invalid){let c=new Error("Worker stream ended before completion");n.invalid=!0,n.operationQueue.cancelPending(c),n.controller.abort(c),await n.workerChannel.destroy(c)}}},t[0]?.signal)}get state(){return this.invalid?"invalid":this.finalized?"closed":this.closed?"closing":"ready"}close(){return this.closing||(this.closed=!0,this.closing=(async()=>{try{await this.operationQueue.close(),this.invalid?!this.pool&&!this.workerChannel&&await this.runtime.destroy():await this.invoke("destroy",{},{})}finally{try{await this.pool?.destroy(),await this.workerChannel?.destroy()}finally{this.finalized=!0,this.release()}}})()),this.closing}async terminate(e=new Error("Task terminated")){this.operationQueue.cancelPending(e),this.controller.abort(e),this.workerChannel&&(this.invalid=!0,await this.workerChannel.destroy(e)),this.pool&&(this.invalid=!0,await this.pool.destroy(e)),await Promise.allSettled([...this.streams].map(t=>t())),await this.close()}checkCapability(e){if(this.pool||this.workerChannel?!this.task.worker?.capabilities[e]:!(e==="atomic"?this.task.process:this.task.processInBatches))throw new Error(`Task has no ${e} processor for this execution route`)}controls(e={}){if(e.outputOwnership&&!["copy","transfer"].includes(e.outputOwnership))throw new TypeError("Invalid output ownership");return{...e,signal:e.signal?AbortSignal.any([e.signal,this.controller.signal]):this.controller.signal}}workerOptions(e){return{workerPool:this.pool,workerType:"module",inputOwnership:e.inputOwnership??"copy",outputOwnership:e.outputOwnership??"transfer",signal:e.signal,onProgress:e.onProgress,cancellationMode:"terminate"}}async invoke(e,t,n,s={}){if(this.invalid)throw new Error("Initialized task is invalid; initialize a new instance");let i=e==="destroy"?{}:this.controls(s);i.signal?.throwIfAborted(),dn(t),dA(t,n,i.inputOwnership);let o=wt(n);if(this.workerChannel){let l=this.nextProgressId++,f={input:wt(t,i.inputOwnership),options:o,outputOwnership:i.outputOwnership??"transfer",progressId:l};e==="stream-open"&&(this.streamProgressId=l),this.progressCallbacks.set(l,i.onProgress);let d;try{let h=await this.workerChannel.channel.request(e,f,i.signal,yt(f));if(d=this.callbackFailures.get(l)??(e.startsWith("stream-")&&this.streamProgressId!==void 0?this.callbackFailures.get(this.streamProgressId):void 0),d)throw d.reason;return h}catch(h){throw e==="process"&&!i.signal?.aborted&&(h instanceof kc||d)||(this.invalid=!0,this.operationQueue.cancelPending(h),this.controller.abort(h),await this.workerChannel.destroy(h)),h}finally{this.progressCallbacks.delete(l),this.streamProgressId!==l&&this.callbackFailures.delete(l)}}if(this.pool)try{return await Pm(this.descriptor,{operation:e,input:wt(t,i.inputOwnership),options:o},this.workerOptions({...i,inputOwnership:"transfer"}))}catch(l){throw this.invalid=!0,await this.pool.destroy(l),l}if(e==="destroy")return this.runtime.destroy();let a=wt(t,i.inputOwnership),c=this.runtimeContext(i);if(e==="initialize"){let l=await this.runtime.initialize(a,c);return i.signal?.throwIfAborted(),l}let u=await this.runtime.process(a,o,c);return i.signal?.throwIfAborted(),wt(u,i.outputOwnership??"transfer")}runtimeContext(e){return{...gf(e),requestHost:async(t,n,s={})=>{let i=e.signal??this.controller.signal;i.throwIfAborted();let o=this.initializationControls.onRequest;if(!o)throw new Error("No host request handler configured");let a=await o(t,wt(n,s.inputOwnership),i);return i.throwIfAborted(),structuredClone(a,{transfer:s.outputOwnership==="transfer"?yt(a):[]})},emitHost:(t,n)=>this.initializationControls.onEvent?.(t,structuredClone(n))}}enqueue(e){return this.closed?Promise.reject(new Error("Initialized task is closed")):this.operationQueue.run("exclusive",e)}serialStream(e,t){let n=new AbortController,s=AbortSignal.any([n.signal,this.controller.signal,t].filter(c=>!!c)),i=!1,o=this.acquireStream(e,s,()=>{i=!0}),a=()=>{i||n.abort(new Error("Stream returned before execution"))};return{[Symbol.asyncIterator](){return this},next:()=>o.next(),return:async()=>(a(),o.return(void 0)),throw:async c=>(a(),o.throw(c))}}async*acquireStream(e,t,n){if(this.closed)throw new Error("Initialized task is closed");let s,i=new Promise(d=>{s=d}),o,a=new Promise(d=>{o=d}),c=this.operationQueue.run("exclusive",async()=>{s(),await a},t);if(await Promise.race([i,c]),t.aborted)throw o(),t.reason;n();let u=e(this)[Symbol.asyncIterator](),l,f=()=>(l??(l=(async()=>{try{await u.return?.()}finally{this.streams.delete(f),o()}})()),l);this.streams.add(f);try{for(;;){this.controller.signal.throwIfAborted();let d=await u.next();if(d.done)return;yield d.value}}finally{await f()}}},Cc=class{constructor(e={}){if(this.active=new Set,this.count=0,this.waiters=[],this.closed=!1,this.initializing=new Set,this.iterations=new Set,this.maxConcurrency=e.maxConcurrency??1,!Number.isSafeInteger(this.maxConcurrency)||this.maxConcurrency<1)throw new RangeError("maxConcurrency must be a positive safe integer")}runTaskSync(e,t,...n){if(this.closed)throw new Error("Task runner is closed");if(this.count>=this.maxConcurrency)throw new Error("Task runner has no synchronous capacity");this.count++;try{return cA(e,t,n[0])}finally{let s=this.waiters.shift();s?s.resolve():this.count--}}initializeTask(e,t,n={}){let s=this.open(e,t,n);return this.initializing.add(s),s.then(()=>this.initializing.delete(s),()=>this.initializing.delete(s)),s}async runTask(e,t,...n){let s=n[0]??{},i=await this.initializeTask(e,s.initialization??{},{...s,inputOwnership:s.initializationOwnership??"copy"});return VM(i,()=>i.runTask(t,s))}async*runTasks(e,t,...n){let s=n[0]??{};if(this.closed)throw new Error("Task runner is closed");if(s.initializationOwnership==="transfer")throw new TypeError("runTasks initialization is a reusable template; use copy or share");let i=s.concurrency??1;if(!Number.isSafeInteger(i)||i<1||i>this.maxConcurrency)throw new RangeError("concurrency must be between 1 and maxConcurrency");let o=[],a=new Set,c=[],u=new AbortController;this.iterations.add(u);let l=s.signal?AbortSignal.any([s.signal,u.signal]):u.signal,f=Xm(t,l)[Symbol.asyncIterator](),d=!1,h;try{for(;!d||c.length;){l.throwIfAborted(),!d&&!h&&c.length<i&&(h=f.next().then(y=>({kind:"input",next:y})));let m=await Promise.race([...c.length?[c[0]]:[],...h?[h]:[]]);if(m.kind==="result"){if(c.shift(),a.delete(m.handle),m.failed)throw m.error;yield m.value;continue}if(h=void 0,m.next.done){d=!0;continue}let b=o.find(y=>!a.has(y));if(!b&&(o.length===0||this.count<this.maxConcurrency)&&(b=await this.initializeTask(e,wt(s.initialization??{},s.initializationOwnership),{...s,signal:l,inputOwnership:s.initializationOwnership??"copy"}),o.push(b)),!b){let y=await c.shift();if(a.delete(y.handle),y.failed)throw y.error;yield y.value,b=y.handle}a.add(b);let g=b;c.push(b.runTask(m.next.value,{...s,signal:l}).then(y=>({kind:"result",handle:g,value:y}),y=>({kind:"result",handle:g,failed:!0,error:y})))}}finally{this.iterations.delete(u),u.abort(new Error("Task iteration closed"));try{h&&await h.catch(()=>{}),d||await f.return?.()}finally{await Promise.all(c),await Promise.all(o.map(m=>m.close()))}}}async*runTaskInBatches(e,t,...n){let s=n[0]??{},i=await this.initializeTask(e,s.initialization??{},{...s,inputOwnership:s.initializationOwnership??"copy"});try{yield*i.runTaskInBatches(t,s)}finally{await i.close()}}close(){if(!this.closing){this.closed=!0;for(let e of this.waiters.splice(0))e.reject(new Error("Task runner is closed"));this.closing=(async()=>{await Promise.allSettled(this.initializing);let t=(await Promise.allSettled([...this.active].map(n=>n.close()))).find(n=>n.status==="rejected");if(t?.status==="rejected")throw t.reason})()}return this.closing}async terminate(e=new Error("Task runner terminated")){for(let n of this.iterations)n.abort(e);let t=this.close();await Promise.allSettled([...this.active].map(n=>n.terminate(e))),await t}async open(e,t,n){if(this.closed)throw new Error("Task runner is closed");n.signal?.throwIfAborted(),this.count>=this.maxConcurrency?await new Promise((a,c)=>{let u={resolve:()=>{f(),a()},reject:d=>{f(),c(d)}},l=()=>{this.waiters=this.waiters.filter(d=>d!==u),u.reject(n.signal?.reason)},f=()=>n.signal?.removeEventListener("abort",l);this.waiters.push(u),n.signal?.addEventListener("abort",l,{once:!0}),n.signal?.aborted&&l()}):this.count++;let s,i=!1,o=()=>{if(i)return;i=!0,s&&this.active.delete(s);let a=this.waiters.shift();a?a.resolve():this.count--};try{if(this.closed)throw new Error("Task runner is closed");return s=new Km(e,o,n),this.active.add(s),await s.initialize(t,n),s}catch(a){throw o(),a}}}});var pA=p(()=>{hA()});var mA=p(()=>{pA()});function Hm(r,e={}){let t=Xe?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=Jm(r,e),s=e._workerType||e?.core?._workerType;if(!n&&s==="test")if(Xe)n=`modules/${r.module}/dist/${t}`;else{let i=r.module==="core"&&r.workerNode?.startsWith("worker-utils/")?"worker-utils/workers":"workers",o=r.workerSourceNode||`${i}/${r.id}-worker-node.ts`;n=`modules/${r.module}/src/${o}`}return n||null}function Jm(r,e={}){return(e[r.id]||{}).workerUrl||(r.id==="compression"?e.workerUrl:null)||null}function gA(r,e={}){let t=Hm(r,e),n=typeof r.worker=="string"?r.worker:null,s=t||n||jM(r,!0);return uf(s),s}function jM(r,e=!1){let t=Xe?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=r.version;n==="latest"&&(n=Am);let s=n?`@${n}`:"",i=`https://unpkg.com/@loaders.gl/${r.module}${s}/dist/${t}`;return e&&GM(r,i),i}function GM(r,e){if(r.version!=="latest")return;let t=`${r.module}:${r.id}`;bA.has(t)||(bA.add(t),console.warn(`loaders.gl: ${r.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${e} from CDN.`))}var bA,yA=p(()=>{"use strict";vm();Fc();E_();bA=new Set});function wA(r){return{...r,phase:r.phase??"process",unit:r.unit??"items"}}var xA=p(()=>{"use strict"});function Ym(r,e=!0,t){let n=t||new Set;if(r){if(TA(r))n.add(r);else if(TA(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let s in r)Ym(r[s],e,n)}}return t===void 0?Array.from(n):[]}function TA(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function Qm(r){if(r===null)return{};let e=Object.assign({},r);return Object.keys(e).forEach(t=>{r[t]!==null&&typeof r[t]=="object"&&!ArrayBuffer.isView(r[t])&&!(r[t]instanceof Array)?e[t]=Qm(r[t]):typeof e[t]=="function"||e[t]instanceof RegExp?e[t]={}:e[t]=r[t]}),e}var _A=p(()=>{"use strict"});function Zm(r,e={}){return!!((Xe?typeof Worker<"u":!!e._nodeWorkers)&&e.worker&&(r.worker||r.loadWorker||Jm(r,e)))}async function*eb(r,e,t={},n={},s={}){let i=qM(e),o;try{o=await $M(r,t,n,s);for await(let a of o.handle.runTaskInBatches(i,{...SA(t),options:WM(t)}))yield a.value}finally{i.return?.()?.catch(()=>{}),await o?.close()}}function zM(r,e){if(e.source||e.core?.source)throw new Error("Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory");let t=!Hm(r,e)&&Xe?r.loadWorker:void 0,n=gA(r,e);return{id:`${r.module}:${r.id}`,initialize:s=>s,worker:{...t?{create:()=>t()??KM(n)}:{url:n},capabilities:{atomic:!0,streaming:!0}}}}function SA(r){return{execution:"worker",signal:r.signal,inputOwnership:r.inputOwnership??"transfer",outputOwnership:r.outputOwnership??"transfer",onProgress:r.onProgress?e=>r.onProgress?.(wA(e)):void 0}}function WM(r){let{signal:e,onProgress:t,...n}=r;return Qm(n)}async function $M(r,e,t,n){e.signal?.throwIfAborted();let s=zM(r,e),i=AA.get(r);i||(i={runner:new Cc({maxConcurrency:O_?e.maxMobileConcurrency??1:e.maxConcurrency??3}),requests:0},AA.set(r,i));let o=i,a=t.process?new MessageChannel:void 0,c=new AbortController,u=!1,l=()=>c.abort(e.signal?.reason);e.signal?.addEventListener("abort",l,{once:!0});let f=()=>{u=!0,e.signal?.removeEventListener("abort",l),c.abort(),a?.port1.close(),a?.port2.close()};a&&(a.port1.onmessage=async({data:b})=>{try{let g=await t.process(b.input,b.options,{signal:c.signal,throwIfAborted:()=>c.signal.throwIfAborted()},b.context);!u&&!c.signal.aborted&&a.port1.postMessage({identifier:b.identifier,value:g},Ym(g))}catch(g){if(u||c.signal.aborted)return;a.port1.postMessage({identifier:b.identifier,error:{name:g instanceof Error?g.name:"Error",message:g instanceof Error?g.message:String(g)}})}},a.port1.start()),o.requests++,vA.add(o);let d=!1,h=()=>{d||(d=!0,o.requests--,o.requests||vA.delete(o))},m;try{m=await o.runner.initializeTask(s,{context:structuredClone(n),...a?{port:a.port2}:{}},{...SA(e),inputOwnership:"transfer"})}catch(b){throw h(),f(),b}return{handle:m,async close(){try{await m.close()}finally{f(),h()}}}}function qM(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator](),t=!1;return{[Symbol.asyncIterator](){return this},async next(){if(t)return{done:!0,value:void 0};let n=await e.next();return n.done||t?(t=!0,{done:!0,value:void 0}):{done:!1,value:{value:n.value}}},async return(){return t||(t=!0,await e.return?.()),{done:!0,value:void 0}}}}function KM(r){let e=new URL(r,globalThis.document?.baseURI??globalThis.location.href),t=e.href;if(/^https?:$/.test(e.protocol)&&e.origin!==globalThis.location.origin){let n=IA.get(e.href);n||(n=URL.createObjectURL(new Blob([`import ${JSON.stringify(e.href)};`],{type:"application/javascript"})),IA.set(e.href,n)),t=n}return new Worker(t,{type:"module"})}var AA,vA,IA,EA=p(()=>{"use strict";mA();yA();xA();_A();Fc();AA=new WeakMap,vA=new Set,IA=new Map});function hn(r={}){let e=r.useLocalLibraries??r.core?.useLocalLibraries,t=XM(r.CDN,r.core?.CDN),n=r.modules;return{...e!==void 0?{useLocalLibraries:e}:{},...t!==void 0?{CDN:t}:{},...n!==void 0?{modules:n}:{}}}function XM(r,e){if(typeof r=="string"||r===null)return r;if(typeof e=="string"||e===null)return e}async function ia(r,e=null,t={},n=null,s=null){let i=r;if(e){let a=n||r,c=t.modules?.[a];if(c!==void 0&&typeof c!="string")return c;r=rb(r,e,t,n),i=s&&(!(typeof c=="string")||typeof t.modules?.[s]=="string")?rb(s,e,t,s):r}let o=HM(r,i,Yi);return tb[o]=tb[o]||JM(r,i),await tb[o]}function HM(r,e,t){return t?JSON.stringify([r,e]):r}function rb(r,e,t={},n=null){if(t?.core)throw new Error("loadLibrary: options.core must be pre-normalized");n=n||r;let s=t.modules||{};if(typeof s[n]=="string")return s[n];if(!t.useLocalLibraries&&r.startsWith("http"))return r;if(!Xe)return`modules/${e}/dist/libs/${n}`;if(t.CDN){if(typeof t.CDN!="string")throw new Error("loadLibrary: options.CDN must be a string or null");return uf(t.CDN.startsWith("http")),`${t.CDN}/${e}@${L_}/dist/libs/${n}`}return Yi?n.endsWith(".mjs")?`./libs/${n}`:`../src/libs/${n}`:`modules/${e}/src/libs/${n}`}async function JM(r,e){if(r.endsWith("wasm"))return await ZM(r);if(!Xe){let{requireFromFile:n}=globalThis.loaders||{};try{let s=await n?.(r);return s||!r.includes("/dist/libs/")?s:await n?.(r.replace("/dist/libs/","/src/libs/"))}catch(s){if(r.includes("/dist/libs/"))try{return await n?.(r.replace("/dist/libs/","/src/libs/"))}catch{}return console.error(s),null}}if(Yi)return YM(r,e);let t=await e2(r);return QM(t,r)}async function YM(r,e=r){try{importScripts()}catch{let n=await import(new URL(e,globalThis.location.href).href);return n.default??n}return importScripts(r)}function QM(r,e){let t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function ZM(r){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};if(Xe||!e||r.startsWith("http"))return await(await fetch(r)).arrayBuffer();try{return await e(r)}catch{if(r.includes("/dist/libs/"))return await e(r.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load ArrayBuffer from ${r}`)}}async function e2(r){let{readFileAsText:e}=globalThis.loaders||{};if(Xe||!e||r.startsWith("http"))return await(await fetch(r)).text();try{return await e(r)}catch{if(r.includes("/dist/libs/"))return await e(r.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load text from ${r}`)}}var tb,LA=p(()=>{"use strict";Fc();vm();B_();tb={}});var Js=p(()=>{"use strict";Fc();EA();LA()});function nb(r,e){let t=e?._nodeWorkers??e?.core?._nodeWorkers,n=e?.worker??e?.core?.worker;return!Gn&&!t?!1:Zm({...r,options:r.options||{}},{worker:!!n,_nodeWorkers:!!t})}var BA=p(()=>{"use strict";Js();wm()});function OA(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?FA(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?FA(r,0,e):""}function FA(r,e,t){if(r.byteLength<=e+t)return"";let n=new DataView(r),s="";for(let i=0;i<t;i++)s+=String.fromCharCode(n.getUint8(e+i));return s}var MA=p(()=>{"use strict"});function sb(r){try{return JSON.parse(r)}catch{throw new Error(`Failed to parse JSON from data starting with "${OA(r)}"`)}}var DA=p(()=>{"use strict";MA()});function ib(...r){return RA(r)}function RA(r){let e=r.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),t=e.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(t),s=0;for(let i of e)n.set(i,s),s+=i.byteLength;return n.buffer}function eo(r,e,t){let n=t!==void 0?new Uint8Array(r).subarray(e,e+t):new Uint8Array(r).subarray(e);return new Uint8Array(n).buffer}var ob=p(()=>{"use strict"});function _e(r,e){return fr(r>=0),fr(e>0),r+(e-1)&~(e-1)}function to(r,e,t){let n;if(r instanceof ArrayBuffer)n=new Uint8Array(r);else{let s=r.byteOffset,i=r.byteLength;n=new Uint8Array(r.buffer||r.arrayBuffer,s,i)}return e.set(n,t),t+_e(n.byteLength,4)}var ab=p(()=>{"use strict";ym()});function Uc(r,e,t,n){let s=_e(t.byteLength,n),i=s-t.byteLength;if(r){let o=new Uint8Array(r.buffer,r.byteOffset+e,t.byteLength),a=new Uint8Array(t);o.set(a);for(let c=0;c<i;++c)r.setUint8(e+t.byteLength+c,32)}return e+=s,e}function xf(r,e,t,n){let i=new TextEncoder().encode(t);return e=Uc(r,e,i,n),e}var kA=p(()=>{"use strict";ab()});function cb(r){let e=new Uint8Array(r),t=[],n=3*4096;for(let s=0;s<e.length;s+=n)t.push(btoa(String.fromCharCode(...e.subarray(s,s+n))));return t.join("")}var NA=p(()=>{"use strict"});async function*ub(r,e={}){let t=new TextDecoder(void 0,e);for await(let n of r)yield typeof n=="string"?n:t.decode(n,{stream:!0})}async function*lb(r){let e="";for await(let t of r){e+=t;let n;for(n=e.indexOf(`
36
+ }`}var gb,PA=p(()=>{Pf();gb=new Map});function yt(r,e=!0,t){let n=t||new Set,s=new Set;function i(o){if(!(!o||typeof o!="object"||s.has(o))){if(s.add(o),wb(o))n.add(o);else if(ArrayBuffer.isView(o))wb(o.buffer)&&n.add(o.buffer);else if(e&&typeof MessageChannel<"u"&&o instanceof MessageChannel)i(o.port1),i(o.port2);else if(e&&o instanceof Map)for(let[a,c]of o)i(a),i(c);else if(e&&o instanceof Set)for(let a of o)i(a);else if(e)for(let a of Object.keys(o))i(o[a])}}return i(r),t===void 0?Array.from(n):[]}function wb(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function da(r){let e=new Map;function t(n){if(typeof n=="function"||n instanceof RegExp)return{};if(!n||typeof n!="object")return n;if(e.has(n))return e.get(n);if(ArrayBuffer.isView(n)||n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||n instanceof Date||typeof WebAssembly<"u"&&n instanceof WebAssembly.Module||wb(n))return n;let s=n instanceof Map?new Map:n instanceof Set?new Set:Array.isArray(n)?[]:{};if(e.set(n,s),n instanceof Map)for(let[i,o]of n)s.set(t(i),t(o));else if(n instanceof Set)for(let i of n)s.add(t(i));else for(let i of Object.keys(n))Object.defineProperty(s,i,{value:t(n[i]),enumerable:!0,writable:!0,configurable:!0});return s}return r===null?{}:t(r)}var Vf=p(()=>{});var xb,Er,Xc=p(()=>{CA();la();Pf();PA();Vf();xb=()=>{},Er=class{static isSupported(){return typeof Worker<"u"&&zt||typeof fa<"u"&&!zt}constructor(e){this.terminated=!1,this.createdAt=performance.now(),this._loadableURL="";let{name:t,source:n,url:s,getUrl:i,loadWorker:o}=e;so(n||s||i||o),this.name=t,this.source=n,this.url=s,this.workerType=e.workerType??"classic",this.getUrl=i,this.loadWorker=o,this.onMessage=xb,this.onError=c=>console.log(c);let a=performance.now();this.worker=zt?this._createBrowserWorker():this._createNodeWorker(),this.creationTimeMs=performance.now()-a}destroy(){return this.onMessage=xb,this.onError=xb,this.terminated?this.termination??Promise.resolve():(this.terminated=!0,this.termination=Promise.resolve(this.worker.terminate()).then(()=>{}).finally(()=>this.releaseModuleWorkerURL()),this.termination.catch(()=>{}),this.termination)}unref(){!zt&&typeof this.worker.unref=="function"&&this.worker.unref()}ref(){!zt&&typeof this.worker.ref=="function"&&this.worker.ref()}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||yt(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url||"built-in worker factory"}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){if(this.loadWorker)try{let t=this.loadWorker();if(t)return this._initializeBrowserWorker(t)}catch(t){if(!this.source&&!this.url&&!this.getUrl)throw t}let e=this.url||this.getUrl?.();this._loadableURL=UA({source:this.source,url:e,workerType:this.workerType}),this.workerType==="module"&&e&&this._loadableURL!==e&&this._loadableURL.startsWith("blob:")&&(this.ownedModuleWorkerURL=this._loadableURL);try{let t=new Worker(this._loadableURL,{name:this.name,type:this.workerType});return this._initializeBrowserWorker(t)}catch(t){throw this.releaseModuleWorkerURL(),t}}releaseModuleWorkerURL(){this.ownedModuleWorkerURL&&(URL.revokeObjectURL(this.ownedModuleWorkerURL),this.ownedModuleWorkerURL=void 0)}_initializeBrowserWorker(e){return e.onmessage=t=>{t.data?t.data.type==="ready"?this.startupTimeMs=performance.now()-this.createdAt:this.onMessage(t.data):this.onError(new Error("No data received"))},e.onerror=t=>{let n=this.onError,s=this._getErrorFromErrorEvent(t);this.destroy(),n(s)},e.onmessageerror=()=>{let t=this.onError;this.destroy(),t(new Error("Worker message could not be deserialized"))},e}_createNodeWorker(){let e;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,s=n.startsWith("file:")?new URL(n):n,i=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";e=new fa(s,{eval:!1,type:i})}else if(this.source)e=new fa(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",t=>{t?.type==="ready"?this.startupTimeMs=performance.now()-this.createdAt:this.onMessage(t)}),e.on("error",t=>{this.terminated=!0,this.onError(t)}),this.termination=new Promise(t=>e.on("exit",()=>t())),e.on("exit",t=>{this.terminated||(this.terminated=!0,this.onError(new Error(`Worker ${this.name} exited unexpectedly (code ${t})`)))}),e}}});var ei,Tb=p(()=>{la();Xc();NA();ei=class{get stats(){return{...this.totals,queuedJobs:this.jobQueue.length,activeJobs:this.activeJobs.size,queuedBytes:this.queuedBytes+this.reservedBytes,inFlightBytes:this.inFlightBytes,pendingAdmissions:this.admissions.length,reservations:this.reservations.size}}reserve(e,t={}){let{signal:n}=t;return n?.aborted?Promise.reject(n.reason):this.isDestroyed?Promise.reject(new Error("Worker pool was destroyed")):this.isClosing?Promise.reject(new Error("Worker pool is closing")):!Number.isSafeInteger(e)||e<0||e>this.maxQueuedBytes||e>this.maxInFlightBytes?Promise.reject(new RangeError("Reservation exceeds worker byte budgets")):this.maxQueuedJobs<1||this.admissions.length>=this.maxPendingAdmissions?Promise.reject(new RangeError("Worker admission queue is full")):new Promise((s,i)=>{let o=()=>{let c=this.admissions.indexOf(a);c>=0&&this.admissions.splice(c,1),a.cleanup(),i(n?.reason),this._admit()},a={inputBytes:e,resolve:s,reject:i,cleanup:()=>n?.removeEventListener("abort",o)};this.admissions.push(a),n?.addEventListener("abort",o,{once:!0}),this._admit()})}_admit(){for(;!this.isDestroyed&&!this.isClosing&&this.admissions.length;){let e=this.admissions[0];if(e.inputBytes>this.maxQueuedBytes||e.inputBytes>this.maxInFlightBytes){this.admissions.shift(),e.cleanup(),e.reject(new RangeError("Reservation exceeds worker byte budgets"));continue}if(this.jobQueue.length+this.reservations.size>=this.maxQueuedJobs||e.inputBytes>this.maxQueuedBytes-this.queuedBytes-this.reservedBytes)return;this.admissions.shift(),e.cleanup();let t={inputBytes:e.inputBytes,release:()=>{this.reservations.delete(t)&&(this.reservedBytes-=t.inputBytes,this._admit())}};this.reservations.add(t),this.reservedBytes+=t.inputBytes,this.totals.peakQueuedBytes=Math.max(this.totals.peakQueuedBytes,this.queuedBytes+this.reservedBytes),e.resolve(t)}}static isSupported(){return Er.isSupported()}constructor(e){this.name="unnamed",this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.activeJobs=new Set,this.startingJobs=0,this.count=0,this.workers=new Set,this.queuedBytes=0,this.inFlightBytes=0,this.maxQueuedBytes=1/0,this.maxInFlightBytes=1/0,this.isDestroyed=!1,this.isClosing=!1,this.maxQueuedJobs=1/0,this.maxPendingAdmissions=128,this.priorityAgingMs=1e3,this.reservations=new Set,this.admissions=[],this.reservedBytes=0,this.totals={peakQueuedBytes:0,peakInFlightBytes:0,workersCreated:0,workerRestarts:0,completed:0,failed:0,cancelled:0},this.source=e.source,this.url=e.url,this.workerType=e.workerType,this.getUrl=e.getUrl,this.loadWorker=e.loadWorker,this.setProps(e)}close(e={}){if(this.closing)return this.closing;if(this.isDestroyed)return this.destroy();if(e.timeout!==void 0&&(!Number.isFinite(e.timeout)||e.timeout<0||e.timeout>2147483647))return Promise.reject(new RangeError("Close timeout must be between 0 and 2147483647 ms"));this.isClosing=!0;let t=new Error("Worker pool is closing");this.admissions.splice(0).forEach(o=>{o.cleanup(),o.reject(t)}),this.reservations.clear(),this.reservedBytes=0;let n,s=new Promise(o=>{this.onDrained=o}),i=e.timeout===void 0?s:Promise.race([s,new Promise(o=>{n=setTimeout(o,e.timeout)})]);return this.closing=i.then(async()=>{clearTimeout(n),await this.destroy()}),this._checkDrained(),this.closing}_checkDrained(){this.isClosing&&!this.jobQueue.length&&!this.activeJobs.size&&!this.startingJobs&&this.onDrained?.()}destroy(e=new Error("Worker pool was destroyed")){if(this.destruction)return this.destruction;let t=[...this.workers];this.isDestroyed=!0,this.onDrained?.(),this.activeJobs.forEach(s=>s.abort(e)),this.admissions.splice(0).forEach(s=>{s.cleanup(),s.reject(e)}),this.reservations.clear(),this.reservedBytes=0;let n=this.jobQueue.splice(0);return this.queuedBytes=0,n.forEach(s=>{s.removeAbortListener(),s.onReject(e)}),this.idleQueue.splice(0).forEach(s=>{s.destroy(),this.count--}),this.isDestroyed=!0,this.destruction=Promise.all(t.map(s=>s.destroy())).then(()=>{this.workers.clear()}),this.destruction.catch(()=>{}),this.destruction}setProps(e){for(let t of["maxQueuedBytes","maxInFlightBytes","maxQueuedJobs","maxPendingAdmissions"]){let n=e[t];if(n!==void 0&&(!(n>=0)||n!==1/0&&!Number.isSafeInteger(n)))throw new RangeError(`${t} must be a nonnegative safe integer or Infinity`)}if(e.priorityAgingMs!==void 0&&(!Number.isFinite(e.priorityAgingMs)||e.priorityAgingMs<=0))throw new RangeError("priorityAgingMs must be positive and finite");this.maxQueuedJobs=e.maxQueuedJobs??this.maxQueuedJobs,this.maxPendingAdmissions=e.maxPendingAdmissions??this.maxPendingAdmissions,this.priorityAgingMs=e.priorityAgingMs??this.priorityAgingMs,this.maxQueuedBytes=e.maxQueuedBytes??this.maxQueuedBytes,this.maxInFlightBytes=e.maxInFlightBytes??this.maxInFlightBytes,this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug);for(let t of[...this.jobQueue])t.inputBytes>this.maxInFlightBytes&&(this.jobQueue.splice(this.jobQueue.indexOf(t),1),this.queuedBytes-=t.inputBytes,t.removeAbortListener(),t.onReject(new RangeError("Worker job exceeds maxInFlightBytes")));this._admit(),this._startQueuedJob(),this._checkDrained()}get requiresInputBytes(){return this.maxQueuedBytes!==1/0||this.maxInFlightBytes!==1/0}async startJob(e,t=(o,a,c)=>o.done(c),n=(o,a)=>o.error(a),s,i={}){if(i.cancellationMode!==void 0&&!["terminate","cooperative"].includes(i.cancellationMode))throw new Error("Invalid worker cancellation mode");if(i.cancellationTimeout!==void 0&&(!Number.isFinite(i.cancellationTimeout)||i.cancellationTimeout<0))throw new RangeError("cancellationTimeout must be finite and nonnegative");if(s?.aborted)throw s.reason;if(this.isDestroyed)return Promise.reject(new Error("Worker pool was destroyed"));if(this.isClosing)return Promise.reject(new Error("Worker pool is closing"));let{inputBytes:o=0,priority:a=0}=i;if(!Number.isSafeInteger(o)||o<0||!Number.isFinite(a))throw new RangeError("Invalid worker scheduling inputBytes or priority");if(o>this.maxInFlightBytes)throw new RangeError("Worker job exceeds maxInFlightBytes");let c=i.admission;if(c&&(!this.reservations.has(c)||c.inputBytes!==o))throw new Error("Invalid or consumed worker admission");let u=!this.jobQueue.length&&this.activeJobs.size<this._getMaxConcurrency()&&this.inFlightBytes+o<=this.maxInFlightBytes;if(!c&&!u&&(this.jobQueue.length+this.reservations.size>=this.maxQueuedJobs||o>this.maxQueuedBytes-this.queuedBytes-this.reservedBytes))throw new RangeError("Worker queue exceeds maxQueuedBytes or maxQueuedJobs");c&&(this.reservations.delete(c),this.reservedBytes-=c.inputBytes);let l=new Promise((f,d)=>{let h=()=>{let g=this.jobQueue.indexOf(m);g>=0&&(this.jobQueue.splice(g,1),this.queuedBytes-=m.inputBytes,this._admit(),this._startQueuedJob(),m.removeAbortListener(),d(s?.reason),this._checkDrained())},m={name:e,inputBytes:o,priority:a,queuedAt:performance.now(),sharedState:i.sharedState,cancellationMode:i.cancellationMode,cancellationTimeout:i.cancellationTimeout,onMessage:t,onError:n,onStart:f,onReject:d,signal:s,removeAbortListener:()=>s?.removeEventListener("abort",h)},b=this.jobQueue.findIndex(g=>g.priority<a);return this.jobQueue.splice(b<0?this.jobQueue.length:b,0,m),this.queuedBytes+=o,u||(this.totals.peakQueuedBytes=Math.max(this.totals.peakQueuedBytes,this.queuedBytes+this.reservedBytes)),s?.addEventListener("abort",h,{once:!0}),this});return this._startQueuedJob(),await l}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=performance.now();if(this.jobQueue.sort((s,i)=>i.priority+Math.floor((e-i.queuedAt)/this.priorityAgingMs)-(s.priority+Math.floor((e-s.queuedAt)/this.priorityAgingMs))),this.jobQueue[0].inputBytes>this.maxInFlightBytes-this.inFlightBytes)return;let t;try{t=this._getAvailableWorker()}catch(s){let i=this.jobQueue.shift();i&&(this.queuedBytes-=i.inputBytes),this._admit(),i?.removeAbortListener(),i?.onReject(s),this._startQueuedJob(),this._checkDrained();return}if(!t)return;let n=this.jobQueue.shift();if(n){this.startingJobs++,this.queuedBytes-=n.inputBytes,this.inFlightBytes+=n.inputBytes,this.totals.peakInFlightBytes=Math.max(this.totals.peakInFlightBytes,this.inFlightBytes),this._admit();let s=performance.now();try{this.onDebug({message:"Starting job",name:n.name,workerThread:t,backlog:this.jobQueue.length})}catch{}if(this.isDestroyed||t.terminated){this.startingJobs--,this.inFlightBytes-=n.inputBytes,n.removeAbortListener(),n.onReject(new Error("Worker pool was destroyed before job start")),this.returnWorkerToQueue(t);return}let i=new Hc(n.name,t);i.sharedState=n.sharedState,n.removeAbortListener();let o=()=>{n.cancellationMode==="cooperative"?i.cancel(n.signal?.reason,n.cancellationTimeout):i.abort(n.signal?.reason)};n.signal?.addEventListener("abort",o,{once:!0}),n.signal?.aborted&&o(),this.activeJobs.add(i),this.startingJobs--,t.ref(),t.onMessage=a=>{try{i.isRunning&&n.onMessage(i,a.type,a.payload)}catch(c){i.abort(c)}},t.onError=a=>{try{n.onError(i,a)}catch(c){i.abort(c)}},i.result.catch(()=>{}),n.onStart(i),this._startQueuedJob();try{await i.completion}catch{}finally{n.signal?.removeEventListener("abort",o),this.activeJobs.delete(i),this.inFlightBytes-=n.inputBytes;let a=i.isCancelled?"cancelled":i.failed?"failed":"completed";this.totals[a]++;let c={name:i.name,outcome:a,queueWaitMs:s-n.queuedAt,durationMs:performance.now()-s,workerCreationMs:t.creationTimeMs,workerStartupMs:t.startupTimeMs,postMessageMs:i.postMessageMs,executionMs:i.executionMs,inputBytes:n.inputBytes};try{this.props.onMetrics?.(c),this.props.performanceMarks&&typeof performance.measure=="function"&&performance.measure(`math.gl.worker:${i.name}`,{start:n.queuedAt,end:performance.now(),detail:c})}catch{}this._admit(),this.returnWorkerToQueue(t)}}else this.returnWorkerToQueue(t)}returnWorkerToQueue(e){e.terminated||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.terminated&&!this.isDestroyed&&this.totals.workerRestarts++,e.terminated||e.destroy(),e.destroy().then(()=>this.workers.delete(e)),this.count--):(e.unref(),this.idleQueue.push(e)),this.isDestroyed||this._startQueuedJob(),this._checkDrained()}_getAvailableWorker(){for(;this.idleQueue.length>0;){let e=this.idleQueue.shift();if(e&&(e.terminated||this.count>this._getMaxConcurrency()))e.terminated&&this.totals.workerRestarts++,e.destroy().then(()=>this.workers.delete(e)),this.count--;else if(e)return e}if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;try{let t=new Er({name:e,source:this.source,url:this.url,workerType:this.workerType,getUrl:this.getUrl,loadWorker:this.loadWorker});return this.totals.workersCreated++,this.workers.add(t),t}catch(t){throw this.count--,t}}return null}_getMaxConcurrency(){return RA?this.maxMobileConcurrency:this.maxConcurrency}}});function $2(r){let{name:e,source:t,url:n,urlKey:s,loadWorker:i,workerType:o}=r,a=t?`source:${t}`:"",c=n||s?`url:${n||s}`:"",u=i?`loadWorker:${q2(i)}`:"";return[e,a,c,u,`type:${o||"classic"}`].filter(Boolean).join("|")}function q2(r){let e=jA.get(r);return e||(e=W2++,jA.set(r,e)),e}var VA,jA,W2,ha,GA=p(()=>{Tb();Xc();VA={maxQueuedJobs:1/0,maxPendingAdmissions:128,priorityAgingMs:1e3,onMetrics:()=>{},performanceMarks:!1,maxQueuedBytes:1/0,maxInFlightBytes:1/0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},jA=new WeakMap,W2=1,ha=class r{static isSupported(){return Er.isSupported()}static getWorkerFarm(e={}){return r._workerFarm=r._workerFarm||new r({}),r._workerFarm.setProps(e),r._workerFarm}constructor(e){this.workerPools=new Map,this.props={...VA},this.setProps(e),this.workerPools=new Map}destroy(e){let t=[...this.workerPools.values()];return this.workerPools.clear(),Promise.all(t.map(n=>n.destroy(e))).then(()=>{})}setProps(e){let t={};for(let n of Object.keys(VA))e[n]!==void 0&&(t[n]=e[n]);this.props={...this.props,...t};for(let n of this.workerPools.values())n.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:t,source:n,url:s,getUrl:i,loadWorker:o,workerType:a}=e,c=$2(e),u=this.workerPools.get(c);return u||(u=new ei({name:t,source:n,url:s,getUrl:i,loadWorker:o,workerType:a}),u.setProps(this._getWorkerPoolProps()),this.workerPools.set(c,u)),u}_getWorkerPoolProps(){return{maxQueuedJobs:this.props.maxQueuedJobs,maxPendingAdmissions:this.props.maxPendingAdmissions,priorityAgingMs:this.props.priorityAgingMs,onMetrics:this.props.onMetrics,performanceMarks:this.props.performanceMarks,maxQueuedBytes:this.props.maxQueuedBytes,maxInFlightBytes:this.props.maxInFlightBytes,maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}});var Jc,zA=p(()=>{Jc=class{constructor(){this._values=[],this._settlers=[],this._closed=!1}[Symbol.asyncIterator](){return this}push(e){return this.enqueue(e)}enqueue(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");let t=this._settlers.shift();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.push(e)}close(){for(;this._settlers.length>0;)this._settlers.shift().resolve({done:!0});this._closed=!0}next(){if(this._values.length>0){let e=this._values.shift();return e instanceof Error?Promise.reject(e):Promise.resolve({done:!1,value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0,value:void 0})}return new Promise((e,t)=>{this._settlers.push({resolve:e,reject:t})})}}});function _b(r){let e=r.version!==bb?` (worker-utils@${bb})`:"";return`${r.name}@${r.version}${e}`}function Ab(r,e={}){let t=zt?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=$A(r,e),s=e._workerType||e?.core?._workerType;if(!n&&s==="test")if(zt)n=`modules/${r.module}/dist/${t}`;else{let i=r.module==="tasks"&&r.workerNode?.startsWith("worker-utils/")?"worker-utils/workers":"workers",o=r.workerSourceNode||`${i}/${r.id}-worker-node.ts`;n=`modules/${r.module}/src/${o}`}return n||null}function $A(r,e={}){return(e[r.id]||{}).workerUrl||(r.id==="compression"?e.workerUrl:null)||null}function vb(r,e={}){let t=Ab(r,e),n=typeof r.worker=="string"?r.worker:null,s=t||n||Ib(r,!0);return so(s),s}function Ib(r,e=!1){let t=zt?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=r.version;n==="latest"&&(n=Uf);let s=n?`@${n}`:"",o=`https://unpkg.com/${r.packageName||`@loaders.gl/${r.module}`}${s}/dist/${t}`;return e&&K2(r,o),o}function K2(r,e){if(r.version!=="latest")return;let t=`${r.module}:${r.id}`;WA.has(t)||(WA.add(t),console.warn(`loaders.gl: ${r.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${e} from CDN.`))}var WA,qA=p(()=>{Pf();la();MA();mb();WA=new Set});function KA(){let r=typeof globalThis.crossOriginIsolated=="boolean"?globalThis.crossOriginIsolated:void 0,e={workers:Er.isSupported(),sharedMemory:!1,crossOriginIsolated:r};if(zt&&r!==!0)e.sharedMemoryUnavailableReason="cross-origin-isolation";else if(typeof SharedArrayBuffer>"u"||typeof Atomics>"u"||typeof structuredClone!="function")e.sharedMemoryUnavailableReason="unsupported";else try{let t=new SharedArrayBuffer(4),n=structuredClone(t);Atomics.store(new Int32Array(t),0,17),e.sharedMemory=Atomics.load(new Int32Array(n),0)===17,e.sharedMemory||(e.sharedMemoryUnavailableReason="blocked")}catch{e.sharedMemoryUnavailableReason="blocked"}return e}function H2(){if(!KA().sharedMemory)return null;let r=new io(new SharedArrayBuffer(16));return r.setProgress(0),r}function Sb(r){if(r.sharedState===void 0&&r.cancellationMode==="cooperative"){let e=H2();return e?{...r,sharedState:e.buffer}:r}if(r.sharedState){if(!KA().sharedMemory)throw new Error("Shared worker memory is unavailable");new io(r.sharedState).throwIfCancelled()}return r}var io,HA=p(()=>{Xc();la();io=class{constructor(e){if(typeof SharedArrayBuffer>"u"||!(e instanceof SharedArrayBuffer)||e.byteLength!==16)throw new Error("Expected a 16-byte shared worker control buffer");this.buffer=e,this.values=new Int32Array(e)}get snapshot(){return{cancelled:Atomics.load(this.values,0)!==0,completed:Atomics.load(this.values,1),total:Atomics.load(this.values,2),revision:Atomics.load(this.values,3)}}cancel(){Atomics.store(this.values,0,1),Atomics.add(this.values,3,1),Atomics.notify(this.values,0)}throwIfCancelled(){if(Atomics.load(this.values,0)!==0){let e=new Error("Shared worker task was cancelled");throw e.name="AbortError",e}}setProgress(e,t=-1){if(!Number.isInteger(e)||e<0||e>2147483647||!Number.isInteger(t)||t<-1||t>2147483647)throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");Atomics.store(this.values,1,e),Atomics.store(this.values,2,t),Atomics.add(this.values,3,1)}}});function jf(r){let e=new Set,t=0;function n(s){if(!(!s||typeof s!="object"||e.has(s)))if(e.add(s),ArrayBuffer.isView(s))n(s.buffer);else if(s instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&s instanceof SharedArrayBuffer)t+=s.byteLength;else if(s instanceof Map)for(let[i,o]of s)n(i),n(o);else if(s instanceof Set)for(let i of s)n(i);else for(let i of Object.keys(s))n(s[i])}return n(r),t}var XA=p(()=>{});function Eb(r){if(r!==void 0&&r!=="copy"&&r!=="transfer")throw new Error("Invalid worker output ownership")}var JA=p(()=>{});async function Bb(r,e,t={},n={},s={}){if(Eb(t.outputOwnership),t.inputOwnership!==void 0&&!["copy","transfer","share"].includes(t.inputOwnership))throw new Error("Invalid worker input ownership");t=Sb(t),YA(t.signal),Lb(t,[e,Yc(t),s]);let i=_b(r),o=t.workerPool??ha.getWorkerFarm(t).getWorkerPool(e1(r,t,i)),a=t.jobName||r.name,c=await o.startJob(a,t1.bind(null,n,t),void 0,t.signal,{inputBytes:jf([e,n1(t),s]),priority:t.priority,admission:t.admission,sharedState:t.sharedState?new io(t.sharedState):void 0,cancellationMode:t.cancellationMode,cancellationTimeout:t.cancellationTimeout});try{t.signal?.aborted&&!c.isCancelled&&c.abort(QA(t.signal));let u=Yc(t),l=da(u),f=da(s);return c.isRunning&&c.postMessage("process",{input:e,options:l,context:f},t.inputOwnership==="copy"||t.inputOwnership==="share"?[]:void 0),(await c.result).result}catch(u){throw c.isCancelled||c.abort(u),u}}function Fb(r,e,t={},n={},s={}){if(Eb(t.outputOwnership),t.inputOwnership!==void 0&&!["copy","transfer","share"].includes(t.inputOwnership))throw new Error("Invalid worker input ownership");return X2(r,e,t,n,s)}async function*X2(r,e,t,n,s){t=Sb(t),YA(t.signal);let i=_b(r),o=t.workerPool??ha.getWorkerFarm(t).getWorkerPool(e1(r,t,i));Lb(t,[Yc(t),s]);let a=jf([n1(t),s]),c=t.inputBytes??a;if(o.requiresInputBytes&&t.inputBytes===void 0)throw new Error("Byte-bounded batch sessions require inputBytes");if(!Number.isSafeInteger(c)||c<a)throw new RangeError("Batch inputBytes must cover options and context buffers");let u=new Jc,l=J2(e),f=!1,d=!1,h=!1,m=Promise.resolve(),b=new Error("Worker batch job failed"),g=()=>{!d&&!h&&(h=!0,Y2(l))},y=()=>{f||(f=!0,u.close())},x=_=>{f||(f=!0,u.enqueue(b),u.close())},T=await o.startJob(t.jobName||r.name,(_,v,I)=>{if(!(_.isCancelled&&v!=="done"&&v!=="error"))switch(v){case"progress":r1(_,t,I);break;case"input-request":m=m.then(async()=>{if(!_.isRunning)return;let N=await l.next();if(_.isRunning)if(N.done)d=!0,_.postMessage("input-done",{});else{if(Lb(t,N.value),t.inputBytes!==void 0&&jf(N.value)+a>c)throw new RangeError("Worker batch exceeds reserved inputBytes");_.postMessage("input-batch",{input:N.value},t.inputOwnership==="copy"||t.inputOwnership==="share"?[]:void 0)}}).catch(N=>{_.isCancelled||_.abort(N)});break;case"output-batch":u.push(I.result);break;case"done":_.done(I),y();break;case"error":{let N=new Error(I.error||"Worker batch processing failed");N.name=I.errorName||"Error",_.error(N),x(N);break}case"process":t1(n,t,_,v,I);break;default:{let N=new Error(`Unexpected worker batch message: ${v}`);_.error(N),x(N);break}}},void 0,t.signal,{inputBytes:c,priority:t.priority,admission:t.admission,sharedState:t.sharedState?new io(t.sharedState):void 0,cancellationMode:t.cancellationMode,cancellationTimeout:t.cancellationTimeout}).catch(_=>{throw g(),_});T.result.catch(_=>{x(_),g()});try{let _=Yc(t);T.isRunning&&T.postMessage("process-in-batches",{options:da(_),context:da(s)},t.inputOwnership==="copy"||t.inputOwnership==="share"?[]:void 0);try{for await(let v of u)yield v,T.isRunning&&T.postMessage("output-ack",{})}catch(v){throw v===b&&await T.result,v}await T.result}finally{T.isRunning&&!T.isCancelled&&T.abort(ZA("Worker batch iterator was closed")),g()}}function YA(r){if(r?.aborted)throw QA(r)}function QA(r){return r?r.reason:ZA("Worker job was aborted")}function ZA(r){let e=new Error(r);return e.name="AbortError",e}function J2(r){return Symbol.asyncIterator in r?r[Symbol.asyncIterator]():(async function*(){yield*r})()}function Y2(r){try{Promise.resolve(r.return?.()).catch(()=>{})}catch{}}function e1(r,e,t){if(e.source)return{name:t,source:e.source,workerType:e.workerType};let n=Ab(r,e);return n?{name:t,url:n,workerType:e.workerType}:zt&&r.loadWorker?{name:t,workerType:e.workerType,loadWorker:r.loadWorker,getUrl:()=>vb(r,e),urlKey:Ib(r)}:{name:t,url:vb(r,e),workerType:e.workerType}}async function t1(r,e,t,n,s){if(!(t.isCancelled&&n!=="done"&&n!=="error"))switch(n){case"progress":r1(t,e,s);break;case"done":t.done(s);break;case"error":let i=new Error(s.error);i.name=s.errorName||"Error",t.error(i);break;case"process":let{id:o,input:a,options:c}=s;try{if(!r.process){t.postMessage("error",{id:o,error:"Worker not set up to process on main thread"});return}let u=await r.process(a,{...c,signal:e.signal,onProgress:e.onProgress},void 0,s.context||{});t.postMessage("done",{id:o,result:u})}catch(u){let l=u instanceof Error?u.message:"unknown error";t.postMessage("error",{id:o,error:l})}break;default:console.warn(`process-on-worker: unknown message ${n}`)}}function r1(r,e,t){if(!(!r.isRunning||r.isCancelled||!t.progress))try{e.onProgress?.(t.progress)}catch(n){r.abort(n)}}function Yc(r){let{signal:e,onProgress:t,onMetrics:n,workerPool:s,admission:i,workerType:o,...a}=r;return a}function Lb(r,e){if(r.inputOwnership==="share"&&yt(e).length)throw new Error("Share ownership requires SharedArrayBuffer storage; ordinary transferables are not allowed")}function n1(r){let{sharedState:e,...t}=Yc(r);return t}var s1=p(()=>{zA();GA();qA();Vf();HA();la();XA();JA()});var Q2,Ob,L7,Gf=p(()=>{Tb();s1();Vf();Q2={},Ob=typeof __filename=="string"?__filename.replace(/\\/g,"/"):"",L7=Ob?`file://${Ob.startsWith("/")?"":"/"}${encodeURI(Ob).replace(/#/g,"%23").replace(/\?/g,"%3F")}`:Q2.url});function o1(r,e){if(!r.preload)return Promise.resolve();let t=Mb.get(r);return t||(t=Promise.resolve().then(()=>r.preload()).then(()=>{i1.add(r)}),Mb.set(r,t),t.catch(()=>Mb.delete(r))),Z2(t,e)}function a1(r){return!r.preload||i1.has(r)}function Z2(r,e){return e?new Promise((t,n)=>{let s=()=>{e.removeEventListener("abort",s),n(e.reason)};e.addEventListener("abort",s,{once:!0}),e.aborted&&s(),r.then(i=>{e.removeEventListener("abort",s),t(i)},i=>{e.removeEventListener("abort",s),n(i)})}):r}var Mb,i1,Db=p(()=>{Mb=new WeakMap,i1=new WeakSet});var Qc,zf,Rb=p(()=>{Qc=class extends Error{},zf=class{constructor(e){this.options=e,this.nextId=1,this.pending=new Map,this.incoming=new Map}request(e,t,n,s=[]){if(this.failure)return Promise.reject(this.failure.reason);if(n?.aborted)return Promise.reject(n.reason);let i=this.nextId++;return new Promise((o,a)=>{let c=()=>{let u=this.pending.get(i);u&&(this.pending.delete(i),u.cleanup(),a(n?.reason),this.send({source:"math.gl/tasks",kind:"cancel",id:i}))};this.pending.set(i,{resolve:o,reject:a,cleanup:()=>n?.removeEventListener("abort",c)}),n?.addEventListener("abort",c,{once:!0}),this.send({source:"math.gl/tasks",kind:"request",id:i,operation:e,value:t},s)})}emit(e,t,n=[]){if(this.failure)throw this.failure.reason;this.send({source:"math.gl/tasks",kind:"event",id:0,operation:e,value:t},n)}receive(e){if(!(this.failure||e?.source!=="math.gl/tasks")){if(e.kind==="failure"){let t=new Error(e.error?.message??"Task channel failed");this.close(t),this.options.onFailure?.(t)}else if(e.kind==="result"||e.kind==="error"){let t=this.pending.get(e.id);if(!t)return;if(this.pending.delete(e.id),t.cleanup(),e.kind==="result")t.resolve(e.value);else{let n=new Qc(e.error?.message??"Task request failed");n.name=e.error?.name??"Error",t.reject(n)}}else if(e.kind==="cancel")this.incoming.get(e.id)?.abort(new DOMException("Task request cancelled","AbortError"));else if(e.kind==="event")try{this.options.handleEvent?.(e.operation,e.value)}catch(t){this.fail(t)}else if(e.kind==="request"){if(this.incoming.has(e.id)){this.fail(new Error("Duplicate task request identifier"));return}let t=new AbortController;this.incoming.set(e.id,t),Promise.resolve().then(()=>(t.signal.throwIfAborted(),this.options.handleRequest(e.operation,e.value,t.signal))).then(n=>{!t.signal.aborted&&!this.failure&&this.send({source:"math.gl/tasks",kind:"result",id:e.id,value:n},this.options.getResultTransferList?.(n,e.value))}).catch(n=>{!t.signal.aborted&&!this.failure&&this.send({source:"math.gl/tasks",kind:"error",id:e.id,error:{name:n instanceof Error?n.name:"Error",message:n instanceof Error?n.message:String(n)}})}).finally(()=>this.incoming.delete(e.id))}}}close(e=new Error("Task channel closed")){if(!this.failure){this.failure={reason:e};for(let t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear();for(let t of this.incoming.values())t.abort(e);this.incoming.clear()}}send(e,t=[]){if(!this.failure)try{this.options.send(e,t)}catch(n){this.fail(n)}}fail(e){if(!this.failure){this.close(e);try{this.options.send({source:"math.gl/tasks",kind:"failure",id:0,error:{name:e instanceof Error?e.name:"Error",message:e instanceof Error?e.message:String(e)}},[])}catch{}this.options.onFailure?.(e)}}}});function pn(r){if(!r||typeof r!="object"||Object.getPrototypeOf(r)!==Object.prototype)throw new TypeError("Task payloads must be plain objects with named fields")}function wt(r,e="copy"){if(pn(r),!["copy","transfer","share"].includes(e))throw new TypeError("Invalid input ownership");let t=yt(r);if(e==="share"&&t.length)throw new TypeError("Share requires shared storage");return structuredClone(r,{transfer:e==="transfer"?t:[]})}function Zc(r,e={}){let t=e.signal??new AbortController().signal;return{state:r,signal:t,requestHost:async(n,s,i)=>{if(t.throwIfAborted(),!e.requestHost)throw new Error("No host request handler configured");return e.requestHost(n,s,i)},emitHost:(n,s)=>{t.throwIfAborted(),e.emitHost?.(n,s)},throwIfAborted:()=>{t.throwIfAborted(),e.throwIfAborted?.()},reportProgress:n=>e.reportProgress?.({...n,phase:n.phase??"process",unit:n.unit??"items"})}}function $f(r){return{signal:r.signal,reportProgress:e=>r.onProgress?.(e)}}var Wf,kb=p(()=>{Gf();Db();Wf=class{constructor(e){this.task=e,this.initialized=!1}async initialize(e,t={}){if(this.initialized)throw new Error("Task is already initialized");return pn(e),await o1(this.task,t.signal),t.signal?.throwIfAborted(),this.state=await this.task.initialize?.(e,Zc(void 0,t)),this.initialized=!0,{}}async destroy(){if(this.initialized){this.initialized=!1;let e=this.state;this.state=void 0,this.task.initialize&&await this.task.destroy?.(e)}return{}}async process(e,t,n={}){if(!this.initialized)throw new Error("Task is not initialized");if(!this.task.process)throw new Error("Task has no atomic processor");pn(e);let s=await this.task.process(e,t,Zc(this.state,n));return pn(s),s}async*stream(e,t,n={}){if(!this.initialized)throw new Error("Task is not initialized");if(!this.task.processInBatches)throw new Error("Task has no streaming processor");for await(let s of this.task.processInBatches(e,t,Zc(this.state,n)))pn(s),yield s}}});function c1(r,e,t={}){if(!a1(r))throw new Error("Preload task on the main thread before runTaskSync");if("execution"in t)throw new TypeError("runTaskSync always runs on the calling thread");if(!r.process)throw new TypeError("Task has no atomic processor");for(let f of[r.initialize,r.process,r.destroy])if(f&&Object.prototype.toString.call(f)==="[object AsyncFunction]")throw new TypeError("runTaskSync requires synchronous lifecycle hooks");if(t.outputOwnership&&!["copy","transfer"].includes(t.outputOwnership))throw new TypeError("Invalid output ownership");let n=Zc(void 0,$f(t));n.throwIfAborted();let s=t.options??{};if(t.inputOwnership==="transfer"){let f=new Set(yt(s));if(yt(e).some(d=>f.has(d)))throw new Error("Transferred input aliases reusable options; use inputOwnership: copy")}let i=wt(s),o=wt(t.initialization??{},t.initializationOwnership),a=!1,c,u=!1,l;try{let f=r.initialize?.(o,n);if(Nb(f))throw Promise.resolve(f).then(m=>r.destroy?.(m)).catch(()=>{}),new TypeError("runTaskSync initialize returned a promise");n.state=f,a=!0,n.throwIfAborted();let d=wt(e,t.inputOwnership),h=r.process(d,i,n);if(Nb(h))throw a=!1,Promise.resolve(h).catch(()=>{}).then(()=>{if(r.initialize)return r.destroy?.(n.state)}).catch(()=>{}),new TypeError("runTaskSync process returned a promise");pn(h),n.throwIfAborted(),l=wt(h,t.outputOwnership??"transfer")}catch(f){u=!0,c=f}finally{if(a&&r.initialize)try{let f=r.destroy?.(n.state);if(Nb(f))throw Promise.resolve(f).catch(()=>{}),new TypeError("runTaskSync destroy returned a promise")}catch(f){throw u?new AggregateError([c,f],"Task processing and destruction failed"):f}}if(u)throw c;return l}function Nb(r){return!!(r&&(typeof r=="object"||typeof r=="function")&&typeof r.then=="function")}var u1=p(()=>{Db();Gf();kb()});var qf,l1=p(()=>{qf=class{constructor(e){if(this.maxConcurrency=e,this.pending=[],this.active=0,this.exclusive=!1,this.closed=!1,this.idleWaiters=new Set,!Number.isSafeInteger(e)||e<1)throw new RangeError("maxConcurrency must be a positive safe integer")}run(e,t,n){return this.closed?Promise.reject(new Error("Task operation queue is closed")):e!=="parallel"&&e!=="exclusive"?Promise.reject(new TypeError("Invalid operation mode")):n?.aborted?Promise.reject(n.reason):new Promise((s,i)=>{let o=()=>{let c=this.pending.indexOf(a);c>=0&&(this.pending.splice(c,1),a.cancel(n?.reason),this.pump())},a={mode:e,cancel:c=>{n?.removeEventListener("abort",o),i(c)},start:()=>{n?.removeEventListener("abort",o),this.active++,e==="exclusive"&&(this.exclusive=!0),Promise.resolve().then(()=>(n?.throwIfAborted(),t())).then(s,i).finally(()=>{this.active--,e==="exclusive"&&(this.exclusive=!1),this.pump()})}};this.pending.push(a),n?.addEventListener("abort",o,{once:!0}),n?.aborted?o():this.pump()})}cancelPending(e){this.closed=!0;for(let t of this.pending.splice(0))t.cancel(e);this.pump()}close(){return this.closed=!0,this.whenIdle()}whenIdle(){return!this.active&&!this.pending.length?Promise.resolve():new Promise(e=>this.idleWaiters.add(e))}pump(){for(;!this.exclusive&&this.pending.length&&this.active<this.maxConcurrency;){let e=this.pending[0];if(e.mode==="exclusive"&&this.active||(this.pending.shift(),e.start(),e.mode==="exclusive"))break}if(!this.active&&!this.pending.length){for(let e of this.idleWaiters)e();this.idleWaiters.clear()}}}});var Kf,f1=p(()=>{Xc();Rb();Kf=class{constructor(e,t,n){this.thread=new Er({name:e,url:t.url?.toString(),loadWorker:t.create,workerType:"module"}),this.channel=new zf({...n,send:(s,i)=>this.thread.postMessage({source:"loaders.gl/tasks",type:"task-channel",payload:s},i)}),this.thread.onMessage=s=>{s?.type==="task-channel"&&this.channel.receive(s.payload)},this.thread.onError=s=>{this.channel.close(s),n.onFailure?.(s)}}async destroy(e){this.channel.close(e),await this.thread.destroy()}}});async function eD(r,e){let t;try{t=await e()}catch(n){try{await r.close()}catch(s){throw new AggregateError([n,s],"Task processing and destruction failed")}throw n}return await r.close(),t}async function*Ub(r,e){let t=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator](),n=!1,s=!1;try{for(;;){let i=await new Promise((o,a)=>{let c=()=>e?.removeEventListener("abort",u),u=()=>{c(),a(e?.reason)};if(e?.addEventListener("abort",u,{once:!0}),e?.aborted){u();return}try{s=!0,Promise.resolve(t.next()).then(l=>{s=!1,c(),o(l)},l=>{s=!1,c(),a(l)})}catch(l){s=!1,c(),a(l)}});if(i.done){n=!0;return}yield i.value}}finally{if(!n)if(s)try{Promise.resolve(t.return?.()).catch(()=>{})}catch{}else await t.return?.()}}function d1(r,e,t){if(t==="transfer"){let n=new Set(yt(e));if(yt(r).some(s=>n.has(s)))throw new Error("Transferred input aliases reusable options; use inputOwnership: copy")}}var Cb,eu,h1=p(()=>{Gf();kb();u1();l1();f1();Rb();Cb=class{constructor(e,t,n){this.task=e,this.release=t,this.initializationControls=n,this.nextProgressId=1,this.progressCallbacks=new Map,this.callbackFailures=new Map,this.closed=!1,this.finalized=!1,this.streams=new Set,this.invalid=!1,this.controller=new AbortController;let s=n;this.runtime=new Wf(e);let i=s.operationConcurrency??1,o=e.concurrency?.maxConcurrency??1;if(!Number.isSafeInteger(o)||o<1||!Number.isSafeInteger(i)||i<1||i>o)throw new RangeError("Task concurrency must be between 1 and the task maximum");this.operationQueue=new qf(i),this.concurrent=i>1;let a=s.execution??"auto";if(!["auto","main-thread","worker"].includes(a))throw new TypeError("Invalid execution mode");if(a==="worker"&&!e.worker)throw new Error("Task has no worker");if(a!=="main-thread"&&e.worker){let c=e.worker;if(!!c.url==!!c.create)throw new Error("Supply exactly one worker URL or factory");if(this.concurrent||s.onRequest||s.onEvent){this.workerChannel=new Kf(e.id,c,{handleRequest:async(u,l,f)=>{if(u==="task:next-input"){if(!this.channelInputs)throw new Error("No active task stream");return this.channelInputs.next()}if(!s.onRequest)throw new Error("No host request handler configured");let d=l;if(u!=="task:host-request")throw new Error("Unknown host request");return s.onRequest(d.operation,d.payload,f)},getResultTransferList:(u,l)=>l.outputOwnership==="transfer"?yt(u):[],handleEvent:(u,l)=>{let{id:f}=l;try{if(u==="task:progress"){let d=l;(this.progressCallbacks.get(d.id)??this.streamProgress)?.(d.progress)}else if(u==="task:host-event"){let d=l;s.onEvent?.(d.operation,d.payload)}}catch(d){(this.progressCallbacks.has(f)||this.streamProgressId===f)&&(this.callbackFailures.has(f)||this.callbackFailures.set(f,{reason:d}))}},onFailure:u=>{this.invalid=!0,this.operationQueue.cancelPending(u),this.controller.abort(u)}});return}this.pool=new ei({name:e.id,url:c.url?.toString(),loadWorker:c.create,workerType:"module",maxConcurrency:1,maxMobileConcurrency:1}),this.descriptor={id:e.id,name:e.id,module:"tasks",version:"prototype",options:{},worker:c.url?.toString()??!0,loadWorker:c.create,workerInBatches:c.capabilities.streaming}}}async initialize(e,t){try{pn(e),await this.enqueue(()=>this.invoke("initialize",e,{},t))}catch(n){throw await this.terminate(n),n}}runTask(e,...t){if(this.invalid)return Promise.reject(new Error("Initialized task is invalid; initialize a new instance"));if(this.closed)return Promise.reject(new Error("Initialized task is closed"));let n=t[0]?.timeout;if(n!==void 0&&(!Number.isSafeInteger(n)||n<0||n>4294967295))return Promise.reject(new RangeError("Invalid task timeout"));let s=n===void 0?void 0:AbortSignal.timeout(n),i=s&&t[0]?.signal?AbortSignal.any([s,t[0].signal]):s??t[0]?.signal,o={...t[0],signal:i},a=this.task.concurrency?.getSchedulingMode?.(e)??"exclusive";return this.operationQueue.run(a,async()=>{i?.throwIfAborted(),this.checkCapability("atomic");let c=()=>{this.concurrent&&(this.invalid=!0,this.operationQueue.cancelPending(i?.reason),this.controller.abort(i?.reason))};i?.addEventListener("abort",c,{once:!0});try{return await this.invoke("process",e,t[0]?.options??{},o)}finally{i?.removeEventListener("abort",c)}},i)}runTasks(e,...t){return this.serialStream(async function*(n){n.checkCapability("atomic");for await(let s of Ub(e,n.controls(t[0]).signal))yield await n.invoke("process",s,t[0]?.options??{},t[0])},t[0]?.signal)}runTaskInBatches(e,...t){return this.serialStream(async function*(n){n.checkCapability("streaming");let s=n.controls(t[0]),i=wt(t[0]?.options??{});async function*o(){for await(let c of Ub(e,s.signal))s.signal?.throwIfAborted(),d1(c,t[0]?.options??{},s.inputOwnership),yield wt(c,s.inputOwnership)}let a=!1;try{if(n.workerChannel){n.channelInputs=o()[Symbol.asyncIterator](),n.streamProgress=s.onProgress;try{for(await n.invoke("stream-open",{},i,s);;){let c=await n.invoke("stream-next",{},{},s);if(c.done)break;yield c.value}}finally{try{n.invalid||await n.invoke("stream-close",{},{},s)}finally{await n.channelInputs.return?.(),n.channelInputs=void 0,n.streamProgress=void 0,n.streamProgressId!==void 0&&n.callbackFailures.delete(n.streamProgressId),n.streamProgressId=void 0}}}else if(n.pool)await n.invoke("stream-options",{},i,s),yield*Fb(n.descriptor,o(),{...n.workerOptions(s),inputOwnership:"transfer",workerInBatches:!0});else for await(let c of n.runtime.stream(o(),i,n.runtimeContext(s)))s.signal?.throwIfAborted(),yield wt(c,s.outputOwnership??"transfer");a=!0}catch(c){throw n.workerChannel&&(n.invalid=!0,n.operationQueue.cancelPending(c),n.controller.abort(c),await n.workerChannel.destroy(c)),n.pool&&(n.invalid=!0,await n.pool.destroy(c)),c}finally{if(n.pool&&!a&&(n.invalid=!0),n.workerChannel&&!a&&!n.invalid){let c=new Error("Worker stream ended before completion");n.invalid=!0,n.operationQueue.cancelPending(c),n.controller.abort(c),await n.workerChannel.destroy(c)}}},t[0]?.signal)}get state(){return this.invalid?"invalid":this.finalized?"closed":this.closed?"closing":"ready"}close(){return this.closing||(this.closed=!0,this.closing=(async()=>{try{await this.operationQueue.close(),this.invalid?!this.pool&&!this.workerChannel&&await this.runtime.destroy():await this.invoke("destroy",{},{})}finally{try{await this.pool?.destroy(),await this.workerChannel?.destroy()}finally{this.finalized=!0,this.release()}}})()),this.closing}async terminate(e=new Error("Task terminated")){this.operationQueue.cancelPending(e),this.controller.abort(e),this.workerChannel&&(this.invalid=!0,await this.workerChannel.destroy(e)),this.pool&&(this.invalid=!0,await this.pool.destroy(e)),await Promise.allSettled([...this.streams].map(t=>t())),await this.close()}checkCapability(e){if(this.pool||this.workerChannel?!this.task.worker?.capabilities[e]:!(e==="atomic"?this.task.process:this.task.processInBatches))throw new Error(`Task has no ${e} processor for this execution route`)}controls(e={}){if(e.outputOwnership&&!["copy","transfer"].includes(e.outputOwnership))throw new TypeError("Invalid output ownership");return{...e,signal:e.signal?AbortSignal.any([e.signal,this.controller.signal]):this.controller.signal}}workerOptions(e){return{workerPool:this.pool,workerType:"module",inputOwnership:e.inputOwnership??"copy",outputOwnership:e.outputOwnership??"transfer",signal:e.signal,onProgress:e.onProgress,cancellationMode:"terminate"}}async invoke(e,t,n,s={}){if(this.invalid)throw new Error("Initialized task is invalid; initialize a new instance");let i=e==="destroy"?{}:this.controls(s);i.signal?.throwIfAborted(),pn(t),d1(t,n,i.inputOwnership);let o=wt(n);if(this.workerChannel){let l=this.nextProgressId++,f={input:wt(t,i.inputOwnership),options:o,outputOwnership:i.outputOwnership??"transfer",progressId:l};e==="stream-open"&&(this.streamProgressId=l),this.progressCallbacks.set(l,i.onProgress);let d;try{let h=await this.workerChannel.channel.request(e,f,i.signal,yt(f));if(d=this.callbackFailures.get(l)??(e.startsWith("stream-")&&this.streamProgressId!==void 0?this.callbackFailures.get(this.streamProgressId):void 0),d)throw d.reason;return h}catch(h){throw e==="process"&&!i.signal?.aborted&&(h instanceof Qc||d)||(this.invalid=!0,this.operationQueue.cancelPending(h),this.controller.abort(h),await this.workerChannel.destroy(h)),h}finally{this.progressCallbacks.delete(l),this.streamProgressId!==l&&this.callbackFailures.delete(l)}}if(this.pool)try{return await Bb(this.descriptor,{operation:e,input:wt(t,i.inputOwnership),options:o},this.workerOptions({...i,inputOwnership:"transfer"}))}catch(l){throw this.invalid=!0,await this.pool.destroy(l),l}if(e==="destroy")return this.runtime.destroy();let a=wt(t,i.inputOwnership),c=this.runtimeContext(i);if(e==="initialize"){let l=await this.runtime.initialize(a,c);return i.signal?.throwIfAborted(),l}let u=await this.runtime.process(a,o,c);return i.signal?.throwIfAborted(),wt(u,i.outputOwnership??"transfer")}runtimeContext(e){return{...$f(e),requestHost:async(t,n,s={})=>{let i=e.signal??this.controller.signal;i.throwIfAborted();let o=this.initializationControls.onRequest;if(!o)throw new Error("No host request handler configured");let a=await o(t,wt(n,s.inputOwnership),i);return i.throwIfAborted(),structuredClone(a,{transfer:s.outputOwnership==="transfer"?yt(a):[]})},emitHost:(t,n)=>this.initializationControls.onEvent?.(t,structuredClone(n))}}enqueue(e){return this.closed?Promise.reject(new Error("Initialized task is closed")):this.operationQueue.run("exclusive",e)}serialStream(e,t){let n=new AbortController,s=AbortSignal.any([n.signal,this.controller.signal,t].filter(c=>!!c)),i=!1,o=this.acquireStream(e,s,()=>{i=!0}),a=()=>{i||n.abort(new Error("Stream returned before execution"))};return{[Symbol.asyncIterator](){return this},next:()=>o.next(),return:async()=>(a(),o.return(void 0)),throw:async c=>(a(),o.throw(c))}}async*acquireStream(e,t,n){if(this.closed)throw new Error("Initialized task is closed");let s,i=new Promise(d=>{s=d}),o,a=new Promise(d=>{o=d}),c=this.operationQueue.run("exclusive",async()=>{s(),await a},t);if(await Promise.race([i,c]),t.aborted)throw o(),t.reason;n();let u=e(this)[Symbol.asyncIterator](),l,f=()=>(l??(l=(async()=>{try{await u.return?.()}finally{this.streams.delete(f),o()}})()),l);this.streams.add(f);try{for(;;){this.controller.signal.throwIfAborted();let d=await u.next();if(d.done)return;yield d.value}}finally{await f()}}},eu=class{constructor(e={}){if(this.active=new Set,this.count=0,this.waiters=[],this.closed=!1,this.initializing=new Set,this.iterations=new Set,this.maxConcurrency=e.maxConcurrency??1,!Number.isSafeInteger(this.maxConcurrency)||this.maxConcurrency<1)throw new RangeError("maxConcurrency must be a positive safe integer")}runTaskSync(e,t,...n){if(this.closed)throw new Error("Task runner is closed");if(this.count>=this.maxConcurrency)throw new Error("Task runner has no synchronous capacity");this.count++;try{return c1(e,t,n[0])}finally{let s=this.waiters.shift();s?s.resolve():this.count--}}initializeTask(e,t,n={}){let s=this.open(e,t,n);return this.initializing.add(s),s.then(()=>this.initializing.delete(s),()=>this.initializing.delete(s)),s}async runTask(e,t,...n){let s=n[0]??{},i=await this.initializeTask(e,s.initialization??{},{...s,inputOwnership:s.initializationOwnership??"copy"});return eD(i,()=>i.runTask(t,s))}async*runTasks(e,t,...n){let s=n[0]??{};if(this.closed)throw new Error("Task runner is closed");if(s.initializationOwnership==="transfer")throw new TypeError("runTasks initialization is a reusable template; use copy or share");let i=s.concurrency??1;if(!Number.isSafeInteger(i)||i<1||i>this.maxConcurrency)throw new RangeError("concurrency must be between 1 and maxConcurrency");let o=[],a=new Set,c=[],u=new AbortController;this.iterations.add(u);let l=s.signal?AbortSignal.any([s.signal,u.signal]):u.signal,f=Ub(t,l)[Symbol.asyncIterator](),d=!1,h;try{for(;!d||c.length;){l.throwIfAborted(),!d&&!h&&c.length<i&&(h=f.next().then(y=>({kind:"input",next:y})));let m=await Promise.race([...c.length?[c[0]]:[],...h?[h]:[]]);if(m.kind==="result"){if(c.shift(),a.delete(m.handle),m.failed)throw m.error;yield m.value;continue}if(h=void 0,m.next.done){d=!0;continue}let b=o.find(y=>!a.has(y));if(!b&&(o.length===0||this.count<this.maxConcurrency)&&(b=await this.initializeTask(e,wt(s.initialization??{},s.initializationOwnership),{...s,signal:l,inputOwnership:s.initializationOwnership??"copy"}),o.push(b)),!b){let y=await c.shift();if(a.delete(y.handle),y.failed)throw y.error;yield y.value,b=y.handle}a.add(b);let g=b;c.push(b.runTask(m.next.value,{...s,signal:l}).then(y=>({kind:"result",handle:g,value:y}),y=>({kind:"result",handle:g,failed:!0,error:y})))}}finally{this.iterations.delete(u),u.abort(new Error("Task iteration closed"));try{h&&await h.catch(()=>{}),d||await f.return?.()}finally{await Promise.all(c),await Promise.all(o.map(m=>m.close()))}}}async*runTaskInBatches(e,t,...n){let s=n[0]??{},i=await this.initializeTask(e,s.initialization??{},{...s,inputOwnership:s.initializationOwnership??"copy"});try{yield*i.runTaskInBatches(t,s)}finally{await i.close()}}close(){if(!this.closing){this.closed=!0;for(let e of this.waiters.splice(0))e.reject(new Error("Task runner is closed"));this.closing=(async()=>{await Promise.allSettled(this.initializing);let t=(await Promise.allSettled([...this.active].map(n=>n.close()))).find(n=>n.status==="rejected");if(t?.status==="rejected")throw t.reason})()}return this.closing}async terminate(e=new Error("Task runner terminated")){for(let n of this.iterations)n.abort(e);let t=this.close();await Promise.allSettled([...this.active].map(n=>n.terminate(e))),await t}async open(e,t,n){if(this.closed)throw new Error("Task runner is closed");n.signal?.throwIfAborted(),this.count>=this.maxConcurrency?await new Promise((a,c)=>{let u={resolve:()=>{f(),a()},reject:d=>{f(),c(d)}},l=()=>{this.waiters=this.waiters.filter(d=>d!==u),u.reject(n.signal?.reason)},f=()=>n.signal?.removeEventListener("abort",l);this.waiters.push(u),n.signal?.addEventListener("abort",l,{once:!0}),n.signal?.aborted&&l()}):this.count++;let s,i=!1,o=()=>{if(i)return;i=!0,s&&this.active.delete(s);let a=this.waiters.shift();a?a.resolve():this.count--};try{if(this.closed)throw new Error("Task runner is closed");return s=new Cb(e,o,n),this.active.add(s),await s.initialize(t,n),s}catch(a){throw o(),a}}}});var p1=p(()=>{h1()});var m1=p(()=>{p1()});function Pb(r,e={}){let t=He?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=Vb(r,e),s=e._workerType||e?.core?._workerType;if(!n&&s==="test")if(He)n=`modules/${r.module}/dist/${t}`;else{let i=r.module==="core"&&r.workerNode?.startsWith("worker-utils/")?"worker-utils/workers":"workers",o=r.workerSourceNode||`${i}/${r.id}-worker-node.ts`;n=`modules/${r.module}/src/${o}`}return n||null}function Vb(r,e={}){return(e[r.id]||{}).workerUrl||(r.id==="compression"?e.workerUrl:null)||null}function g1(r,e={}){let t=Pb(r,e),n=typeof r.worker=="string"?r.worker:null,s=t||n||tD(r,!0);return Cf(s),s}function tD(r,e=!1){let t=He?r.workerFile||`${r.id}-worker.js`:r.workerNode||`${r.id}-worker-node.js`,n=r.version;n==="latest"&&(n=hb);let s=n?`@${n}`:"",i=`https://unpkg.com/@loaders.gl/${r.module}${s}/dist/${t}`;return e&&rD(r,i),i}function rD(r,e){if(r.version!=="latest")return;let t=`${r.module}:${r.id}`;b1.has(t)||(b1.add(t),ua.warn(`loaders.gl: ${r.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${e} from CDN.`)())}var b1,y1=p(()=>{"use strict";Nf();pb();Kc();EA();b1=new Set});function w1(r){return{...r,phase:r.phase??"process",unit:r.unit??"items"}}var x1=p(()=>{"use strict"});function jb(r,e=!0,t){let n=t||new Set;if(r){if(T1(r))n.add(r);else if(T1(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let s in r)jb(r[s],e,n)}}return t===void 0?Array.from(n):[]}function T1(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function Gb(r){if(r===null)return{};let e=Object.assign({},r);return Object.keys(e).forEach(t=>{r[t]!==null&&typeof r[t]=="object"&&!ArrayBuffer.isView(r[t])&&!(r[t]instanceof Array)?e[t]=Gb(r[t]):typeof e[t]=="function"||e[t]instanceof RegExp?e[t]={}:e[t]=r[t]}),e}var _1=p(()=>{"use strict"});function zb(r,e={}){return!!((He?typeof Worker<"u":!!e._nodeWorkers)&&e.worker&&(r.worker||r.loadWorker||Vb(r,e)))}async function*Wb(r,e,t={},n={},s={}){let i=oD(e),o;try{o=await iD(r,t,n,s);for await(let a of o.handle.runTaskInBatches(i,{...S1(t),options:sD(t)}))yield a.value}finally{i.return?.()?.catch(()=>{}),await o?.close()}}function nD(r,e){if(e.source||e.core?.source)throw new Error("Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory");let t=!Pb(r,e)&&He?r.loadWorker:void 0,n=g1(r,e);return{id:`${r.module}:${r.id}`,initialize:s=>s,worker:{...t?{create:()=>t()??aD(n)}:{url:n},capabilities:{atomic:!0,streaming:!0}}}}function S1(r){return{execution:"worker",signal:r.signal,inputOwnership:r.inputOwnership??"transfer",outputOwnership:r.outputOwnership??"transfer",onProgress:r.onProgress?e=>r.onProgress?.(w1(e)):void 0}}function sD(r){let{signal:e,onProgress:t,...n}=r;return Gb(n)}async function iD(r,e,t,n){e.signal?.throwIfAborted();let s=nD(r,e),i=A1.get(r);i||(i={runner:new eu({maxConcurrency:OA?e.maxMobileConcurrency??1:e.maxConcurrency??3}),requests:0},A1.set(r,i));let o=i,a=t.process?new MessageChannel:void 0,c=new AbortController,u=!1,l=()=>c.abort(e.signal?.reason);e.signal?.addEventListener("abort",l,{once:!0});let f=()=>{u=!0,e.signal?.removeEventListener("abort",l),c.abort(),a?.port1.close(),a?.port2.close()};a&&(a.port1.onmessage=async({data:b})=>{try{let g=await t.process(b.input,b.options,{signal:c.signal,throwIfAborted:()=>c.signal.throwIfAborted()},b.context);!u&&!c.signal.aborted&&a.port1.postMessage({identifier:b.identifier,value:g},jb(g))}catch(g){if(u||c.signal.aborted)return;a.port1.postMessage({identifier:b.identifier,error:{name:g instanceof Error?g.name:"Error",message:g instanceof Error?g.message:String(g)}})}},a.port1.start()),o.requests++,v1.add(o);let d=!1,h=()=>{d||(d=!0,o.requests--,o.requests||v1.delete(o))},m;try{m=await o.runner.initializeTask(s,{context:structuredClone(n),...a?{port:a.port2}:{}},{...S1(e),inputOwnership:"transfer"})}catch(b){throw h(),f(),b}return{handle:m,async close(){try{await m.close()}finally{f(),h()}}}}function oD(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator](),t=!1;return{[Symbol.asyncIterator](){return this},async next(){if(t)return{done:!0,value:void 0};let n=await e.next();return n.done||t?(t=!0,{done:!0,value:void 0}):{done:!1,value:{value:n.value}}},async return(){return t||(t=!0,await e.return?.()),{done:!0,value:void 0}}}}function aD(r){let e=new URL(r,globalThis.document?.baseURI??globalThis.location.href),t=e.href;if(/^https?:$/.test(e.protocol)&&e.origin!==globalThis.location.origin){let n=I1.get(e.href);n||(n=URL.createObjectURL(new Blob([`import ${JSON.stringify(e.href)};`],{type:"application/javascript"})),I1.set(e.href,n)),t=n}return new Worker(t,{type:"module"})}var A1,v1,I1,E1=p(()=>{"use strict";m1();y1();x1();_1();Kc();A1=new WeakMap,v1=new Set,I1=new Map});function mn(r={}){let e=r.useLocalLibraries??r.core?.useLocalLibraries,t=cD(r.CDN,r.core?.CDN),n=r.modules;return{...e!==void 0?{useLocalLibraries:e}:{},...t!==void 0?{CDN:t}:{},...n!==void 0?{modules:n}:{}}}function cD(r,e){if(typeof r=="string"||r===null)return r;if(typeof e=="string"||e===null)return e}async function pa(r,e=null,t={},n=null,s=null){let i=r;if(e){let a=n||r,c=t.modules?.[a];if(c!==void 0&&typeof c!="string")return c;r=qb(r,e,t,n),i=s&&(!(typeof c=="string")||typeof t.modules?.[s]=="string")?qb(s,e,t,s):r}let o=uD(r,i,no);return $b[o]=$b[o]||lD(r,i),await $b[o]}function uD(r,e,t){return t?JSON.stringify([r,e]):r}function qb(r,e,t={},n=null){if(t?.core)throw new Error("loadLibrary: options.core must be pre-normalized");n=n||r;let s=t.modules||{};if(typeof s[n]=="string")return s[n];if(!t.useLocalLibraries&&r.startsWith("http"))return r;if(!He)return`modules/${e}/dist/libs/${n}`;if(t.CDN){if(typeof t.CDN!="string")throw new Error("loadLibrary: options.CDN must be a string or null");return Cf(t.CDN.startsWith("http")),`${t.CDN}/${e}@${LA}/dist/libs/${n}`}return no?n.endsWith(".mjs")?`./libs/${n}`:`../src/libs/${n}`:`modules/${e}/src/libs/${n}`}async function lD(r,e){if(r.endsWith("wasm"))return await hD(r);if(!He){let{requireFromFile:n}=globalThis.loaders||{};try{let s=await n?.(r);return s||!r.includes("/dist/libs/")?s:await n?.(r.replace("/dist/libs/","/src/libs/"))}catch(s){if(r.includes("/dist/libs/"))try{return await n?.(r.replace("/dist/libs/","/src/libs/"))}catch{}return ua.error(String(s))(),null}}if(no)return fD(r,e);let t=await pD(r);return dD(t,r)}async function fD(r,e=r){try{importScripts()}catch{let n=await import(new URL(e,globalThis.location.href).href);return n.default??n}return importScripts(r)}function dD(r,e){let t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function hD(r){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};if(He||!e||r.startsWith("http"))return await(await fetch(r)).arrayBuffer();try{return await e(r)}catch{if(r.includes("/dist/libs/"))return await e(r.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load ArrayBuffer from ${r}`)}}async function pD(r){let{readFileAsText:e}=globalThis.loaders||{};if(He||!e||r.startsWith("http"))return await(await fetch(r)).text();try{return await e(r)}catch{if(r.includes("/dist/libs/"))return await e(r.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load text from ${r}`)}}var $b,L1=p(()=>{"use strict";Nf();Kc();pb();BA();$b={}});var ti=p(()=>{"use strict";Kc();E1();L1()});function Kb(r,e){let t=e?._nodeWorkers??e?.core?._nodeWorkers,n=e?.worker??e?.core?.worker;return!Wn&&!t?!1:zb({...r,options:r.options||{}},{worker:!!n,_nodeWorkers:!!t})}var B1=p(()=>{"use strict";ti();Hm()});function O1(r,e=5){return typeof r=="string"?r.slice(0,e):ArrayBuffer.isView(r)?F1(r.buffer,r.byteOffset,e):r instanceof ArrayBuffer?F1(r,0,e):""}function F1(r,e,t){if(r.byteLength<=e+t)return"";let n=new DataView(r),s="";for(let i=0;i<t;i++)s+=String.fromCharCode(n.getUint8(e+i));return s}var M1=p(()=>{"use strict"});function Hb(r){try{return JSON.parse(r)}catch{throw new Error(`Failed to parse JSON from data starting with "${O1(r)}"`)}}var D1=p(()=>{"use strict";M1()});function Xb(...r){return R1(r)}function R1(r){let e=r.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),t=e.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(t),s=0;for(let i of e)n.set(i,s),s+=i.byteLength;return n.buffer}function oo(r,e,t){let n=t!==void 0?new Uint8Array(r).subarray(e,e+t):new Uint8Array(r).subarray(e);return new Uint8Array(n).buffer}var Jb=p(()=>{"use strict"});function _e(r,e){return fr(r>=0),fr(e>0),r+(e-1)&~(e-1)}function ao(r,e,t){let n;if(r instanceof ArrayBuffer)n=new Uint8Array(r);else{let s=r.byteOffset,i=r.byteLength;n=new Uint8Array(r.buffer||r.arrayBuffer,s,i)}return e.set(n,t),t+_e(n.byteLength,4)}var Yb=p(()=>{"use strict";Km()});function tu(r,e,t,n){let s=_e(t.byteLength,n),i=s-t.byteLength;if(r){let o=new Uint8Array(r.buffer,r.byteOffset+e,t.byteLength),a=new Uint8Array(t);o.set(a);for(let c=0;c<i;++c)r.setUint8(e+t.byteLength+c,32)}return e+=s,e}function Hf(r,e,t,n){let i=new TextEncoder().encode(t);return e=tu(r,e,i,n),e}var k1=p(()=>{"use strict";Yb()});function Qb(r){let e=new Uint8Array(r),t=[],n=3*4096;for(let s=0;s<e.length;s+=n)t.push(btoa(String.fromCharCode(...e.subarray(s,s+n))));return t.join("")}var N1=p(()=>{"use strict"});async function*Zb(r,e={}){let t=new TextDecoder(void 0,e);for await(let n of r)yield typeof n=="string"?n:t.decode(n,{stream:!0})}async function*eg(r){let e="";for await(let t of r){e+=t;let n;for(n=e.indexOf(`
37
37
  `);n>=0;){let s=e.slice(0,n+1);e=e.slice(n+1),yield s,n=e.indexOf(`
38
- `)}}e.length>0&&(yield e)}var CA=p(()=>{"use strict"});async function fb(r){let e=[];for await(let t of r)e.push(t2(t));return ib(...e)}function t2(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:e,byteOffset:t,byteLength:n}=r;return UA(e,t,n)}return UA(r)}function UA(r,e=0,t=r.byteLength-e){let n=new Uint8Array(r,e,t),s=new Uint8Array(n.length);return s.set(n),s.buffer}var PA=p(()=>{"use strict";ob()});function ro(r){if(r instanceof ArrayBuffer)return r;if(__(r))return db(r);let{buffer:e,byteOffset:t,byteLength:n}=r;return e instanceof ArrayBuffer&&t===0&&n===e.byteLength?e:db(e,t,n)}function db(r,e=0,t=r.byteLength-e){let n=new Uint8Array(r,e,t),s=new Uint8Array(n.length);return s.set(n),s.buffer}var VA=p(()=>{"use strict";A_()});function hb(r){return{...r,batchType:"data",length:r.data.numRows}}var jA=p(()=>{"use strict"});var JX,YX,QX,ZX,GA=p(()=>{JX=Math.PI/2,YX=Math.PI/4,QX=Math.PI/6,ZX=Math.PI*2});function zA(r,{precision:e=st.precision}={}){return r=s2(r),`${parseFloat(r.toPrecision(e))}`}function oa(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function pb(r,e,t){let n=st.EPSILON;t&&(st.EPSILON=t);try{if(r===e)return!0;if(oa(r)&&oa(e)){if(r.length!==e.length)return!1;for(let s=0;s<r.length;++s)if(!pb(r[s],e[s]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=st.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{st.EPSILON=n}}function s2(r){return Math.round(r/st.EPSILON)*st.EPSILON}var eH,tH,n2,st,Pc=p(()=>{eH=1/Math.PI*180,tH=1/180*Math.PI,n2={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...n2}};st=globalThis.mathgl.config});var Ys,Tf=p(()=>{Pc();Ys=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+t];return this.check()}toArray(e=[],t=0){for(let n=0;n<this.ELEMENTS;++n)e[t+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:oa(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toString(){return this.formatString(st)}formatString(e){let t="";for(let n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+zA(this[n],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!pb(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,n){if(n===void 0)return this.lerp(this,e,t);for(let s=0;s<this.ELEMENTS;++s){let i=e[s],o=typeof t=="number"?t:t[s];this[s]=i+n*(o-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),t[n]);return this.check()}add(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n];return this.check()}subtract(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=t[n];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(st.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}});function i2(r,e){if(r.length!==e)return!1;for(let t=0;t<r.length;++t)if(!Number.isFinite(r[t]))return!1;return!0}function Ve(r){if(!Number.isFinite(r))throw new Error(`Invalid number ${JSON.stringify(r)}`);return r}function aa(r,e,t=""){if(st.debug&&!i2(r,e))throw new Error(`math.gl: ${t} some fields set to invalid numbers'`);return r}var no=p(()=>{Pc()});var ca,mb=p(()=>{Tf();no();Pc();ca=class extends Ys{toString(){let e="[";if(st.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,n){return this[t*this.RANK+e]=Ve(n),this}getColumn(e,t=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)t[s]=this[n+s];return t}setColumn(e,t){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=t[s];return this}}});function bb(r,e){if(!r)throw new Error(`math.gl assertion ${e}`)}var WA=p(()=>{});var _f,$A=p(()=>{Tf();no();WA();_f=class extends Ys{get x(){return this[0]}set x(e){this[0]=Ve(e)}get y(){return this[1]}set y(e){this[1]=Ve(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];t+=s*s}return Ve(t)}dot(e){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return Ve(t)}normalize(){let e=this.magnitude();if(e!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=t[n];return this.check()}divide(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return bb(e>=0&&e<this.ELEMENTS,"index is out of range"),Ve(this[e])}setComponent(e,t){return bb(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=e[n]*t;return this.check()}}});var Af,bH,qA=p(()=>{Af=typeof Float32Array<"u"?Float32Array:Array,bH=Math.PI/180});function KA(r,e,t){let n=e[0],s=e[1];return r[0]=t[0]*n+t[3]*s+t[6],r[1]=t[1]*n+t[4]*s+t[7],r}function XA(r,e,t){let n=e[0],s=e[1];return r[0]=t[0]*n+t[4]*s+t[12],r[1]=t[1]*n+t[5]*s+t[13],r}var vf=p(()=>{});function HA(r,e,t){let n=e[0],s=e[1],i=t[3]*n+t[7]*s||1;return r[0]=(t[0]*n+t[4]*s)/i,r[1]=(t[1]*n+t[5]*s)/i,r}function If(r,e,t){let n=e[0],s=e[1],i=e[2],o=t[3]*n+t[7]*s+t[11]*i||1;return r[0]=(t[0]*n+t[4]*s+t[8]*i)/o,r[1]=(t[1]*n+t[5]*s+t[9]*i)/o,r[2]=(t[2]*n+t[6]*s+t[10]*i)/o,r}function JA(r,e,t){let n=e[0],s=e[1];return r[0]=t[0]*n+t[2]*s,r[1]=t[1]*n+t[3]*s,r[2]=e[2],r}function YA(r,e,t){let n=e[0],s=e[1],i=e[2];return r[0]=t[0]*n+t[3]*s+t[6]*i,r[1]=t[1]*n+t[4]*s+t[7]*i,r[2]=t[2]*n+t[5]*s+t[8]*i,r[3]=e[3],r}var Sf=p(()=>{});function QA(){let r=new Af(3);return Af!==Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function a2(r){let e=r[0],t=r[1],n=r[2];return Math.sqrt(e*e+t*t+n*n)}function gb(r,e,t){let n=new Af(3);return n[0]=r,n[1]=e,n[2]=t,n}function ZA(r,e){let t=e[0],n=e[1],s=e[2],i=t*t+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function yb(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function ua(r,e,t){let n=e[0],s=e[1],i=e[2],o=t[0],a=t[1],c=t[2];return r[0]=s*c-i*a,r[1]=i*o-n*c,r[2]=n*a-s*o,r}function Ef(r,e,t){let n=e[0],s=e[1],i=e[2],o=t[3]*n+t[7]*s+t[11]*i+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*s+t[8]*i+t[12])/o,r[1]=(t[1]*n+t[5]*s+t[9]*i+t[13])/o,r[2]=(t[2]*n+t[6]*s+t[10]*i+t[14])/o,r}function Lf(r,e,t){let n=e[0],s=e[1],i=e[2];return r[0]=n*t[0]+s*t[3]+i*t[6],r[1]=n*t[1]+s*t[4]+i*t[7],r[2]=n*t[2]+s*t[5]+i*t[8],r}function e1(r,e,t){let n=t[0],s=t[1],i=t[2],o=t[3],a=e[0],c=e[1],u=e[2],l=s*u-i*c,f=i*a-n*u,d=n*c-s*a,h=s*d-i*f,m=i*l-n*d,b=n*f-s*l,g=o*2;return l*=g,f*=g,d*=g,h*=2,m*=2,b*=2,r[0]=a+l+h,r[1]=c+f+m,r[2]=u+d+b,r}function t1(r,e,t,n){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function r1(r,e,t,n){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function n1(r,e,t,n){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function s1(r,e){let t=r[0],n=r[1],s=r[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt((t*t+n*n+s*s)*(i*i+o*o+a*a)),u=c&&yb(r,e)/c;return Math.acos(Math.min(Math.max(u,-1),1))}var i1,la=p(()=>{qA();i1=a2});var wb,Bf,jc,o1=p(()=>{$A();Pc();no();la();Sf();wb=[0,0,0],jc=class r extends _f{static get ZERO(){return Bf||(Bf=new r(0,0,0),Object.freeze(Bf)),Bf}constructor(e=0,t=0,n=0){super(-0,-0,-0),arguments.length===1&&oa(e)?this.copy(e):(st.debug&&(Ve(e),Ve(t),Ve(n)),this[0]=e,this[1]=t,this[2]=n)}set(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return st.debug&&(Ve(e.x),Ve(e.y),Ve(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Ve(e)}angle(e){return s1(this,e)}cross(e){return ua(this,this,e),this.check()}rotateX({radians:e,origin:t=wb}){return t1(this,this,t,e),this.check()}rotateY({radians:e,origin:t=wb}){return r1(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=wb}){return n1(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Ef(this,this,e),this.check()}transformAsVector(e){return If(this,this,e),this.check()}transformByMatrix3(e){return Lf(this,this,e),this.check()}transformByMatrix2(e){return JA(this,this,e),this.check()}transformByQuaternion(e){return e1(this,this,e),this.check()}}});function a1(r,e){if(r===e){let t=e[1],n=e[2],s=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=s}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function c1(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=l*o-a*u,d=-l*i+a*c,h=u*i-o*c,m=t*f+n*d+s*h;return m?(m=1/m,r[0]=f*m,r[1]=(-l*n+s*u)*m,r[2]=(a*n-s*o)*m,r[3]=d*m,r[4]=(l*t-s*c)*m,r[5]=(-a*t+s*i)*m,r[6]=h*m,r[7]=(-u*t+n*c)*m,r[8]=(o*t-n*i)*m,r):null}function u1(r){let e=r[0],t=r[1],n=r[2],s=r[3],i=r[4],o=r[5],a=r[6],c=r[7],u=r[8];return e*(u*i-o*c)+t*(-u*s+o*a)+n*(c*s-i*a)}function xb(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=t[0],h=t[1],m=t[2],b=t[3],g=t[4],y=t[5],x=t[6],T=t[7],_=t[8];return r[0]=d*n+h*o+m*u,r[1]=d*s+h*a+m*l,r[2]=d*i+h*c+m*f,r[3]=b*n+g*o+y*u,r[4]=b*s+g*a+y*l,r[5]=b*i+g*c+y*f,r[6]=x*n+T*o+_*u,r[7]=x*s+T*a+_*l,r[8]=x*i+T*c+_*f,r}function l1(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=t[0],h=t[1];return r[0]=n,r[1]=s,r[2]=i,r[3]=o,r[4]=a,r[5]=c,r[6]=d*n+h*o+u,r[7]=d*s+h*a+l,r[8]=d*i+h*c+f,r}function f1(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=Math.sin(t),h=Math.cos(t);return r[0]=h*n+d*o,r[1]=h*s+d*a,r[2]=h*i+d*c,r[3]=h*o-d*n,r[4]=h*a-d*s,r[5]=h*c-d*i,r[6]=u,r[7]=l,r[8]=f,r}function Tb(r,e,t){let n=t[0],s=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=s*e[3],r[4]=s*e[4],r[5]=s*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function d1(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t+t,a=n+n,c=s+s,u=t*o,l=n*o,f=n*a,d=s*o,h=s*a,m=s*c,b=i*o,g=i*a,y=i*c;return r[0]=1-f-m,r[3]=l-y,r[6]=d+g,r[1]=l+y,r[4]=1-u-m,r[7]=h-b,r[2]=d-g,r[5]=h+b,r[8]=1-u-f,r}var _b=p(()=>{});function l2(){return Ff||(Ff=new zn([0,0,0,0,0,0,0,0,0]),Object.freeze(Ff)),Ff}function f2(){return Of||(Of=new zn,Object.freeze(Of)),Of}var Ab,u2,zn,Ff,Of,h1=p(()=>{mb();no();Sf();_b();vf();la();(function(r){r[r.COL0ROW0=0]="COL0ROW0",r[r.COL0ROW1=1]="COL0ROW1",r[r.COL0ROW2=2]="COL0ROW2",r[r.COL1ROW0=3]="COL1ROW0",r[r.COL1ROW1=4]="COL1ROW1",r[r.COL1ROW2=5]="COL1ROW2",r[r.COL2ROW0=6]="COL2ROW0",r[r.COL2ROW1=7]="COL2ROW1",r[r.COL2ROW2=8]="COL2ROW2"})(Ab||(Ab={}));u2=Object.freeze([1,0,0,0,1,0,0,0,1]),zn=class extends ca{static get IDENTITY(){return f2()}static get ZERO(){return l2()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Ab}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(u2)}fromObject(e){return this.check()}fromQuaternion(e){return d1(this,e),this.check()}fromMatrix4(e){return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])}set(e,t,n,s,i,o,a,c,u){return this[0]=e,this[1]=t,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=u,this.check()}setRowMajor(e,t,n,s,i,o,a,c,u){return this[0]=e,this[1]=s,this[2]=a,this[3]=t,this[4]=i,this[5]=c,this[6]=n,this[7]=o,this[8]=u,this.check()}determinant(){return u1(this)}transpose(){return a1(this,this),this.check()}invert(){return c1(this,this),this.check()}multiplyLeft(e){return xb(this,e,this),this.check()}multiplyRight(e){return xb(this,this,e),this.check()}rotate(e){return f1(this,this,e),this.check()}scale(e){return Array.isArray(e)?Tb(this,this,e):Tb(this,this,[e,e]),this.check()}translate(e){return l1(this,this,e),this.check()}transform(e,t){let n;switch(e.length){case 2:n=KA(t||[-0,-0],e,this);break;case 3:n=Lf(t||[-0,-0,-0],e,this);break;case 4:n=YA(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return aa(n,e.length),n}},Of=null});function d2(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function p1(r,e){if(r===e){let t=e[1],n=e[2],s=e[3],i=e[6],o=e[7],a=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=i,r[11]=e[14],r[12]=s,r[13]=o,r[14]=a}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function m1(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=e[9],d=e[10],h=e[11],m=e[12],b=e[13],g=e[14],y=e[15],x=t*a-n*o,T=t*c-s*o,_=t*u-i*o,v=n*c-s*a,I=n*u-i*a,N=s*u-i*c,K=l*b-f*m,ne=l*g-d*m,be=l*y-h*m,Re=f*g-d*b,ke=f*y-h*b,ue=d*y-h*g,oe=x*ue-T*ke+_*Re+v*be-I*ne+N*K;return oe?(oe=1/oe,r[0]=(a*ue-c*ke+u*Re)*oe,r[1]=(s*ke-n*ue-i*Re)*oe,r[2]=(b*N-g*I+y*v)*oe,r[3]=(d*I-f*N-h*v)*oe,r[4]=(c*be-o*ue-u*ne)*oe,r[5]=(t*ue-s*be+i*ne)*oe,r[6]=(g*_-m*N-y*T)*oe,r[7]=(l*N-d*_+h*T)*oe,r[8]=(o*ke-a*be+u*K)*oe,r[9]=(n*be-t*ke-i*K)*oe,r[10]=(m*I-b*_+y*x)*oe,r[11]=(f*_-l*I-h*x)*oe,r[12]=(a*ne-o*Re-c*K)*oe,r[13]=(t*Re-n*ne+s*K)*oe,r[14]=(b*T-m*v-g*x)*oe,r[15]=(l*v-f*T+d*x)*oe,r):null}function b1(r){let e=r[0],t=r[1],n=r[2],s=r[3],i=r[4],o=r[5],a=r[6],c=r[7],u=r[8],l=r[9],f=r[10],d=r[11],h=r[12],m=r[13],b=r[14],g=r[15],y=e*o-t*i,x=e*a-n*i,T=t*a-n*o,_=u*m-l*h,v=u*b-f*h,I=l*b-f*m,N=e*I-t*v+n*_,K=i*I-o*v+a*_,ne=u*T-l*x+f*y,be=h*T-m*x+b*y;return c*N-s*K+g*ne-d*be}function vb(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],b=e[12],g=e[13],y=e[14],x=e[15],T=t[0],_=t[1],v=t[2],I=t[3];return r[0]=T*n+_*a+v*f+I*b,r[1]=T*s+_*c+v*d+I*g,r[2]=T*i+_*u+v*h+I*y,r[3]=T*o+_*l+v*m+I*x,T=t[4],_=t[5],v=t[6],I=t[7],r[4]=T*n+_*a+v*f+I*b,r[5]=T*s+_*c+v*d+I*g,r[6]=T*i+_*u+v*h+I*y,r[7]=T*o+_*l+v*m+I*x,T=t[8],_=t[9],v=t[10],I=t[11],r[8]=T*n+_*a+v*f+I*b,r[9]=T*s+_*c+v*d+I*g,r[10]=T*i+_*u+v*h+I*y,r[11]=T*o+_*l+v*m+I*x,T=t[12],_=t[13],v=t[14],I=t[15],r[12]=T*n+_*a+v*f+I*b,r[13]=T*s+_*c+v*d+I*g,r[14]=T*i+_*u+v*h+I*y,r[15]=T*o+_*l+v*m+I*x,r}function g1(r,e,t){let n=t[0],s=t[1],i=t[2],o,a,c,u,l,f,d,h,m,b,g,y;return e===r?(r[12]=e[0]*n+e[4]*s+e[8]*i+e[12],r[13]=e[1]*n+e[5]*s+e[9]*i+e[13],r[14]=e[2]*n+e[6]*s+e[10]*i+e[14],r[15]=e[3]*n+e[7]*s+e[11]*i+e[15]):(o=e[0],a=e[1],c=e[2],u=e[3],l=e[4],f=e[5],d=e[6],h=e[7],m=e[8],b=e[9],g=e[10],y=e[11],r[0]=o,r[1]=a,r[2]=c,r[3]=u,r[4]=l,r[5]=f,r[6]=d,r[7]=h,r[8]=m,r[9]=b,r[10]=g,r[11]=y,r[12]=o*n+l*s+m*i+e[12],r[13]=a*n+f*s+b*i+e[13],r[14]=c*n+d*s+g*i+e[14],r[15]=u*n+h*s+y*i+e[15]),r}function y1(r,e,t){let n=t[0],s=t[1],i=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*s,r[5]=e[5]*s,r[6]=e[6]*s,r[7]=e[7]*s,r[8]=e[8]*i,r[9]=e[9]*i,r[10]=e[10]*i,r[11]=e[11]*i,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function w1(r,e,t,n){let s=n[0],i=n[1],o=n[2],a=Math.sqrt(s*s+i*i+o*o),c,u,l,f,d,h,m,b,g,y,x,T,_,v,I,N,K,ne,be,Re,ke,ue,oe,xe;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,u=Math.sin(t),c=Math.cos(t),l=1-c,f=e[0],d=e[1],h=e[2],m=e[3],b=e[4],g=e[5],y=e[6],x=e[7],T=e[8],_=e[9],v=e[10],I=e[11],N=s*s*l+c,K=i*s*l+o*u,ne=o*s*l-i*u,be=s*i*l-o*u,Re=i*i*l+c,ke=o*i*l+s*u,ue=s*o*l+i*u,oe=i*o*l-s*u,xe=o*o*l+c,r[0]=f*N+b*K+T*ne,r[1]=d*N+g*K+_*ne,r[2]=h*N+y*K+v*ne,r[3]=m*N+x*K+I*ne,r[4]=f*be+b*Re+T*ke,r[5]=d*be+g*Re+_*ke,r[6]=h*be+y*Re+v*ke,r[7]=m*be+x*Re+I*ke,r[8]=f*ue+b*oe+T*xe,r[9]=d*ue+g*oe+_*xe,r[10]=h*ue+y*oe+v*xe,r[11]=m*ue+x*oe+I*xe,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function x1(r,e,t){let n=Math.sin(t),s=Math.cos(t),i=e[4],o=e[5],a=e[6],c=e[7],u=e[8],l=e[9],f=e[10],d=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=i*s+u*n,r[5]=o*s+l*n,r[6]=a*s+f*n,r[7]=c*s+d*n,r[8]=u*s-i*n,r[9]=l*s-o*n,r[10]=f*s-a*n,r[11]=d*s-c*n,r}function T1(r,e,t){let n=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],u=e[8],l=e[9],f=e[10],d=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=i*s-u*n,r[1]=o*s-l*n,r[2]=a*s-f*n,r[3]=c*s-d*n,r[8]=i*n+u*s,r[9]=o*n+l*s,r[10]=a*n+f*s,r[11]=c*n+d*s,r}function _1(r,e,t){let n=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],u=e[4],l=e[5],f=e[6],d=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=i*s+u*n,r[1]=o*s+l*n,r[2]=a*s+f*n,r[3]=c*s+d*n,r[4]=u*s-i*n,r[5]=l*s-o*n,r[6]=f*s-a*n,r[7]=d*s-c*n,r}function A1(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t+t,a=n+n,c=s+s,u=t*o,l=n*o,f=n*a,d=s*o,h=s*a,m=s*c,b=i*o,g=i*a,y=i*c;return r[0]=1-f-m,r[1]=l+y,r[2]=d-g,r[3]=0,r[4]=l-y,r[5]=1-u-m,r[6]=h+b,r[7]=0,r[8]=d+g,r[9]=h-b,r[10]=1-u-f,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function v1(r,e,t,n,s,i,o){let a=1/(t-e),c=1/(s-n),u=1/(i-o);return r[0]=i*2*a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i*2*c,r[6]=0,r[7]=0,r[8]=(t+e)*a,r[9]=(s+n)*c,r[10]=(o+i)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=o*i*2*u,r[15]=0,r}function h2(r,e,t,n,s){let i=1/Math.tan(e/2);if(r[0]=i/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,s!=null&&s!==1/0){let o=1/(n-s);r[10]=(s+n)*o,r[14]=2*s*n*o}else r[10]=-1,r[14]=-2*n;return r}function p2(r,e,t,n,s,i,o){let a=1/(e-t),c=1/(n-s),u=1/(i-o);return r[0]=-2*a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*c,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(e+t)*a,r[13]=(s+n)*c,r[14]=(o+i)*u,r[15]=1,r}function E1(r,e,t,n){let s,i,o,a,c,u,l,f,d,h,m=e[0],b=e[1],g=e[2],y=n[0],x=n[1],T=n[2],_=t[0],v=t[1],I=t[2];return Math.abs(m-_)<1e-6&&Math.abs(b-v)<1e-6&&Math.abs(g-I)<1e-6?d2(r):(f=m-_,d=b-v,h=g-I,s=1/Math.sqrt(f*f+d*d+h*h),f*=s,d*=s,h*=s,i=x*h-T*d,o=T*f-y*h,a=y*d-x*f,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=d*a-h*o,u=h*i-f*a,l=f*o-d*i,s=Math.sqrt(c*c+u*u+l*l),s?(s=1/s,c*=s,u*=s,l*=s):(c=0,u=0,l=0),r[0]=i,r[1]=c,r[2]=f,r[3]=0,r[4]=o,r[5]=u,r[6]=d,r[7]=0,r[8]=a,r[9]=l,r[10]=h,r[11]=0,r[12]=-(i*m+o*b+a*g),r[13]=-(c*m+u*b+l*g),r[14]=-(f*m+d*b+h*g),r[15]=1,r)}function Ib(r){if(r.length!==16||Array.from(r).some(s=>!Number.isFinite(s))||r[3]!==0||r[7]!==0||r[11]!==0||r[15]!==1)throw new RangeError("Expected a finite affine matrix");let e=[Math.hypot(r[0],r[1],r[2]),Math.hypot(r[4],r[5],r[6]),Math.hypot(r[8],r[9],r[10])];if(e.some(s=>s===0||!Number.isFinite(s)))throw new RangeError("Singular transform");let t=Array.from({length:9},(s,i)=>r[Math.floor(i/3)*4+i%3]/e[Math.floor(i/3)]);for(let[s,i]of[[0,3],[0,6],[3,6]])if(Math.abs(t[s]*t[i]+t[s+1]*t[i+1]+t[s+2]*t[i+2])>1e-7)throw new RangeError("Sheared transforms do not have a TRS decomposition");if(t[0]*(t[4]*t[8]-t[5]*t[7])-t[3]*(t[1]*t[8]-t[2]*t[7])+t[6]*(t[1]*t[5]-t[2]*t[4])<0){e[0]=-e[0];for(let s=0;s<3;s++)t[s]=-t[s]}return{rotation:t,scale:e,translation:[r[12],r[13],r[14]]}}var I1,S1,Mf=p(()=>{I1=h2;S1=p2});function L1(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function B1(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function F1(r){let e=r[0],t=r[1],n=r[2],s=r[3];return Math.sqrt(e*e+t*t+n*n+s*s)}function O1(r){let e=r[0],t=r[1],n=r[2],s=r[3];return e*e+t*t+n*n+s*s}function M1(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t*t+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=s*o,r[3]=i*o,r}function D1(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function R1(r,e,t,n){let s=e[0],i=e[1],o=e[2],a=e[3];return r[0]=s+n*(t[0]-s),r[1]=i+n*(t[1]-i),r[2]=o+n*(t[2]-o),r[3]=a+n*(t[3]-a),r}function k1(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3];return r[0]=t[0]*n+t[4]*s+t[8]*i+t[12]*o,r[1]=t[1]*n+t[5]*s+t[9]*i+t[13]*o,r[2]=t[2]*n+t[6]*s+t[10]*i+t[14]*o,r[3]=t[3]*n+t[7]*s+t[11]*i+t[15]*o,r}var Df=p(()=>{});function w2(){return Rf||(Rf=new Qs([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Rf)),Rf}function x2(){return kf||(kf=new Qs,Object.freeze(kf)),kf}function N1(r){if(r>Math.PI*2)throw Error("expected radians")}function T2(r,e,t,n,s,i){let o=2*i/(t-e),a=2*i/(s-n),c=(t+e)/(t-e),u=(s+n)/(s-n),l=-1,f=-1,d=-2*i;return r[0]=o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=c,r[9]=u,r[10]=l,r[11]=f,r[12]=0,r[13]=0,r[14]=d,r[15]=0,r}var Lb,b2,g2,Sb,Eb,y2,Qs,Rf,kf,C1=p(()=>{mb();Mf();no();Sf();Mf();vf();la();Df();(function(r){r[r.COL0ROW0=0]="COL0ROW0",r[r.COL0ROW1=1]="COL0ROW1",r[r.COL0ROW2=2]="COL0ROW2",r[r.COL0ROW3=3]="COL0ROW3",r[r.COL1ROW0=4]="COL1ROW0",r[r.COL1ROW1=5]="COL1ROW1",r[r.COL1ROW2=6]="COL1ROW2",r[r.COL1ROW3=7]="COL1ROW3",r[r.COL2ROW0=8]="COL2ROW0",r[r.COL2ROW1=9]="COL2ROW1",r[r.COL2ROW2=10]="COL2ROW2",r[r.COL2ROW3=11]="COL2ROW3",r[r.COL3ROW0=12]="COL3ROW0",r[r.COL3ROW1=13]="COL3ROW1",r[r.COL3ROW2=14]="COL3ROW2",r[r.COL3ROW3=15]="COL3ROW3"})(Lb||(Lb={}));b2=45*Math.PI/180,g2=1,Sb=.1,Eb=500,y2=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Qs=class extends ca{static get IDENTITY(){return x2()}static get ZERO(){return w2()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Lb}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,n,s,i,o,a,c,u,l,f,d,h,m,b,g){return this[0]=e,this[1]=t,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=u,this[9]=l,this[10]=f,this[11]=d,this[12]=h,this[13]=m,this[14]=b,this[15]=g,this.check()}setRowMajor(e,t,n,s,i,o,a,c,u,l,f,d,h,m,b,g){return this[0]=e,this[1]=i,this[2]=u,this[3]=h,this[4]=t,this[5]=o,this[6]=l,this[7]=m,this[8]=n,this[9]=a,this[10]=f,this[11]=b,this[12]=s,this[13]=c,this[14]=d,this[15]=g,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(y2)}fromObject(e){return this.check()}fromQuaternion(e){return A1(this,e),this.check()}fromMatrix3(e){return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1)}frustum(e){let{left:t,right:n,bottom:s,top:i,near:o=Sb,far:a=Eb}=e;return a===1/0?T2(this,t,n,s,i,o):v1(this,t,n,s,i,o,a),this.check()}lookAt(e){let{eye:t,center:n=[0,0,0],up:s=[0,1,0]}=e;return E1(this,t,n,s),this.check()}ortho(e){let{left:t,right:n,bottom:s,top:i,near:o=Sb,far:a=Eb}=e;return S1(this,t,n,s,i,o,a),this.check()}orthographic(e){let{fovy:t=b2,aspect:n=g2,focalDistance:s=1,near:i=Sb,far:o=Eb}=e;N1(t);let a=t/2,c=s*Math.tan(a),u=c*n;return this.ortho({left:-u,right:u,bottom:-c,top:c,near:i,far:o})}perspective(e){let{fovy:t=45*Math.PI/180,aspect:n=1,near:s=.1,far:i=500}=e;return N1(t),I1(this,t,n,s,i),this.check()}determinant(){return b1(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){let{rotation:n,scale:s}=Ib(this);if(e=e||new Array(16),t)for(let i=0;i<3;i++)t[i]=s[i];for(let i=0;i<16;i++)e[i]=0;for(let i=0;i<9;i++)e[Math.floor(i/3)*4+i%3]=n[i];return e[15]=1,e}getRotationMatrix3(e,t){let{rotation:n,scale:s}=Ib(this);if(e=e||new Array(9),t)for(let i=0;i<3;i++)t[i]=s[i];for(let i=0;i<9;i++)e[i]=n[i];return e}transpose(){return p1(this,this),this.check()}invert(){return m1(this,this),this.check()}multiplyLeft(e){return vb(this,e,this),this.check()}multiplyRight(e){return vb(this,this,e),this.check()}rotateX(e){return x1(this,this,e),this.check()}rotateY(e){return T1(this,this,e),this.check()}rotateZ(e){return _1(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return w1(this,this,e,t),this.check()}scale(e){return y1(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return g1(this,this,e),this.check()}transform(e,t){return e.length===4?(t=k1(t||[-0,-0,-0,-0],e,this),aa(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){let{length:n}=e,s;switch(n){case 2:s=XA(t||[-0,-0],e,this);break;case 3:s=Ef(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return aa(s,e.length),s}transformAsVector(e,t){let n;switch(e.length){case 2:n=HA(t||[-0,-0],e,this);break;case 3:n=If(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return aa(n,e.length),n}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,n){return this.identity().translate([e,t,n])}}});function U1(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function Bb(r,e,t){t=t*.5;let n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function Fb(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=t[0],c=t[1],u=t[2],l=t[3];return r[0]=n*l+o*a+s*u-i*c,r[1]=s*l+o*c+i*a-n*u,r[2]=i*l+o*u+n*c-s*a,r[3]=o*l-n*a-s*c-i*u,r}function P1(r,e,t){t*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return r[0]=n*c+o*a,r[1]=s*c+i*a,r[2]=i*c-s*a,r[3]=o*c-n*a,r}function V1(r,e,t){t*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return r[0]=n*c-i*a,r[1]=s*c+o*a,r[2]=i*c+n*a,r[3]=o*c-s*a,r}function j1(r,e,t){t*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return r[0]=n*c+s*a,r[1]=s*c-n*a,r[2]=i*c+o*a,r[3]=o*c-i*a,r}function G1(r,e){let t=e[0],n=e[1],s=e[2];return r[0]=t,r[1]=n,r[2]=s,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-s*s)),r}function Ob(r,e,t,n){let s=e[0],i=e[1],o=e[2],a=e[3],c=t[0],u=t[1],l=t[2],f=t[3],d,h,m,b,g;return d=s*c+i*u+o*l+a*f,d<0&&(d=-d,c=-c,u=-u,l=-l,f=-f),1-d>1e-6?(h=Math.acos(d),g=Math.sin(h),m=Math.sin((1-n)*h)/g,b=Math.sin(n*h)/g):(m=1-n,b=n),r[0]=m*s+b*c,r[1]=m*i+b*u,r[2]=m*o+b*l,r[3]=m*a+b*f,r}function z1(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t*t+n*n+s*s+i*i,a=o?1/o:0;return r[0]=-t*a,r[1]=-n*a,r[2]=-s*a,r[3]=i*a,r}function W1(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function $1(r,e){let t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[i*3+i]-e[o*3+o]+1),r[s]=.5*n,n=.5/n,r[3]=(e[i*3+o]-e[o*3+i])*n,r[i]=(e[i*3+s]+e[s*3+i])*n,r[o]=(e[o*3+s]+e[s*3+o])*n}return r}function Z1(r,e,t,n){if(e.length!==4||t.length!==4||[...Array.from(e),...Array.from(t),n].some(d=>!Number.isFinite(d)))throw new RangeError("Expected finite quaternions and step");if(e.length!==4||n<0)throw new RangeError("Expected quaternions and a nonnegative step");let s=Math.max(...Array.from(e,Math.abs)),i=Math.max(...Array.from(t,Math.abs));if(!s||!i)throw new RangeError("Zero quaternion");let o=Array.from(e,d=>d/s),a=Array.from(t,d=>d/i),c=Math.hypot(...o),u=Math.hypot(...a);for(let d=0;d<4;d++)o[d]/=c,a[d]/=u;let l=o.reduce((d,h,m)=>d+h*a[m],0),f=2*Math.acos(Math.min(1,Math.abs(l)));if(r.length<4)throw new RangeError("Result buffer is too short");return Ob(r,o,a,f===0?0:Math.min(1,n/f)),r}var q1,K1,X1,H1,J1,Y1,_2,Q1,Nf=p(()=>{la();Df();q1=L1,K1=B1,X1=D1,H1=R1,J1=F1,Y1=O1,_2=M1,Q1=(function(){let r=QA(),e=gb(1,0,0),t=gb(0,1,0);return function(n,s,i){let o=yb(s,i);return o<-.999999?(ua(r,e,s),i1(r)<1e-6&&ua(r,t,s),ZA(r,r),Bb(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ua(r,s,i),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,_2(n,n))}})()});var Gc,ev=p(()=>{Nf();Tf();no();Nf();Gc=class extends Ys{constructor(e=0,t=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,t,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,n,s){return this[0]=e,this[1]=t,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return $1(this,e),this.check()}fromEuler(e){switch(this.identity(),e.order){case"xyz":return this.rotateX(e.x).rotateY(e.y).rotateZ(e.z);case"yxz":return this.rotateY(e.y).rotateX(e.x).rotateZ(e.z);case"zxy":return this.rotateZ(e.z).rotateX(e.x).rotateY(e.y);case"zyx":return this.rotateZ(e.z).rotateY(e.y).rotateX(e.x);case"yzx":return this.rotateY(e.y).rotateZ(e.z).rotateX(e.x);case"xzy":return this.rotateX(e.x).rotateZ(e.z).rotateY(e.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(e,t){return Bb(this,e,t),this.check()}rotateTowards(e,t){return Z1(this,this,e,t)}identity(){return U1(this),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=Ve(e)}get y(){return this[1]}set y(e){this[1]=Ve(e)}get z(){return this[2]}set z(e){this[2]=Ve(e)}get w(){return this[3]}set w(e){this[3]=Ve(e)}len(){return J1(this)}lengthSquared(){return Y1(this)}dot(e){return X1(this,e)}rotationTo(e,t){return Q1(this,e,t),this.check()}add(e){return q1(this,this,e),this.check()}calculateW(){return G1(this,this),this.check()}conjugate(){return W1(this,this),this.check()}invert(){return z1(this,this),this.check()}lerp(e,t,n){return n===void 0?this.lerp(this,e,t):(H1(this,e,t,n),this.check())}multiplyRight(e){return Fb(this,this,e),this.check()}multiplyLeft(e){return Fb(this,e,this),this.check()}normalize(){let e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,e===0&&(this[3]=1),this.check()}rotateX(e){return P1(this,this,e),this.check()}rotateY(e){return V1(this,this,e),this.check()}rotateZ(e){return j1(this,this,e),this.check()}scale(e){return K1(this,this,e),this.check()}slerp(e,t,n){let s,i,o;return arguments.length===2?(s=this,i=e,o=t):(s=e,i=t,o=n),Ob(this,s,i,o),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}});function Cf(){return fa??Uint16Array}var fa,tv=p(()=>{fa=globalThis.Float16Array});var rv=p(()=>{tv()});var nv=p(()=>{rv()});var sv=p(()=>{_b()});var iv=p(()=>{Mf()});var ov=p(()=>{Nf()});var av=p(()=>{vf()});var cv=p(()=>{la()});var uv=p(()=>{Df()});var Uf=p(()=>{o1();h1();C1();ev();GA();nv();sv();iv();ov();av();cv();uv()});var Ue=p(()=>{"use strict";x_();ym();wm();v_();_m();_m();BA();DA();ob();ab();kA();NA();CA();PA();VA();jA()});function O2(r,e="float32"){return r instanceof Date?"date-millisecond":typeof r=="number"?e:typeof r=="boolean"?"bool":typeof r=="string"?"utf8":"null"}function zc(r){let e=Mb(r);return e!=="null"?{type:e,nullable:!1}:r.length>0?(e=O2(r[0]),{type:e,nullable:!0}):{type:"null",nullable:!0}}function Mb(r){if(typeof Float16Array<"u"&&r instanceof Float16Array)return"float16";switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var Pf=p(()=>{"use strict"});function Vf(r){return{fields:r.fields.map(e=>so(e)),metadata:hv(r.metadata)}}function hv(r){return Object.fromEntries(r)}function Db(r){return r?new Map(Object.entries(r)):new Map}function so(r){return{name:r.name,type:pv(r.type),nullable:r.nullable,metadata:hv(r.metadata)}}function Wn(r,e){return new O(r.name,jf(r.type,e),r.nullable,Db(r.metadata))}function pv(r){if(lv(r,"BinaryView"))return"binary-view";if(lv(r,"Utf8View"))return"utf8-view";if(M2(r,"LargeList"))return{type:"large-list",children:[so(r.valueField)]};switch(r.constructor){case Ne:return"null";case Ct:return"binary";case Pt:return{type:"fixed-size-binary",byteWidth:r.byteWidth};case lt:return"bool";case Fe:let e=r;return`${e.isSigned?"":"u"}int${e.bitWidth}`;case Zt:return"int8";case er:return"int16";case Pe:return"int32";case tr:return"int64";case rr:return"uint8";case nr:return"uint16";case vt:return"uint32";case Nr:return"uint64";case ct:switch(r.precision){case le.HALF:return"float16";case le.SINGLE:return"float32";case le.DOUBLE:return"float64";default:return"float16"}case Cr:return"float16";case It:return"float32";case sr:return"float64";case ut:return"utf8";case Ut:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case Et:return r.unit===ye.DAY?"date-day":"date-millisecond";case os:return"date-day";case as:return"date-millisecond";case tt:switch(r.unit){case L.SECOND:return"time-second";case L.MILLISECOND:return"time-millisecond";case L.MICROSECOND:return"time-microsecond";case L.NANOSECOND:return"time-nanosecond";default:return"time-second"}case us:return"time-millisecond";case cs:return"time-second";case ls:return"time-microsecond";case fs:return"time-nanosecond";case rt:switch(r.unit){case L.SECOND:return"timestamp-second";case L.MILLISECOND:return"timestamp-millisecond";case L.MICROSECOND:return"timestamp-microsecond";case L.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case ds:return"timestamp-second";case Zr:return"timestamp-millisecond";case hs:return"timestamp-microsecond";case ps:return"timestamp-nanosecond";case ft:switch(r.unit){case ae.DAY_TIME:return"interval-daytime";case ae.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case ms:return"interval-daytime";case bs:return"interval-yearmonth";case dt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(b=>so(b))};case je:let l=r.valueField;return{type:"list",children:[so(l)]};case Be:let f=r;return{type:"fixed-size-list",listSize:f.listSize,children:[so(f.children[0])]};case pe:return{type:"struct",children:r.children.map(b=>so(b))};case gs:case _n:let h=r;return{type:h instanceof _n?"dense-union":"sparse-union",typeIds:h.typeIds,children:h.children.map(b=>so(b)),typeIdToChildIndex:{...h.typeIdToChildIndex}};case Ge:let m=r;return{type:"dictionary",id:m.id,indices:D2(m.indices),dictionary:pv(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function jf(r,e){if(typeof r=="object")switch(r.type){case"decimal":return new Ut(r.scale,r.precision,r.bitWidth);case"map":{let t=r.children.map(n=>Wn(n,e));return new dt(t[0],r.keysSorted)}case"list":{let t=Wn(r.children[0],e);return new je(t)}case"large-list":{let t=Wn(r.children[0],e),n=Wc("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(t)}case"fixed-size-list":{let t=Wn(r.children[0],e);return new Be(r.listSize,t)}case"fixed-size-binary":return new Pt(r.byteWidth);case"struct":{let t=r.children.map(n=>Wn(n,e));return new pe(t)}case"sparse-union":case"dense-union":{let t=r.children.map(n=>Wn(n,e));return r.type==="dense-union"?new _n(r.typeIds,t):new gs(r.typeIds,t)}case"dictionary":return new Ge(jf(r.dictionary,e),k2(r.indices),r.id,r.isOrdered);default:throw new Error("array type not supported")}switch(r){case"null":return new Ne;case"binary":return fv("BinaryView",new Ct,e);case"binary-view":return dv("BinaryView");case"bool":return new lt;case"int8":return new Zt;case"int16":return new er;case"int32":return new Pe;case"int64":return new tr;case"uint8":return new rr;case"uint16":return new nr;case"uint32":return new vt;case"uint64":return new Nr;case"float16":return new Cr;case"float32":return new It;case"float64":return new sr;case"utf8":return fv("Utf8View",new ut,e);case"utf8-view":return dv("Utf8View");case"date-day":return new os;case"date-millisecond":return new as;case"time-second":return new cs;case"time-millisecond":return new us;case"time-microsecond":return new ls;case"time-nanosecond":return new fs;case"timestamp-second":return new ds;case"timestamp-millisecond":return new Zr;case"timestamp-microsecond":return new hs;case"timestamp-nanosecond":return new ps;case"interval-daytime":return new ms;case"interval-yearmonth":return new bs;default:throw new Error("array type not supported")}}function Wc(r){return cn[r]}function lv(r,e){let t=Wc(e);if(t&&r instanceof t)return!0;let n=E;return!!(e==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(r)}function M2(r,e){let t=Wc(e);return!!(t&&r instanceof t)}function fv(r,e,t){let n=t?.viewTypes||"never";if(n==="never")return e;let s=Wc(r);if(s)return new s;if(n==="require")throw new Error(`${r} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return e}function dv(r){let e=Wc(r);if(!e)throw new Error(`${r} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new e}function D2(r){if(r instanceof Fe){let t=`${r.isSigned?"int":"uint"}${r.bitWidth}`;if(R2(t))return t}switch(r.constructor){case Zt:return"int8";case er:return"int16";case Pe:return"int32";case rr:return"uint8";case nr:return"uint16";case vt:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${r.constructor.name}`)}}function R2(r){return["int8","int16","int32","uint8","uint16","uint32"].includes(r)}function k2(r){switch(r){case"int8":return new Zt;case"int16":return new er;case"int32":return new Pe;case"uint8":return new rr;case"uint16":return new nr;case"uint32":return new vt;default:throw new Error(`schema dictionary index type not supported: ${r}`)}}var Gf=p(()=>{"use strict";jn()});function Er(r){let e=r?.POSITION;if(!e||!("value"in e)||!e.value.length)return null;let t=1/0,n=1/0,s=1/0,i=-1/0,o=-1/0,a=-1/0,c=e.value,u=c.length;for(let l=0;l<u;l+=3){let f=c[l],d=c[l+1],h=c[l+2];t=f<t?f:t,n=d<n?d:n,s=h<s?h:s,i=f>i?f:i,o=d>o?d:o,a=h>a?h:a}return[[t,n,s],[i,o,a]]}var Rb=p(()=>{"use strict"});function kb(r){let e=Cf();return new e(r)}function Zs(r){return!!(fa&&r instanceof fa)}function Nb(r,e,t){Zs(r)?r[e]=t:r[e]=mv(t)}function Cb(r,e){return Zs(r)?r[e]:N2(r[e])}function $c(r){return Zs(r)?new Uint16Array(r.buffer,r.byteOffset,r.length):r}function mv(r){if(!Number.isFinite(r))return r===1/0?31744:r===-1/0?64512:32256;let e=r<0||Object.is(r,-0)?32768:0,t=Math.abs(r);if(t===0)return e;if(t>=65520)return e|31744;if(t>=65504)return e|31743;let n=Math.floor(Math.log2(t));if(n<-14)return e|Math.round(t/2**-24);let s=n+15,i=Math.round((t/2**n-1)*1024);return i===1024?e|s+1<<10:e|s<<10|i}function N2(r){let e=r&32768?-1:1,t=r>>10&31,n=r&1023;return t===0?e*n*2**-24:t===31?n?NaN:e*(1/0):e*(1+n/1024)*2**(t-15)}var bv=p(()=>{"use strict";Uf()});var zf,Ub,gv=p(()=>{"use strict";jn();zf=new Q([new O("POSITION",new Be(3,new O("value",new It,!1)),!1)]),Ub=new Q([...zf.fields,new O("indices",new je(new O("item",new vt,!1)),!0)])});var qc=p(()=>{"use strict";bv();gv()});function yv(r){return r.type instanceof Be?r.type.listSize:1}function Pb(r,e,t){let n=C2(r,e,t);return new B([n])}function C2(r,e,t){let n=U2(r,e,t),s=n.children[0].type,i=t==="float16"&&Zs(r)?$c(r):r,o={[re.DATA]:i},a=new G(s,0,i.length,0,o);return new G(n,0,i.length/e,0,void 0,[a])}function U2(r,e,t){let n=t||zc(r).type,s=jf(n);return new Be(e,new O("value",s,!1))}var Vb=p(()=>{"use strict";qc();jn();Pf();Gf()});function ei(r,e){switch(e){case"columnar-table":return P2(r);case"arrow-table":return V2(r);default:throw new Error(e)}}function P2(r){let e={},t=Tv(r);for(let[n,s]of Object.entries(r.attributes))e[n]=s.value;return{shape:"columnar-table",schema:r.schema,data:e,topology:r.topology,indices:t?r.indices:void 0}}function V2(r,e){return xv(r.attributes,{schema:r.schema,topology:r.topology,mode:r.mode,boundingBox:r.header?.boundingBox,indices:Tv(r)?r.indices:void 0})}function xv(r,e={}){let t=[],n={},s=G2(r);for(let c of s){let u=r[c],{value:l,size:f=1}=u,d=j2(l,f,u.componentType);if(n[c]=d,t.push(z2(e.schema,c,d,u.componentType)),c==="POSITION"&&e.indices?.value?.length){let h=Ub.fields.find(m=>m.name==="indices");n.indices=$2(e.indices.value,d.length,h.type),t.push(h)}}let i=new Q(t,q2(e)),o=n[s[0]]?.length===0?new me(i):new me(i,n);return{shape:"arrow-table",schema:Vf(o.schema),data:o,topology:e.topology||"point-list",indices:e.indices}}function j2(r,e,t){if(t==="float16"){let n=Zs(r)?$c(r):r;if(e===1){let s=new G(new Cr,0,n.length,0,{[re.DATA]:n});return new B([s])}return Pb(r,e,t)}return e===1?rn(r):Pb(r,e)}function G2(r){let e=Object.keys(r),t=wv.filter(s=>s in r),n=e.filter(s=>!wv.includes(s));return[...t,...n]}function Tv(r){return!!r.indices?.value?.length}function z2(r,e,t,n){if(e==="POSITION"&&W2(t)){let i=zf.fields[0],o=r?.fields.find(c=>c.name===e);if(!o?.metadata)return i;let a=new Map(i.metadata);for(let[c,u]of Object.entries(o.metadata))a.set(c,u);return new O(i.name,i.type,i.nullable,a)}let s=r?.fields.find(i=>i.name===e);if(n==="float16"){let i=new Map(Object.entries(s?.metadata||{}));return i.set("componentType","float16"),new O(e,t.type,!1,i)}if(s&&s.type.toString()!==t.type.toString()){let i=Wn(s);return new O(e,t.type,i.nullable,i.metadata)}return s?Wn(s):new O(e,t.type,!1)}function W2(r){return r.type instanceof Be&&r.type.listSize===3&&r.type.children[0].type instanceof It}function $2(r,e,t){let n=t,s=r instanceof Uint32Array?r:Uint32Array.from(r),i=new Int32Array(e+1);e>0&&i.fill(s.length,1);let o=new Uint8Array(Math.ceil(e/8));e>0&&(o[0]=1);let a=new G(n.children[0].type,0,s.length,0,{[re.DATA]:s}),c=new G(n,0,e,Math.max(0,e-1),{[re.OFFSET]:i,[re.VALIDITY]:o},[a]);return new B([c])}function q2(r){let e={...r.schema?.metadata};return r.topology&&(e.topology||=r.topology),Number.isFinite(r.mode)&&(e.mode||=String(r.mode)),r.boundingBox&&(e.boundingBox||=JSON.stringify(r.boundingBox)),Db(e)}var wv,_v=p(()=>{"use strict";qc();qc();jn();Vb();Gf();wv=["POSITION"]});function pn(r){if(r.shape==="arrow-table")return K2(r);throw new Error(r.shape)}function K2(r){let e=r.data,t=Vf(e.schema),n=t.fields,s={},i=[];for(let l of n){let{name:f}=l;if(f==="indices")continue;let d=e.getChild(f),h=yv(d),m=Q2(d,h),b=H2(l.metadata),g=b.componentType==="float16"?Z2(m):m,y=i.find(x=>x.data.length===d.data.length&&s[x.name].value.constructor===g.constructor&&x.data.every((T,_)=>Av(T,d.data[_])));s[f]={value:y?s[y.name].value:g,size:h,...b},y||i.push({name:f,data:d.data})}Y2(t);let o=t.metadata.topology,a=eD(t),c=tD(e),u=s.POSITION?.transform?.type==="quantization"?X2(t)||Er(s):Er(s);return{schema:t,attributes:s,topology:o,mode:a,indices:c,header:{vertexCount:e.numRows,boundingBox:u??void 0}}}function X2(r){let e=r.metadata?.boundingBox;if(!e)return null;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===2&&t.every(n=>Array.isArray(n)&&n.length===3&&n.every(s=>typeof s=="number")))return t}catch{}return null}function H2(r={}){let e={};if(r.byteOffset!==void 0&&(e.byteOffset=Number(r.byteOffset)),r.byteStride!==void 0&&(e.byteStride=Number(r.byteStride)),r.normalized!==void 0&&(e.normalized=r.normalized==="true"),r.componentType==="float16"&&(e.componentType="float16"),r["loaders.gl.transform"])try{let t=JSON.parse(r["loaders.gl.transform"]);J2(t)&&(e.transform=t)}catch{}return e}function J2(r){if(!r||typeof r!="object"||!("type"in r))return!1;let e=r;return e.type==="octahedron"?Number.isInteger(e.bits)&&e.bits>=1&&e.bits<=30:e.type==="quantization"&&Number.isInteger(e.bits)&&e.bits>=1&&e.bits<=30&&Array.isArray(e.origin)&&e.origin.every(t=>typeof t=="number")&&typeof e.range=="number"}function Y2(r){r.metadata||={},r.metadata.topology||="point-list",r.metadata.mode||="0"}function Q2(r,e){if(!(r.type instanceof Be))return r.toArray();let n=r.data[0].children[0].values.constructor,s=new n(r.length*e),i=0;for(let o of r.data){let a=o.children[0],c=o.length*e,u=a.offset||o.offset*e,l=u+c<=a.values.length?u:0,f=a.values.subarray(l,l+c);s.set(f,i),i+=c}return s}function Z2(r){let e=kb(r.length);for(let t=0;t<r.length;t++)Nb(e,t,Cb(r,t));return e}function eD(r){let e=Number(r.metadata?.mode);return Number.isFinite(e)?e:0}function tD(r){let e=r.getChild("indices");if(!e?.isValid(0))return;let t=e.data[0],n=t.valueOffsets,s=n[t.offset],i=n[t.offset+1];return{value:t.children[0].values.subarray(s,i),size:1}}function Av(r,e){let t=Object.values(e.buffers);return r.type.toString()===e.type.toString()&&r.offset===e.offset&&r.length===e.length&&r.nullCount===e.nullCount&&r.dictionary===e.dictionary&&Object.values(r.buffers).every((n,s)=>{let i=t[s];return n===i||!!(n&&i&&n.buffer===i.buffer&&n.byteOffset===i.byteOffset&&n.byteLength===i.byteLength)})&&r.children.length===e.children.length&&r.children.every((n,s)=>Av(n,e.children[s]))}var vv=p(()=>{"use strict";qc();jn();Vb();Gf();Rb()});function jb(r,e={}){return{fields:rD(r),metadata:e}}function Wf(r,e,t){let n=e.componentType||Mb(e.value),s=t||$f(e),i=e.size===1?n:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]};return{name:r,type:i,nullable:!1,metadata:s}}function rD(r){let e=[];for(let t in r){let n=r[t];e.push(Wf(t,n))}return e}function $f(r){let e={};return"byteOffset"in r&&(e.byteOffset=r.byteOffset.toString(10)),"byteStride"in r&&(e.byteStride=r.byteStride.toString(10)),"normalized"in r&&(e.normalized=r.normalized.toString()),r.componentType&&(e.componentType=r.componentType),r.transform&&(e["loaders.gl.transform"]=JSON.stringify(r.transform)),e}var Iv=p(()=>{"use strict";Pf()});var mn=p(()=>{"use strict";Pf();Rb();_v();vv();Iv()});function qf(r,e={}){let t={};for(let s in e)s!=="value"&&(t[s]=JSON.stringify(e[s]));let n=[];for(let s in r){let i=r[s],o=nD(s,i);n.push(o)}return{fields:n,metadata:t}}function nD(r,e){let t={};for(let i in e)i!=="value"&&(t[i]=JSON.stringify(e[i]));let{type:n}=zc(e.value);return e.size===1||e.size===void 0||(n={type:"fixed-size-list",listSize:e.size,children:[{name:"values",type:n}]}),{name:r,type:n,nullable:!1,metadata:t}}var Gb=p(()=>{"use strict";mn()});function Ev(r){let e=new $b;r.indexOf(`\r
38
+ `)}}e.length>0&&(yield e)}var C1=p(()=>{"use strict"});async function tg(r){let e=[];for await(let t of r)e.push(mD(t));return Xb(...e)}function mD(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:e,byteOffset:t,byteLength:n}=r;return U1(e,t,n)}return U1(r)}function U1(r,e=0,t=r.byteLength-e){let n=new Uint8Array(r,e,t),s=new Uint8Array(n.length);return s.set(n),s.buffer}var P1=p(()=>{"use strict";Jb()});function co(r){if(r instanceof ArrayBuffer)return r;if(_A(r))return rg(r);let{buffer:e,byteOffset:t,byteLength:n}=r;return e instanceof ArrayBuffer&&t===0&&n===e.byteLength?e:rg(e,t,n)}function rg(r,e=0,t=r.byteLength-e){let n=new Uint8Array(r,e,t),s=new Uint8Array(n.length);return s.set(n),s.buffer}var V1=p(()=>{"use strict";AA()});function ng(r){return{...r,batchType:"data",length:r.data.numRows}}var j1=p(()=>{"use strict"});var JJ,YJ,QJ,ZJ,G1=p(()=>{JJ=Math.PI/2,YJ=Math.PI/4,QJ=Math.PI/6,ZJ=Math.PI*2});function z1(r,{precision:e=st.precision}={}){return r=yD(r),`${parseFloat(r.toPrecision(e))}`}function ma(r){return Array.isArray(r)||ArrayBuffer.isView(r)&&!(r instanceof DataView)}function sg(r,e,t){let n=st.EPSILON;t&&(st.EPSILON=t);try{if(r===e)return!0;if(ma(r)&&ma(e)){if(r.length!==e.length)return!1;for(let s=0;s<r.length;++s)if(!sg(r[s],e[s]))return!1;return!0}return r&&r.equals?r.equals(e):e&&e.equals?e.equals(r):typeof r=="number"&&typeof e=="number"?Math.abs(r-e)<=st.EPSILON*Math.max(1,Math.abs(r),Math.abs(e)):!1}finally{st.EPSILON=n}}function yD(r){return Math.round(r/st.EPSILON)*st.EPSILON}var eY,tY,gD,st,ru=p(()=>{eY=1/Math.PI*180,tY=1/180*Math.PI,gD={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...gD}};st=globalThis.mathgl.config});var ri,Xf=p(()=>{ru();ri=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+t];return this.check()}toArray(e=[],t=0){for(let n=0;n<this.ELEMENTS;++n)e[t+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:ma(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toString(){return this.formatString(st)}formatString(e){let t="";for(let n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+z1(this[n],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!sg(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,n){if(n===void 0)return this.lerp(this,e,t);for(let s=0;s<this.ELEMENTS;++s){let i=e[s],o=typeof t=="number"?t:t[s];this[s]=i+n*(o-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),t[n]);return this.check()}add(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n];return this.check()}subtract(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=t[n];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(st.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}});function wD(r,e){if(r.length!==e)return!1;for(let t=0;t<r.length;++t)if(!Number.isFinite(r[t]))return!1;return!0}function Ve(r){if(!Number.isFinite(r))throw new Error(`Invalid number ${JSON.stringify(r)}`);return r}function ba(r,e,t=""){if(st.debug&&!wD(r,e))throw new Error(`math.gl: ${t} some fields set to invalid numbers'`);return r}var uo=p(()=>{ru()});var ga,ig=p(()=>{Xf();uo();ru();ga=class extends ri{toString(){let e="[";if(st.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,n){return this[t*this.RANK+e]=Ve(n),this}getColumn(e,t=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)t[s]=this[n+s];return t}setColumn(e,t){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=t[s];return this}}});function og(r,e){if(!r)throw new Error(`math.gl assertion ${e}`)}var W1=p(()=>{});var Jf,$1=p(()=>{Xf();uo();W1();Jf=class extends ri{get x(){return this[0]}set x(e){this[0]=Ve(e)}get y(){return this[1]}set y(e){this[1]=Ve(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];t+=s*s}return Ve(t)}dot(e){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return Ve(t)}normalize(){let e=this.magnitude();if(e!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=t[n];return this.check()}divide(...e){for(let t of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return og(e>=0&&e<this.ELEMENTS,"index is out of range"),Ve(this[e])}setComponent(e,t){return og(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=e[n]*t;return this.check()}}});var Yf,bY,q1=p(()=>{Yf=typeof Float32Array<"u"?Float32Array:Array,bY=Math.PI/180});function K1(r,e,t){let n=e[0],s=e[1];return r[0]=t[0]*n+t[3]*s+t[6],r[1]=t[1]*n+t[4]*s+t[7],r}function H1(r,e,t){let n=e[0],s=e[1];return r[0]=t[0]*n+t[4]*s+t[12],r[1]=t[1]*n+t[5]*s+t[13],r}var Qf=p(()=>{});function X1(r,e,t){let n=e[0],s=e[1],i=t[3]*n+t[7]*s||1;return r[0]=(t[0]*n+t[4]*s)/i,r[1]=(t[1]*n+t[5]*s)/i,r}function Zf(r,e,t){let n=e[0],s=e[1],i=e[2],o=t[3]*n+t[7]*s+t[11]*i||1;return r[0]=(t[0]*n+t[4]*s+t[8]*i)/o,r[1]=(t[1]*n+t[5]*s+t[9]*i)/o,r[2]=(t[2]*n+t[6]*s+t[10]*i)/o,r}function J1(r,e,t){let n=e[0],s=e[1];return r[0]=t[0]*n+t[2]*s,r[1]=t[1]*n+t[3]*s,r[2]=e[2],r}function Y1(r,e,t){let n=e[0],s=e[1],i=e[2];return r[0]=t[0]*n+t[3]*s+t[6]*i,r[1]=t[1]*n+t[4]*s+t[7]*i,r[2]=t[2]*n+t[5]*s+t[8]*i,r[3]=e[3],r}var ed=p(()=>{});function Q1(){let r=new Yf(3);return Yf!==Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function TD(r){let e=r[0],t=r[1],n=r[2];return Math.sqrt(e*e+t*t+n*n)}function ag(r,e,t){let n=new Yf(3);return n[0]=r,n[1]=e,n[2]=t,n}function Z1(r,e){let t=e[0],n=e[1],s=e[2],i=t*t+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function cg(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function ya(r,e,t){let n=e[0],s=e[1],i=e[2],o=t[0],a=t[1],c=t[2];return r[0]=s*c-i*a,r[1]=i*o-n*c,r[2]=n*a-s*o,r}function td(r,e,t){let n=e[0],s=e[1],i=e[2],o=t[3]*n+t[7]*s+t[11]*i+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*s+t[8]*i+t[12])/o,r[1]=(t[1]*n+t[5]*s+t[9]*i+t[13])/o,r[2]=(t[2]*n+t[6]*s+t[10]*i+t[14])/o,r}function rd(r,e,t){let n=e[0],s=e[1],i=e[2];return r[0]=n*t[0]+s*t[3]+i*t[6],r[1]=n*t[1]+s*t[4]+i*t[7],r[2]=n*t[2]+s*t[5]+i*t[8],r}function ev(r,e,t){let n=t[0],s=t[1],i=t[2],o=t[3],a=e[0],c=e[1],u=e[2],l=s*u-i*c,f=i*a-n*u,d=n*c-s*a,h=s*d-i*f,m=i*l-n*d,b=n*f-s*l,g=o*2;return l*=g,f*=g,d*=g,h*=2,m*=2,b*=2,r[0]=a+l+h,r[1]=c+f+m,r[2]=u+d+b,r}function tv(r,e,t,n){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function rv(r,e,t,n){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function nv(r,e,t,n){let s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],r[0]=i[0]+t[0],r[1]=i[1]+t[1],r[2]=i[2]+t[2],r}function sv(r,e){let t=r[0],n=r[1],s=r[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt((t*t+n*n+s*s)*(i*i+o*o+a*a)),u=c&&cg(r,e)/c;return Math.acos(Math.min(Math.max(u,-1),1))}var iv,wa=p(()=>{q1();iv=TD});var ug,nd,su,ov=p(()=>{$1();ru();uo();wa();ed();ug=[0,0,0],su=class r extends Jf{static get ZERO(){return nd||(nd=new r(0,0,0),Object.freeze(nd)),nd}constructor(e=0,t=0,n=0){super(-0,-0,-0),arguments.length===1&&ma(e)?this.copy(e):(st.debug&&(Ve(e),Ve(t),Ve(n)),this[0]=e,this[1]=t,this[2]=n)}set(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return st.debug&&(Ve(e.x),Ve(e.y),Ve(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Ve(e)}angle(e){return sv(this,e)}cross(e){return ya(this,this,e),this.check()}rotateX({radians:e,origin:t=ug}){return tv(this,this,t,e),this.check()}rotateY({radians:e,origin:t=ug}){return rv(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=ug}){return nv(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return td(this,this,e),this.check()}transformAsVector(e){return Zf(this,this,e),this.check()}transformByMatrix3(e){return rd(this,this,e),this.check()}transformByMatrix2(e){return J1(this,this,e),this.check()}transformByQuaternion(e){return ev(this,this,e),this.check()}}});function av(r,e){if(r===e){let t=e[1],n=e[2],s=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=s}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function cv(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=l*o-a*u,d=-l*i+a*c,h=u*i-o*c,m=t*f+n*d+s*h;return m?(m=1/m,r[0]=f*m,r[1]=(-l*n+s*u)*m,r[2]=(a*n-s*o)*m,r[3]=d*m,r[4]=(l*t-s*c)*m,r[5]=(-a*t+s*i)*m,r[6]=h*m,r[7]=(-u*t+n*c)*m,r[8]=(o*t-n*i)*m,r):null}function uv(r){let e=r[0],t=r[1],n=r[2],s=r[3],i=r[4],o=r[5],a=r[6],c=r[7],u=r[8];return e*(u*i-o*c)+t*(-u*s+o*a)+n*(c*s-i*a)}function lg(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=t[0],h=t[1],m=t[2],b=t[3],g=t[4],y=t[5],x=t[6],T=t[7],_=t[8];return r[0]=d*n+h*o+m*u,r[1]=d*s+h*a+m*l,r[2]=d*i+h*c+m*f,r[3]=b*n+g*o+y*u,r[4]=b*s+g*a+y*l,r[5]=b*i+g*c+y*f,r[6]=x*n+T*o+_*u,r[7]=x*s+T*a+_*l,r[8]=x*i+T*c+_*f,r}function lv(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=t[0],h=t[1];return r[0]=n,r[1]=s,r[2]=i,r[3]=o,r[4]=a,r[5]=c,r[6]=d*n+h*o+u,r[7]=d*s+h*a+l,r[8]=d*i+h*c+f,r}function fv(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=Math.sin(t),h=Math.cos(t);return r[0]=h*n+d*o,r[1]=h*s+d*a,r[2]=h*i+d*c,r[3]=h*o-d*n,r[4]=h*a-d*s,r[5]=h*c-d*i,r[6]=u,r[7]=l,r[8]=f,r}function fg(r,e,t){let n=t[0],s=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=s*e[3],r[4]=s*e[4],r[5]=s*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function dv(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t+t,a=n+n,c=s+s,u=t*o,l=n*o,f=n*a,d=s*o,h=s*a,m=s*c,b=i*o,g=i*a,y=i*c;return r[0]=1-f-m,r[3]=l-y,r[6]=d+g,r[1]=l+y,r[4]=1-u-m,r[7]=h-b,r[2]=d-g,r[5]=h+b,r[8]=1-u-f,r}var dg=p(()=>{});function vD(){return sd||(sd=new qn([0,0,0,0,0,0,0,0,0]),Object.freeze(sd)),sd}function ID(){return id||(id=new qn,Object.freeze(id)),id}var hg,AD,qn,sd,id,hv=p(()=>{ig();uo();ed();dg();Qf();wa();(function(r){r[r.COL0ROW0=0]="COL0ROW0",r[r.COL0ROW1=1]="COL0ROW1",r[r.COL0ROW2=2]="COL0ROW2",r[r.COL1ROW0=3]="COL1ROW0",r[r.COL1ROW1=4]="COL1ROW1",r[r.COL1ROW2=5]="COL1ROW2",r[r.COL2ROW0=6]="COL2ROW0",r[r.COL2ROW1=7]="COL2ROW1",r[r.COL2ROW2=8]="COL2ROW2"})(hg||(hg={}));AD=Object.freeze([1,0,0,0,1,0,0,0,1]),qn=class extends ga{static get IDENTITY(){return ID()}static get ZERO(){return vD()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return hg}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(AD)}fromObject(e){return this.check()}fromQuaternion(e){return dv(this,e),this.check()}fromMatrix4(e){return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])}set(e,t,n,s,i,o,a,c,u){return this[0]=e,this[1]=t,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=u,this.check()}setRowMajor(e,t,n,s,i,o,a,c,u){return this[0]=e,this[1]=s,this[2]=a,this[3]=t,this[4]=i,this[5]=c,this[6]=n,this[7]=o,this[8]=u,this.check()}determinant(){return uv(this)}transpose(){return av(this,this),this.check()}invert(){return cv(this,this),this.check()}multiplyLeft(e){return lg(this,e,this),this.check()}multiplyRight(e){return lg(this,this,e),this.check()}rotate(e){return fv(this,this,e),this.check()}scale(e){return Array.isArray(e)?fg(this,this,e):fg(this,this,[e,e]),this.check()}translate(e){return lv(this,this,e),this.check()}transform(e,t){let n;switch(e.length){case 2:n=K1(t||[-0,-0],e,this);break;case 3:n=rd(t||[-0,-0,-0],e,this);break;case 4:n=Y1(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ba(n,e.length),n}},id=null});function SD(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function pv(r,e){if(r===e){let t=e[1],n=e[2],s=e[3],i=e[6],o=e[7],a=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=i,r[11]=e[14],r[12]=s,r[13]=o,r[14]=a}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function mv(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=e[9],d=e[10],h=e[11],m=e[12],b=e[13],g=e[14],y=e[15],x=t*a-n*o,T=t*c-s*o,_=t*u-i*o,v=n*c-s*a,I=n*u-i*a,N=s*u-i*c,K=l*b-f*m,ne=l*g-d*m,be=l*y-h*m,ke=f*g-d*b,Ne=f*y-h*b,ue=d*y-h*g,oe=x*ue-T*Ne+_*ke+v*be-I*ne+N*K;return oe?(oe=1/oe,r[0]=(a*ue-c*Ne+u*ke)*oe,r[1]=(s*Ne-n*ue-i*ke)*oe,r[2]=(b*N-g*I+y*v)*oe,r[3]=(d*I-f*N-h*v)*oe,r[4]=(c*be-o*ue-u*ne)*oe,r[5]=(t*ue-s*be+i*ne)*oe,r[6]=(g*_-m*N-y*T)*oe,r[7]=(l*N-d*_+h*T)*oe,r[8]=(o*Ne-a*be+u*K)*oe,r[9]=(n*be-t*Ne-i*K)*oe,r[10]=(m*I-b*_+y*x)*oe,r[11]=(f*_-l*I-h*x)*oe,r[12]=(a*ne-o*ke-c*K)*oe,r[13]=(t*ke-n*ne+s*K)*oe,r[14]=(b*T-m*v-g*x)*oe,r[15]=(l*v-f*T+d*x)*oe,r):null}function bv(r){let e=r[0],t=r[1],n=r[2],s=r[3],i=r[4],o=r[5],a=r[6],c=r[7],u=r[8],l=r[9],f=r[10],d=r[11],h=r[12],m=r[13],b=r[14],g=r[15],y=e*o-t*i,x=e*a-n*i,T=t*a-n*o,_=u*m-l*h,v=u*b-f*h,I=l*b-f*m,N=e*I-t*v+n*_,K=i*I-o*v+a*_,ne=u*T-l*x+f*y,be=h*T-m*x+b*y;return c*N-s*K+g*ne-d*be}function pg(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],d=e[9],h=e[10],m=e[11],b=e[12],g=e[13],y=e[14],x=e[15],T=t[0],_=t[1],v=t[2],I=t[3];return r[0]=T*n+_*a+v*f+I*b,r[1]=T*s+_*c+v*d+I*g,r[2]=T*i+_*u+v*h+I*y,r[3]=T*o+_*l+v*m+I*x,T=t[4],_=t[5],v=t[6],I=t[7],r[4]=T*n+_*a+v*f+I*b,r[5]=T*s+_*c+v*d+I*g,r[6]=T*i+_*u+v*h+I*y,r[7]=T*o+_*l+v*m+I*x,T=t[8],_=t[9],v=t[10],I=t[11],r[8]=T*n+_*a+v*f+I*b,r[9]=T*s+_*c+v*d+I*g,r[10]=T*i+_*u+v*h+I*y,r[11]=T*o+_*l+v*m+I*x,T=t[12],_=t[13],v=t[14],I=t[15],r[12]=T*n+_*a+v*f+I*b,r[13]=T*s+_*c+v*d+I*g,r[14]=T*i+_*u+v*h+I*y,r[15]=T*o+_*l+v*m+I*x,r}function gv(r,e,t){let n=t[0],s=t[1],i=t[2],o,a,c,u,l,f,d,h,m,b,g,y;return e===r?(r[12]=e[0]*n+e[4]*s+e[8]*i+e[12],r[13]=e[1]*n+e[5]*s+e[9]*i+e[13],r[14]=e[2]*n+e[6]*s+e[10]*i+e[14],r[15]=e[3]*n+e[7]*s+e[11]*i+e[15]):(o=e[0],a=e[1],c=e[2],u=e[3],l=e[4],f=e[5],d=e[6],h=e[7],m=e[8],b=e[9],g=e[10],y=e[11],r[0]=o,r[1]=a,r[2]=c,r[3]=u,r[4]=l,r[5]=f,r[6]=d,r[7]=h,r[8]=m,r[9]=b,r[10]=g,r[11]=y,r[12]=o*n+l*s+m*i+e[12],r[13]=a*n+f*s+b*i+e[13],r[14]=c*n+d*s+g*i+e[14],r[15]=u*n+h*s+y*i+e[15]),r}function yv(r,e,t){let n=t[0],s=t[1],i=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*s,r[5]=e[5]*s,r[6]=e[6]*s,r[7]=e[7]*s,r[8]=e[8]*i,r[9]=e[9]*i,r[10]=e[10]*i,r[11]=e[11]*i,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function wv(r,e,t,n){let s=n[0],i=n[1],o=n[2],a=Math.sqrt(s*s+i*i+o*o),c,u,l,f,d,h,m,b,g,y,x,T,_,v,I,N,K,ne,be,ke,Ne,ue,oe,xe;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,u=Math.sin(t),c=Math.cos(t),l=1-c,f=e[0],d=e[1],h=e[2],m=e[3],b=e[4],g=e[5],y=e[6],x=e[7],T=e[8],_=e[9],v=e[10],I=e[11],N=s*s*l+c,K=i*s*l+o*u,ne=o*s*l-i*u,be=s*i*l-o*u,ke=i*i*l+c,Ne=o*i*l+s*u,ue=s*o*l+i*u,oe=i*o*l-s*u,xe=o*o*l+c,r[0]=f*N+b*K+T*ne,r[1]=d*N+g*K+_*ne,r[2]=h*N+y*K+v*ne,r[3]=m*N+x*K+I*ne,r[4]=f*be+b*ke+T*Ne,r[5]=d*be+g*ke+_*Ne,r[6]=h*be+y*ke+v*Ne,r[7]=m*be+x*ke+I*Ne,r[8]=f*ue+b*oe+T*xe,r[9]=d*ue+g*oe+_*xe,r[10]=h*ue+y*oe+v*xe,r[11]=m*ue+x*oe+I*xe,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function xv(r,e,t){let n=Math.sin(t),s=Math.cos(t),i=e[4],o=e[5],a=e[6],c=e[7],u=e[8],l=e[9],f=e[10],d=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=i*s+u*n,r[5]=o*s+l*n,r[6]=a*s+f*n,r[7]=c*s+d*n,r[8]=u*s-i*n,r[9]=l*s-o*n,r[10]=f*s-a*n,r[11]=d*s-c*n,r}function Tv(r,e,t){let n=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],u=e[8],l=e[9],f=e[10],d=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=i*s-u*n,r[1]=o*s-l*n,r[2]=a*s-f*n,r[3]=c*s-d*n,r[8]=i*n+u*s,r[9]=o*n+l*s,r[10]=a*n+f*s,r[11]=c*n+d*s,r}function _v(r,e,t){let n=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],u=e[4],l=e[5],f=e[6],d=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=i*s+u*n,r[1]=o*s+l*n,r[2]=a*s+f*n,r[3]=c*s+d*n,r[4]=u*s-i*n,r[5]=l*s-o*n,r[6]=f*s-a*n,r[7]=d*s-c*n,r}function Av(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t+t,a=n+n,c=s+s,u=t*o,l=n*o,f=n*a,d=s*o,h=s*a,m=s*c,b=i*o,g=i*a,y=i*c;return r[0]=1-f-m,r[1]=l+y,r[2]=d-g,r[3]=0,r[4]=l-y,r[5]=1-u-m,r[6]=h+b,r[7]=0,r[8]=d+g,r[9]=h-b,r[10]=1-u-f,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function vv(r,e,t,n,s,i,o){let a=1/(t-e),c=1/(s-n),u=1/(i-o);return r[0]=i*2*a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i*2*c,r[6]=0,r[7]=0,r[8]=(t+e)*a,r[9]=(s+n)*c,r[10]=(o+i)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=o*i*2*u,r[15]=0,r}function ED(r,e,t,n,s){let i=1/Math.tan(e/2);if(r[0]=i/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,s!=null&&s!==1/0){let o=1/(n-s);r[10]=(s+n)*o,r[14]=2*s*n*o}else r[10]=-1,r[14]=-2*n;return r}function LD(r,e,t,n,s,i,o){let a=1/(e-t),c=1/(n-s),u=1/(i-o);return r[0]=-2*a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*c,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(e+t)*a,r[13]=(s+n)*c,r[14]=(o+i)*u,r[15]=1,r}function Ev(r,e,t,n){let s,i,o,a,c,u,l,f,d,h,m=e[0],b=e[1],g=e[2],y=n[0],x=n[1],T=n[2],_=t[0],v=t[1],I=t[2];return Math.abs(m-_)<1e-6&&Math.abs(b-v)<1e-6&&Math.abs(g-I)<1e-6?SD(r):(f=m-_,d=b-v,h=g-I,s=1/Math.sqrt(f*f+d*d+h*h),f*=s,d*=s,h*=s,i=x*h-T*d,o=T*f-y*h,a=y*d-x*f,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=d*a-h*o,u=h*i-f*a,l=f*o-d*i,s=Math.sqrt(c*c+u*u+l*l),s?(s=1/s,c*=s,u*=s,l*=s):(c=0,u=0,l=0),r[0]=i,r[1]=c,r[2]=f,r[3]=0,r[4]=o,r[5]=u,r[6]=d,r[7]=0,r[8]=a,r[9]=l,r[10]=h,r[11]=0,r[12]=-(i*m+o*b+a*g),r[13]=-(c*m+u*b+l*g),r[14]=-(f*m+d*b+h*g),r[15]=1,r)}function mg(r){if(r.length!==16||Array.from(r).some(s=>!Number.isFinite(s))||r[3]!==0||r[7]!==0||r[11]!==0||r[15]!==1)throw new RangeError("Expected a finite affine matrix");let e=[Math.hypot(r[0],r[1],r[2]),Math.hypot(r[4],r[5],r[6]),Math.hypot(r[8],r[9],r[10])];if(e.some(s=>s===0||!Number.isFinite(s)))throw new RangeError("Singular transform");let t=Array.from({length:9},(s,i)=>r[Math.floor(i/3)*4+i%3]/e[Math.floor(i/3)]);for(let[s,i]of[[0,3],[0,6],[3,6]])if(Math.abs(t[s]*t[i]+t[s+1]*t[i+1]+t[s+2]*t[i+2])>1e-7)throw new RangeError("Sheared transforms do not have a TRS decomposition");if(t[0]*(t[4]*t[8]-t[5]*t[7])-t[3]*(t[1]*t[8]-t[2]*t[7])+t[6]*(t[1]*t[5]-t[2]*t[4])<0){e[0]=-e[0];for(let s=0;s<3;s++)t[s]=-t[s]}return{rotation:t,scale:e,translation:[r[12],r[13],r[14]]}}var Iv,Sv,od=p(()=>{Iv=ED;Sv=LD});function Lv(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Bv(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function Fv(r){let e=r[0],t=r[1],n=r[2],s=r[3];return Math.sqrt(e*e+t*t+n*n+s*s)}function Ov(r){let e=r[0],t=r[1],n=r[2],s=r[3];return e*e+t*t+n*n+s*s}function Mv(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t*t+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=s*o,r[3]=i*o,r}function Dv(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function Rv(r,e,t,n){let s=e[0],i=e[1],o=e[2],a=e[3];return r[0]=s+n*(t[0]-s),r[1]=i+n*(t[1]-i),r[2]=o+n*(t[2]-o),r[3]=a+n*(t[3]-a),r}function kv(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3];return r[0]=t[0]*n+t[4]*s+t[8]*i+t[12]*o,r[1]=t[1]*n+t[5]*s+t[9]*i+t[13]*o,r[2]=t[2]*n+t[6]*s+t[10]*i+t[14]*o,r[3]=t[3]*n+t[7]*s+t[11]*i+t[15]*o,r}var ad=p(()=>{});function DD(){return cd||(cd=new ni([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(cd)),cd}function RD(){return ud||(ud=new ni,Object.freeze(ud)),ud}function Nv(r){if(r>Math.PI*2)throw Error("expected radians")}function kD(r,e,t,n,s,i){let o=2*i/(t-e),a=2*i/(s-n),c=(t+e)/(t-e),u=(s+n)/(s-n),l=-1,f=-1,d=-2*i;return r[0]=o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=c,r[9]=u,r[10]=l,r[11]=f,r[12]=0,r[13]=0,r[14]=d,r[15]=0,r}var yg,FD,OD,bg,gg,MD,ni,cd,ud,Cv=p(()=>{ig();od();uo();ed();od();Qf();wa();ad();(function(r){r[r.COL0ROW0=0]="COL0ROW0",r[r.COL0ROW1=1]="COL0ROW1",r[r.COL0ROW2=2]="COL0ROW2",r[r.COL0ROW3=3]="COL0ROW3",r[r.COL1ROW0=4]="COL1ROW0",r[r.COL1ROW1=5]="COL1ROW1",r[r.COL1ROW2=6]="COL1ROW2",r[r.COL1ROW3=7]="COL1ROW3",r[r.COL2ROW0=8]="COL2ROW0",r[r.COL2ROW1=9]="COL2ROW1",r[r.COL2ROW2=10]="COL2ROW2",r[r.COL2ROW3=11]="COL2ROW3",r[r.COL3ROW0=12]="COL3ROW0",r[r.COL3ROW1=13]="COL3ROW1",r[r.COL3ROW2=14]="COL3ROW2",r[r.COL3ROW3=15]="COL3ROW3"})(yg||(yg={}));FD=45*Math.PI/180,OD=1,bg=.1,gg=500,MD=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ni=class extends ga{static get IDENTITY(){return RD()}static get ZERO(){return DD()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return yg}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,n,s,i,o,a,c,u,l,f,d,h,m,b,g){return this[0]=e,this[1]=t,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=u,this[9]=l,this[10]=f,this[11]=d,this[12]=h,this[13]=m,this[14]=b,this[15]=g,this.check()}setRowMajor(e,t,n,s,i,o,a,c,u,l,f,d,h,m,b,g){return this[0]=e,this[1]=i,this[2]=u,this[3]=h,this[4]=t,this[5]=o,this[6]=l,this[7]=m,this[8]=n,this[9]=a,this[10]=f,this[11]=b,this[12]=s,this[13]=c,this[14]=d,this[15]=g,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(MD)}fromObject(e){return this.check()}fromQuaternion(e){return Av(this,e),this.check()}fromMatrix3(e){return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1)}frustum(e){let{left:t,right:n,bottom:s,top:i,near:o=bg,far:a=gg}=e;return a===1/0?kD(this,t,n,s,i,o):vv(this,t,n,s,i,o,a),this.check()}lookAt(e){let{eye:t,center:n=[0,0,0],up:s=[0,1,0]}=e;return Ev(this,t,n,s),this.check()}ortho(e){let{left:t,right:n,bottom:s,top:i,near:o=bg,far:a=gg}=e;return Sv(this,t,n,s,i,o,a),this.check()}orthographic(e){let{fovy:t=FD,aspect:n=OD,focalDistance:s=1,near:i=bg,far:o=gg}=e;Nv(t);let a=t/2,c=s*Math.tan(a),u=c*n;return this.ortho({left:-u,right:u,bottom:-c,top:c,near:i,far:o})}perspective(e){let{fovy:t=45*Math.PI/180,aspect:n=1,near:s=.1,far:i=500}=e;return Nv(t),Iv(this,t,n,s,i),this.check()}determinant(){return bv(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){let{rotation:n,scale:s}=mg(this);if(e=e||new Array(16),t)for(let i=0;i<3;i++)t[i]=s[i];for(let i=0;i<16;i++)e[i]=0;for(let i=0;i<9;i++)e[Math.floor(i/3)*4+i%3]=n[i];return e[15]=1,e}getRotationMatrix3(e,t){let{rotation:n,scale:s}=mg(this);if(e=e||new Array(9),t)for(let i=0;i<3;i++)t[i]=s[i];for(let i=0;i<9;i++)e[i]=n[i];return e}transpose(){return pv(this,this),this.check()}invert(){return mv(this,this),this.check()}multiplyLeft(e){return pg(this,e,this),this.check()}multiplyRight(e){return pg(this,this,e),this.check()}rotateX(e){return xv(this,this,e),this.check()}rotateY(e){return Tv(this,this,e),this.check()}rotateZ(e){return _v(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return wv(this,this,e,t),this.check()}scale(e){return yv(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return gv(this,this,e),this.check()}transform(e,t){return e.length===4?(t=kv(t||[-0,-0,-0,-0],e,this),ba(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){let{length:n}=e,s;switch(n){case 2:s=H1(t||[-0,-0],e,this);break;case 3:s=td(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ba(s,e.length),s}transformAsVector(e,t){let n;switch(e.length){case 2:n=X1(t||[-0,-0],e,this);break;case 3:n=Zf(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ba(n,e.length),n}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,n){return this.identity().translate([e,t,n])}}});function Uv(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function wg(r,e,t){t=t*.5;let n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function xg(r,e,t){let n=e[0],s=e[1],i=e[2],o=e[3],a=t[0],c=t[1],u=t[2],l=t[3];return r[0]=n*l+o*a+s*u-i*c,r[1]=s*l+o*c+i*a-n*u,r[2]=i*l+o*u+n*c-s*a,r[3]=o*l-n*a-s*c-i*u,r}function Pv(r,e,t){t*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return r[0]=n*c+o*a,r[1]=s*c+i*a,r[2]=i*c-s*a,r[3]=o*c-n*a,r}function Vv(r,e,t){t*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return r[0]=n*c-i*a,r[1]=s*c+o*a,r[2]=i*c+n*a,r[3]=o*c-s*a,r}function jv(r,e,t){t*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return r[0]=n*c+s*a,r[1]=s*c-n*a,r[2]=i*c+o*a,r[3]=o*c-i*a,r}function Gv(r,e){let t=e[0],n=e[1],s=e[2];return r[0]=t,r[1]=n,r[2]=s,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-s*s)),r}function Tg(r,e,t,n){let s=e[0],i=e[1],o=e[2],a=e[3],c=t[0],u=t[1],l=t[2],f=t[3],d,h,m,b,g;return d=s*c+i*u+o*l+a*f,d<0&&(d=-d,c=-c,u=-u,l=-l,f=-f),1-d>1e-6?(h=Math.acos(d),g=Math.sin(h),m=Math.sin((1-n)*h)/g,b=Math.sin(n*h)/g):(m=1-n,b=n),r[0]=m*s+b*c,r[1]=m*i+b*u,r[2]=m*o+b*l,r[3]=m*a+b*f,r}function zv(r,e){let t=e[0],n=e[1],s=e[2],i=e[3],o=t*t+n*n+s*s+i*i,a=o?1/o:0;return r[0]=-t*a,r[1]=-n*a,r[2]=-s*a,r[3]=i*a,r}function Wv(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function $v(r,e){let t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[i*3+i]-e[o*3+o]+1),r[s]=.5*n,n=.5/n,r[3]=(e[i*3+o]-e[o*3+i])*n,r[i]=(e[i*3+s]+e[s*3+i])*n,r[o]=(e[o*3+s]+e[s*3+o])*n}return r}function Zv(r,e,t,n){if(e.length!==4||t.length!==4||[...Array.from(e),...Array.from(t),n].some(d=>!Number.isFinite(d)))throw new RangeError("Expected finite quaternions and step");if(e.length!==4||n<0)throw new RangeError("Expected quaternions and a nonnegative step");let s=Math.max(...Array.from(e,Math.abs)),i=Math.max(...Array.from(t,Math.abs));if(!s||!i)throw new RangeError("Zero quaternion");let o=Array.from(e,d=>d/s),a=Array.from(t,d=>d/i),c=Math.hypot(...o),u=Math.hypot(...a);for(let d=0;d<4;d++)o[d]/=c,a[d]/=u;let l=o.reduce((d,h,m)=>d+h*a[m],0),f=2*Math.acos(Math.min(1,Math.abs(l)));if(r.length<4)throw new RangeError("Result buffer is too short");return Tg(r,o,a,f===0?0:Math.min(1,n/f)),r}var qv,Kv,Hv,Xv,Jv,Yv,ND,Qv,ld=p(()=>{wa();ad();qv=Lv,Kv=Bv,Hv=Dv,Xv=Rv,Jv=Fv,Yv=Ov,ND=Mv,Qv=(function(){let r=Q1(),e=ag(1,0,0),t=ag(0,1,0);return function(n,s,i){let o=cg(s,i);return o<-.999999?(ya(r,e,s),iv(r)<1e-6&&ya(r,t,s),Z1(r,r),wg(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ya(r,s,i),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,ND(n,n))}})()});var iu,eI=p(()=>{ld();Xf();uo();ld();iu=class extends ri{constructor(e=0,t=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,t,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,n,s){return this[0]=e,this[1]=t,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return $v(this,e),this.check()}fromEuler(e){switch(this.identity(),e.order){case"xyz":return this.rotateX(e.x).rotateY(e.y).rotateZ(e.z);case"yxz":return this.rotateY(e.y).rotateX(e.x).rotateZ(e.z);case"zxy":return this.rotateZ(e.z).rotateX(e.x).rotateY(e.y);case"zyx":return this.rotateZ(e.z).rotateY(e.y).rotateX(e.x);case"yzx":return this.rotateY(e.y).rotateZ(e.z).rotateX(e.x);case"xzy":return this.rotateX(e.x).rotateZ(e.z).rotateY(e.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(e,t){return wg(this,e,t),this.check()}rotateTowards(e,t){return Zv(this,this,e,t)}identity(){return Uv(this),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=Ve(e)}get y(){return this[1]}set y(e){this[1]=Ve(e)}get z(){return this[2]}set z(e){this[2]=Ve(e)}get w(){return this[3]}set w(e){this[3]=Ve(e)}len(){return Jv(this)}lengthSquared(){return Yv(this)}dot(e){return Hv(this,e)}rotationTo(e,t){return Qv(this,e,t),this.check()}add(e){return qv(this,this,e),this.check()}calculateW(){return Gv(this,this),this.check()}conjugate(){return Wv(this,this),this.check()}invert(){return zv(this,this),this.check()}lerp(e,t,n){return n===void 0?this.lerp(this,e,t):(Xv(this,e,t,n),this.check())}multiplyRight(e){return xg(this,this,e),this.check()}multiplyLeft(e){return xg(this,e,this),this.check()}normalize(){let e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,e===0&&(this[3]=1),this.check()}rotateX(e){return Pv(this,this,e),this.check()}rotateY(e){return Vv(this,this,e),this.check()}rotateZ(e){return jv(this,this,e),this.check()}scale(e){return Kv(this,this,e),this.check()}slerp(e,t,n){let s,i,o;return arguments.length===2?(s=this,i=e,o=t):(s=e,i=t,o=n),Tg(this,s,i,o),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}});function fd(){return xa??Uint16Array}var xa,tI=p(()=>{xa=globalThis.Float16Array});var rI=p(()=>{tI()});var nI=p(()=>{rI()});var sI=p(()=>{dg()});var iI=p(()=>{od()});var oI=p(()=>{ld()});var aI=p(()=>{Qf()});var cI=p(()=>{wa()});var uI=p(()=>{ad()});var dd=p(()=>{ov();hv();Cv();eI();G1();nI();sI();iI();oI();aI();cI();uI()});var Be=p(()=>{"use strict";fA();Km();Hm();Nf();vA();db();db();B1();D1();Jb();Yb();k1();N1();C1();P1();V1();j1()});function $D(r,e="float32"){return r instanceof Date?"date-millisecond":typeof r=="number"?e:typeof r=="boolean"?"bool":typeof r=="string"?"utf8":"null"}function ou(r){let e=_g(r);return e!=="null"?{type:e,nullable:!1}:r.length>0?(e=$D(r[0]),{type:e,nullable:!0}):{type:"null",nullable:!0}}function _g(r){if(typeof Float16Array<"u"&&r instanceof Float16Array)return"float16";switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var hd=p(()=>{"use strict"});function pd(r){return{fields:r.fields.map(e=>lo(e)),metadata:hI(r.metadata)}}function hI(r){return Object.fromEntries(r)}function Ag(r){return r?new Map(Object.entries(r)):new Map}function lo(r){return{name:r.name,type:pI(r.type),nullable:r.nullable,metadata:hI(r.metadata)}}function Kn(r,e){return new O(r.name,md(r.type,e),r.nullable,Ag(r.metadata))}function pI(r){if(lI(r,"BinaryView"))return"binary-view";if(lI(r,"Utf8View"))return"utf8-view";if(qD(r,"LargeList"))return{type:"large-list",children:[lo(r.valueField)]};switch(r.constructor){case Ce:return"null";case Ct:return"binary";case Pt:return{type:"fixed-size-binary",byteWidth:r.byteWidth};case lt:return"bool";case Oe:let e=r;return`${e.isSigned?"":"u"}int${e.bitWidth}`;case Zt:return"int8";case er:return"int16";case Pe:return"int32";case tr:return"int64";case rr:return"uint8";case nr:return"uint16";case vt:return"uint32";case Cr:return"uint64";case ct:switch(r.precision){case le.HALF:return"float16";case le.SINGLE:return"float32";case le.DOUBLE:return"float64";default:return"float16"}case Ur:return"float16";case It:return"float32";case sr:return"float64";case ut:return"utf8";case Ut:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case Et:return r.unit===ye.DAY?"date-day":"date-millisecond";case us:return"date-day";case ls:return"date-millisecond";case tt:switch(r.unit){case L.SECOND:return"time-second";case L.MILLISECOND:return"time-millisecond";case L.MICROSECOND:return"time-microsecond";case L.NANOSECOND:return"time-nanosecond";default:return"time-second"}case ds:return"time-millisecond";case fs:return"time-second";case hs:return"time-microsecond";case ps:return"time-nanosecond";case rt:switch(r.unit){case L.SECOND:return"timestamp-second";case L.MILLISECOND:return"timestamp-millisecond";case L.MICROSECOND:return"timestamp-microsecond";case L.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case ms:return"timestamp-second";case tn:return"timestamp-millisecond";case bs:return"timestamp-microsecond";case gs:return"timestamp-nanosecond";case ft:switch(r.unit){case ae.DAY_TIME:return"interval-daytime";case ae.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case ys:return"interval-daytime";case ws:return"interval-yearmonth";case dt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(b=>lo(b))};case je:let l=r.valueField;return{type:"list",children:[lo(l)]};case Fe:let f=r;return{type:"fixed-size-list",listSize:f.listSize,children:[lo(f.children[0])]};case pe:return{type:"struct",children:r.children.map(b=>lo(b))};case xs:case vn:let h=r;return{type:h instanceof vn?"dense-union":"sparse-union",typeIds:h.typeIds,children:h.children.map(b=>lo(b)),typeIdToChildIndex:{...h.typeIdToChildIndex}};case Ge:let m=r;return{type:"dictionary",id:m.id,indices:KD(m.indices),dictionary:pI(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function md(r,e){if(typeof r=="object")switch(r.type){case"decimal":return new Ut(r.scale,r.precision,r.bitWidth);case"map":{let t=r.children.map(n=>Kn(n,e));return new dt(t[0],r.keysSorted)}case"list":{let t=Kn(r.children[0],e);return new je(t)}case"large-list":{let t=Kn(r.children[0],e),n=au("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(t)}case"fixed-size-list":{let t=Kn(r.children[0],e);return new Fe(r.listSize,t)}case"fixed-size-binary":return new Pt(r.byteWidth);case"struct":{let t=r.children.map(n=>Kn(n,e));return new pe(t)}case"sparse-union":case"dense-union":{let t=r.children.map(n=>Kn(n,e));return r.type==="dense-union"?new vn(r.typeIds,t):new xs(r.typeIds,t)}case"dictionary":return new Ge(md(r.dictionary,e),XD(r.indices),r.id,r.isOrdered);default:throw new Error("array type not supported")}switch(r){case"null":return new Ce;case"binary":return fI("BinaryView",new Ct,e);case"binary-view":return dI("BinaryView");case"bool":return new lt;case"int8":return new Zt;case"int16":return new er;case"int32":return new Pe;case"int64":return new tr;case"uint8":return new rr;case"uint16":return new nr;case"uint32":return new vt;case"uint64":return new Cr;case"float16":return new Ur;case"float32":return new It;case"float64":return new sr;case"utf8":return fI("Utf8View",new ut,e);case"utf8-view":return dI("Utf8View");case"date-day":return new us;case"date-millisecond":return new ls;case"time-second":return new fs;case"time-millisecond":return new ds;case"time-microsecond":return new hs;case"time-nanosecond":return new ps;case"timestamp-second":return new ms;case"timestamp-millisecond":return new tn;case"timestamp-microsecond":return new bs;case"timestamp-nanosecond":return new gs;case"interval-daytime":return new ys;case"interval-yearmonth":return new ws;default:throw new Error("array type not supported")}}function au(r){return ln[r]}function lI(r,e){let t=au(e);if(t&&r instanceof t)return!0;let n=E;return!!(e==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(r)}function qD(r,e){let t=au(e);return!!(t&&r instanceof t)}function fI(r,e,t){let n=t?.viewTypes||"never";if(n==="never")return e;let s=au(r);if(s)return new s;if(n==="require")throw new Error(`${r} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return e}function dI(r){let e=au(r);if(!e)throw new Error(`${r} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new e}function KD(r){if(r instanceof Oe){let t=`${r.isSigned?"int":"uint"}${r.bitWidth}`;if(HD(t))return t}switch(r.constructor){case Zt:return"int8";case er:return"int16";case Pe:return"int32";case rr:return"uint8";case nr:return"uint16";case vt:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${r.constructor.name}`)}}function HD(r){return["int8","int16","int32","uint8","uint16","uint32"].includes(r)}function XD(r){switch(r){case"int8":return new Zt;case"int16":return new er;case"int32":return new Pe;case"uint8":return new rr;case"uint16":return new nr;case"uint32":return new vt;default:throw new Error(`schema dictionary index type not supported: ${r}`)}}var bd=p(()=>{"use strict";zn()});function Lr(r){let e=r?.POSITION;if(!e||!("value"in e)||!e.value.length)return null;let t=1/0,n=1/0,s=1/0,i=-1/0,o=-1/0,a=-1/0,c=e.value,u=c.length;for(let l=0;l<u;l+=3){let f=c[l],d=c[l+1],h=c[l+2];t=f<t?f:t,n=d<n?d:n,s=h<s?h:s,i=f>i?f:i,o=d>o?d:o,a=h>a?h:a}return[[t,n,s],[i,o,a]]}var vg=p(()=>{"use strict"});function Ig(r){let e=fd();return new e(r)}function si(r){return!!(xa&&r instanceof xa)}function Sg(r,e,t){si(r)?r[e]=t:r[e]=mI(t)}function Eg(r,e){return si(r)?r[e]:JD(r[e])}function cu(r){return si(r)?new Uint16Array(r.buffer,r.byteOffset,r.length):r}function mI(r){if(!Number.isFinite(r))return r===1/0?31744:r===-1/0?64512:32256;let e=r<0||Object.is(r,-0)?32768:0,t=Math.abs(r);if(t===0)return e;if(t>=65520)return e|31744;if(t>=65504)return e|31743;let n=Math.floor(Math.log2(t));if(n<-14)return e|Math.round(t/2**-24);let s=n+15,i=Math.round((t/2**n-1)*1024);return i===1024?e|s+1<<10:e|s<<10|i}function JD(r){let e=r&32768?-1:1,t=r>>10&31,n=r&1023;return t===0?e*n*2**-24:t===31?n?NaN:e*(1/0):e*(1+n/1024)*2**(t-15)}var bI=p(()=>{"use strict";dd()});var gd,Lg,gI=p(()=>{"use strict";zn();gd=new Q([new O("POSITION",new Fe(3,new O("value",new It,!1)),!1)]),Lg=new Q([...gd.fields,new O("indices",new je(new O("item",new vt,!1)),!0)])});var uu=p(()=>{"use strict";bI();gI()});function yI(r){return r.type instanceof Fe?r.type.listSize:1}function Bg(r,e,t){let n=YD(r,e,t);return new B([n])}function YD(r,e,t){let n=QD(r,e,t),s=n.children[0].type,i=t==="float16"&&si(r)?cu(r):r,o={[re.DATA]:i},a=new G(s,0,i.length,0,o);return new G(n,0,i.length/e,0,void 0,[a])}function QD(r,e,t){let n=t||ou(r).type,s=md(n);return new Fe(e,new O("value",s,!1))}var Fg=p(()=>{"use strict";uu();zn();hd();bd()});function ii(r,e){switch(e){case"columnar-table":return ZD(r);case"arrow-table":return eR(r);default:throw new Error(e)}}function ZD(r){let e={},t=TI(r);for(let[n,s]of Object.entries(r.attributes))e[n]=s.value;return{shape:"columnar-table",schema:r.schema,data:e,topology:r.topology,indices:t?r.indices:void 0}}function eR(r,e){return xI(r.attributes,{schema:r.schema,topology:r.topology,mode:r.mode,boundingBox:r.header?.boundingBox,indices:TI(r)?r.indices:void 0})}function xI(r,e={}){let t=[],n={},s=rR(r);for(let c of s){let u=r[c],{value:l,size:f=1}=u,d=tR(l,f,u.componentType);if(n[c]=d,t.push(nR(e.schema,c,d,u.componentType)),c==="POSITION"&&e.indices?.value?.length){let h=Lg.fields.find(m=>m.name==="indices");n.indices=iR(e.indices.value,d.length,h.type),t.push(h)}}let i=new Q(t,oR(e)),o=n[s[0]]?.length===0?new me(i):new me(i,n);return{shape:"arrow-table",schema:pd(o.schema),data:o,topology:e.topology||"point-list",indices:e.indices}}function tR(r,e,t){if(t==="float16"){let n=si(r)?cu(r):r;if(e===1){let s=new G(new Ur,0,n.length,0,{[re.DATA]:n});return new B([s])}return Bg(r,e,t)}return e===1?sn(r):Bg(r,e)}function rR(r){let e=Object.keys(r),t=wI.filter(s=>s in r),n=e.filter(s=>!wI.includes(s));return[...t,...n]}function TI(r){return!!r.indices?.value?.length}function nR(r,e,t,n){if(e==="POSITION"&&sR(t)){let i=gd.fields[0],o=r?.fields.find(c=>c.name===e);if(!o?.metadata)return i;let a=new Map(i.metadata);for(let[c,u]of Object.entries(o.metadata))a.set(c,u);return new O(i.name,i.type,i.nullable,a)}let s=r?.fields.find(i=>i.name===e);if(n==="float16"){let i=new Map(Object.entries(s?.metadata||{}));return i.set("componentType","float16"),new O(e,t.type,!1,i)}if(s&&s.type.toString()!==t.type.toString()){let i=Kn(s);return new O(e,t.type,i.nullable,i.metadata)}return s?Kn(s):new O(e,t.type,!1)}function sR(r){return r.type instanceof Fe&&r.type.listSize===3&&r.type.children[0].type instanceof It}function iR(r,e,t){let n=t,s=r instanceof Uint32Array?r:Uint32Array.from(r),i=new Int32Array(e+1);e>0&&i.fill(s.length,1);let o=new Uint8Array(Math.ceil(e/8));e>0&&(o[0]=1);let a=new G(n.children[0].type,0,s.length,0,{[re.DATA]:s}),c=new G(n,0,e,Math.max(0,e-1),{[re.OFFSET]:i,[re.VALIDITY]:o},[a]);return new B([c])}function oR(r){let e={...r.schema?.metadata};return r.topology&&(e.topology||=r.topology),Number.isFinite(r.mode)&&(e.mode||=String(r.mode)),r.boundingBox&&(e.boundingBox||=JSON.stringify(r.boundingBox)),Ag(e)}var wI,_I=p(()=>{"use strict";uu();uu();zn();Fg();bd();wI=["POSITION"]});function bn(r){if(r.shape==="arrow-table")return aR(r);throw new Error(r.shape)}function aR(r){let e=r.data,t=pd(e.schema),n=t.fields,s={},i=[];for(let l of n){let{name:f}=l;if(f==="indices")continue;let d=e.getChild(f),h=yI(d),m=dR(d,h),b=uR(l.metadata),g=b.componentType==="float16"?hR(m):m,y=i.find(x=>x.data.length===d.data.length&&s[x.name].value.constructor===g.constructor&&x.data.every((T,_)=>AI(T,d.data[_])));s[f]={value:y?s[y.name].value:g,size:h,...b},y||i.push({name:f,data:d.data})}fR(t);let o=t.metadata.topology,a=pR(t),c=mR(e),u=s.POSITION?.transform?.type==="quantization"?cR(t)||Lr(s):Lr(s);return{schema:t,attributes:s,topology:o,mode:a,indices:c,header:{vertexCount:e.numRows,boundingBox:u??void 0}}}function cR(r){let e=r.metadata?.boundingBox;if(!e)return null;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===2&&t.every(n=>Array.isArray(n)&&n.length===3&&n.every(s=>typeof s=="number")))return t}catch{}return null}function uR(r={}){let e={};if(r.byteOffset!==void 0&&(e.byteOffset=Number(r.byteOffset)),r.byteStride!==void 0&&(e.byteStride=Number(r.byteStride)),r.normalized!==void 0&&(e.normalized=r.normalized==="true"),r.componentType==="float16"&&(e.componentType="float16"),r["loaders.gl.transform"])try{let t=JSON.parse(r["loaders.gl.transform"]);lR(t)&&(e.transform=t)}catch{}return e}function lR(r){if(!r||typeof r!="object"||!("type"in r))return!1;let e=r;return e.type==="octahedron"?Number.isInteger(e.bits)&&e.bits>=1&&e.bits<=30:e.type==="quantization"&&Number.isInteger(e.bits)&&e.bits>=1&&e.bits<=30&&Array.isArray(e.origin)&&e.origin.every(t=>typeof t=="number")&&typeof e.range=="number"}function fR(r){r.metadata||={},r.metadata.topology||="point-list",r.metadata.mode||="0"}function dR(r,e){if(!(r.type instanceof Fe))return r.toArray();let n=r.data[0].children[0].values.constructor,s=new n(r.length*e),i=0;for(let o of r.data){let a=o.children[0],c=o.length*e,u=a.offset||o.offset*e,l=u+c<=a.values.length?u:0,f=a.values.subarray(l,l+c);s.set(f,i),i+=c}return s}function hR(r){let e=Ig(r.length);for(let t=0;t<r.length;t++)Sg(e,t,Eg(r,t));return e}function pR(r){let e=Number(r.metadata?.mode);return Number.isFinite(e)?e:0}function mR(r){let e=r.getChild("indices");if(!e?.isValid(0))return;let t=e.data[0],n=t.valueOffsets,s=n[t.offset],i=n[t.offset+1];return{value:t.children[0].values.subarray(s,i),size:1}}function AI(r,e){let t=Object.values(e.buffers);return r.type.toString()===e.type.toString()&&r.offset===e.offset&&r.length===e.length&&r.nullCount===e.nullCount&&r.dictionary===e.dictionary&&Object.values(r.buffers).every((n,s)=>{let i=t[s];return n===i||!!(n&&i&&n.buffer===i.buffer&&n.byteOffset===i.byteOffset&&n.byteLength===i.byteLength)})&&r.children.length===e.children.length&&r.children.every((n,s)=>AI(n,e.children[s]))}var vI=p(()=>{"use strict";uu();zn();Fg();bd();vg()});function Og(r,e={}){return{fields:bR(r),metadata:e}}function yd(r,e,t){let n=e.componentType||_g(e.value),s=t||wd(e),i=e.size===1?n:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]};return{name:r,type:i,nullable:!1,metadata:s}}function bR(r){let e=[];for(let t in r){let n=r[t];e.push(yd(t,n))}return e}function wd(r){let e={};return"byteOffset"in r&&(e.byteOffset=r.byteOffset.toString(10)),"byteStride"in r&&(e.byteStride=r.byteStride.toString(10)),"normalized"in r&&(e.normalized=r.normalized.toString()),r.componentType&&(e.componentType=r.componentType),r.transform&&(e["loaders.gl.transform"]=JSON.stringify(r.transform)),e}var II=p(()=>{"use strict";hd()});var gn=p(()=>{"use strict";hd();vg();_I();vI();II()});function xd(r,e={}){let t={};for(let s in e)s!=="value"&&(t[s]=JSON.stringify(e[s]));let n=[];for(let s in r){let i=r[s],o=gR(s,i);n.push(o)}return{fields:n,metadata:t}}function gR(r,e){let t={};for(let i in e)i!=="value"&&(t[i]=JSON.stringify(e[i]));let{type:n}=ou(e.value);return e.size===1||e.size===void 0||(n={type:"fixed-size-list",listSize:e.size,children:[{name:"values",type:n}]}),{name:r,type:n,nullable:!1,metadata:t}}var Mg=p(()=>{"use strict";gn()});function EI(r){let e=new kg;r.indexOf(`\r
39
39
  `)!==-1&&(r=r.replace(/\r\n/g,`
40
40
  `)),r.indexOf(`\\
41
41
  `)!==-1&&(r=r.replace(/\\\n/g,""));let t=r.split(`
42
- `),n="",s="",i=0,o=[],a=typeof"".trimLeft=="function";for(let l=0,f=t.length;l<f;l++)if(n=t[l],n=a?n.trimLeft():n.trim(),i=n.length,i!==0&&(s=n.charAt(0),s!=="#"))if(s==="v"){let d=n.split(/\s+/);switch(d[0]){case"v":e.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),d.length>=7&&e.colors.push(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6]));break;case"vn":e.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":e.uvs.push(parseFloat(d[1]),parseFloat(d[2]));break;default:}}else if(s==="f"){let h=n.substr(1).trim().split(/\s+/),m=[];for(let g=0,y=h.length;g<y;g++){let x=h[g];if(x.length>0){let T=x.split("/");m.push(T)}}let b=m[0];for(let g=1,y=m.length-1;g<y;g++){let x=m[g],T=m[g+1];e.addFace(b[0],x[0],T[0],b[1],x[1],T[1],b[2],x[2],T[2])}}else if(s==="l"){let d=n.substring(1).trim().split(" "),h,m=[];if(n.indexOf("/")===-1)h=d;else{h=[];for(let b=0,g=d.length;b<g;b++){let y=d[b].split("/");y[0]!==""&&h.push(y[0]),y[1]!==""&&m.push(y[1])}}e.addLineGeometry(h,m)}else if(s==="p"){let h=n.substr(1).trim().split(" ");e.addPointGeometry(h)}else if(Sv.test(n)){o=Sv.exec(n)||[];let d=(" "+o[0].substr(1).trim()).substr(1);e.startObject(d)}else if(iD.test(n))e.object.startMaterial(n.substring(7).trim(),e.materialLibraries);else if(sD.test(n))e.materialLibraries.push(n.substring(7).trim());else if(s==="s"){if(o=n.split(" "),o.length>1){let h=o[1].trim().toLowerCase();e.object.smooth=h!=="0"&&h!=="off"}else e.object.smooth=!0;let d=e.object.currentMaterial();d&&(d.smooth=e.object.smooth)}else{if(n==="\0")continue;throw new Error(`Unexpected line: "${n}"`)}e.finalize();let c=[],u=[];for(let l of e.objects){let{geometry:f}=l;if(f.vertices.length===0)continue;let d={header:{vertexCount:f.vertices.length/3},attributes:{}};switch(f.type){case"Points":d.mode=0;break;case"Line":d.mode=1;break;default:d.mode=4;break}d.attributes.POSITION={value:new Float32Array(f.vertices),size:3},f.normals.length>0&&(d.attributes.NORMAL={value:new Float32Array(f.normals),size:3}),f.colors.length>0&&(d.attributes.COLOR_0={value:new Float32Array(f.colors),size:3}),f.uvs.length>0&&(d.attributes.TEXCOORD_0={value:new Float32Array(f.uvs),size:2}),d.materials=[];for(let h of l.materials){let m={name:h.name,flatShading:!h.smooth};d.materials.push(m),u.push(m)}d.name=l.name,c.push(d)}return{meshes:c,materials:u}}var Sv,sD,iD,zb,Wb,$b,Lv=p(()=>{"use strict";Sv=/^[og]\s*(.+)?/,sD=/^mtllib /,iD=/^usemtl /,zb=class r{constructor({index:e,name:t="",mtllib:n,smooth:s,groupStart:i}){this.index=e,this.name=t,this.mtllib=n,this.smooth=s,this.groupStart=i,this.groupEnd=-1,this.groupCount=-1,this.inherited=!1}clone(e=this.index){return new r({index:e,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0})}},Wb=class{constructor(e=""){this.name=e,this.geometry={vertices:[],normals:[],colors:[],uvs:[]},this.materials=[],this.smooth=!0,this.fromDeclaration=null}startMaterial(e,t){let n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);let s=new zb({index:this.materials.length,name:e,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:n!==void 0?n.smooth:this.smooth,groupStart:n!==void 0?n.groupEnd:0});return this.materials.push(s),s}currentMaterial(){if(this.materials.length>0)return this.materials[this.materials.length-1]}_finalize(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let n=this.materials.length-1;n>=0;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),t}},$b=class{constructor(){this.objects=[],this.object=null,this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materialLibraries=[],this.startObject("",!1)}startObject(e,t=!0){if(this.object&&!this.object.fromDeclaration){this.object.name=e,this.object.fromDeclaration=t;return}let n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object=new Wb(e),this.object.fromDeclaration=t,n&&n.name&&typeof n.clone=="function"){let s=n.clone(0);s.inherited=!0,this.object.materials.push(s)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e);return(n>=0?n-1:n+t/2)*2}addVertex(e,t,n){let s=this.vertices,i=this.object.geometry.vertices;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])}addVertexPoint(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])}addVertexLine(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])}addNormal(e,t,n){let s=this.normals,i=this.object.geometry.normals;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])}addColor(e,t,n){let s=this.colors,i=this.object.geometry.colors;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])}addUV(e,t,n){let s=this.uvs,i=this.object.geometry.uvs;i.push(s[e+0],s[e+1]),i.push(s[t+0],s[t+1]),i.push(s[n+0],s[n+1])}addUVLine(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])}addFace(e,t,n,s,i,o,a,c,u){let l=this.vertices.length,f=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),h=this.parseVertexIndex(n,l);if(this.addVertex(f,d,h),s!==void 0&&s!==""){let m=this.uvs.length;f=this.parseUVIndex(s,m),d=this.parseUVIndex(i,m),h=this.parseUVIndex(o,m),this.addUV(f,d,h)}if(a!==void 0&&a!==""){let m=this.normals.length;f=this.parseNormalIndex(a,m),d=a===c?f:this.parseNormalIndex(c,m),h=a===u?f:this.parseNormalIndex(u,m),this.addNormal(f,d,h)}this.colors.length>0&&this.addColor(f,d,h)}addPointGeometry(e){this.object.geometry.type="Points";let t=this.vertices.length;for(let n of e)this.addVertexPoint(this.parseVertexIndex(n,t))}addLineGeometry(e,t){this.object.geometry.type="Line";let n=this.vertices.length,s=this.uvs.length;for(let i of e)this.addVertexLine(this.parseVertexIndex(i,n));for(let i of t)this.addUVLine(this.parseUVIndex(i,s))}}});function Kf(r,e){let{meshes:t}=Ev(r),n=t.reduce((a,c)=>a+c.header.vertexCount,0),s=oD(t,n),i={vertexCount:n,boundingBox:Er(s)??void 0},o=qf(s,{mode:4,boundingBox:i.boundingBox});return{loaderData:{header:{}},schema:o,header:i,mode:4,topology:"point-list",attributes:s}}function oD(r,e){let t=new Float32Array(e*3),n,s,i,o=0;for(let c of r){let{POSITION:u,NORMAL:l,COLOR_0:f,TEXCOORD_0:d}=c.attributes;t.set(u.value,o*3),l&&(n=n||new Float32Array(e*3),n.set(l.value,o*3)),f&&(s=s||new Float32Array(e*3),s.set(f.value,o*3)),d&&(i=i||new Float32Array(e*2),i.set(d.value,o*2)),o+=u.value.length/3}let a={};return a.POSITION={value:t,size:3},n&&(a.NORMAL={value:n,size:3}),s&&(a.COLOR_0={value:s,size:3}),i&&(a.TEXCOORD_0={value:i,size:2}),a}var Bv=p(()=>{"use strict";mn();Lv();Gb()});function Fv(r,e){let t=ei(r,"arrow-table");return e?.obj?.shape==="mesh"?pn(t):t}function uD(r){let e=r?.batchSize??r?.core?.batchSize;return typeof e=="number"?e:void 0}function lD(r){return r.split(/\r?\n/).some(e=>{let t=e.trimStart();return t.startsWith("f ")||t.startsWith("l ")})}function*fD(r,e,t){let n=r.split(/\r?\n/).filter(s=>s.trimStart().startsWith("v "));yield*hD(n,e,t)}async function*dD(r,e,t){let n=t||1e3,s=[];for await(let i of r)i.trimStart().startsWith("v ")&&(s.push(i),s.length>=n&&(yield Xf(qb(s),e),s=[]));s.length>0&&(yield Xf(qb(s),e))}function*hD(r,e,t){let n=t||r.length||1;for(let s=0;s<r.length;s+=n){let i=qb(r.slice(s,s+n));yield Xf(i,e)}}function qb(r){let e=new Float32Array(r.length*3);for(let s=0;s<r.length;s++){let i=r[s].trim().split(/\s+/);e[s*3+0]=Number(i[1]),e[s*3+1]=Number(i[2]),e[s*3+2]=Number(i[3])}let t={POSITION:{value:e,size:3}},n=Er(t);return{loaderData:{header:{}},schema:qf(t,{mode:0,boundingBox:n??void 0}),header:{vertexCount:r.length,boundingBox:n??void 0},mode:0,topology:"point-list",attributes:t}}function Xf(r,e){let t=ei(r,"arrow-table");if(e?.obj?.shape==="mesh"){let n=pn(t);return{shape:"mesh",batchType:"data",data:n,length:n.header?.vertexCount||0}}return hb(t)}function pD(r,e){let t=gm(r);return e?.obj?.shape==="mesh"?pn(t):t}function mD(r,e){let t=gm(r);return e?.obj?.shape!=="mesh"?t:{shape:"mesh",batchType:"data",data:pn(t),length:t.length}}var eY,aD,cD,Ov=p(()=>{"use strict";Ue();ea();mn();Gb();Bv();Dv();({preload:eY,...aD}=Mv);cD={...aD,parse:async(r,e)=>Fv(Kf(new TextDecoder().decode(r),e),e),parseTextSync:(r,e)=>Fv(Kf(r,e),e),parseInBatches:async function*(r,e){let t=uD(e);if(e?.obj?.pointCloud){let i=ub(r),o=lb(i);yield*dD(o,e,t);return}let n=await fb(r),s=new TextDecoder().decode(n);if(lD(s)){yield Xf(Kf(s,e),e);return}yield*fD(s,e,t)},serializeWorkerResult:Hi,deserializeWorkerResult:pD,serializeWorkerBatch:Hi,deserializeWorkerBatch:mD}});var Kb={};J(Kb,{OBJLoaderWithParser:()=>cD});var Xb=p(()=>{"use strict";Ov()});async function gD(){let{OBJLoaderWithParser:r}=await Promise.resolve().then(()=>(Xb(),Kb));return r}function yD(r){return r[0]==="v"}var bD,Mv,Dv=p(()=>{"use strict";lx();ea();bD="5.0.0-beta.7";Mv={...ux,dataType:null,batchType:null,version:bD,worker:!0,workerInBatches:!0,serializeWorkerResult:Hi,text:!0,testText:yD,options:{obj:{shape:"arrow-table"}},preload:gD}});var Rv,kv=p(()=>{"use strict";Rv={name:"MTL",id:"mtl",module:"mtl",encoding:"text",format:"mtl",extensions:["mtl"],mimeTypes:["text/plain"]}});function Hb(r,e){let t=[],n={name:"placeholder"},s=r.split(`
43
- `);for(let i of s){if(i=i.trim(),i.length===0||i.charAt(0)==="#")continue;let o=i.indexOf(" "),a=o>=0?i.substring(0,o):i;a=a.toLowerCase();let c=o>=0?i.substring(o+1):"";switch(c=c.trim(),a){case"newmtl":n={name:c},t.push(n);break;case"ka":n.ambientColor=Hf(c);break;case"kd":n.diffuseColor=Hf(c);break;case"map_kd":n.diffuseTextureUrl=c;break;case"ks":n.specularColor=Hf(c);break;case"map_ks":n.specularTextureUrl=c;break;case"ke":n.emissiveColor=Hf(c);break;case"map_ke":n.emissiveTextureUrl=c;break;case"ns":n.shininess=parseFloat(c);break;case"map_ns":break;case"ni":n.refraction=parseFloat(c);break;case"illum":n.illumination=parseFloat(c);break;default:break}}return t}function Hf(r,e){let t=r.split(wD,3);return[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}var wD,Nv=p(()=>{"use strict";wD=/\s+/});var fY,xD,dY,TD,_D,AD,Cv=p(()=>{"use strict";Nv();Jb();Jb();({preload:fY,...xD}=Jf),{preload:dY,...TD}=Jf,_D={...xD},AD={...TD,parse:async(r,e)=>Hb(new TextDecoder().decode(r),e?.mtl),parseTextSync:(r,e)=>Hb(r,e?.mtl)}});var Yb={};J(Yb,{MTLLoaderWithParser:()=>AD,MTLWorkerLoaderWithParser:()=>_D});var Qb=p(()=>{"use strict";Cv()});async function ID(){let{MTLLoaderWithParser:r}=await Promise.resolve().then(()=>(Qb(),Yb));return r}var vD,Jf,Jb=p(()=>{"use strict";kv();vD="5.0.0-beta.7";Jf={...Rv,dataType:null,batchType:null,version:vD,worker:!0,text:!0,testText:r=>r.includes("newmtl"),options:{mtl:{}},preload:ID}});var Yf,Zb=p(()=>{"use strict";Yf="5.0.0-beta.7"});var Uv,Pv,eg=p(()=>{"use strict";Uv={name:"glTF",id:"gltf",module:"scene",encoding:"binary",format:"gltf",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"]},Pv={name:"GLB",id:"glb",module:"scene",encoding:"binary",format:"glb",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,tests:["glTF"]}});function Vv(r){return!BD(r,"ftyp",4)||(r[8]&96)===0?null:SD(r)}function SD(r){switch(ED(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ED(r,e,t){return String.fromCharCode(...r.slice(e,t))}function LD(r){return[...r].map(e=>e.charCodeAt(0))}function BD(r,e,t=0){let n=LD(e);for(let s=0;s<n.length;++s)if(n[s]!==r[s+t])return!1;return!0}var jv=p(()=>{"use strict"});function $n(r){let e=Xc(r);return OD(e)||RD(e)||MD(e)||DD(e)||FD(e)}function FD(r){let e=new Uint8Array(r instanceof DataView?r.buffer:r),t=Vv(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function OD(r){let e=Xc(r);return e.byteLength>=33&&e.getUint32(0,dr)===2303741511&&e.getUint32(4,dr)===218765834&&e.getUint32(8,dr)===13&&e.getUint32(12,dr)===1229472850?{mimeType:"image/png",width:e.getUint32(16,dr),height:e.getUint32(20,dr)}:null}function MD(r){let e=Xc(r);return e.byteLength>=10&&e.getUint32(0,dr)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Kc),height:e.getUint16(8,Kc)}:null}function DD(r){let e=Xc(r);return e.byteLength>=14&&e.getUint16(0,dr)===16973&&e.getUint32(2,Kc)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Kc),height:e.getUint32(22,Kc)}:null}function RD(r){let e=Xc(r);if(!(e.byteLength>=3&&e.getUint16(0,dr)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=kD(),i=2;for(;i+9<e.byteLength;){let o=e.getUint16(i,dr);if(s.has(o))return{mimeType:"image/jpeg",height:e.getUint16(i+5,dr),width:e.getUint16(i+7,dr)};if(!n.has(o))return null;i+=2,i+=e.getUint16(i,dr)}return null}function kD(){let r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Xc(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}var dr,Kc,Qf=p(()=>{"use strict";jv();dr=!1,Kc=!0});var ND,CD,UD,Gv,zv=p(()=>{"use strict";Qf();ND=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],CD=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],UD={id:"image",module:"images",name:"Images",encoding:"image",format:"image",mimeTypes:CD,extensions:ND,tests:[r=>!!$n(new DataView(r))]},Gv={...UD,id:"imagebitmap",name:"ImageBitmap",format:"image-bitmap"}});var Zf,tg=p(()=>{"use strict";Zf="5.0.0-beta.7"});function da(r){if(!r)return!1;if(PD.test(r))return!0;for(let e=r.indexOf(".svg");e>=0;e=r.indexOf(".svg",e+4)){let t=r[e+4];if(t===void 0||t==="?"||t==="#")return!0}return!1}function Wv(r,e){if(da(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return rg(r,e)}function rg(r,e){if(da(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}var PD,ed=p(()=>{"use strict";PD=/^data:image\/svg\+xml/});async function $v(r,e,t){let n=Wv(r,t),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await VD(i||n,e)}finally{i&&s.revokeObjectURL(i)}}async function VD(r,e){let t=new Image;return t.src=r,e?.image?.decode&&t.decode?(await t.decode(),t):await new Promise((n,s)=>{try{t.onload=()=>n(t),t.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var qv=p(()=>{"use strict";ed()});async function Xv(r,e,t){let n;da(t)?n=await $v(r,e,t):n=rg(r,t);let s=e&&e.imagebitmap;return await Jv(n,s)}async function Hv(r,e){let t=e&&e.imagebitmap;return await Jv(r,t)}async function Jv(r,e=null){if((jD(e)||!Kv)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(t){console.warn(t),Kv=!1}return await createImageBitmap(r)}function jD(r){if(!r)return!0;for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}var Kv,Yv=p(()=>{"use strict";ed();qv();Kv=!0});async function Qv(r,e){let{mimeType:t}=$n(r)||{},n=globalThis.loaders?.parseImageNode;fr(n);let s=globalThis.loaders?.createImageBitmapNode;if(!s)throw new Error("Install '@loaders.gl/core/polyfills' to parse images under Node.js");let i=await n(r,t);return s(i)}var Zv=p(()=>{"use strict";Ue();Qf()});async function ng(r,e,t){e=e||{},rI(e);let n=!!globalThis.loaders?.parseImageNode;if(!Gn||n)return await Qv(r,e);if(typeof ImageBitmap>"u"||typeof createImageBitmap!="function")throw new Error(eI);return await Xv(r,e,t?.url)}async function tI(r,e,t){e=e||{},rI(e);let n=!!globalThis.loaders?.parseImageNode;if(!Gn||n||da(t?.url)||r.type.startsWith("image/svg+xml"))return await ng(await r.arrayBuffer(),e,t);if(typeof ImageBitmap>"u"||typeof createImageBitmap!="function")throw new Error(eI);return await Hv(r,e)}function rI(r){let e=r.image?.type;if(e&&e!=="imagebitmap")throw new Error(GD)}var GD,eI,nI=p(()=>{"use strict";Ue();Yv();ed();Zv();GD="@loaders.gl/images: ImageLoader only accepts options.image.type='imagebitmap'. Remove legacy image/data/auto values and call getImageData(image) if you need raw pixels.",eI="@loaders.gl/images: ImageLoader requires browser ImageBitmap support. Use a browser with createImageBitmap support or load images under Node.js with @loaders.gl/core/polyfills."});var sI={};J(sI,{ImageLoaderWithParser:()=>WD});var jY,zD,WD,iI=p(()=>{"use strict";nI();sg();({preload:jY,...zD}=Hc),WD={...zD,parse:ng,parseBlob:tI}});async function qD(){let{ImageLoaderWithParser:r}=await Promise.resolve().then(()=>(iI(),sI));return r}var $D,Hc,sg=p(()=>{"use strict";tg();zv();$D={image:{}};Hc={dataType:null,batchType:null,...Gv,version:Zf,options:$D,preload:qD}});function aI(r){let e=JD(r);if(!e)throw new Error("Not an image");return e}function Jc(r){switch(aI(r)){case"data":return r;case"imagebitmap":return KD(r)?XD(r):oI(r);case"image":return oI(r);default:throw new Error("getImageData")}}function KD(r){let e=globalThis.loaders?.isImageBitmapNode;return!!e?.(r)}function XD(r){let e=globalThis.loaders?.getImageBitmapDataNode;if(!e)throw new Error("getImageData");return e(r)}function oI(r){let e=HD(r.width,r.height),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height)}function HD(r,e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(r,e);if(typeof document<"u"){let t=document.createElement("canvas");return t.width=r,t.height=e,t}throw new Error("getImageData")}function JD(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}var cI=p(()=>{"use strict"});async function og(){return td?await td:(td=QD(),await td)}async function QD(){let r=new Set;for(let e of YD)(Gn?await tR(e):uI(e))&&r.add(e);return r}function ag(r){if(ig[r]===void 0){let e=Gn?ZD(r):uI(r);ig[r]=e}return ig[r]}function uI(r){let e=["image/png","image/jpeg","image/gif"],t=globalThis.loaders?.imageFormatsNode||e;return!!globalThis.loaders?.parseImageNode&&t.includes(r)}function ZD(r){switch(r){case"image/avif":case"image/webp":return rR(r);default:return!0}}async function tR(r){let e=eR[r];return e?await nR(e):!0}function rR(r){try{return document.createElement("canvas").toDataURL(r).indexOf(`data:${r}`)===0}catch{return!1}}async function nR(r){return new Promise(e=>{let t=new Image;t.src=r,t.onload=()=>e(t.height>0),t.onerror=()=>e(!1)})}var YD,td,ig,eR,cg=p(()=>{"use strict";Ue();YD=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/tiff","image/svg","image/svg+xml","image/bmp","image/vnd.microsoft.icon"],td=null;ig={};eR={"image/avif":"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=","image/webp":"data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}});var lI,fI=p(()=>{"use strict";lI={name:"Basis",id:"basis",module:"images",encoding:"image",format:"basis",extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],binary:!0,tests:["sB"]}});function hI(r){if(!rd){r=r||iR()||void 0,rd=new Set;for(let e of sR)for(let t in dI)if(r&&r.getExtension(`${e}${t}`))for(let n of dI[t])rd.add(n)}return rd}function iR(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var sR,dI,rd,pI=p(()=>{"use strict";sR=["","WEBKIT_","MOZ_"],dI={WEBGL_compressed_texture_s3tc:["bc1-rgb-unorm-webgl","bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"],WEBGL_compressed_texture_s3tc_srgb:["bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"],EXT_texture_compression_rgtc:["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"],EXT_texture_compression_bptc:["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"],WEBGL_compressed_texture_etc1:["etc1-rgb-unorm-webgl"],WEBGL_compressed_texture_etc:["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"],WEBGL_compressed_texture_pvrtc:["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"],WEBGL_compressed_texture_atc:["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"],WEBGL_compressed_texture_astc:["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]},rd=null});function bI(r=hI(),e,t={}){let n=new Set(r);if(!e)return aR(n);if(e.isHDR){let s=mI(e);return t.astcHDR&&(s==="astc-4x4"||s==="astc-6x6")&&nd(n,s.slice(5))?s==="astc-4x4"?"astc-hdr-4x4":"astc-hdr-6x6":n.has("bc6h-rgb-ufloat")?"bc6h":"rgba16f"}if(e.codec==="xubc7")return lg(n)?"bc7":"rgba32";if(e.codec.startsWith("xuastc-ldr-")||e.codec.startsWith("astc-ldr-")){let s=mI(e);return s&&nd(n,s.slice(5))?s:ug(n,e,["bc7","bc","etc2","atc"])}return e.codec==="uastc-ldr-4x4"?nd(n,"4x4")?"astc-4x4":ug(n,e,["bc7","bc","etc2","etc1","pvrtc","atc"]):ug(n,e,["etc2","etc1","bc7","bc","pvrtc","atc"])}function aR(r){return nd(r,"4x4")?"astc-4x4":lg(r)?"bc7":gI(r)?{alpha:"bc3",noAlpha:"bc1"}:yI(r)?"etc2":r.has("etc1-rgb-unorm-webgl")?{alpha:"rgba32",noAlpha:"etc1"}:wI(r)?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:xI(r)?{alpha:"atc-rgba-interpolated-alpha",noAlpha:"atc-rgb"}:{alpha:"rgba32",noAlpha:"rgb565"}}function ug(r,e,t){for(let n of t)switch(n){case"bc7":if(lg(r))return"bc7";break;case"bc":if(gI(r))return e.hasAlpha?"bc3":"bc1";break;case"etc2":if(yI(r))return"etc2";break;case"etc1":if(!e.hasAlpha&&r.has("etc1-rgb-unorm-webgl"))return"etc1";break;case"pvrtc":if(wI(r))return e.hasAlpha?"pvrtc1-4-rgba":"pvrtc1-4-rgb";break;case"atc":if(xI(r))return e.hasAlpha?"atc-rgba-interpolated-alpha":"atc-rgb";break;default:break}return e.hasAlpha?"rgba32":"rgb565"}function mI(r){let e=`${r.blockWidth}x${r.blockHeight}`;return oR.includes(e)?`astc-${e}`:null}function nd(r,e){return ha(r,[`astc-${e}-unorm`,`astc-${e}-unorm-srgb`])}function lg(r){return ha(r,["bc7-rgba-unorm","bc7-rgba-unorm-srgb"])}function gI(r){return ha(r,["bc1-rgb-unorm-webgl","bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb"])}function yI(r){return ha(r,["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb"])}function wI(r){return ha(r,["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"])}function xI(r){return ha(r,["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"])}function ha(r,e){return e.some(t=>r.has(t))}var oR,TI=p(()=>{"use strict";pI();oR=["4x4","5x4","5x5","6x5","6x6","8x5","8x6","8x8","10x5","10x6","10x8","10x10","12x10","12x12"]});async function vI(r){xm(r.modules);let e=Tm("basis");return e||(AI||=cR(r),await AI)}async function cR(r){let e=null,t=null;return[e,t]=await Promise.all([await ia(_I.TRANSCODER,"images",r,null,"basis_transcoder.mjs"),await ia(_I.TRANSCODER_WASM,"images",r)]),e=e||globalThis.BASIS,await uR(e,t)}function uR(r,e){let t={};return e&&(t.wasmBinary=e),Ji(()=>r(t),n=>{let{BasisFile:s,KTX2File:i,getBasisTexFormatBlockHeight:o,getBasisTexFormatBlockWidth:a,initializeBasis:c,isFormatSupported:u}=n;return c(),{BasisFile:s,KTX2File:i,getBasisTexFormatBlockHeight:o,getBasisTexFormatBlockWidth:a,isFormatSupported:u}})}var _I,AI,II=p(()=>{"use strict";Ue();Js();_I={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"}});function SI(r){if(r.byteLength<fg.byteLength)return!1;let e=new Uint8Array(r,0,fg.byteLength);return fg.every((t,n)=>e[n]===t)}var fg,EI=p(()=>{"use strict";fg=new Uint8Array([171,75,84,88,32,50,48,187,13,10,26,10])});async function hR(r){let e=LI,t;LI=new Promise(n=>{t=n}),await e;try{return await r()}finally{t()}}async function FI(r,e={}){return await hR(async()=>{let t=await vI(hn(e)),n=e.basis?.containerFormat||"auto";if(n==="ktx2"||n==="auto"&&SI(r)){if(!t.KTX2File)throw new Error("The injected Basis transcoder module does not provide KTX2File");return mR(t,r,e)}return pR(t,r,e)})}function pR(r,e,t){let n=new r.BasisFile(new Uint8Array(e));try{let s=MI(n,!1);if(!n.startTranscoding())throw new Error("Failed to start Basis transcoding");let i=[];for(let o=0;o<n.getNumImages();o++){let a=[];for(let c=0;c<n.getNumLevels(o);c++){let u=n.getImageWidth(o,c),l=n.getImageHeight(o,c);a.push(OI(n,s,u,l,t,f=>n.getImageTranscodedSizeInBytes(o,c,f),(f,d)=>n.transcodeImage(f,o,c,d,0,0)))}i.push(a)}return i}finally{n.close(),n.delete()}}function mR(r,e,t){let n=new r.KTX2File(new Uint8Array(e));try{if(!n.isValid())throw new Error("Invalid KTX2 texture");if(n.getHeader().pixelDepth>0)throw new Error("BasisLoader does not support 3D KTX2 textures");let i=MI(n,!0);if(!n.startTranscoding())throw new Error("Failed to start KTX2 transcoding");let o=Math.max(1,n.getLayers()),a=Math.max(1,n.getFaces()),c=[];for(let u=0;u<o;u++)for(let l=0;l<a;l++){let f=[];for(let d=0;d<n.getLevels();d++){let h=n.getImageLevelInfo(d,u,l);f.push(OI(n,{...i,hasAlpha:!!h.alphaFlag},h.width,h.height,t,m=>n.getImageTranscodedSizeInBytes(d,u,l,m),(m,b)=>n.transcodeImage(m,d,u,l,b,0,-1,-1)))}c.push(f)}return c}finally{n.close(),n.delete()}}function OI(r,e,t,n,s,i,o){let a=gR(s,e);bR(e,dg(s,e));let c=i(a.basisFormat),u=wR(c,a.dataType);if(!o(u,a.basisFormat))throw new Error(`Failed to transcode Basis texture to ${dg(s,e)}`);let l=e.isSRGB&&a.srgbTextureFormat;return{shape:"texture-level",width:t,height:n,data:u,compressed:a.compressed,format:l&&a.srgbFormat||a.format,textureFormat:l?a.srgbTextureFormat:a.textureFormat,levelSize:c,hasAlpha:e.hasAlpha}}function bR(r,e){let t=e==="bc6h"||e==="rgba16f"||e==="rgb9e5"||e.startsWith("astc-hdr-");if(r.isHDR!==t)throw new Error(`Basis source codec ${r.codec} cannot be transcoded to ${e}`);if(r.codec==="xubc7"&&e!=="bc7"&&e!=="rgba32")throw new Error(`Basis source codec ${r.codec} cannot be transcoded to ${e}`)}function gR(r,e){let t=dg(r,e),n=BI[t];if(!n)throw new Error(`Unknown Basis format ${t}`);return n}function dg(r,e){let t=r.basis?.format||"auto";return t==="auto"&&(t=bI(r.basis?.supportedTextureFormats,e,r.basis?.supportedTextureFeatures)),typeof t=="object"&&(t=e.hasAlpha?t.alpha:t.noAlpha),t.toLowerCase()}function MI(r,e){let t=r.getBasisTexFormat(),n=yR[t];if(!n)throw new Error(`Unsupported Basis source texture format ${t}`);return{codec:n,isHDR:!!r.isHDR(),isSRGB:e?!!r.isSRGB():!1,hasAlpha:!!r.getHasAlpha(),blockWidth:r.getBlockWidth(),blockHeight:r.getBlockHeight()}}function wR(r,e){return e==="uint16"?new Uint16Array(r/Uint16Array.BYTES_PER_ELEMENT):e==="uint32"?new Uint32Array(r/Uint32Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function it(r,e,t){return{basisFormat:r,compressed:!0,format:e,textureFormat:t}}function pa(r,e,t,n,s){return{basisFormat:r,compressed:!1,format:e,textureFormat:t,srgbFormat:n,srgbTextureFormat:s}}function $t(r,e,t,n){return{...it(r,e,`astc-${n}-unorm`),srgbFormat:t,srgbTextureFormat:`astc-${n}-unorm-srgb`}}var Wt,BI,tZ,LI,yR,DI=p(()=>{"use strict";Js();TI();II();EI();Wt={"4x4":$t(10,37808,37840,"4x4"),"5x4":$t(28,37809,37841,"5x4"),"5x5":$t(29,37810,37842,"5x5"),"6x5":$t(30,37811,37843,"6x5"),"6x6":$t(31,37812,37844,"6x6"),"8x5":$t(32,37813,37845,"8x5"),"8x6":$t(33,37814,37846,"8x6"),"8x8":$t(36,37815,37847,"8x8"),"10x5":$t(34,37816,37848,"10x5"),"10x6":$t(35,37817,37849,"10x6"),"10x8":$t(37,37818,37850,"10x8"),"10x10":$t(38,37819,37851,"10x10"),"12x10":$t(39,37820,37852,"12x10"),"12x12":$t(40,37821,37853,"12x12")},BI={etc1:it(0,36196,"etc1-rgb-unorm-webgl"),etc2:{...it(1,37493,"etc2-rgba8unorm"),srgbFormat:37495,srgbTextureFormat:"etc2-rgba8unorm-srgb"},bc1:{...it(2,33776,"bc1-rgb-unorm-webgl"),srgbFormat:35916,srgbTextureFormat:"bc1-rgb-unorm-srgb-webgl"},bc3:{...it(3,33779,"bc3-rgba-unorm"),srgbFormat:35919,srgbTextureFormat:"bc3-rgba-unorm-srgb"},bc4:it(4,36283,"bc4-r-unorm"),bc5:it(5,36285,"bc5-rg-unorm"),bc7:{...it(6,36492,"bc7-rgba-unorm"),srgbFormat:36493,srgbTextureFormat:"bc7-rgba-unorm-srgb"},"pvrtc1-4-rgb":it(8,35840,"pvrtc-rgb4unorm-webgl"),"pvrtc1-4-rgba":it(9,35842,"pvrtc-rgba4unorm-webgl"),"astc-4x4":Wt["4x4"],"astc-5x4":Wt["5x4"],"astc-5x5":Wt["5x5"],"astc-6x5":Wt["6x5"],"astc-6x6":Wt["6x6"],"astc-8x5":Wt["8x5"],"astc-8x6":Wt["8x6"],"astc-8x8":Wt["8x8"],"astc-10x5":Wt["10x5"],"astc-10x6":Wt["10x6"],"astc-10x8":Wt["10x8"],"astc-10x10":Wt["10x10"],"astc-12x10":Wt["12x10"],"astc-12x12":Wt["12x12"],"atc-rgb":it(11,35986,"atc-rgb-unorm-webgl"),"atc-rgba-interpolated-alpha":it(12,34798,"atc-rgbai-unorm-webgl"),rgba32:pa(13,32856,"rgba8unorm",35907,"rgba8unorm-srgb"),rgb565:pa(14,36194,"rgb565unorm-webgl"),bgr565:pa(15,36194,"rgb565unorm-webgl"),rgba4444:pa(16,32854,"rgba4unorm-webgl"),"eac-r11":it(20,37488,"eac-r11unorm"),"eac-rg11":it(21,37490,"eac-rg11unorm"),bc6h:it(22,36495,"bc6h-rgb-ufloat"),"astc-hdr-4x4":it(23,37808,"astc-4x4-unorm"),rgba16f:{...pa(25,34842,"rgba16float"),dataType:"uint16"},rgb9e5:{...pa(26,35901,"rgb9e5ufloat"),dataType:"uint32"},"astc-hdr-6x6":it(27,37812,"astc-6x6-unorm")},tZ=Object.freeze(Object.keys(BI)),LI=Promise.resolve();yR={0:"etc1s",1:"uastc-ldr-4x4",2:"uastc-hdr-4x4",3:"astc-hdr-6x6",4:"uastc-hdr-6x6",5:"xuastc-ldr-4x4",6:"xuastc-ldr-5x4",7:"xuastc-ldr-5x5",8:"xuastc-ldr-6x5",9:"xuastc-ldr-6x6",10:"xuastc-ldr-8x5",11:"xuastc-ldr-8x6",12:"xuastc-ldr-10x5",13:"xuastc-ldr-10x6",14:"xuastc-ldr-8x8",15:"xuastc-ldr-10x8",16:"xuastc-ldr-10x10",17:"xuastc-ldr-12x10",18:"xuastc-ldr-12x12",19:"astc-ldr-4x4",20:"astc-ldr-5x4",21:"astc-ldr-5x5",22:"astc-ldr-6x5",23:"astc-ldr-6x6",24:"astc-ldr-8x5",25:"astc-ldr-8x6",26:"astc-ldr-10x5",27:"astc-ldr-10x6",28:"astc-ldr-8x8",29:"astc-ldr-10x8",30:"astc-ldr-10x10",31:"astc-ldr-12x10",32:"astc-ldr-12x12",33:"xubc7"}});var RI={};J(RI,{BasisLoaderWithParser:()=>AR,BasisWorkerLoaderWithParser:()=>_R});var oZ,xR,aZ,TR,_R,AR,kI=p(()=>{"use strict";DI();sd();sd();({preload:oZ,...xR}=io),{preload:aZ,...TR}=io,_R={...xR},AR={...TR,parse:FI}});async function vR(){let{BasisLoaderWithParser:r}=await Promise.resolve().then(()=>(kI(),RI));return r}var io,sd=p(()=>{"use strict";fI();tg();io={...lI,dataType:null,batchType:null,name:"Basis",id:"basis",module:"images",version:Zf,worker:!0,workerNode:"basis-worker-node.cjs",extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",containerFormat:"auto"}},preload:vR}});var qn=p(()=>{"use strict";sg();Qf();cI();cg();cg();sd()});function H(r,e){if(!r)throw new Error(e||"assert failed: gltf")}var oo=p(()=>{"use strict"});function FR(r,e=0){return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}function PI(r,e=0,t={}){let n=new DataView(r),{magic:s=NI}=t,i=n.getUint32(e,!1);return i===s||i===NI}function ad(r,e,t=0,n={}){let s=new DataView(e),i=FR(s,t+0),o=s.getUint32(t+4,ti),a=o===3?jI(s,t+8,"GLB byte length"):s.getUint32(t+8,ti);switch(Object.assign(r,{header:{byteOffset:t,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},jsonChunkIndex:-1,binChunks:[]}),r.version){case 1:return OR(r,s,t+id);case 2:return MR(r,s,t+id,n);case 3:return DR(r,s,t+UI,n);default:throw new Error(`Invalid GLB version ${r.version}. Only supports versions 1, 2 and 3.`)}}function OR(r,e,t){fr(r.header.byteLength>id+od);let n=r.header.byteOffset+r.header.byteLength;fr(n<=e.byteLength);let s=e.getUint32(t+0,ti),i=e.getUint32(t+4,ti);if(t+=od,fr(i===ER),t+s>n)throw new Error("GLB JSON content extends beyond the declared file length.");hg(r,e,t,s,0),t+=s;let o=n-t;return o>0&&pg(r,e,t,o,1),n}function MR(r,e,t,n){return fr(r.header.byteLength>id+od),VI(r,e,t,od,n),r.header.byteOffset+r.header.byteLength}function DR(r,e,t,n){return fr(r.header.byteLength>=UI+CI),VI(r,e,t,CI,n),r.header.byteOffset+r.header.byteLength}function VI(r,e,t,n,s){let i=r.header.byteOffset+r.header.byteLength;fr(i<=e.byteLength);let o=0;for(;t+n<=i;){let a=r.version===3,c=e.getUint32(t+(a?0:4),ti),u=a?e.getUint32(t+4,ti):0,l=a?jI(e,t+8,"GLB chunk length"):e.getUint32(t+0,ti);if(t+=n,u!==0)throw new Error(`Unsupported GLB chunk encoding ${u}.`);if(t+l>i)throw new Error("GLB chunk extends beyond the declared file length.");switch(c){case IR:(r.version!==3||r.jsonChunkIndex===-1)&&hg(r,e,t,l,o);break;case SR:pg(r,e,t,l,o);break;case LR:s.strict||hg(r,e,t,l,o);break;case BR:s.strict||pg(r,e,t,l,o);break;default:break}t+=mg(l),o++}return t}function hg(r,e,t,n,s){let i=new Uint8Array(e.buffer,t,n),a=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(a),r.jsonChunkIndex=s,mg(n)}function pg(r,e,t,n,s){return r.header.hasBinChunk=!0,r.binChunks.push({chunkIndex:s,byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),mg(n)}function jI(r,e,t){let n=r.getBigUint64(e,ti);if(n>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(`${t} exceeds JavaScript's safe integer range.`);return Number(n)}function mg(r){return Math.ceil(r/4)*4}var ti,NI,id,UI,od,CI,IR,SR,ER,LR,BR,bg=p(()=>{"use strict";Ue();ti=!0,NI=1735152710,id=12,UI=16,od=8,CI=16,IR=1313821514,SR=5130562,ER=0,LR=0,BR=1});function Kn(r,e,t){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return cd(r);let s=t?.baseUrl||RR(e?.core?.baseUrl);if(!s)throw new Error(`'baseUrl' must be provided to resolve relative url ${r}`);let i=s.endsWith("/")?`${s}${r}`:`${s}/${r}`;return cd(i)}function cd(r){try{return new URL(r).href}catch{return r}}function RR(r){if(!r)return;if(r.endsWith("/"))return r;let e=r.lastIndexOf("/");return e>=0?r.slice(0,e+1):""}var Yc=p(()=>{"use strict"});var ud,Qc,gg=p(()=>{"use strict";ud={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Qc={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8}});function ma(r){return GI[r-1]||GI[0]}function Xn(r){let e=NR.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function Zc(r,e){let t=PR[r.componentType],n=CR[r.type],s=UR[r.componentType],i=r.count*n,o=r.count*n*s;H(o>=0&&o<=e.byteLength);let a=Qc[r.componentType],c=ud[r.type];return{ArrayType:t,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}var GI,kR,NR,CR,UR,PR,ri=p(()=>{"use strict";oo();gg();GI=["SCALAR","VEC2","VEC3","VEC4"],kR=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Int32Array,5124],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130],[BigInt64Array,5134],[BigUint64Array,5135]],NR=new Map(kR),CR={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},UR={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8},PR={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5124:Int32Array,5125:Uint32Array,5126:Float32Array,5130:Float64Array,5131:Uint16Array,5134:BigInt64Array,5135:BigUint64Array}});function hr(r,e,t){let n=typeof t=="number"?r.bufferViews[t]:t;H(n);let s=n.buffer,i=e[s];H(i),H((n.byteOffset||0)>=0&&n.byteLength>=0),H((n.byteOffset||0)+n.byteLength<=i.byteLength),H(i.byteOffset>=0&&i.byteOffset+i.byteLength<=i.arrayBuffer.byteLength);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function zI(r,e,t){let n=r.images[t];return hr(r,e,n.bufferView)}function ld(r,e,t){let n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);H(Number.isSafeInteger(n.count)&&n.count>=0);let{ArrayType:s,length:i,numberOfComponentsInElement:o}=Zc(n,{byteLength:1/0}),a=n.value,c;ArrayBuffer.isView(a)?(H(a.length===i),c=a):n.bufferView===void 0?c=new s(i):c=yg(r,e,n);let u=n.sparse;if(!u)return c;let l=new s(i);new Uint8Array(l.buffer).set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),H(u.count>=0&&u.count<=n.count),H([5121,5123,5125].includes(u.indices.componentType));let f=yg(r,e,{bufferView:u.indices.bufferView,byteOffset:u.indices.byteOffset,componentType:u.indices.componentType,count:u.count,type:"SCALAR"}),d=yg(r,e,{bufferView:u.values.bufferView,byteOffset:u.values.byteOffset,componentType:n.componentType,count:u.count,type:n.type}),h=-1,m=new Uint8Array(l.buffer),b=o*s.BYTES_PER_ELEMENT,g=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);for(let y=0;y<u.count;y++){let x=Number(f[y]);H(x>h&&x<n.count),m.set(g.subarray(y*b,(y+1)*b),x*b),h=x}return l}function yg(r,e,t){let n=r.bufferViews?.[t.bufferView];if(!n)throw new Error(`No gltf buffer view for accessor ${n}`);let s=e[n.buffer];H(s);let{arrayBuffer:i,byteOffset:o}=s;H((n.byteOffset||0)>=0&&n.byteLength>=0),H((n.byteOffset||0)+n.byteLength<=s.byteLength),H(o>=0&&o+s.byteLength<=i.byteLength),H((t.byteOffset||0)>=0);let a=(o||0)+(t.byteOffset||0)+(n.byteOffset||0),{ArrayType:c,length:u,componentByteSize:l,numberOfComponentsInElement:f}=Zc(t,n),d=l*f,h=t.type.startsWith("MAT")?Number(t.type.slice(3)):1,m=_e(h*l,4),b=h>1?h*m:d,g=n.byteStride??b,y=h>1?(h-1)*m+h*l:d;if(H(g>=b),H((t.byteOffset||0)+(t.count===0?0:(t.count-1)*g+y)<=n.byteLength),t.count===0)return new c(0);if(h>1&&m!==h*l){let _=n.byteStride??h*m,v=(h-1)*m+h*l;H((t.byteOffset||0)+(t.count-1)*_+v<=n.byteLength);let I=new c(u),N=new Uint8Array(I.buffer,I.byteOffset,I.byteLength);for(let K=0;K<t.count;K++)for(let ne=0;ne<h;ne++){let be=new Uint8Array(i,a+K*_+ne*m,h*l);N.set(be,K*d+ne*h*l)}return I}let x=n.byteStride||d;if(typeof n.byteStride>"u"||n.byteStride===d){if(a%l!==0){let v=new Uint8Array(i,a,u*l),I=new Uint8Array(v.byteLength);return I.set(v),new c(I.buffer,0,u)}return new c(i,a,u)}let T=new c(u);for(let _=0;_<t.count;_++){let v=a+_*x,I;if(v%l!==0){let N=new Uint8Array(i,v,d),K=new Uint8Array(d);K.set(N),I=new c(K.buffer,0,f)}else I=new c(i,v,f);T.set(I,_*f)}return T}var ao=p(()=>{"use strict";oo();Ue();ri()});function wg(r,e){let t=r.json.files||[],n=[];for(let s=0;s<t.length;s++){let i=t[s];(i.name===e||i.uri===e)&&n.push(s)}return H(n.length<=1,`glTF package file reference ${e} is ambiguous.`),n[0]??-1}async function fd(r,e,t,n){let s=r.json.files||[],i=typeof e=="number"?e:wg(r,e);H(Number.isInteger(i)&&i>=0&&i<s.length),r.files=r.files||new Array(s.length).fill(null);let o=r.files[i];if(o)return o;let a=s[i];H(a.mimeType,`glTF file ${i} must define mimeType.`);let c=a.uri!==void 0,u=a.bufferView!==void 0;H(c!==u,`glTF file ${i} must define exactly one of uri or bufferView.`);let l;if(a.uri!==void 0){let f=Kn(a.uri,t,n),d=await n.fetch(f);H(d?.ok,`Failed to fetch glTF file ${a.uri}: HTTP ${d?.status}.`);let h=await d.arrayBuffer();l={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength,mimeType:a.mimeType,name:a.name,url:f}}else{let f=hr(r.json,r.buffers,a.bufferView);l={arrayBuffer:f.buffer,byteOffset:f.byteOffset,byteLength:f.byteLength,mimeType:a.mimeType,name:a.name}}return r.files[i]=l,l}var WI=p(()=>{"use strict";ao();Yc();oo()});var xg={};J(xg,{name:()=>co,preprocess:()=>VR});function VR(r){let{json:e}=r;if(!(!e.extensionsUsed?.includes(co)&&!e.extensionsRequired?.includes(co))){if(!e.extensionsUsed?.includes(co)||!e.extensionsRequired?.includes(co))throw new Error(`${co}: must be declared in extensionsUsed and extensionsRequired.`);for(let[t,n]of(e.accessors||[]).entries())if(n.componentType===5130&&n.normalized)throw new Error(`${co}: accessor ${t} must not be normalized.`)}}var co,$I=p(()=>{"use strict";co="KHR_accessor_float64"});function jR(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var bn,eu=p(()=>{"use strict";qn();Ue();oo();ri();ao();bn=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||jR(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=_e(this.gltf.buffers[0].byteLength,4),this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof t=="string"||typeof n=="string"}getExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if(typeof t=="object")return t;let n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){return hr(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return ld(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForImageData(e){e=this.getAccessor(e);let t=this.getBufferView(e.bufferView),s=this.getBuffer(t.buffer).data,i=t.byteOffset||0;return new Uint8Array(s,i,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){let s=e.extensions||{};s[t]=n}removeObjectExtension(e,t){let n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(t)||s.push(t)}delete n[t]}addExtension(e,t={}){return H(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return H(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let t=this.json.extensionsRemoved;t.includes(e)||t.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){let{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:t};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:t,indices:n,material:s,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){let n=$n(e),s=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){let s=e.byteLength;H(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let i={buffer:t,byteOffset:n,byteLength:s};return this.byteLength+=_e(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){let n=t.normalized,s={bufferView:e,...n===void 0?{}:{normalized:n},type:ma(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(s),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){let n=this.addBufferView(e),s={min:t.min,max:t.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,t.size));let i={size:t.size,componentType:Xn(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(i,t))}addTexture(e){let{imageIndex:t,samplerIndex:n}=e,s={source:t,...n===void 0?{}:{sampler:n}};return this.json.textures=this.json.textures||[],this.json.textures.push(s),this.json.textures.length-1}addSampler(e){return this.json.samplers=this.json.samplers||[],this.json.samplers.push({...e}),this.json.samplers.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){if(this.byteLength===0&&!this.json.buffers?.length){delete this.json.buffers,delete this.gltf.binary,this.sourceBuffers=[],this.gltf.buffers=[];return}let e=[0],t=this.byteLength;for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&(e[o]=_e(t,8),t=e[o]+_e(a.byteLength,4))}let n=new ArrayBuffer(t),s=new Uint8Array(n),i=0;for(let o of this.sourceBuffers||[])i=to(o,s,i);for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&to(a,s,e[o])}for(let o of this.json.bufferViews||[]){let a=e[o.buffer];H(a!==void 0),o.byteOffset=a+(o.byteOffset||0),o.buffer=0;for(let c of["EXT_meshopt_compression","KHR_meshopt_compression"]){let u=o.extensions?.[c];if(u){let l=e[u.buffer];H(l!==void 0),u.byteOffset=l+(u.byteOffset||0),u.buffer=0}}}this.byteLength=t,this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n],this.gltf.buffers=[{arrayBuffer:n,byteOffset:0,byteLength:n.byteLength}]}_removeStringFromArray(e,t){let n=!0;for(;n;){let s=e.indexOf(t);s>-1?e.splice(s,1):n=!1}}_addAttributes(e={}){let t={};for(let n in e){let s=e[n],i=this._getGltfAttributeName(n),o=s.value,a=o.BYTES_PER_ELEMENT*s.size,c=_e(a,4),u;if(c===a)u=this.addBinaryBuffer(o,s);else{let l=o.length/s.size,f=new Uint8Array(l*c),d=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);for(let m=0;m<l;m++)f.set(d.subarray(m*a,(m+1)*a),m*c);let h=this.addBufferView(f);this.json.bufferViews[h].byteStride=c,u=this.addAccessor(h,{...this._getAccessorMinMax(o,s.size),...s,componentType:Xn(o),count:l})}t[i]=u}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){let n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];let s=e.subarray(0,t);for(let i of s)n.min.push(i),n.max.push(i);for(let i=t;i<e.length;i+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[i+o]),n.max[0+o]=Math.max(n.max[0+o],e[i+o]);return n}}});function GR(r){switch(r.type){case"accessor":return{get bufferView(){return r.bufferView?.data}};case"animation":return{get channels(){return uo(r.channels)},get samplers(){return uo(r.samplers)}};case"animationChannel":return{get sampler(){return r.sampler.data},get target(){return r.target.data}};case"animationChannelTarget":return{get node(){return r.node?.data}};case"animationSampler":return{get input(){return r.input.data},get output(){return r.output.data}};case"bufferView":return{get buffer(){return r.buffer.data}};case"externalAsset":return{get file(){return r.file.data}};case"file":case"image":return{get bufferView(){return r.bufferView?.data}};case"material":return{get baseColorTexture(){return r.baseColorTexture?.data},get metallicRoughnessTexture(){return r.metallicRoughnessTexture?.data},get normalTexture(){return r.normalTexture?.data},get occlusionTexture(){return r.occlusionTexture?.data},get emissiveTexture(){return r.emissiveTexture?.data},get textures(){return uo(r.textures)}};case"textureInfo":return{get texture(){return r.texture.data}};case"mesh":return{get primitives(){return uo(r.primitives)}};case"primitive":return{get attributes(){return qI(r.attributes)},get indices(){return r.indices?.data},get material(){return r.material?.data},get targets(){return r.targets.map(qI)}};case"node":return{get camera(){return r.camera?.data},get children(){return uo(r.children)},get skin(){return r.skin?.data},get mesh(){return r.mesh?.data},get externalAsset(){return r.externalAsset?.data}};case"scene":return{get nodes(){return uo(r.nodes)}};case"skin":return{get inverseBindMatrices(){return r.inverseBindMatrices?.data},get skeleton(){return r.skeleton?.data},get joints(){return uo(r.joints)}};case"texture":return{get sampler(){return r.sampler?.data},get source(){return r.source?.data}};default:return{}}}function lo(r,e){return(function*(){for(let n=0;n<r.length;n++)yield e(r[n],n)})()}function uo(r){return(function*(){for(let t of r)yield t.data})()}function qI(r){return new Map(Array.from(r,([e,t])=>[e,t.data]))}function zR(r){switch(r){case"bufferView":return"bufferViews";case"externalAsset":return"externalAssets";case"mesh":return"meshes";default:return`${r}s`}}function KI(r,e){if(r)for(let t=r.length-1;t>=0;t--)r[t]===e&&r.splice(t,1)}var Je,ni,Tg,_g,Ag,vg,dd,Ig,Sg,Eg,Lg,Bg,Fg,Og,Mg,Dg,Rg,kg,Ng,Cg,Ug,Pg,ie,He=p(()=>{"use strict";ao();ri();Je=class{gltf;type;index;data;path;iterator;constructor(e,t,n,s,i){this.iterator=e,this.gltf=e.gltf,this.type=t,this.index=n,this.data=s,this.path=i}},ni=class extends Je{parent;constructor(e,t,n,s,i,o){super(e,t,n,s,i),this.parent=o}},Tg=class extends Je{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}},_g=class extends Je{get channels(){return lo(this.data.channels,(e,t)=>this.iterator.getOrCreateNested(e,()=>new Ag(this.iterator,"animationChannel",t,e,`${this.path}.channels[${t}]`,this)))}get samplers(){return lo(this.data.samplers,(e,t)=>this.iterator.getOrCreateNested(e,()=>new dd(this.iterator,"animationSampler",t,e,`${this.path}.samplers[${t}]`,this)))}},Ag=class extends ni{get sampler(){let t=this.parent.data.samplers[this.data.sampler];if(!t)throw new Error(`Invalid glTF reference at ${this.path}.sampler: animation sampler index ${this.data.sampler} is out of range`);return this.iterator.getOrCreateNested(t,()=>new dd(this.iterator,"animationSampler",this.data.sampler,t,`${this.parent.path}.samplers[${this.data.sampler}]`,this.parent))}get target(){return this.iterator.getOrCreateNested(this.data.target,()=>new vg(this.iterator,"animationChannelTarget",0,this.data.target,`${this.path}.target`,this))}},vg=class extends ni{get node(){return this.data.node===void 0?void 0:this.iterator.resolveNode(this.data.node,`${this.path}.node`)}},dd=class extends ni{get input(){return this.iterator.resolveAccessor(this.data.input,`${this.path}.input`)}get output(){return this.iterator.resolveAccessor(this.data.output,`${this.path}.output`)}},Ig=class extends Je{get loadedBuffer(){return this.gltf.buffers[this.index]}},Sg=class extends Je{get buffer(){return this.iterator.resolveBuffer(this.data.buffer,`${this.path}.buffer`)}get loadedBufferView(){let e=this.buffer.loadedBuffer;if(!e)return;let t=e.byteOffset+(this.data.byteOffset||0);return new Uint8Array(e.arrayBuffer,t,this.data.byteLength)}},Eg=class extends Je{},Lg=class extends Je{get file(){return this.iterator.resolveFile(this.data.file,`${this.path}.file`)}get loadedAsset(){return this.gltf.externalAssets?.[this.index]}},Bg=class extends Je{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedFile(){return this.gltf.files?.[this.index]}},Fg=class extends Je{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedImage(){return this.gltf.images?.[this.index]}},Og=class extends Je{get baseColorTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.baseColorTexture,0,"pbrMetallicRoughness.baseColorTexture")}get metallicRoughnessTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.metallicRoughnessTexture,1,"pbrMetallicRoughness.metallicRoughnessTexture")}get normalTexture(){return this.getTextureInfo(this.data.normalTexture,2,"normalTexture")}get occlusionTexture(){return this.getTextureInfo(this.data.occlusionTexture,3,"occlusionTexture")}get emissiveTexture(){return this.getTextureInfo(this.data.emissiveTexture,4,"emissiveTexture")}get textures(){return[this.baseColorTexture,this.metallicRoughnessTexture,this.normalTexture,this.occlusionTexture,this.emissiveTexture].filter(t=>!!t).values()}getTextureInfo(e,t,n){return e?this.iterator.getOrCreateNested(e,()=>new Mg(this.iterator,"textureInfo",t,e,`${this.path}.${n}`,this)):void 0}},Mg=class extends ni{get texture(){return this.iterator.resolveTexture(this.data.index,`${this.path}.index`)}},Dg=class extends Je{get primitives(){return lo(this.data.primitives,(e,t)=>this.iterator.getOrCreateNested(e,()=>new Rg(this.iterator,"primitive",t,e,`${this.path}.primitives[${t}]`,this)))}},Rg=class extends ni{get attributes(){return new Map(Object.entries(this.data.attributes).map(([e,t])=>[e,this.iterator.resolveAccessor(t,`${this.path}.attributes.${e}`)]))}get indices(){return this.data.indices===void 0?void 0:this.iterator.resolveAccessor(this.data.indices,`${this.path}.indices`)}get material(){return this.data.material===void 0?void 0:this.iterator.resolveMaterial(this.data.material,`${this.path}.material`)}get targets(){return(this.data.targets||[]).map((e,t)=>new Map(Object.entries(e).map(([n,s])=>[n,this.iterator.resolveAccessor(s,`${this.path}.targets[${t}].${n}`)])))}},kg=class extends Je{get camera(){return this.data.camera===void 0?void 0:this.iterator.resolveCamera(this.data.camera,`${this.path}.camera`)}get children(){return lo(this.data.children||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.children[${t}]`))}get skin(){return this.data.skin===void 0?void 0:this.iterator.resolveSkin(this.data.skin,`${this.path}.skin`)}get mesh(){return this.data.mesh===void 0?void 0:this.iterator.resolveMesh(this.data.mesh,`${this.path}.mesh`)}get externalAsset(){return this.data.externalAsset===void 0?void 0:this.iterator.resolveExternalAsset(this.data.externalAsset,`${this.path}.externalAsset`)}},Ng=class extends Je{},Cg=class extends Je{get nodes(){return lo(this.data.nodes||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.nodes[${t}]`))}},Ug=class extends Je{get inverseBindMatrices(){return this.data.inverseBindMatrices===void 0?void 0:this.iterator.resolveAccessor(this.data.inverseBindMatrices,`${this.path}.inverseBindMatrices`)}get skeleton(){return this.data.skeleton===void 0?void 0:this.iterator.resolveNode(this.data.skeleton,`${this.path}.skeleton`)}get joints(){return lo(this.data.joints,(e,t)=>this.iterator.resolveNode(e,`${this.path}.joints[${t}]`))}},Pg=class extends Je{get sampler(){return this.data.sampler===void 0?void 0:this.iterator.resolveSampler(this.data.sampler,`${this.path}.sampler`)}get source(){return this.data.source===void 0?void 0:this.iterator.resolveImage(this.data.source,`${this.path}.source`)}},ie=class{gltf;objectCache=new WeakMap;referencesCache=new WeakMap;constructor(e){this.gltf=e}get data(){return this.gltf.json}getTypedArrayForBufferView(e){return hr(this.data,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return ld(this.data,this.gltf.buffers,e)}getTypedArrayForImageData(e){return zI(this.data,this.gltf.buffers,e)}getLoadedBuffer(e){let t=this.getMetadata(e);return this.gltf.buffers[t.index]}getLoadedBufferView(e){let t=this.getReferences(e).buffer,n=this.getLoadedBuffer(t);if(!n)return;let s=n.byteOffset+(e.byteOffset||0);return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getLoadedImage(e){return this.gltf.images?.[this.getMetadata(e).index]}getLoadedFile(e){return this.gltf.files?.[this.getMetadata(e).index]}getLoadedExternalAsset(e){return this.gltf.externalAssets?.[this.getMetadata(e).index]}addBuffer(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return this.gltf.buffers.push({arrayBuffer:t,byteOffset:0,byteLength:e.byteLength}),this.data.buffers||=[],this.data.buffers.push({byteLength:e.byteLength}),this.data.buffers.length-1}addBufferView(e,t,n=0){return this.data.bufferViews||=[],this.data.bufferViews.push({buffer:e,byteOffset:n,byteLength:t}),this.data.bufferViews.length-1}addAccessor(e,t){return this.data.accessors||=[],this.data.accessors.push({bufferView:e,type:ma(t.size),componentType:t.componentType,count:t.count,min:t.min,max:t.max}),this.data.accessors.length-1}getReferences(e){let t=this.referencesCache.get(e);if(t)return t;let n=this.getObjectIterator(e),s=GR(n);return this.referencesCache.set(e,s),s}getMetadata(e){let t=this.getObjectIterator(e),n=t instanceof ni?t.parent.data:void 0;return{gltf:this.gltf,type:t.type,index:t.index,parent:n,path:t.path}}get scene(){return this.data.scene===void 0?void 0:this.resolveScene(this.data.scene,"scene").data}get thumbnail(){return this.data.asset.thumbnail===void 0?void 0:this.resolveImage(this.data.asset.thumbnail,"asset.thumbnail").data}get accessors(){return this.iterateCollectionData("accessor")}get animations(){return this.iterateCollectionData("animation")}get buffers(){return this.iterateCollectionData("buffer")}get bufferViews(){return this.iterateCollectionData("bufferView")}get cameras(){return this.iterateCollectionData("camera")}get externalAssets(){return this.iterateCollectionData("externalAsset")}get files(){return this.iterateCollectionData("file")}get images(){return this.iterateCollectionData("image")}get materials(){return this.iterateCollectionData("material")}get meshes(){return this.iterateCollectionData("mesh")}get nodes(){return this.iterateCollectionData("node")}get samplers(){return this.iterateCollectionData("sampler")}get scenes(){return this.iterateCollectionData("scene")}get skins(){return this.iterateCollectionData("skin")}get textures(){return this.iterateCollectionData("texture")}hasExtension(e){return!!this.data.extensionsUsed?.includes(e)||!!this.data.extensionsRequired?.includes(e)}isExtensionRequired(e){return!!this.data.extensionsRequired?.includes(e)}getExtension(e,t){let n=typeof e=="string"?this.data:e,s=typeof e=="string"?e:t;return n.extensions?.[s]}setExtension(e,t,n){let s=typeof e=="string",i=s?this.data:e,o=s?e:t,a=s?t:n,c=s?!!n:!1;i.extensions||={},i.extensions[o]=a,this.registerUsedExtension(o),c&&this.registerRequiredExtension(o)}registerUsedExtension(e){this.data.extensionsUsed||=[],this.data.extensionsUsed.includes(e)||this.data.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.data.extensionsRequired||=[],this.data.extensionsRequired.includes(e)||this.data.extensionsRequired.push(e)}removeExtension(e,t){let n=typeof e=="string",s=n?this.data:e,i=n?e:t;s.extensions?.[i]!==void 0&&(this.recordRemovedExtension(i),delete s.extensions[i]),n&&(KI(this.data.extensionsUsed,i),KI(this.data.extensionsRequired,i))}recordRemovedExtension(e){let t=this.data;t.extensionsRemoved||=[],t.extensionsRemoved.includes(e)||t.extensionsRemoved.push(e)}resolveAccessor(e,t){return this.resolveCollectionObject("accessor",e,t)}resolveBuffer(e,t){return this.resolveCollectionObject("buffer",e,t)}resolveBufferView(e,t){return this.resolveCollectionObject("bufferView",e,t)}resolveCamera(e,t){return this.resolveCollectionObject("camera",e,t)}resolveExternalAsset(e,t){return this.resolveCollectionObject("externalAsset",e,t)}resolveFile(e,t){return this.resolveCollectionObject("file",e,t)}resolveImage(e,t){return this.resolveCollectionObject("image",e,t)}resolveMaterial(e,t){return this.resolveCollectionObject("material",e,t)}resolveMesh(e,t){return this.resolveCollectionObject("mesh",e,t)}resolveNode(e,t){return this.resolveCollectionObject("node",e,t)}resolveSampler(e,t){return this.resolveCollectionObject("sampler",e,t)}resolveScene(e,t){return this.resolveCollectionObject("scene",e,t)}resolveSkin(e,t){return this.resolveCollectionObject("skin",e,t)}resolveTexture(e,t){return this.resolveCollectionObject("texture",e,t)}getOrCreateNested(e,t){return this.getOrCreate(e,t)}iterateCollection(e){let t=this.getCollection(e);return lo(t,(n,s)=>this.resolveCollectionObject(e,s,e))}iterateCollectionData(e){return(function*(n){for(let s of n.iterateCollection(e))yield s.data})(this)}getObjectIterator(e){let t=this.objectCache.get(e);if(!t)throw new Error("glTF object is not registered with this iterator");return t}resolveCollectionObject(e,t,n){let i=this.getCollection(e)[t];if(!i)throw new Error(`Invalid glTF reference at ${n}: ${e} index ${t} is out of range`);return this.getOrCreate(i,()=>this.createCollectionObject(e,t,i))}getCollection(e){switch(e){case"accessor":return this.data.accessors||[];case"animation":return this.data.animations||[];case"buffer":return this.data.buffers||[];case"bufferView":return this.data.bufferViews||[];case"camera":return this.data.cameras||[];case"externalAsset":return this.data.externalAssets||[];case"file":return this.data.files||[];case"image":return this.data.images||[];case"material":return this.data.materials||[];case"mesh":return this.data.meshes||[];case"node":return this.data.nodes||[];case"sampler":return this.data.samplers||[];case"scene":return this.data.scenes||[];case"skin":return this.data.skins||[];case"texture":return this.data.textures||[]}}createCollectionObject(e,t,n){let s=`${zR(e)}[${t}]`;switch(e){case"accessor":return new Tg(this,e,t,n,s);case"animation":return new _g(this,e,t,n,s);case"buffer":return new Ig(this,e,t,n,s);case"bufferView":return new Sg(this,e,t,n,s);case"camera":return new Eg(this,e,t,n,s);case"externalAsset":return new Lg(this,e,t,n,s);case"file":return new Bg(this,e,t,n,s);case"image":return new Fg(this,e,t,n,s);case"material":return new Og(this,e,t,n,s);case"mesh":return new Dg(this,e,t,n,s);case"node":return new kg(this,e,t,n,s);case"sampler":return new Ng(this,e,t,n,s);case"scene":return new Cg(this,e,t,n,s);case"skin":return new Ug(this,e,t,n,s);case"texture":return new Pg(this,e,t,n,s)}}getOrCreate(e,t){let n=this.objectCache.get(e);if(n)return n;let s=t();return this.objectCache.set(e,s),s}}});function XI(r){return(r%1+1)%1}function tu(r,e){return JI[e]*HI[r]}function ba(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;let s=r.getTypedArrayForBufferView(e),i=ga(s,"SCALAR",t,n+1);if(i instanceof BigInt64Array||i instanceof BigUint64Array){let o=new Float64Array(i.length),a=BigInt(Number.MAX_SAFE_INTEGER);for(let c=0;c<i.length;c++){let u=i[c];if(u<0n||u>a)throw new Error("EXT_structural_metadata: UINT64 offset exceeds the safe integer range");o[c]=Number(u)}return o}return i}function ga(r,e,t,n=1){let s=HI[e],i=WR[t],o=JI[t],a=n*s,c=a*o,u=r.buffer,l=r.byteOffset;return l%o!==0&&(u=new Uint8Array(u).slice(l,l+c).buffer,l=0),new i(ro(u),l,a)}function ya(r,e,t){let n=`TEXCOORD_${e.texCoord||0}`,s=t.attributes[n],i=r.getTypedArrayForAccessor(s),o=r.gltf.json,a=e.index,c=o.textures?.[a]?.source;if(typeof c<"u"){let u=o.images?.[c]?.mimeType,l=r.gltf.images?.[c];if(l&&typeof l.width<"u"&&!("compressed"in l&&l.compressed)){let f=[];for(let d=0;d<i.length;d+=2){let h=$R(l,u,i,d,e.channels);f.push(h)}return f}}return[]}function hd(r,e,t,n,s){if(!t?.length)return;let i=[];for(let f of t){let d=n.findIndex(h=>h===f);d===-1&&(d=n.push(f)-1),i.push(d)}let o=new Uint32Array(i),a=r instanceof ie?r:new ie(r.gltf),c=a.addBuffer(o),u=a.addBufferView(c,o.byteLength),l=a.addAccessor(u,{size:1,componentType:Xn(o),count:o.length});s.attributes[e]=l}function $R(r,e,t,n,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],a=t[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let u=qR(o,a,r,c),l=0;for(let f of s){let d=typeof f=="number"?Object.values(i)[f]:i[f],h=u+d.offset,m=Jc(r);if(m.data.length<=h)throw new Error(`${m.data.length} <= ${h}`);let b=m.data[h];l|=b<<d.shift}return l}function qR(r,e,t,n=1){let s=t.width,i=XI(r)*(s-1),o=Math.round(i),a=t.height,c=XI(e)*(a-1),u=Math.round(c),l=t.components?t.components:n;return(u*s+o)*l}function ru(r,e,t,n=1){let s=[];for(let i=0;i<e;i++){let o=Number(t[i]),a=Number(t[i+1])-o;if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<0||(o+a)*n>r.length)break;let c=o*n,u=a*n;s.push(r.slice(c,c+u))}return s}function nu(r,e,t,n=1){let s=[],i=t*n;for(let o=0;o<e;o++){let a=o*i;s.push(r.slice(a,a+i))}return s}function pd(r,e,t,n,s){let i=new TextDecoder("utf8");if(t){if(!n)throw new Error("stringOffsets is required for variable-length string arrays");let o=[];for(let a=0;a<r;a++){let c=t[a],u=t[a+1],l=[];for(let f=c;f<u;f++){let d=n[f],h=n[f+1],m=e.subarray(d,h);l.push(i.decode(m))}o.push(l)}return o}if(n){let o=[],a=r*(s||1);for(let c=0;c<a;c++){let u=Number(n[c]),l=Number(n[c+1]);u>=0&&l>=u&&l<=e.length&&o.push(i.decode(e.subarray(u,l)))}return s?Array.from({length:r},(c,u)=>o.slice(u*s,(u+1)*s)):o}return[]}var HI,WR,JI,md=p(()=>{"use strict";He();ri();qn();Ue();HI={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},WR={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},JI={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8}});var Vg={};J(Vg,{createExtMeshFeatures:()=>ZR,decode:()=>XR,encode:()=>HR,name:()=>KR});async function XR(r,e){let t=new ie(r);JR(t,e)}function HR(r,e){let t=new bn(r);return QR(t,e),t.createBinaryChunk(),t.gltf}function JR(r,e){for(let t of r.meshes)for(let n of r.getReferences(t).primitives)YR(r,n,e)}function YR(r,e,t){let s=r.getExtension(e,wa)?.featureIds||[];if(s)for(let i of s){let o;if(typeof i.attribute<"u"){if(!t?.gltf?.loadBuffers)continue;let a=`_FEATURE_ID_${i.attribute}`,c=e.attributes[a];o=r.getTypedArrayForAccessor(c)}else if(typeof i.texture<"u"){if(!t?.gltf?.loadImages)continue;o=ya(r,i.texture,e)}else{let a=e.attributes.POSITION,c=typeof a=="number"?r.data.accessors?.[a]?.count:a?.count;if(typeof c!="number"||!Number.isInteger(c)||c<0)throw new Error("EXT_mesh_features: implicit feature IDs require a POSITION accessor");if(i.featureCount!==c)throw new Error(`EXT_mesh_features: implicit featureCount ${i.featureCount} does not match vertex count ${c}`);delete i.data,Object.defineProperty(i,"implicit",{configurable:!0,enumerable:!1,writable:!0,value:{start:0,count:c}})}o&&(i.data=o,delete i.implicit)}}function QR(r,e){let t=r.gltf.json.meshes;if(t)for(let n of t)for(let s of n.primitives)ek(r,s)}function ZR(r,e,t,n){e.extensions||(e.extensions={});let s=e.extensions[wa];s||(s={featureIds:[]},e.extensions[wa]=s);let{featureIds:i}=s,o={featureCount:t.length,propertyTable:n,data:t};i.push(o),r.addObjectExtension(e,wa,s)}function ek(r,e){let t=e.extensions?.[wa];if(!t)return;let n=t.featureIds;n.forEach((s,i)=>{if(s.data){let{accessorKey:o,index:a}=tk(e.attributes),c=new Uint32Array(s.data);n[i]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a};let u=r.addBufferView(c),l=r.addAccessor(u,{size:1,componentType:Xn(c),count:c.length});e.attributes[o]=l}})}function tk(r){let e="_FEATURE_ID_",t=Object.keys(r).filter(i=>i.indexOf(e)===0),n=-1;for(let i of t){let o=Number(i.substring(e.length));o>n&&(n=o)}return n++,{accessorKey:`${e}${n}`,index:n}}var wa,KR,YI=p(()=>{"use strict";eu();He();md();ri();wa="EXT_mesh_features",KR=wa});var Wg={};J(Wg,{createExtStructuralMetadata:()=>Sk,decode:()=>nk,encode:()=>sk,name:()=>rk});async function nk(r,e,t){let n=new ie(r),s=n.getExtension(fo);if(e.gltf?.loadBuffers&&s?.schemaUri&&!s.schema){if(!t?.fetch)throw new Error("EXT_structural_metadata: a loader context is required to load schemaUri");let i=Kn(s.schemaUri,e,t),o=await t.fetch(i);if(!o.ok)throw new Error(`EXT_structural_metadata: failed to load schemaUri ${i} (${o.status})`);s.schema=await o.json()}ik(n,e)}function sk(r,e){let t=new bn(r);return vk(t,e),t.createBinaryChunk(),t.gltf}function ik(r,e){if(!e.gltf?.loadBuffers)return;let t=r.getExtension(fo);t&&(e.gltf?.loadImages&&ok(r,t),ak(r,t))}function ok(r,e){let t=e.propertyTextures,n=r.data;if(t&&n.meshes)for(let s of n.meshes)for(let i of s.primitives)ck(r,t,i,e)}function ak(r,e){let t=e.schema;if(!t)return;let n=t.classes,s=e.propertyTables;if(n&&s)for(let i of s)i.class&&n[i.class]&&lk(r,t,i)}function ck(r,e,t,n){if(!e)return;let i=t.extensions?.[fo]?.propertyTextures;if(i)for(let o of i){let a=e[o];uk(r,a,t,n)}}function uk(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let i in e.properties){let o=`${s}_${i}`,a=e.properties?.[i];if(!a)continue;a.data||(a.data=[]);let c=a.data,u=ya(r,a,t);u!==null&&(hd(r,o,u,c,t),a.data=c,n.dataAttributeNames.push(o))}}function lk(r,e,t){let n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);let s=t.count;for(let i in n.properties){let o=n.properties[i],a=t.properties?.[i];if(a){let c={},u=fk(r,e,o,s,a,c);a.data=u,c.value!==void 0&&Object.defineProperty(a,"rawData",{value:c.value,configurable:!0,enumerable:!1,writable:!0})}}}function fk(r,e,t,n,s,i){let o=[],a=s.values,c=r.getTypedArrayForBufferView(a),u=hk(r,t,s,n),l=pk(r,t,s,n,u);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{let f=mk(t,s,n,c,u);o=f.data,i&&(i.value=f.rawData);break}case"BOOLEAN":{o=dk(t,n,c,u);break}case"STRING":{o=pd(n,c,u,l,t.array?t.count:void 0);break}case"ENUM":{o=wk(e,t,n,c,u);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return o}function dk(r,e,t,n){return r.array?n?Array.from({length:e},(s,i)=>{let o=Number(n[i]),a=Number(n[i+1]);if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<o)throw new Error("EXT_structural_metadata: invalid BOOLEAN array offsets");return jg(t,o,a-o)}):r.count===void 0?[]:Array.from({length:e},(s,i)=>jg(t,i*r.count,r.count)):jg(t,0,e)}function jg(r,e,t){if(e+t>r.byteLength*8)throw new Error("EXT_structural_metadata: BOOLEAN values exceed their buffer view");return Array.from({length:t},(n,s)=>{let i=e+s;return!!(r[Math.floor(i/8)]&1<<i%8)})}function hk(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?ba(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function pk(r,e,t,n,s){if(typeof t.stringOffsets<"u"){let i=s?Number(s[n]):n*(e.array&&e.count||1);return ba(r,t.stringOffsets,t.stringOffsetType||"UINT32",i)}return null}function mk(r,e,t,n,s){let i=r.array,o=r.count,a={VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}[r.type]||1,c=tu(r.type,r.componentType),u=n.byteLength/c,l;r.componentType?l=ga(n,r.type,r.componentType,u):l=n;let f=l,d=e.offset??r.offset,h=e.scale??r.scale,m=r.normalized||d!==void 0||h!==void 0?bk(f,r.componentType,r.type,r.normalized,d,h):f;return i?s?{data:ru(m,t,s,a),rawData:ru(f,t,s,a)}:o?{data:nu(m,t,o,a),rawData:nu(f,t,o,a)}:{data:[],rawData:[]}:{data:m,rawData:f}}function bk(r,e,t,n,s,i){let o=yk(e),a=!!(n&&o!==void 0);if(!a&&s===void 0&&i===void 0)return r;let c=gk(t),u=new Float64Array(r.length);for(let l=0;l<r.length;l++){let f=Number(r[l]);a&&(f=e?.startsWith("INT")?Math.max(f/o,-1):f/o);let d=l%c,h=Array.isArray(s)?s[d]??0:s??0,m=Array.isArray(i)?i[d]??1:i??1;u[l]=f*m+h}return u}function gk(r){switch(r){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}}function yk(r){switch(r){case"INT8":return 127;case"UINT8":return 255;case"INT16":return 32767;case"UINT16":return 65535;case"INT32":return 2147483647;case"UINT32":return 4294967295;case"INT64":return 2**63-1;case"UINT64":return 2**64-1;default:return}}function wk(r,e,t,n,s){let i=e.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=r.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let a=o.valueType||"UINT16",c=tu(e.type,a),u=n.byteLength/c,l=ga(n,e.type,a,u);if(l||(l=n),e.array){if(s)return xk({valuesData:l,numberOfElements:t,arrayOffsets:s,enumEntry:o});let f=e.count;return f?Tk(l,t,f,o):[]}return zg(l,0,t,o)}function xk(r){let{valuesData:e,numberOfElements:t,arrayOffsets:n,enumEntry:s}=r,i=[];for(let o=0;o<t;o++){let a=Number(n[o]),c=Number(n[o+1])-a;if(!Number.isInteger(a)||!Number.isInteger(c)||a<0||c<0||a+c>e.length)break;let u=zg(e,a,c,s);i.push(u)}return i}function Tk(r,e,t,n){let s=[];for(let i=0;i<e;i++){let o=t*i,a=zg(r,o,t,n);s.push(a)}return s}function zg(r,e,t,n){let s=[];for(let i=0;i<t;i++){let o=r[e+i],a=_k(n,o);a?s.push(a.name):s.push("")}return s}function _k(r,e){for(let t of r.values)if(typeof e=="bigint"?Number.isSafeInteger(t.value)&&BigInt(t.value)===e:t.value===e)return t;return null}function vk(r,e){let t=r.getExtension(fo);if(t&&t.propertyTables)for(let n of t.propertyTables){let s=n.class,i=t.schema?.classes?.[s];n.properties&&i&&Ik(n,i,r)}}function Ik(r,e,t){for(let n in r.properties){let s=r.properties[n].data;if(s){let i=e.properties[n];if(i){let o=Bk(s,i,t);r.properties[n]=o}}}}function Sk(r,e,t=Ak){let n=r.getExtension(fo);n||(n=r.addExtension(fo)),n.schema=Ek(e,t,n.schema);let s=Lk(e,t,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function Ek(r,e,t){let n=t??{id:"schema_id"},s={properties:{}};for(let i of r){let o={type:i.elementType,componentType:i.componentType};s.properties[i.name]=o}return n.classes={},n.classes[e]=s,n}function Lk(r,e,t){let n={class:e,count:0},s=0,i=t.classes?.[e];for(let o of r){if(s===0&&(s=o.values.length),s!==o.values.length&&o.values.length)throw new Error("Illegal values in attributes");i?.properties[o.name]&&(n.properties||(n.properties={}),n.properties[o.name]={values:0,data:o.values})}return n.count=s,n}function Bk(r,e,t){let n={values:0};if(e.type==="STRING"){let{stringData:s,stringOffsets:i}=Mk(r);n.stringOffsets=Gg(i,t),n.values=Gg(s,t)}else if(e.type==="SCALAR"&&e.componentType){let s=Ok(r,e.componentType);n.values=Gg(s,t)}return n}function Ok(r,e){let t=[];for(let s of r)t.push(Number(s));let n=Fk[e];if(!n)throw new Error("Illegal component type");return new n(t)}function Mk(r){let e=new TextEncoder,t=[],n=0;for(let c of r){let u=e.encode(c);n+=u.length,t.push(u)}let s=new Uint8Array(n),i=[],o=0;for(let c of t)s.set(c,o),i.push(o),o+=c.length;i.push(o);let a=new Uint32Array(i);return{stringData:s,stringOffsets:a}}function Gg(r,e){return e.addBufferView(r)}var fo,rk,Ak,Fk,QI=p(()=>{"use strict";eu();He();md();Yc();fo="EXT_structural_metadata",rk=fo;Ak="schemaClassId";Fk={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array}});var qg={};J(qg,{SPZ_COMPRESSION_EXTENSION_NAME:()=>su,decode:()=>Rk,getGaussianSplatPrimitives:()=>ZI,name:()=>$g});async function Rk(r,e,t){let n=t?.loaders?.find(o=>o.extensions?.includes("spz")),s=ZI(r),i=new ie(r);for(let[o,a]of(r.json.meshes||[]).entries())for(let[c,u]of a.primitives.entries()){let l=u.extensions?.[$g];if(!l)continue;let f=s.find(b=>b.meshIndex===o&&b.primitiveIndex===c),d=e?.gltf?.legacyGaussianSplatColorSpace,h=d&&l.extensions?.[su]?{...l,kernel:l.kernel??"ellipse",colorSpace:l.colorSpace??d}:l;f&&(f.extension=h),Nk(r.json,u,h,o,c,i);let m=l.extensions?.[su];if(m&&f){let b=e?.gltf?.splatDecoder,g=r.json.bufferViews?.[m.bufferView];if(g&&r.buffers[g.buffer])f.compressedBytes=kk(r,m.bufferView);else if(b||n)throw new Error(`KHR_gaussian_splatting: bufferView ${m.bufferView} is not loaded for SPZ2 decoding.`);n&&t&&f.compressedBytes?f.decoded=await Xs(f.compressedBytes.buffer,n,{...e,splats:{...e.splats,sourceCoordinateSystem:"LUF"}},t):b&&f.compressedBytes&&(f.decoded=await b(f.compressedBytes.buffer,{sourceCoordinateSystem:"LUF"}))}}s.length&&(r.gaussianSplatPrimitives=s)}function kk(r,e){let t=r.json.bufferViews?.[e];if(!t)throw new Error(`KHR_gaussian_splatting: bufferView ${e} is not defined.`);let n=r.buffers[t.buffer];if(!n)throw new Error(`KHR_gaussian_splatting: buffer ${t.buffer} is not loaded for SPZ2 payload.`);let s=n.byteOffset+(t.byteOffset||0);return new Uint8Array(n.arrayBuffer,s,t.byteLength).slice()}function ZI(r){let e="json"in r?r.json:r,t=[];for(let[n,s]of(e.meshes||[]).entries())for(let[i,o]of s.primitives.entries()){let a=o.extensions?.[$g];if(!a)continue;let c=a.extensions?.[su]?.bufferView;t.push({meshIndex:n,primitiveIndex:i,attributes:{...o.attributes},extension:a,compressedBufferView:c})}return t}function Nk(r,e,t,n,s,i){if((e.mode??4)!==0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} must use POINTS mode.`);if(typeof t.kernel!="string"||t.kernel.length===0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} is missing kernel.`);if(typeof t.colorSpace!="string"||t.colorSpace.length===0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} is missing colorSpace.`);let o=t.extensions?.[su]?.bufferView;if(o!==void 0){if(!Number.isInteger(o)||o<0||o>=(r.bufferViews||[]).length)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has an invalid SPZ bufferView.`)}else for(let a of Dk)if(e.attributes[a]===void 0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} is missing ${a}.`);for(let[a,c]of Object.entries(e.attributes))if(!Number.isInteger(c)||c<0||c>=(r.accessors||[]).length)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has invalid accessor ${a}.`);Ck(r,e,i,n,s);for(let a=1;a<=3;a++){let c=a*2+1,u=Array.from({length:c},(l,f)=>e.attributes[`KHR_gaussian_splatting:SH_DEGREE_${a}_COEF_${f}`]!==void 0);if(u.some(Boolean)&&!u.every(Boolean))throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has incomplete SH degree ${a}.`);if(u.some(Boolean)&&a>1){let l=a-1,f=l*2+1;for(let d=0;d<f;d++)if(e.attributes[`KHR_gaussian_splatting:SH_DEGREE_${l}_COEF_${d}`]===void 0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} skips SH degree ${l}.`)}}}function Ck(r,e,t,n,s){let i=e.attributes["KHR_gaussian_splatting:SCALE"],o=e.attributes["KHR_gaussian_splatting:OPACITY"];for(let[a,c,u]of[["KHR_gaussian_splatting:SCALE",i,l=>l>=0],["KHR_gaussian_splatting:OPACITY",o,l=>l>=0&&l<=1]]){if(c===void 0||!Uk(r,t,c))continue;let l=t.getTypedArrayForAccessor(c);for(let f=0;f<l.length;f++)if(!u(Number(l[f])))throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has an invalid ${a} value.`)}}function Uk(r,e,t){let n=r.accessors?.[t],s=n?.bufferView===void 0?void 0:r.bufferViews?.[n.bufferView];return!!(s&&e.gltf.buffers[s.buffer])}var $g,su,Dk,eS=p(()=>{"use strict";Ue();He();$g="KHR_gaussian_splatting",su="KHR_gaussian_splatting_compression_spz_2",Dk=["POSITION","KHR_gaussian_splatting:ROTATION","KHR_gaussian_splatting:SCALE","KHR_gaussian_splatting:OPACITY","KHR_gaussian_splatting:SH_DEGREE_0_COEF_0"]});var Xg={};J(Xg,{decode:()=>Pk,getVoxelPrimitives:()=>Vk,name:()=>Kg});async function Pk(r){for(let[e,t]of(r.json.meshes||[]).entries())for(let[n,s]of t.primitives.entries()){let i=s.extensions?.[Kg];i&&jk(r.json,s,i,e,n)}}function Vk(r){let e="json"in r?r.json:r,t=[];for(let[n,s]of(e.meshes||[]).entries())for(let[i,o]of s.primitives.entries()){let a=o.extensions?.[Kg];a&&t.push({meshIndex:n,primitiveIndex:i,attributes:{...o.attributes},extension:a})}return t}function jk(r,e,t,n,s){if(!Number.isInteger(t.shape)||t.shape<0)throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} has invalid shape.`);if(!Array.isArray(t.dimensions)||t.dimensions.length!==3||t.dimensions.some(i=>!Number.isInteger(i)||i<=0))throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} must provide three positive dimensions.`);if(e.mode!==void 0&&e.mode!==2147483647)throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} must use voxel mode.`);for(let i of Object.keys(e.attributes)){let o=e.attributes[i];if(!Number.isInteger(o)||o<0||o>=(r.accessors||[]).length)throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} has invalid accessor ${i}.`)}}var Kg,tS=p(()=>{"use strict";Kg="EXT_primitive_voxels"});var Hg={};J(Hg,{decode:()=>zk,getPrimitiveRestartRanges:()=>bd,name:()=>si});async function zk(r,e){if(!r.json.extensionsUsed?.includes(si))return;if(!r.json.extensionsRequired?.includes(si))throw new Error(`${si} must be declared in extensionsRequired`);if(!e.gltf?.loadBuffers)return;let t=new ie(r);for(let n of t.meshes)for(let s of t.getReferences(n).primitives)Wk(t,s)}function Wk(r,e){if(e.indices===void 0)return;let t=e.indices,n=typeof t=="number"?r.data.accessors?.[t]:t;if(!n)throw new Error(`${si}: primitive references missing indices accessor ${e.indices}`);let s=$k(n),i=r.getTypedArrayForAccessor(e.indices),o=Array.prototype.includes.call(i,s);if(!Gk.has(e.mode??4)){if(o)throw new Error(`${si}: primitive restart is not valid for mode ${e.mode??4}`);return}Object.defineProperty(e,"primitiveRestart",{configurable:!0,enumerable:!1,writable:!0,value:{restartIndex:s,ranges:bd(i,s)}})}function $k(r){if(r.type!=="SCALAR")throw new Error(`${si}: indices accessor must have SCALAR type`);switch(r.componentType){case 5121:return 255;case 5123:return 65535;case 5125:return 4294967295;default:throw new Error(`${si}: indices accessor must use an unsigned integer component type`)}}function bd(r,e){let t=[],n=0;for(let s=0;s<=r.length;s++)(s===r.length||r[s]===e)&&(s>n&&t.push({offset:n,count:s-n}),n=s+1);return t}var si,Gk,Jg=p(()=>{"use strict";He();si="KHR_mesh_primitive_restart",Gk=new Set([2,3,5,6])});var Yg={};J(Yg,{decode:()=>qk,name:()=>qt});async function qk(r,e){if(!e.gltf?.loadBuffers)return;let t=new ie(r);for(let n of t.meshes)for(let s of t.getReferences(n).primitives){let i=t.getExtension(s,qt);i&&Object.defineProperty(i,"data",{configurable:!0,enumerable:!1,writable:!0,value:Kk(t,s,i)})}}function Kk(r,e,t){if(!Number.isInteger(t.count)||t.count<1)throw new Error(`${qt}: count must be a positive integer`);if((e.mode??4)!==4||e.indices===void 0)throw new Error(`${qt}: primitive must use TRIANGLES mode with indices`);let n=gd(r,e.indices,"indices"),s=gd(r,t.indicesOffsets,"indicesOffsets",t.count),i=gd(r,t.loopIndices,"loopIndices"),o=gd(r,t.loopIndicesOffsets,"loopIndicesOffsets",t.count),a=r.data.accessors?.[t.loopIndices],c=Xk(a.componentType);rS(s,n.length,"indicesOffsets"),rS(o,i.length,"loopIndicesOffsets");let u=[];for(let l=0;l<t.count;l++){let f=Number(s[l]),d=l+1<t.count?Number(s[l+1]):n.length,h=Number(o[l]),m=l+1<t.count?Number(o[l+1]):i.length,b=Array.from(i).slice(h,m),g=bd(b,c).map(y=>({offset:y.offset+h,count:y.count}));if((d-f)%3!==0)throw new Error(`${qt}: polygon ${l} triangle range must contain complete triangles`);if(g.length===0)throw new Error(`${qt}: polygon ${l} must contain at least one loop`);if(g.some(y=>y.count<3))throw new Error(`${qt}: polygon ${l} loops must contain at least three indices`);u.push({triangleRange:{offset:f,count:d-f},loopRanges:g})}return{indicesOffsets:s,loopIndices:i,loopIndicesOffsets:o,polygons:u}}function gd(r,e,t,n){if(typeof e=="number"&&(!Number.isInteger(e)||e<0))throw new Error(`${qt}: ${t} must reference an accessor`);let s=typeof e=="number"?r.data.accessors?.[e]:e;if(!s)throw new Error(`${qt}: ${t} references missing accessor ${e}`);if(s.type!=="SCALAR"||![5121,5123,5125].includes(s.componentType))throw new Error(`${qt}: ${t} must be an unsigned integer SCALAR accessor`);if(n!==void 0&&s.count!==n)throw new Error(`${qt}: ${t} count must equal polygon count ${n}`);return r.getTypedArrayForAccessor(e)}function rS(r,e,t){if(Number(r[0])!==0)throw new Error(`${qt}: ${t} must begin at zero`);let n=-1;for(let s=0;s<r.length;s++){let i=Number(r[s]);if(!Number.isInteger(i)||i<0||i>=e||i<=n)throw new Error(`${qt}: ${t} must contain increasing in-bounds offsets`);n=i}}function Xk(r){switch(r){case 5121:return 255;case 5123:return 65535;case 5125:return 4294967295;default:throw new Error(`${qt}: unsupported loop index component type ${r}`)}}var qt,nS=p(()=>{"use strict";He();Jg();qt="EXT_mesh_polygon"});var Qg={};J(Qg,{decode:()=>Hk,getSpatialAudio:()=>sS,name:()=>xa});function sS(r){let e="asset"in r?r:r.json,t=[],n=e.extensions?.[xa];n&&t.push({nodeIndex:null,extension:n});for(let[s,i]of(e.nodes||[]).entries()){let o=i.extensions?.[xa];o&&t.push({nodeIndex:s,extension:o})}return t}async function Hk(r){let e=sS(r);for(let{extension:t,nodeIndex:n}of e){let s=n===null?"root":`node ${n}`;for(let i of t.sources||[]){if(!Array.isArray(i.accessors)||i.accessors.length===0)throw new Error(`${xa}: ${s} source ${i.id} requires audio accessors.`);for(let o of i.accessors)if(!Number.isInteger(o)||o<0||!r.json.accessors?.[o])throw new Error(`${xa}: ${s} source ${i.id} has invalid accessor ${o}.`);if(i.reverbFeedGain&&i.reverbFeedGain.length!==(i.reverbFeed?.length||0))throw new Error(`${xa}: ${s} source ${i.id} has mismatched reverb feed gains.`)}}e.length&&(r.spatialAudio=e)}var xa,iS=p(()=>{"use strict";xa="MPEG_audio_spatial"});var Zg={};J(Zg,{decode:()=>Jk,name:()=>Kt});async function Jk(r,e,t){let n=r.json.extensions?.[Kt],s=(n?.audio||[]).map(c=>({audio:c})),i=n?.sources||[],o=n?.emitters||[];for(let c of i)c.audio!==void 0&&yd(s,c.audio,"audio");for(let c of o){if(c.type!=="global"&&c.type!=="positional")throw new Error(`${Kt}: invalid emitter type ${c.type}.`);if(c.type==="global"&&c.positional!==void 0)throw new Error(`${Kt}: global emitters cannot have positional settings.`);for(let u of c.sources||[])yd(i,u,"source")}let a=[];for(let c of["nodes","scenes"])for(let[u,l]of(r.json[c]||[]).entries()){let f=l.extensions?.[Kt];if(f){if(!Array.isArray(f.emitters)||!f.emitters.length)throw new Error(`${Kt}: ${c} ${u} requires emitters.`);for(let d of f.emitters){let h=yd(o,d,"emitter");if(c==="scenes"&&h.type!=="global")throw new Error(`${Kt}: scenes may only reference global emitters.`);a.push({emitterIndex:d,nodeIndex:c==="nodes"?u:null,sceneIndex:c==="scenes"?u:null,emitter:h,sources:(h.sources||[]).map(m=>{let b=i[m];return{sourceIndex:m,source:b,clip:b.audio===void 0?void 0:s[b.audio]}})})}}}if(n){for(let c of s)Yk(r,c);e.gltf?.loadAudio!==!1&&await Promise.all(s.map(c=>Qk(r,c,e,t))),r.audioClips=s,r.audioEmitters=a}}function yd(r,e,t){if(!Number.isInteger(e)||e<0||!r[e])throw new Error(`${Kt}: invalid ${t} index ${e}.`);return r[e]}function Yk(r,e){let{audio:t}=e;if(t.bufferView!==void 0){if(yd(r.json.bufferViews||[],t.bufferView,"bufferView"),!t.mimeType)throw new Error(`${Kt}: buffer-view audio requires mimeType.`)}else if(!t.uri)throw new Error(`${Kt}: audio requires a uri or bufferView.`)}async function Qk(r,e,t,n){let{audio:s}=e;if(s.bufferView!==void 0){let a=r.json.bufferViews[s.bufferView],c=r.buffers[a.buffer];if(!c){if(t.gltf?.loadBuffers===!1)return;throw new Error(`${Kt}: audio buffer ${a.buffer} is not loaded.`)}let u=a.byteOffset??0,l=a.byteLength;if(!Number.isSafeInteger(u)||u<0||!Number.isSafeInteger(l)||l<0||u+l>c.byteLength||c.byteOffset+u+l>c.arrayBuffer.byteLength)throw new Error(`${Kt}: audio bufferView exceeds its buffer.`);e.data=new Uint8Array(c.arrayBuffer,c.byteOffset+u,l);return}if(!n?.fetch)throw new Error(`${Kt}: a loader context is required to load audio.`);let i=Kn(s.uri,t,n),o=await n.fetch(i);if(!o.ok)throw new Error(`${Kt}: failed to load audio ${i} (${o.status}).`);e.url=i,e.data=new Uint8Array(await o.arrayBuffer())}var Kt,oS=p(()=>{"use strict";Yc();Kt="KHR_audio_emitter"});var aS={};J(aS,{MeshoptDecoder:()=>Zk});var Zk,cS=p(()=>{"use strict";Zk=(function(){var r="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq;X8:kdbk:kYi5ud9:du8Jjjjjbcjq9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCaAcethXaxaDfhiaOaeaoaeao6E9RhQalcl4cifcd4hLazcjdfaAfhKcbhYabaOad2fg8AhEaHh3incbh5dnawTmbaxaYcd4fRbbh5kcbh8Eazcjdfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcjdfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcjdfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaL6mva8FaLfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasaYcd4fRbbgociGPlbedrbkaATmdazaYfh8Fazcjdfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeazaYfhaazcjdfhhcbhoceh8EaKh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaQaocefgofmbka8FaXfh8FcdhoaacdfhaahaXfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8EazaYfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaKhainazcjdfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3aYclfgYad6mbkaza8AaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcjqf8Kjjjjbaok:bsesu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhDaicefgiarfhqdndnaeci9pmbaqhexekcmcsawceSEhkcbhxcbhmaqhecbhlcbhoindndnaiRbbgrc;Ve0mbavc;abfaoarcu7gPcl4fcsGcitfgwydlhsawydbhzdndnarcsGgwak9pmbavalaPfcsGcdtfydbaxawEhraxawTgHfhxxekdnaeaD9nmbc9:hoxokdndnawcsSmbcehHamawcetfcWfhrxekaecefhrae8SbbgwcFeGhPdndnawcu9mmbarhexekaecvfheaPcFbGhPcrhwdninar8SbbgHcFbGawtaPVhPaHcu9kmearcefhrawcrfgwc8J9hmbxdkkarcefhekcehHaPce4cbaPceG9R7amfhrkarhmkavc;abfaocitfgwarBdbawasBdlavalcdtfarBdbavc;abfaocefcsGcitfgwazBdbawarBdlaocdfhoaHalfhldnadcd9hmbabar87elabas87edabaz87ebabcofhbxdkabarBdwabasBdlabazBdbabcxfhbxekdnarcpe0mbavalaDarcsGfRbbgwcl4gP9RcsGcdtfydbaxcefgsaPEhravalaw9RcsGcdtfydbasaPTgzfgsawcsGgPEhwaPThPdndnadcd9hmbabaw87elabar87edabax87ebcohHxekabawBdwabarBdlabaxBdbcxhHkavalcdtfaxBdbavc;abfaocitfgOarBdbaOaxBdlavalcefglcsGcdtfarBdbavc;abfaocefcsGcitfgOawBdbaOarBdlavalazfglcsGcdtfawBdbavc;abfaocdfcsGcitfgraxBdbarawBdlaocifhoabaHfhbalaPfhlasaPfhxxekdnaeaD9nmbc9:hoxlkaxcbaeRbbgwEgHarc;:eSgrfhsawcsGhOdndnawcl4gAmbascefhzxekashzavalaA9RcsGcdtfydbhskdndnaOmbazcefhxxekazhxavalaw9RcsGcdtfydbhzkdndnarTmbaecefhrxekaecdfhrae8SbegPcFeGhwdnaPcu9kmbaecofhHawcFbGhwcrhedninar8SbbgPcFbGaetawVhwaPcu9kmearcefhraecrfgec8J9hmbkaHhrxekarcefhrkawce4cbawceG9R7amfgmhHkdndnaAcsSmbarhwxekarcefhwar8SbbgecFeGhPdnaecu9kmbarcvfhsaPcFbGhPcrhedninaw8SbbgrcFbGaetaPVhParcu9kmeawcefhwaecrfgec8J9hmbkashwxekawcefhwkaPce4cbaPceG9R7amfgmhskdndnaOcsSmbawhexekawcefheaw8SbbgrcFeGhPdnarcu9kmbawcvfhzaPcFbGhPcrhrdninae8SbbgwcFbGartaPVhPawcu9kmeaecefhearcrfgrc8J9hmbkazhexekaecefhekaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabaz87elabas87edabaH87ebcohrxekabazBdwabasBdlabaHBdbcxhrkavc;abfaocitfgwasBdbawaHBdlavalcdtfaHBdbavc;abfaocefcsGcitfgwazBdbawasBdlavalcefglcsGcdtfasBdbavc;abfaocdfcsGcitfgwaHBdbawazBdlavalaATaAcsSVfglcsGcdtfazBdbalaOTaOcsSVfhlaocifhoabarfhbkaocsGhoalcsGhlaicefgiaq6mbkkcbc99aeaDSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:I9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:SBlEud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fgOavcjdfasaeaH9RaHasfae6EgAaAcsfgoc9WGgCSEhXaPaDfhQaocl4cifcd4hLavcj;cbfaCcetfhKavcj;cbfaCci2fhYavcj;cbfaCfh8AcbhEaoc;ab6h3incbh5dnawTmbaPaEcd4fRbbh5kcbh8Eavcj;cbfh8Findndndndna5a8Ecet4ciGgoc9:fPdebdkaxaQ9RaC6mwdnaCTmbavcj;cbfa8EaC2faQaC;8qbbkaQaAfhQxdkaCTmeavcj;cbfa8EaC2fcbaC;8kbxekaxaQ9RaL6moaoclVcbawEhraQaLfhocbhidna3mbaxao9Rc;Gb6mbcbhlina8FalfhidndndndndndnaQalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaoclffa8JRb:q:W:cjbfhoxikaiaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaocwffa8JRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbagaocdffa8JRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaoclffa8JRb:q:W:cjbfhoxikaiczfaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaocwffa8JRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbagaocdffa8JRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaoclffa8JRb:q:W:cjbfhoxikaicafaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaocwffa8JRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbagaocdffa8JRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsaap5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsaap5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaC0meaihlaxao9Rc;Fb0mbkkdnaiaC9pmbaici4hlinaxao9RcK6mwa8FaifhqdndndndndndnaQaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spkbbagaoclffa8JRb:q:W:cjbfhoxikaqaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spkbbagaocwffa8JRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbagaocdffa8JRb:q:W:cjbfhokalcdfhlaiczfgiaC6mbkkaohQaoTmoka8FaCfh8Fa8Ecefg8Ecl9hmbkdndndndnawTmbazaEcd4fRbbglciGPlbedwbkaCTmdaXaEfhlavaEfpbdbh8Kcbhoinalavcj;cbfaofpblbg8La8Aaofpblbg8MpmbzeHdOiAlCvXoQrLg8NaKaofpblbgyaYaofpblbg8PpmbzeHdOiAlCvXoQrLgIpmbezHdiOAlvCXorQLgacep9Taapxeeeeeeeeeeeeeeeeghp9op9Hp9rgaa8Kp9Ug8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp9Ug8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp9Ug8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9Abbbaladfgla8Ka8NaIpmwDKYqk8AExm35Ps8E8Fgacep9Taaahp9op9Hp9rgap9Ug8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp9Ug8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp9Ug8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9Abbbaladfgla8Ka8La8MpmwKDYq8AkEx3m5P8Es8Fg8Laya8PpmwKDYq8AkEx3m5P8Es8Fg8MpmbezHdiOAlvCXorQLgacep9Taaahp9op9Hp9rgap9Ug8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp9Ug8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp9Ug8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9Abbbaladfgla8Ka8La8MpmwDKYqk8AExm35Ps8E8Fgacep9Taaahp9op9Hp9rgap9Ughp9Abbbaladfglahaaaapmlvorlvorlvorlvorp9Ughp9AbbbaladfglahaaaapmwDqkwDqkwDqkwDqkp9Ughp9AbbbaladfglahaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9AbbbaladfhlaoczfgoaC6mbxikkaCTmeaXaEfhlavaEfpbdbh8Kcbhoinalavcj;cbfaofpblbg8La8Aaofpblbg8MpmbzeHdOiAlCvXoQrLg8NaKaofpblbgyaYaofpblbg8PpmbzeHdOiAlCvXoQrLgIpmbezHdiOAlvCXorQLgacep:neaapxebebebebebebebebghp9op:bep9rgaa8Kp:oeg8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp:oeg8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp:oeg8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9Abbbaladfgla8Ka8NaIpmwDKYqk8AExm35Ps8E8Fgacep:neaaahp9op:bep9rgap:oeg8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp:oeg8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp:oeg8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9Abbbaladfgla8Ka8La8MpmwKDYq8AkEx3m5P8Es8Fg8Laya8PpmwKDYq8AkEx3m5P8Es8Fg8MpmbezHdiOAlvCXorQLgacep:neaaahp9op:bep9rgap:oeg8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp:oeg8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp:oeg8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9Abbbaladfgla8Ka8La8MpmwDKYqk8AExm35Ps8E8Fgacep:neaaahp9op:bep9rgap:oeghp9Abbbaladfglahaaaapmlvorlvorlvorlvorp:oeghp9AbbbaladfglahaaaapmwDqkwDqkwDqkwDqkp:oeghp9AbbbaladfglahaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9AbbbaladfhlaoczfgoaC6mbxdkkaCTmbaXaEfhrcbhocbalcl4gl9Rc8FGhiavaEfpbdbhhinaravcj;cbfaofpblbg8Ka8Aaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaKaofpblbg8NaYaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLgaaip:Reaaalp:Tep9qgaahp9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9Abbbaradfgraha8Ma8PpmwDKYqk8AExm35Ps8E8Fgaaip:Reaaalp:Tep9qgap9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9Abbbaradfgraha8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLgaaip:Reaaalp:Tep9qgap9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9Abbbaradfgraha8Ka8LpmwDKYqk8AExm35Ps8E8Fgaaip:Reaaalp:Tep9qgap9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9AbbbaradfhraoczfgoaC6mbkkaEclfgEad6mbkdnaXavcjdf9hmbaAad2goTmbaOavcjdfao;8qbbkdnammbavaXaAcufad2fad;8qbbkaAaHfhHc9:hoaQhPaQmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkpPesu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhDaicefgiarfhqdndnaeci9pmbaqhexekcmcsawceSEhkcbhxcbhmaqhecbhlcbhoindndnaiRbbgrc;Ve0mbavc;abfaoarcu7gPcl4fcsGcitfgwydlhsawydbhzdndnarcsGgwak9pmbavalaPfcsGcdtfydbaxawEhraxawTgHfhxxekdnaeaD9nmbc9:hoxokdndnawcsSmbcehHamawcetfcWfhrxekaecefhrae8SbbgwcFeGhPdndnawcu9mmbarhexekaecvfheaPcFbGhPcrhwdninar8SbbgHcFbGawtaPVhPaHcu9kmearcefhrawcrfgwc8J9hmbxdkkarcefhekcehHaPce4cbaPceG9R7amfhrkarhmkavc;abfaocitfgwarBdbawasBdlavalcdtfarBdbavc;abfaocefcsGcitfgwazBdbawarBdlaocdfhoaHalfhldnadcd9hmbabar87elabas87edabaz87ebabcofhbxdkabarBdwabasBdlabazBdbabcxfhbxekdnarcpe0mbavalaDarcsGfRbbgwcl4gP9RcsGcdtfydbaxcefgsaPEhravalaw9RcsGcdtfydbasaPTgzfgsawcsGgPEhwaPThPdndnadcd9hmbabaw87elabar87edabax87ebcohHxekabawBdwabarBdlabaxBdbcxhHkavalcdtfaxBdbavc;abfaocitfgOarBdbaOaxBdlavalcefglcsGcdtfarBdbavc;abfaocefcsGcitfgOawBdbaOarBdlavalazfglcsGcdtfawBdbavc;abfaocdfcsGcitfgraxBdbarawBdlaocifhoabaHfhbalaPfhlasaPfhxxekdnaeaD9nmbc9:hoxlkaxcbaeRbbgwEgHarc;:eSgrfhsawcsGhOdndnawcl4gAmbascefhzxekashzavalaA9RcsGcdtfydbhskdndnaOmbazcefhxxekazhxavalaw9RcsGcdtfydbhzkdndnarTmbaecefhrxekaecdfhrae8SbegPcFeGhwdnaPcu9kmbaecofhHawcFbGhwcrhedninar8SbbgPcFbGaetawVhwaPcu9kmearcefhraecrfgec8J9hmbkaHhrxekarcefhrkawce4cbawceG9R7amfgmhHkdndnaAcsSmbarhwxekarcefhwar8SbbgecFeGhPdnaecu9kmbarcvfhsaPcFbGhPcrhedninaw8SbbgrcFbGaetaPVhParcu9kmeawcefhwaecrfgec8J9hmbkashwxekawcefhwkaPce4cbaPceG9R7amfgmhskdndnaOcsSmbawhexekawcefheaw8SbbgrcFeGhPdnarcu9kmbawcvfhzaPcFbGhPcrhrdninae8SbbgwcFbGartaPVhPawcu9kmeaecefhearcrfgrc8J9hmbkazhexekaecefhekaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabaz87elabas87edabaH87ebcohrxekabazBdwabasBdlabaHBdbcxhrkavc;abfaocitfgwasBdbawaHBdlavalcdtfaHBdbavc;abfaocefcsGcitfgwazBdbawasBdlavalcefglcsGcdtfasBdbavc;abfaocdfcsGcitfgwaHBdbawazBdlavalaATaAcsSVfglcsGcdtfazBdbalaOTaOcsSVfhlaocifhoabarfhbkaocsGhoalcsGhlaicefgiaq6mbkkcbc99aeaDSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var s=WebAssembly.validate(t)?a(e):a(r),i,o=WebAssembly.instantiate(s,{}).then(function(y){i=y.instance,i.exports.__wasm_call_ctors()});function a(y){for(var x=new Uint8Array(y.length),T=0;T<y.length;++T){var _=y.charCodeAt(T);x[T]=_>96?_-97:_>64?_-39:_+4}for(var v=0,T=0;T<y.length;++T)x[v++]=x[T]<60?n[x[T]]:(x[T]-60)*64+x[++T];return x.buffer.slice(0,v)}function c(y,x,T,_,v,I,N){var K=y.exports.sbrk,ne=_+3&-4,be=K(ne*v),Re=K(I.length),ke=new Uint8Array(y.exports.memory.buffer);ke.set(I,Re);var ue=x(be,_,v,Re,I.length);if(ue==0&&N&&N(be,ne,v),T.set(ke.subarray(be,be+_*v)),K(be-K(0)),ue!=0)throw new Error("Malformed buffer data: "+ue)}var u={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},f=[],d=0;function h(y){var x={object:new Worker(y),pending:0,requests:{}};return x.object.onmessage=function(T){var _=T.data;x.pending-=_.count,x.requests[_.id][_.action](_.value),delete x.requests[_.id]},x}function m(y){for(var x="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+g.name+";"+c.toString()+g.toString(),T=new Blob([x],{type:"text/javascript"}),_=URL.createObjectURL(T),v=f.length;v<y;++v)f[v]=h(_);for(var v=y;v<f.length;++v)f[v].object.postMessage({});f.length=y,URL.revokeObjectURL(_)}function b(y,x,T,_,v){for(var I=f[0],N=1;N<f.length;++N)f[N].pending<I.pending&&(I=f[N]);return new Promise(function(K,ne){var be=new Uint8Array(T),Re=++d;I.pending+=y,I.requests[Re]={resolve:K,reject:ne},I.object.postMessage({id:Re,count:y,size:x,source:be,mode:_,filter:v},[be.buffer])})}function g(y){var x=y.data;self.ready.then(function(T){if(!x.id)return self.close();try{var _=new Uint8Array(x.count*x.size);c(T,T.exports[x.mode],_,x.count,x.size,x.source,T.exports[x.filter]),self.postMessage({id:x.id,count:x.count,action:"resolve",value:_},[_.buffer])}catch(v){self.postMessage({id:x.id,count:x.count,action:"reject",value:v})}})}return{ready:o,supported:!0,useWorkers:function(y){m(y)},decodeVertexBuffer:function(y,x,T,_,v){c(i,i.exports.meshopt_decodeVertexBuffer,y,x,T,_,i.exports[u[v]])},decodeIndexBuffer:function(y,x,T,_){c(i,i.exports.meshopt_decodeIndexBuffer,y,x,T,_)},decodeIndexSequence:function(y,x,T,_){c(i,i.exports.meshopt_decodeIndexSequence,y,x,T,_)},decodeGltfBuffer:function(y,x,T,_,v,I){c(i,i.exports[l[v]],y,x,T,_,i.exports[u[I]])},decodeGltfBufferAsync:function(y,x,T,_,v){return f.length>0?b(y,x,T,l[_],u[v]):o.then(function(){var I=new Uint8Array(y*x);return c(i,i.exports[l[_]],I,y,x,T,i.exports[u[v]]),I})}}})()});function uS(){return Promise.resolve().then(()=>(cS(),aS))}var lS=p(()=>{"use strict"});async function eN(){return wd||(wd=uS().then(async({MeshoptDecoder:r})=>(await r.ready,r),r=>{throw wd=void 0,new Error("Failed to load the packaged meshopt decoder.",{cause:r})})),wd}function tN(r){return typeof r=="string"?r:["NONE","OCTAHEDRAL","QUATERNION","EXPONENTIAL","COLOR"][r]}async function fS(r,e,t,n,s,i="NONE"){(await eN()).decodeGltfBuffer(r,e,t,n,s,tN(i))}var wd,dS=p(()=>{"use strict";lS()});async function xd(r,e,t){if(!e.gltf?.decompressMeshes&&e.gltf?.decompressBufferViewIndices===void 0||!e.gltf?.loadBuffers)return;rN(r.json);let n=new ie(r),s=e.gltf.decompressBufferViewIndices,i=s?new Set(typeof s=="function"?s(r.json):s):void 0,o=Array.from(n.bufferViews),a=o.map((c,u)=>i?.has(u)===!1?Promise.resolve():nN(n,c,t));if(await Promise.all(a),i){for(let c of i){let u=o[c];u&&n.removeExtension(u,t)}return}for(let c of o)n.removeExtension(c,t);for(let c of n.buffers)n.removeExtension(c,t);n.removeExtension(t)}function rN(r){let e=r.bufferViews||[];for(let n=0;n<e.length;n++){let s=e[n].extensions;if(s?.KHR_meshopt_compression&&s.EXT_meshopt_compression)throw new Error(`glTF bufferView ${n} cannot use both KHR_meshopt_compression and EXT_meshopt_compression.`)}let t=r.buffers||[];for(let n=0;n<t.length;n++){let s=t[n].extensions;if(s?.KHR_meshopt_compression&&s.EXT_meshopt_compression)throw new Error(`glTF buffer ${n} cannot use both KHR_meshopt_compression and EXT_meshopt_compression.`)}}async function nN(r,e,t){let n=r.getExtension(e,t);if(!n)return;let{byteOffset:s=0,byteLength:i,byteStride:o,count:a,mode:c,filter:u="NONE",buffer:l}=n,f=r.gltf.buffers[l],d=r.gltf.buffers[e.buffer],h=new Uint8Array(f.arrayBuffer,f.byteOffset+s,i),m=new Uint8Array(d.arrayBuffer,d.byteOffset+(e.byteOffset||0),e.byteLength);await fS(m,a,o,h,c,u)}var ey=p(()=>{"use strict";He();dS()});var ty={};J(ty,{decode:()=>sN,name:()=>hS});async function sN(r,e){await xd(r,e,hS)}var hS,pS=p(()=>{"use strict";ey();hS="EXT_meshopt_compression"});var ry={};J(ry,{decode:()=>iN,name:()=>mS});async function iN(r,e){await xd(r,e,mS)}var mS,bS=p(()=>{"use strict";ey();mS="KHR_meshopt_compression"});var ny={};J(ny,{name:()=>oN,preprocess:()=>aN});function aN(r,e){let t=new ie(r);if(t.hasExtension(ho)){if(!ag("image/webp")){if(t.isExtensionRequired(ho))throw new Error(`gltf: Required extension ${ho} not supported by browser`);return}for(let n of t.textures){let s=t.getExtension(n,ho);s&&(n.source=s.source),t.removeExtension(n,ho)}t.removeExtension(ho)}}var ho,oN,gS=p(()=>{"use strict";qn();He();ho="EXT_texture_webp",oN=ho});var sy={};J(sy,{name:()=>cN,preprocess:()=>uN});async function uN(r,e){let t=new ie(r);if(!t.hasExtension(po))return;if(!(await og()).has("image/avif")){if(t.isExtensionRequired(po))throw new Error(`gltf: Required extension ${po} not supported by browser`);return}for(let s of t.textures){let i=t.getExtension(s,po);i&&(s.source=i.source),t.removeExtension(s,po)}t.removeExtension(po)}var po,cN,yS=p(()=>{"use strict";qn();He();po="EXT_texture_avif",cN=po});var iy={};J(iy,{decode:()=>fN,getDDSLoader:()=>iu,name:()=>mo,preprocess:()=>lN});function iu(r){return r?.loaders?.find(e=>e.extensions?.includes("dds")||e.mimeTypes?.includes("image/vnd-ms.dds"))}function lN(r,e,t){let n=new ie(r);if(n.hasExtension(mo)){if(!iu(t)){if(n.isExtensionRequired(mo))throw new Error("gltf: Required extension MSFT_texture_dds needs a DDS parser");return}for(let s of n.textures){let i=n.getExtension(s,mo);i&&(s.source=i.source)}}}async function fN(r,e,t){if(!iu(t)||e.gltf?.loadImages===!1)return;let n=new ie(r);if(n.hasExtension(mo)){for(let s of n.textures)n.removeExtension(s,mo);n.removeExtension(mo)}}var mo,oy=p(()=>{"use strict";He();mo="MSFT_texture_dds"});var ay={};J(ay,{name:()=>dN,preprocess:()=>hN});function hN(r,e){let t=new ie(r);for(let n of t.textures){let s=t.getExtension(n,Td);s&&(n.source=s.source,t.removeExtension(n,Td))}t.removeExtension(Td)}var Td,dN,wS=p(()=>{"use strict";He();Td="KHR_texture_basisu",dN=Td});var ou,cy=p(()=>{"use strict";ou="5.0.0-beta.7"});var au,uy=p(()=>{"use strict";au={name:"Draco",id:"draco",module:"scene",encoding:"binary",format:"draco",extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"]}});var xS,TS=p(()=>{"use strict";xS={backend:typeof WebAssembly=="object"?"wasm":"javascript",extraAttributes:{},attributeNameEntry:void 0,shape:"arrow-table",decoderProfile:"full"}});async function bo(r,e=null,t={},n=null,s=null){if(Xe&&t.useLocalLibraries&&!t.CDN&&n&&t.modules?.[n]===void 0){let i=Yi?"./libs":`modules/${e}/dist/libs`;t={...t,modules:{[n]:`${i}/${n}`,...s?{[s]:`${i}/${s}`}:{},...t.modules}}}return await ia(r,e,t,n,s)}var _S=p(()=>{"use strict";Js()});var pN,mN,cu,AS,Ae,go,vS=p(()=>{"use strict";pN="1.5.7",mN="8786740086a9f4d83f44aa83badfbea4dce7a1b5",cu=`https://www.gstatic.com/draco/versioned/decoders/${pN}`,AS=`https://cdn.jsdelivr.net/gh/google/draco@${mN}/javascript`,Ae={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",GLTF_DECODER:"draco_wasm_wrapper_gltf.js",GLTF_DECODER_WASM:"draco_decoder_gltf.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js",ENCODER_WASM:"draco_encoder.wasm"},go={[Ae.DECODER]:`${cu}/${Ae.DECODER}`,[Ae.DECODER_WASM]:`${cu}/${Ae.DECODER_WASM}`,[Ae.GLTF_DECODER]:`${cu}/${Ae.GLTF_DECODER}`,[Ae.GLTF_DECODER_WASM]:`${cu}/${Ae.GLTF_DECODER_WASM}`,[Ae.FALLBACK_DECODER]:`${cu}/${Ae.FALLBACK_DECODER}`,[Ae.ENCODER]:`${AS}/${Ae.ENCODER}`,[Ae.ENCODER_WASM]:`${AS}/${Ae.ENCODER_WASM}`}});async function _d(r={},e,t="full"){let n=DS(r);return n?await dy(n):await bN(r,e==="js"?"javascript":e,t)}async function bN(r={},e,t="full"){let n=RS(`${e}:${t}`,r),s=IS.get(n);return s||(s=gN(r,e,t),IS.set(n,s)),await s}async function dy(r){let e=xN(r),t=ES.get(e);return t||(t=Ji(()=>e.createDecoderModule({}),n=>({draco:n})),ES.set(e,t)),await t}async function hy(r={}){let e=DS(r);if(e){let s=TN(e),i=LS.get(s);return i||(i=Ji(()=>s.createEncoderModule({}),o=>({draco:o})),LS.set(s,i)),await i}let t=RS("encoder",r),n=SS.get(t);return n||(n=wN(r),SS.set(t,n)),await n}async function gN(r,e,t){try{return await FS(r,e,t)}catch(n){if(e==="javascript")throw n;try{return await FS(r,"javascript","full")}catch(s){throw new AggregateError([n,s],"Draco decoder could not load either the WebAssembly or JavaScript backend")}}}async function FS(r,e,t){let n=BS.then(()=>yN(r,e,t));return BS=n.then(()=>{},()=>{}),await n}async function yN(r,e,t){if(e==="javascript"){let o;try{o=await bo(go[Ae.FALLBACK_DECODER],"scene",r,Ae.FALLBACK_DECODER,"draco_decoder.mjs")}catch(c){if(Xe||r.useLocalLibraries)throw c;o=await bo(go[Ae.FALLBACK_DECODER],"scene",{...r,useLocalLibraries:!0},Ae.FALLBACK_DECODER,"draco_decoder.mjs")}let a=fy(o,"DracoDecoderModule")||globalThis.DracoDecoderModule;return await ly(a)}let n,s;try{[n,s]=await OS(r,t)}catch(o){if(Xe||r.useLocalLibraries)throw o;[n,s]=await OS({...r,useLocalLibraries:!0},t)}let i=fy(n,"DracoDecoderModule")||globalThis.DracoDecoderModule;return await ly(i,s)}async function OS(r,e){let t=e==="gltf"?Ae.GLTF_DECODER:Ae.DECODER,n=e==="gltf"?Ae.GLTF_DECODER_WASM:Ae.DECODER_WASM;return await Promise.all([bo(go[t],"scene",r,t,e==="gltf"?"draco_wasm_wrapper_gltf.mjs":"draco_wasm_wrapper.mjs"),bo(go[n],"scene",r,n)])}async function wN(r){let e,t;try{[e,t]=await MS(r)}catch(s){if(Xe||r.useLocalLibraries)throw s;[e,t]=await MS({...r,useLocalLibraries:!0})}let n=fy(e,"DracoEncoderModule")||globalThis.DracoEncoderModule;return await ly(n,t)}async function MS(r){return await Promise.all([bo(go[Ae.ENCODER],"scene",r,Ae.ENCODER,"draco_encoder.mjs"),bo(go[Ae.ENCODER_WASM],"scene",r,Ae.ENCODER_WASM)])}function ly(r,e){if(typeof r!="function")throw new Error("Draco module initializer could not be loaded");return Ji(t=>r({...e?{wasmBinary:e}:{},onModuleLoaded:t}),t=>({draco:t}))}function fy(r,e){if(typeof r=="function")return r;if(r&&typeof r=="object"){let t=r,n=t[e]||t.default;return typeof n=="function"?n:void 0}}function DS(r){let e=r.modules?.draco3d;if(e){if(typeof e!="object"&&typeof e!="function")throw new Error("Invalid draco3d module");return e}}function xN(r){let e=r;if(typeof e?.createDecoderModule!="function")throw new Error("Invalid draco3d decoder module");return e}function TN(r){let e=r;if(typeof e?.createEncoderModule!="function")throw new Error("Invalid draco3d encoder module");return e}function RS(r,e){let t=Object.entries(e.modules||{}).filter(([n])=>n!=="draco3d").map(([n,s])=>`${n}:${String(s)}`).sort().join("|");return[r,e.useLocalLibraries?"local":"remote",e.CDN||"",t].join("|")}var IS,SS,ES,LS,BS,uu=p(()=>{"use strict";Ue();_S();vS();IS=new Map,SS=new Map,ES=new WeakMap,LS=new WeakMap;BS=Promise.resolve()});function NS(r,e,t){let n=CS(e.metadata),s=[],i=_N(e.attributes);for(let o in r){let a=r[o],c=kS(o,a,i[o]);s.push(c)}if(t){let o=kS("indices",t);s.push(o)}return{fields:s,metadata:n}}function _N(r){let e={};for(let t in r){let n=r[t];e[n.name||"undefined"]=n}return e}function kS(r,e,t){let n={...$f(e),...t?CS(t.metadata):{}};return Wf(r,e,n)}function CS(r){Object.entries(r);let e={};for(let t in r)e[`${t}.string`]=JSON.stringify(r[t]);return e}var US=p(()=>{"use strict";mn()});function SN(r,e){switch(e){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32;default:return r.DT_INVALID}}function EN(r){let e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function LN(r){let e=r.size(),t=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function BN(r,e){if(!Object.prototype.hasOwnProperty.call(e,r))return r;let t=/^(.*)_([0-9]+)$/.exec(r),n=t?t[1]:r,s=t?BigInt(t[2])+1n:1n;for(;Object.prototype.hasOwnProperty.call(e,`${n}_${s}`);)s++;return`${n}_${s}`}function FN(r){if(r.quantization_transform){let{quantization_bits:e,min_values:t,range:n}=r.quantization_transform;if(e!==void 0&&t&&n!==void 0)return{type:"quantization",bits:e,origin:Array.from(t),range:n}}if(r.octahedron_transform?.quantization_bits!==void 0)return{type:"octahedron",bits:r.octahedron_transform.quantization_bits}}function ON(r){if(r.includeAttributes&&r.excludeAttributes)throw new Error("DracoLoader: includeAttributes and excludeAttributes cannot be combined")}function MN(r,e){for(let t of r.includeAttributes||r.excludeAttributes||[])if(!e.includes(t))throw new Error(`DracoLoader: selected attribute "${t}" does not exist`)}function DN(r){let e=Er(r);if(!e)throw new Error("Decoded mesh is missing positions");let t=r.POSITION;if(t?.transform?.type!=="quantization")return e;let{bits:n,origin:s,range:i}=t.transform,o=i/(2**n-1);return e.map(a=>a.map((c,u)=>s[u]+c*o))}var PS,AN,vN,IN,lu,VS=p(()=>{"use strict";mn();US();PS={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},AN={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},vN=2,IN=4,lu=class{draco;decoder;metadataQuerier;constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){ON(t);let n=ArrayBuffer.isView(e)?new Int8Array(e.buffer,e.byteOffset,e.byteLength):new Int8Array(e);this._disableAttributeTransforms(t);let s=this.decoder.GetEncodedGeometryType(n),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud,o=null;try{switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeArrayToMesh(n,n.byteLength,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeArrayToPointCloud(n,n.byteLength,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let d=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(d)}let a=this._getDracoLoaderData(i,s,t),c=this._getMeshData(i,a,t),u=DN(c.attributes),l=NS(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:u},...c,schema:l}}finally{o&&this.draco.destroy(o),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,t,n){let s=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(e,t){let n={};for(let s=0;s<e.num_attributes();s++){let i=this.decoder.GetAttribute(e,s),o=this._getAttributeMetadata(e,s);n[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,t);a&&(n[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,t);c&&(n[i.unique_id()].octahedron_transform=c)}return n}_getMeshData(e,t,n){let s=this._getMeshAttributes(t,e,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");return e instanceof this.draco.Mesh?n.topology==="triangle-strip"?{topology:"triangle-strip",mode:5,attributes:s,indices:{value:this._getTriangleStripIndices(e),size:1}}:{topology:"triangle-list",mode:4,attributes:s,indices:{value:this._getTriangleListIndices(e),size:1}}:{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(e,t,n){let s={},i={},a=Object.values(e.attributes).sort((c,u)=>c.attribute_index-u.attribute_index).map(c=>{let u=this._deduceAttributeName(c,n),l=BN(u,i);return i[l]=!0,c.name=l,{attributeName:l,loaderAttribute:c}});MN(n,Object.keys(i));for(let{attributeName:c,loaderAttribute:u}of a){if(!this._shouldExtractAttribute(c,u,n))continue;let l=this._getAttributeValues(t,u);if(l){let{value:f,size:d}=l;s[c]={value:f,size:d,byteOffset:u.byte_offset,byteStride:u.byte_stride,normalized:u.normalized,transform:FN(u)}}}return s}_shouldExtractAttribute(e,t,n){if(t.attribute_type===this.draco.POSITION){if(n.excludeAttributes?.includes(e))throw new Error(`DracoLoader: position attribute "${e}" cannot be excluded`);return!0}return n.includeAttributes&&!n.includeAttributes.includes(e)?!1:!n.excludeAttributes?.includes(e)}_getTriangleListIndices(e){let n=e.num_faces()*3,s=e.num_points()<=65536,i=n*(s?vN:IN),o=this.draco._malloc(i);try{if(s){if(!this.decoder.GetTrianglesUInt16Array(e,i,o))throw new Error("DRACO: Failed to decode triangle indices.");return new Uint16Array(this.draco.HEAPU8.buffer,o,n).slice()}if(!this.decoder.GetTrianglesUInt32Array(e,i,o))throw new Error("DRACO: Failed to decode triangle indices.");return new Uint32Array(this.draco.HEAPU8.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(e){let t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),LN(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){let n=AN[t.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${t.data_type}`),null;let s=t.num_components,o=e.num_points()*s,a=o*n.BYTES_PER_ELEMENT,c=SN(this.draco,n),u,l=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(e,t.attribute_index);if(!this.decoder.GetAttributeDataArrayForAllPoints(e,f,c,a,l))throw new Error(`DRACO: Failed to decode attribute ${t.unique_id}.`);u=new n(this.draco.HEAPU8.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:u,size:s}}_deduceAttributeName(e,t){let n=e.unique_id;for(let[o,a]of Object.entries(t.extraAttributes||{}))if(a===n)return o;let s=t.attributeNameEntry||"name";if(e.metadata[s]){let o=e.metadata[s].string;return o==="COLOR"?"COLOR_0":o==="TEX_COORD"?"TEXCOORD_0":o}let i=e.attribute_type;for(let o in PS)if(this.draco[o]===i)return PS[o];return`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){let t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){let n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let t={},n=this.metadataQuerier.NumEntries(e);for(let s=0;s<n;s++){let i=this.metadataQuerier.GetEntryName(e,s);t[i]=this._getDracoMetadataField(e,i)}return t}_getDracoMetadataField(e,t){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);let s=EN(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){let{quantizedAttributes:t=[],octahedronAttributes:n=[]}=e,s=[...t,...n];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(e,t){let{quantizedAttributes:n=[]}=t,s=e.attribute_type();if(n.map(o=>this.draco[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:Float32Array.from({length:e.num_components()},(a,c)=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(e,t){let{octahedronAttributes:n=[]}=t,s=e.attribute_type();if(n.map(o=>this.draco[o]).includes(s)){let o=new this.draco.AttributeOctahedronTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}}});async function Ta(r,e,t,n){let s=n?.reportProgress||e?.onProgress;s?.({phase:"decode",completed:0,total:1,unit:"tasks"});let{draco:i}=await t();(e?.signal||n?.signal)?.throwIfAborted();let o=new lu(i);try{let a=o.parseSync(r,e?.draco);return s?.({phase:"decode",completed:1,total:1,unit:"tasks"}),e?.draco?.shape==="arrow-table"?ei(a,"arrow-table"):a}finally{o.destroy()}}var Ad=p(()=>{"use strict";mn();VS()});var qee,RN,kN,jS=p(()=>{"use strict";Js();uu();Ad();fu();({preload:qee,...RN}=Hn),kN={...RN,parse:async(r,e,t)=>await Ta(r,e,async()=>await _d(hn(e),"wasm",e?.draco?.decoderProfile),t)}});var py={};J(py,{DracoWASMLoaderWithParser:()=>kN});var my=p(()=>{"use strict";jS()});var Zee,NN,CN,GS=p(()=>{"use strict";Js();uu();Ad();fu();({preload:Zee,...NN}=Hn),CN={...NN,parse:async(r,e,t)=>await Ta(r,e,async()=>await _d(hn(e),"js"),t)}});var by={};J(by,{DracoJavaScriptLoaderWithParser:()=>CN});var gy=p(()=>{"use strict";GS()});function VN(r){let e=r?.modules?.draco3d;if(!e)throw new Error('DracoLoader: backend "draco3d" requires options.modules.draco3d');return e}var ite,UN,PN,zS=p(()=>{"use strict";uu();Ad();fu();({preload:ite,...UN}=Hn),PN={...UN,parse:async(r,e,t)=>await Ta(r,e,async()=>await dy(VN(e)),t)}});var yy={};J(yy,{Draco3DLoaderWithParser:()=>PN});var wy=p(()=>{"use strict";zS()});async function jN(r,e){let t=e;switch(GN(t)){case"wasm":{let{DracoWASMLoaderWithParser:n}=await Promise.resolve().then(()=>(my(),py));return n}case"javascript":{let{DracoJavaScriptLoaderWithParser:n}=await Promise.resolve().then(()=>(gy(),by));return n}case"draco3d":{let{Draco3DLoaderWithParser:n}=await Promise.resolve().then(()=>(wy(),yy));return n}default:throw new Error(`DracoLoader: unsupported backend "${t?.draco?.backend}"`)}}function GN(r){return r?.draco?.backend?r.draco.backend==="js"?"javascript":r.draco.backend:Hn.options.draco.backend}var Hn,fu=p(()=>{"use strict";ea();cy();uy();TS();Hn={dataType:null,batchType:null,...au,version:ou,worker:!0,workerSourceNode:"draco/workers/draco-worker-node.ts",serializeWorkerResult:af,deserializeWorkerResult:cf,options:{draco:xS},preload:jN}});var WS=p(()=>{"use strict";fu()});function $S(r){let e={};for(let t in r){let n=r[t];if(t!=="indices"){let s=xy(n);e[t]=s}}return e}function xy(r){let{buffer:e,size:t,count:n}=zN(r);return{value:e,size:t,byteOffset:0,count:n,type:ma(t),componentType:Xn(e)}}function zN(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=WN(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function WN(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}var qS=p(()=>{"use strict";ri()});var Ty={};J(Ty,{decode:()=>KN,name:()=>$N,preprocess:()=>qN});function qN(r,e,t){let n=new ie(r);for(let s of n.meshes)for(let i of n.getReferences(s).primitives)n.getExtension(i,_a)}async function KN(r,e,t){if(!e?.gltf?.decompressMeshes)return;let n=new ie(r),s=[];for(let i of n.meshes)for(let o of n.getReferences(i).primitives)n.getExtension(o,_a)&&s.push(XN(n,o,e,t));await Promise.all(s),n.removeExtension(_a)}async function XN(r,e,t,n){let s=r.getExtension(e,_a);if(!s)return;let i=hr(r.data,r.gltf.buffers,s.bufferView),o=eo(i.buffer,i.byteOffset,i.byteLength),a={...t,draco:{...t.draco,shape:"mesh",topology:"triangle-list",decoderProfile:t.draco?.decoderProfile||"gltf",extraAttributes:s.attributes}};delete a["3d-tiles"];let c=await Xs(o,Hn,a,n),u=$S(c.attributes);for(let l of Object.keys(s.attributes))if(!Object.hasOwn(u,l))throw new Error(`glTF: Draco decompression did not produce attribute ${l}`);for(let[l,f]of Object.entries(u))if(l in e.attributes){let d=e.attributes[l],h=r.data.accessors?.[d];h?.normalized!==void 0&&(f.normalized=h.normalized),h?.min&&h?.max&&(f.min=h.min,f.max=h.max)}e.attributes={...e.attributes,...u},c.indices&&(e.indices=xy(c.indices),e.mode=4),r.removeExtension(e,_a),HN(e)}function HN(r){if(!r.attributes||Object.keys(r.attributes).length===0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}var _a,$N,KS=p(()=>{"use strict";Ue();WS();He();qS();ao();_a="KHR_draco_mesh_compression",$N=_a});var Ay={};J(Ay,{decode:()=>ZN,name:()=>JN});async function ZN(r,e){let t=new ie(r);if(!t.hasExtension(Aa)||!e.gltf?.loadBuffers)return;let s=r.json.materials||[];for(let i=0;i<s.length;i++)eC(i,r,t);s.some(i=>_y(i).length>0)||t.removeExtension(Aa)}function eC(r,e,t){let n=e.json.materials?.[r],s=_y(n),i=new Map,o=rC(e);for(let a of s){let c=a.extensions?.[Aa];if(c){let u=c.texCoord??a.texCoord??0,l=nC(u,c),f=i.get(l);if(!f){if(f={sourceTexCoord:u,texCoord:o,matrix:aC(c)},!sC(e,r,f))continue;o++,i.set(l,f)}a.texCoord=f.texCoord,tC(t,a,Aa),a.extensions&&Object.keys(a.extensions).length===0&&delete a.extensions}}}function tC(r,e,t){e.extensions?.[t]!==void 0&&(r.recordRemovedExtension(t),delete e.extensions[t])}function _y(r){if(!r||typeof r!="object")return[];let e=r,t=[],n=e.extensions;Number.isFinite(e.index)&&n?.[Aa]&&t.push(e);for(let[s,i]of Object.entries(e))s!=="extras"&&t.push(..._y(i));return t}function rC(r){let e=-1;for(let t of r.json.meshes||[])for(let n of t.primitives)for(let s of Object.keys(n.attributes)){let i=/^TEXCOORD_(\d+)$/.exec(s);i&&(e=Math.max(e,Number(i[1])))}return e+1}function nC(r,e){let{offset:t=[0,0],rotation:n=0,scale:s=[1,1]}=e;return JSON.stringify([r,t,n,s])}function sC(r,e,t){let n=[],s=r.json.meshes||[];for(let i of s)for(let o of i.primitives){let a=o.material;Number.isFinite(a)&&e===a&&n.push(o)}if(n.length===0||n.some(i=>!iC(r,i,t.sourceTexCoord)))return!1;for(let i of n)oC(r,i,t);return!0}function iC(r,e,t){let n=e.attributes[`TEXCOORD_${t}`],s=n;if(ArrayBuffer.isView(s?.value))return!0;if(!Number.isFinite(n))return!1;let i=r.json.accessors?.[n];if(!i||i.bufferView===void 0||i.sparse)return!1;let o=r.json.bufferViews?.[i.bufferView];return!!(o&&r.buffers[o.buffer])}function oC(r,e,t){let{sourceTexCoord:n,texCoord:s,matrix:i}=t,o=e.attributes[`TEXCOORD_${n}`],a=o;if(ArrayBuffer.isView(a?.value)){let c=new Float32Array(a.count*2);for(let u=0;u<a.count;u++)XS(a.value.subarray(u*2,u*2+2),a,i,c,u*2);HS(s,a,e,r,c);return}if(Number.isFinite(o)){let c=r.json.accessors?.[o];if(c&&c.bufferView!==void 0){let u=r.json.bufferViews?.[c.bufferView];if(u){let{arrayBuffer:l,byteOffset:f}=r.buffers[u.buffer],d=(f||0)+(c.byteOffset||0)+(u.byteOffset||0),{ArrayType:h,length:m}=Zc(c,u),b=Qc[c.componentType],g=ud[c.type],y=u.byteStride||b*g,x=new Float32Array(m);for(let T=0;T<c.count;T++){let _=new h(l,d+T*y,2);XS(_,c,i,x,T*g)}HS(s,c,e,r,x)}}}}function XS(r,e,t,n,s){let i=e.componentType===5120||e.componentType===5122,o=2**(Qc[e.componentType]*8-(i?1:0))-1;vd.set(e.normalized?Math.max(r[0]/o,-1):r[0],e.normalized?Math.max(r[1]/o,-1):r[1],1),vd.transformByMatrix3(t),n.set([vd[0],vd[1]],s)}function HS(r,e,t,n,s){n.buffers.push({arrayBuffer:ro(s.buffer),byteOffset:0,byteLength:s.buffer.byteLength}),n.json.bufferViews=n.json.bufferViews||[];let i=n.json.bufferViews;i.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),t.attributes[`TEXCOORD_${r}`]=o.length-1)}function aC(r){let{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,s=new zn().set(1,0,0,0,1,0,e[0],e[1],1),i=YN.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=QN.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var Aa,JN,vd,YN,QN,JS=p(()=>{"use strict";Uf();ri();gg();He();Ue();Aa="KHR_texture_transform",JN=Aa,vd=new jc,YN=new zn,QN=new zn});var vy={};J(vy,{decode:()=>uC,encode:()=>lC,name:()=>cC});async function uC(r){let e=new ie(r),t=e.getExtension(yo);t&&(e.data.lights=t.lights,e.removeExtension(yo));for(let n of e.nodes){let s=e.getExtension(n,yo);s&&(n.light=s.light),e.removeExtension(n,yo)}}async function lC(r){let e=new bn(r),{json:t}=e;if(t.lights){let n=e.addExtension(yo);H(!n.lights),n.lights=t.lights,delete t.lights}if(e.json.lights){for(let n of e.json.lights){let s=n.node;e.addObjectExtension(s,yo,n)}delete e.json.lights}}var yo,cC,YS=p(()=>{"use strict";oo();He();eu();yo="KHR_lights_punctual",cC=yo});var Iy={};J(Iy,{decode:()=>dC,encode:()=>hC,name:()=>fC});async function dC(r){let e=new ie(r);for(let t of e.materials)e.getExtension(t,va)&&(t.unlit=!0),e.removeExtension(t,va);e.removeExtension(va)}function hC(r){let e=new bn(r);for(let t of r.json.materials||[]){let n=t;n.unlit&&(delete n.unlit,e.addObjectExtension(t,va,{}),e.registerRequiredExtension(va))}for(let t of["extensionsUsed","extensionsRequired"])r.json[t]?.length===0&&delete r.json[t]}var va,fC,QS=p(()=>{"use strict";He();eu();va="KHR_materials_unlit",fC=va});var Sy={};J(Sy,{decode:()=>mC,encode:()=>bC,name:()=>pC});async function mC(r){let e=new ie(r),t=e.getExtension(du);if(t){let n=gC(t,e);for(let s of e.materials){let i=e.getExtension(s,du);i&&(s.technique=Object.assign({},i,n[i.technique]),s.technique.values=yC(s.technique,e)),e.removeExtension(s,du)}e.removeExtension(du)}}async function bC(r,e){}function gC(r,e){let{programs:t=[],shaders:n=[],techniques:s=[]}=r,i=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(hr(e.data,e.gltf.buffers,o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),t.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),s.forEach(o=>{o.program=t[o.program]}),s}function yC(r,e){let t=Object.assign({},r.values);return Object.keys(r.uniforms||{}).forEach(n=>{r.uniforms[n].value&&!(n in t)&&(t[n]=r.uniforms[n].value)}),Object.keys(t).forEach(n=>{typeof t[n]=="object"&&t[n].index!==void 0&&(t[n].texture=e.resolveTexture(t[n].index,`technique.values.${n}.index`))}),t}var du,pC,ZS=p(()=>{"use strict";He();ao();du="KHR_techniques_webgl",pC=du});var Ey={};J(Ey,{decode:()=>xC,name:()=>wC});async function xC(r,e){let t=new ie(r);TC(t,e)}function TC(r,e){if(!e.gltf?.loadBuffers)return;let t=r.getExtension(eE);t&&(e.gltf?.loadImages&&_C(r,t),AC(r,t))}function _C(r,e){let t=e.schema;if(!t)return;let n=t.classes,{featureTextures:s}=e;if(n&&s)for(let i in n){let o=n[i],a=IC(s,i);a&&EC(r,a,o)}}function AC(r,e){let t=e.schema;if(!t)return;let n=t.classes,s=e.featureTables;if(n&&s)for(let i in n){let o=vC(s,i);o&&SC(r,t,o)}}function vC(r,e){for(let t in r){let n=r[t];if(n.class===e)return n}return null}function IC(r,e){for(let t in r){let n=r[t];if(n.class===e)return n}return null}function SC(r,e,t){if(!t.class)return;let n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);let s=t.count;for(let i in n.properties){let o=n.properties[i],a=t.properties?.[i];if(a){let c=LC(r,e,o,s,a);a.data=c}}}function EC(r,e,t){let n=e.class;for(let s in t.properties){let i=e?.properties?.[s];if(i){let o=DC(r,i,n);i.data=o}}}function LC(r,e,t,n,s){let i=[],o=s.bufferView,a=r.getTypedArrayForBufferView(o),c=BC(r,t,s,n),u=FC(r,t,s,n,c);return t.type==="STRING"||t.componentType==="STRING"?i=pd(n,a,c,u,t.type==="ARRAY"?t.componentCount:void 0):OC(t)&&(i=MC(t,n,a,c)),i}function BC(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?ba(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function FC(r,e,t,n,s){if(typeof t.stringOffsetBufferView<"u"){let i=s?Number(s[n]):n*(e.type==="ARRAY"&&e.componentCount||1);return ba(r,t.stringOffsetBufferView,t.offsetType||"UINT32",i)}return null}function OC(r){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(r.type)||typeof r.componentType<"u"&&e.includes(r.componentType)}function MC(r,e,t,n){let s=r.type==="ARRAY",i=r.componentCount,o="SCALAR",a=r.componentType||r.type,c=tu(o,a),u=t.byteLength/c,l=ga(t,o,a,u);return s?n?ru(l,e,n):i?nu(l,e,i):[]:l}function DC(r,e,t){let n=r.data;if(!n.meshes)return[];let s=[];for(let i of n.meshes)for(let o of i.primitives)RC(r,t,e,s,o);return s}function RC(r,e,t,n,s){let i={channels:t.channels,...t.texture},o=ya(r,i,s);o&&hd(r,e,o,n,s)}var eE,wC,tE=p(()=>{"use strict";He();md();eE="EXT_feature_metadata",wC=eE});async function nE(r,e={},t){let n=rE.filter(s=>iE(s.name,e));for(let s of n)await s.preprocess?.(r,e,t)}async function sE(r,e={},t){let n=rE.filter(s=>iE(s.name,e));for(let s of n)await s.decode?.(r,e,t)}function iE(r,e){let t=e?.gltf?.excludeExtensions||{};return Array.isArray(t)?!t.includes(r):!(r in t&&!t[r])}var rE,oE=p(()=>{"use strict";$I();YI();QI();eS();tS();nS();iS();oS();pS();bS();gS();yS();oy();wS();KS();JS();Jg();YS();QS();ZS();tE();rE=[xg,ry,ty,Ty,Wg,Vg,qg,Xg,Hg,Yg,Qg,Zg,ny,sy,iy,ay,vy,Iy,Sy,Ay,Ey]});function aE(r){let e=new ie(r);for(let t of e.images){let n=e.getExtension(t,Ly);n&&(t.bufferView=n.bufferView,t.mimeType=n.mimeType,delete t.uri),e.removeExtension(t,Ly)}for(let t of e.data.buffers||[])t.id==="binary_glTF"&&delete t.uri;e.removeExtension(Ly)}var Ly,cE=p(()=>{"use strict";He();Ly="KHR_binary_glTF"});function lE(r,e){let t=r.accessors||[],n=r.bufferViews||[],s=NC(r),i=new Map;for(let[o,a]of t.entries()){let c=a.bufferView;if(c===void 0&&!a.byteStride){delete a.byteStride;continue}let u=n[c],l=s.get(o)||"unused",f=CC(a),d=a.byteStride===0?f:a.byteStride??f,h=a.byteOffset??0,m=u?.byteOffset??0,b=typeof a.componentType=="number"&&Object.hasOwn(Id,a.componentType)?Id[a.componentType]:0,g=l==="vertex",y=g?d>=f&&d>=4&&d<=252&&d%4===0&&h%4===0&&(m+h)%4===0:d===f;if(!u||!f||l==="mixed"||!Number.isInteger(d)||!y||g&&d>u.byteLength||!Number.isInteger(a.count)||a.count<1||!Number.isInteger(h)||h<0||!Number.isInteger(m)||m<0||h%b!==0||(m+h)%b!==0||a.type.startsWith("MAT")&&(m+h)%4!==0||!Number.isInteger(u.byteLength)||h+(a.count-1)*d+f>u.byteLength){e(o);continue}let x=`${c}:${l}:${g?d:0}`,T=i.get(x);if(T===void 0){let _={...u};delete _.id,delete _.byteStride,delete _.target,g?(_.byteStride=d,_.target=34962):l==="indices"&&(_.target=34963),T=n.length,n.push(_),i.set(x,T)}a.bufferView=T,delete a.byteStride}}function NC(r){let e=new Map,t=(n,s)=>{if(n===void 0)return;let i=e.get(n);e.set(n,i&&i!==s?"mixed":s)};for(let n of r.meshes||[])for(let s of n.primitives){for(let i of Object.values(s.attributes))t(i,"vertex");t(s.indices,"indices")}for(let n of r.animations||[])for(let s of n.samplers)t(s.input,"animation"),t(s.output,"animation");for(let n of r.skins||[])t(n.inverseBindMatrices,"inverseBind");return e}function CC(r){let e=typeof r.componentType=="number"&&Object.hasOwn(Id,r.componentType)?Id[r.componentType]:0,t=Object.hasOwn(uE,r.type)?uE[r.type]:0;if(!e||!t)return 0;let n=r.type==="MAT2"?2:r.type==="MAT3"?3:4;return r.type.startsWith("MAT")&&n*e%4!==0?0:(e||0)*t}var Id,uE,fE=p(()=>{"use strict";Id={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},uE={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}});function dE(r,e,t){let n=r.nodes||[],s=r.skins||[],i=s.length,o=!1;for(let a=0;a<i;a++){let c=s[a],u=c.jointNames;if(!Array.isArray(u)||u.length===0||u.some(m=>typeof m!="string"||!m)||new Set(u).size!==u.length){t(`skin ${a} has invalid joint names`),o=!0;continue}let l=n.flatMap((m,b)=>m.skin===a?[b]:[]),f=(l.length?l:[void 0]).map(m=>UC(n,u,m,e,b=>t(`skin ${a} ${b}`))),d=f.some(m=>!m);o||=d;let h=new Map;for(let m of f){if(!m)continue;let b=`${m.skeletonIndex}:${m.jointIndices.join(",")}`,g=h.get(b);if(g===void 0){let y={...c,joints:m.jointIndices,skeleton:m.skeletonIndex};delete y.jointNames,c.bindShapeMatrix!==void 0&&jC(c.bindShapeMatrix)&&delete y.bindShapeMatrix,!d&&h.size===0?(g=a,s[a]=y):(delete y.id,g=s.length,s.push(y)),h.set(b,g)}m.nodeIndex!==void 0&&(n[m.nodeIndex].skin=g,delete n[m.nodeIndex].skeletons)}}if(!o)for(let a of n)delete a.jointName}function UC(r,e,t,n,s){let i=t===void 0?void 0:r[t].skeletons;if(i!==void 0&&(!Array.isArray(i)||i.some(f=>typeof f!="string"||!f)||new Set(i).size!==i.length))return s("has invalid skeleton roots"),null;let o=(i||[]).map(n),a=o.length?PC(r,o):r.map((f,d)=>d);if(!a)return s("has invalid or overlapping skeleton subtrees"),null;let c=[],u=new Map;for(let f of a){let d=r[f].jointName;if(d===void 0)continue;let h=u.get(d)||[];h.push(f),u.set(d,h)}for(let f of e){let d=u.get(f)||[];if(d.length!==1)return s(`cannot uniquely resolve joint ${f}`),null;c.push(d[0])}let l=VC(r,[...c,...o]);return l===void 0?(s("joints have no unambiguous common hierarchy root"),null):{nodeIndex:t,jointIndices:c,skeletonIndex:o.length===1?o[0]:l}}function PC(r,e){let t=new Set,n=[...e];for(;n.length;){let s=n.pop();if(!Number.isSafeInteger(s)||!r[s]||t.has(s))return null;t.add(s),n.push(...r[s].children||[])}return Array.from(t)}function VC(r,e){let t=new Map;for(let[i,o]of r.entries())for(let a of o.children||[]){if(!Number.isSafeInteger(a)||!r[a]||t.has(a))return;t.set(a,i)}let n=e.map(i=>{let o=[],a=new Set,c=i;for(;c!==void 0;){if(a.has(c))return[];a.add(c),o.push(c),c=t.get(c)}return o}),s=n.map(i=>new Set(i));return n[0].find(i=>s.every(o=>o.has(i)))}function jC(r){return Array.isArray(r)&&r.length===16&&Array.from(r).every((e,t)=>e===(t%5===0?1:0))}var hE=p(()=>{"use strict"});function Sd(r,e){if(!e.length)return;let t=new Map;for(let n of e){let s=t.get(n.bufferIndex)||[];s.push(n),t.set(n.bufferIndex,s)}r.buffers=[...r.buffers],r.json.bufferViews||=[];for(let[n,s]of t){let i=r.json.buffers[n],o=r.buffers[n],a=_e(i.byteLength,4),c=a+s.reduce((f,d)=>f+_e(d.bytes.byteLength,4),0),u=new ArrayBuffer(c),l=new Uint8Array(u);l.set(new Uint8Array(o.arrayBuffer,o.byteOffset,i.byteLength));for(let f of s){l.set(new Uint8Array(f.bytes),a);let d=r.json.bufferViews.length;r.json.bufferViews.push({buffer:n,byteOffset:a,byteLength:f.bytes.byteLength,...f.byteStride===void 0?{}:{byteStride:f.byteStride},...f.target===void 0?{}:{target:f.target}}),f.apply(d),a+=_e(f.bytes.byteLength,4)}i.byteLength=c,i.uri!==void 0&&(i.uri=`data:application/octet-stream;base64,${cb(u)}`),r.buffers[n]={arrayBuffer:u,byteOffset:0,byteLength:c}}}var By=p(()=>{"use strict";Ue()});function pE(r,e){let t=new Map;for(let[n,s]of(r.json.skins||[]).entries()){if(s.bindShapeMatrix===void 0)continue;let i=s.bindShapeMatrix;if(!mE(i)){e(`skin ${n} non-identity bindShapeMatrix requires a finite affine matrix`);continue}let o=`${s.inverseBindMatrices}:${i.join(",")}`,a=t.get(o);if(a){if((s.joints||s.jointNames||[]).length>a.count){e(`skin ${n} non-identity bindShapeMatrix has too few inverse-bind matrices`);continue}a.skins.push(s);continue}let c=GC(r,s,i);if(typeof c=="string"){e(`skin ${n} non-identity bindShapeMatrix ${c}`);continue}t.set(o,c)}Sd(r,Array.from(t.values(),n=>({bufferIndex:n.bufferIndex,bytes:n.matrixBytes,apply:s=>{r.json.accessors||=[];let i=r.json.accessors.length;r.json.accessors.push({bufferView:s,byteOffset:0,componentType:5126,count:n.count,type:"MAT4"});for(let o of n.skins)o.inverseBindMatrices=i,delete o.bindShapeMatrix}})))}function GC(r,e,t){let n=r.json.accessors?.[e.inverseBindMatrices],s=(e.joints||e.jointNames||[]).length;if(!n||n.componentType!==5126||n.type!=="MAT4"||n.normalized||n.sparse||n.extensions||Object.hasOwn(n,"byteStride")||!Number.isSafeInteger(n.count)||n.count<1)return"requires packed FLOAT MAT4 inverse-bind matrices";if(n.count<s)return"has too few inverse-bind matrices";let i=r.json.bufferViews?.[n.bufferView],o=i?.buffer,a=r.json.buffers?.[o],c=r.buffers[o];if(!i||o===void 0||!a||!c)return"requires a loaded inverse-bind buffer";if(i.extensions)return"does not support inverse-bind buffer-view extensions";let u=i.byteOffset??0,l=n.byteOffset??0,f=n.count*64;if(!(c.arrayBuffer instanceof ArrayBuffer)||!Number.isSafeInteger(a.byteLength)||a.byteLength<1||!Number.isSafeInteger(c.byteOffset)||c.byteOffset<0||!Number.isSafeInteger(c.byteLength)||c.byteLength<a.byteLength||c.byteOffset+c.byteLength>c.arrayBuffer.byteLength||!Number.isSafeInteger(u)||u<0||u%4!==0||!Number.isSafeInteger(i.byteLength)||i.byteLength<1||i.byteStride!==void 0||u+i.byteLength>a.byteLength||!Number.isSafeInteger(l)||l<0||l%4!==0||l+f>i.byteLength)return"has an invalid inverse-bind buffer layout";let d=new DataView(c.arrayBuffer),h=c.byteOffset+u+l,m=new ArrayBuffer(f),b=new DataView(m);for(let g=0;g<n.count;g++){let y=Array.from({length:16},(x,T)=>d.getFloat32(h+g*64+T*4,!0));if(!mE(y))return"requires finite affine inverse-bind matrices";for(let x=0;x<4;x++)for(let T=0;T<4;T++){let _=0;for(let v=0;v<4;v++)_+=y[v*4+T]*t[x*4+v];if(!Number.isFinite(Math.fround(_)))return"produces non-finite FLOAT matrix values";b.setFloat32(g*64+(x*4+T)*4,_,!0)}}return{bufferIndex:o,count:n.count,matrixBytes:m,skins:[e]}}function mE(r){if(!Array.isArray(r)||r.length!==16)return!1;for(let e=0;e<16;e++)if(!Number.isFinite(r[e]))return!1;return r[3]===0&&r[7]===0&&r[11]===0&&r[15]===1}var bE=p(()=>{"use strict";By()});function yE(r){let e=r.accessors||[],t=new Map,n=new Map,s=Oy(r),i=(o,a)=>{if(!Number.isSafeInteger(o)||o<0||!Object.hasOwn(e,o))return o;let c=e[o];if(!c)return o;let u=t.get(o)||new Map,l=`${a.usage}:${a.mode}:${["unit","signed","direction"].includes(a.mode)?a.semantic?.split("_")[0]:""}:${a.hasOpaqueConsumer?"opaque":""}`,f=u.get(l);return f===void 0&&(f=u.size?e.length:o,u.size&&e.push({...c}),u.set(l,f),n.set(f,a),t.set(o,u)),f};for(let o of r.meshes||[])for(let a of o.primitives){for(let[c,u]of Object.entries(a.attributes)){let l=e[u],f=["NORMAL","TANGENT"].includes(c)&&l&&[5120,5121,5122,5123].includes(l.componentType)?"direction":/^JOINTS_\d+$/.test(c)?"joints":/^(COLOR|WEIGHTS|TEXCOORD)_\d+$/.test(c)&&l&&[5120,5122].includes(l.componentType)?"signed":/^(COLOR|WEIGHTS|TEXCOORD)_\d+$/.test(c)&&l&&[5121,5123].includes(l.componentType)&&!l.normalized?"unit":/^WEIGHTS_\d+$/.test(c)?"weights":"copy";a.attributes[c]=i(u,{usage:"vertex",mode:f,semantic:c,...["signed","direction"].includes(f)?{hasOpaqueConsumer:s}:{}})}a.indices!==void 0&&(a.indices=i(a.indices,{usage:"indices",mode:"copy",hasOpaqueConsumer:a.extensions!==void 0}))}for(let o of r.animations||[])for(let a of o.samplers)a.input=i(a.input,{usage:"animation",mode:"copy"}),a.output=i(a.output,{usage:"animation",mode:"copy"});for(let o of r.skins||[])o.inverseBindMatrices!==void 0&&(o.inverseBindMatrices=i(o.inverseBindMatrices,{usage:"inverseBind",mode:"copy"}));for(let o=0;o<e.length;o++)n.has(o)||n.set(o,{usage:"unused",mode:"copy"});return n}function wE(r,e,t,n,s){let i=[],o=[];for(let[a,c]of e){let u=r.json.accessors[a],l=c.mode==="joints"||c.mode==="weights"||c.semantic?.startsWith("WEIGHTS_"),f=!!(l&&["SCALAR","VEC2","VEC3"].includes(u.type)),d=c.mode==="weights"&&(u.type!=="VEC4"||![5121,5123,5126].includes(u.componentType)||u.componentType===5126&&u.normalized),h=c.mode==="signed",m=c.mode==="direction",b=h||m,g=c.mode==="joints"&&(![5121,5123].includes(u.componentType)||u.normalized||u.type!=="VEC4");if(!t.has(a)&&!g&&!d&&!b&&!f&&c.usage!=="indices"&&c.mode!=="unit")continue;let y=hu(r,a);if(typeof y=="string"){n(`accessor ${a} layout requires binary repacking: ${y}`);continue}if(l&&!["SCALAR","VEC2","VEC3","VEC4"].includes(u.type)){n(`accessor ${a} skin influences require scalar/vector data`);continue}if(c.mode==="weights"&&(![5121,5123,5126].includes(u.componentType)||u.componentType===5126&&u.normalized||u.componentType!==5126&&!u.normalized)){n(`accessor ${a} weights require FLOAT or normalized unsigned data`);continue}let x=u.componentType,T=u.normalized;if(b){if(c.hasOpaqueConsumer){n(`accessor ${a} integer conversion cannot interpret opaque extension consumers`);continue}if(!(m?[c.semantic==="NORMAL"?"VEC3":"VEC4"]:c.semantic?.startsWith("COLOR_")?["VEC3","VEC4"]:c.semantic?.startsWith("WEIGHTS_")?["SCALAR","VEC2","VEC3","VEC4"]:["VEC2"]).includes(u.type)||T!==void 0&&typeof T!="boolean"){n(`accessor ${a} integer ${c.semantic} has incompatible shape or normalization`);continue}let oe=!0;for(let xe=0;xe<u.count;xe++)if(m){let Rt=Math.hypot(Math.fround(Ia(y,xe,0)),Math.fround(Ia(y,xe,1)),Math.fround(Ia(y,xe,2)));(Math.abs(Rt-1)>1e-5||c.semantic==="TANGENT"&&![-1,1].includes(Ia(y,xe,3)))&&(oe=!1)}else if(!c.semantic?.startsWith("TEXCOORD_"))for(let Rt=0;Rt<y.rows;Rt++){let mr=Ia(y,xe,Rt);(mr<0||mr>1)&&(oe=!1)}if(!oe){n(m?`accessor ${a} integer ${c.semantic} requires unit directions and tangent handedness of +/-1; values are not repaired`:`accessor ${a} signed ${c.semantic} values must remain in [0, 1]`);continue}x=5126,T=!1}if(c.usage==="indices"){if(u.type!=="SCALAR"||![5121,5123,5125].includes(x)||T){n(`index accessor ${a} requires unnormalized unsigned SCALAR data`);continue}let ue=0;for(let xe=0;xe<u.count;xe++)ue=Math.max(ue,Xt(y,xe,0));if(ue===(x===5121?255:x===5123?65535:4294967295)){if(c.hasOpaqueConsumer){n(`index accessor ${a} cannot widen opaque primitive extension semantics`);continue}if(x===5125){n(`index accessor ${a} contains the unrepresentable uint32 restart value`);continue}x=x===5121?5123:5125}if(!t.has(a)&&x===u.componentType)continue}if(g||c.mode==="unit"){if(g&&u.normalized){n(`accessor ${a} joint indices require unnormalized scalar/vector data`);continue}if(c.mode==="unit"&&!(c.semantic?.startsWith("COLOR_")?["VEC3","VEC4"]:c.semantic?.startsWith("WEIGHTS_")?["SCALAR","VEC2","VEC3","VEC4"]:["VEC2"]).includes(u.type)){n(`accessor ${a} integer ${c.semantic} has an incompatible shape`);continue}let ue=0,oe=!0;for(let xe=0;xe<u.count;xe++)for(let Rt=0;Rt<y.rows*y.columns;Rt++){let mr=Xt(y,xe,Rt);(!Number.isInteger(mr)||mr<0||g&&mr>65535)&&(oe=!1),ue=Math.max(ue,mr)}if(!oe){n(`accessor ${a} joint indices require finite integers in [0, 65535]`);continue}if(g)x=ue<=255?5121:5123,T=!1;else if(ue<=1)x=5126,T=!1;else if(n(`accessor ${a} ambiguous integer attribute normalization; best effort assumes normalized unsigned values`),T=!0,!t.has(a)&&!f){o.push(()=>{u.normalized=!0});continue}}let _=f?4:y.rows,v=Fy[x],I=y.columns>1?_e(y.rows*v,4):_*v,N=I*y.columns,K=c.usage==="vertex"?_e(N,4):N,ne=new ArrayBuffer(u.count*K),be=new Uint8Array(ne),Re=new Uint8Array(y.data.buffer),ke=new DataView(ne);for(let ue=0;ue<u.count;ue++)for(let oe=0;oe<y.columns;oe++)if(x===u.componentType){let xe=y.byteOffset+ue*y.byteStride+oe*y.rows*y.componentSize;be.set(Re.subarray(xe,xe+y.rows*y.componentSize),ue*K+oe*I)}else for(let xe=0;xe<y.rows;xe++){let Rt=(b?Ia:Xt)(y,ue,oe*y.rows+xe),mr=ue*K+oe*I+xe*v;x===5126?ke.setFloat32(mr,Rt,!0):x===5121?ke.setUint8(mr,Rt):x===5125?ke.setUint32(mr,Rt,!0):ke.setUint16(mr,Rt,!0)}i.push({bufferIndex:y.bufferIndex,bytes:ne,...c.usage==="vertex"?{byteStride:K,target:34962}:c.usage==="indices"?{target:34963}:{},apply:ue=>{b&&s(`Converted ${h?"signed":"integer"} ${c.semantic} accessor ${a} to FLOAT, preserving ${y.accessor.normalized?"explicitly normalized":"literal"} values.`),c.usage==="indices"&&x!==u.componentType&&s(`Widened index accessor ${a} to preserve a glTF 1 index reserved by glTF 2.`),u.bufferView=ue,u.byteOffset=0,delete u.byteStride,(x!==u.componentType||f)&&(delete u.min,delete u.max),u.componentType=x,f&&(u.type="VEC4"),T?u.normalized=!0:delete u.normalized}})}Sd(r,i);for(let a of o)a()}function Ia(r,e,t){let n=Xt(r,e,t);if(r.accessor.normalized!==!0)return n;let s=zC[r.accessor.componentType];return Math.max(n/s,-1)}function Oy(r){let e=[r],t=new Set;for(;e.length;){let n=e.pop();if(!(!n||typeof n!="object"||t.has(n))){t.add(n);for(let[s,i]of Object.entries(n))if(s!=="extras"){if(s==="extensions"&&i&&typeof i=="object"&&Object.keys(i).some(o=>!["KHR_materials_unlit","KHR_materials_common"].includes(o)))return!0;e.push(i)}}}return!1}function hu(r,e){let t=r.json.accessors?.[e];if(!t||!Number.isSafeInteger(e)||e<0)return"invalid accessor reference";let n=typeof t.componentType=="number"&&Object.hasOwn(Fy,t.componentType)?Fy[t.componentType]:void 0,s=typeof t.type=="string"&&Object.hasOwn(gE,t.type)?gE[t.type]:void 0;if(!n||!s||!Number.isSafeInteger(t.count)||t.count<1)return"invalid component type, shape, or count";let[i,o]=s,a=r.json.bufferViews?.[t.bufferView],c=r.json.buffers?.[a?.buffer],u=r.buffers[a?.buffer];if(!a||!c||!u)return"requires a loaded accessor buffer";if(t.sparse||t.extensions||a.extensions)return"sparse or extension-bearing data is unsupported";let l=i*o*n,f=t.byteStride??a.byteStride??l,d=f===0?l:f,h=t.byteOffset??0,m=a.byteOffset??0;return!(u.arrayBuffer instanceof ArrayBuffer)||!Number.isSafeInteger(d)||d<l||t.byteStride!==void 0&&t.byteStride>255||!Number.isSafeInteger(h)||h<0||!Number.isSafeInteger(m)||m<0||!Number.isSafeInteger(a.byteLength)||a.byteLength<1||!Number.isSafeInteger(c.byteLength)||c.byteLength<1||m+a.byteLength>c.byteLength||h+(t.count-1)*d+l>a.byteLength||!Number.isSafeInteger(u.byteOffset)||u.byteOffset<0||!Number.isSafeInteger(u.byteLength)||u.byteLength<c.byteLength||u.byteOffset+u.byteLength>u.arrayBuffer.byteLength?"invalid source buffer span or stride":{accessor:t,bufferIndex:a.buffer,componentSize:n,rows:i,columns:o,byteStride:d,data:new DataView(u.arrayBuffer),byteOffset:u.byteOffset+m+h}}function Xt(r,e,t){let n=r.byteOffset+e*r.byteStride+t*r.componentSize;switch(r.accessor.componentType){case 5120:return r.data.getInt8(n);case 5121:return r.data.getUint8(n);case 5122:return r.data.getInt16(n,!0);case 5123:return r.data.getUint16(n,!0);case 5125:return r.data.getUint32(n,!0);default:return r.data.getFloat32(n,!0)}}var Fy,zC,gE,pu=p(()=>{"use strict";Ue();By();Fy={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},zC={5120:127,5121:255,5122:32767,5123:65535},gE={SCALAR:[1,1],VEC2:[2,1],VEC3:[3,1],VEC4:[4,1],MAT2:[2,2],MAT3:[3,3],MAT4:[4,4]}});function TE(r,e){let t=r.asset;t.premultipliedAlpha&&e("asset premultipliedAlpha rendering"),xE(t,["profile","premultipliedAlpha"]);for(let[n,s]of(r.textures||[]).entries()){let i=s;for(let[o,a]of Object.entries({format:6408,internalFormat:6408,target:3553,type:5121}))i[o]!==void 0&&i[o]!==a&&e(`texture ${n} non-default ${o} rendering`);xE(i,["format","internalFormat","target","type"])}}function xE(r,e){let t={};for(let a of e)Object.hasOwn(r,a)&&(t[a]=r[a],delete r[a]);if(!Object.keys(t).length)return;let n=My(r.extras)?r.extras:r.extras===void 0?{}:{originalExtras:r.extras},s=My(n.gltf1)?n.gltf1:n.gltf1===void 0?{}:{originalExtras:n.gltf1},i=My(s.legacyFields)?s.legacyFields:s.legacyFields===void 0?{}:{originalExtras:s.legacyFields},o=Object.keys(t).some(a=>Object.hasOwn(i,a));r.extras={...n,gltf1:{...s,legacyFields:{...i,...t,...o?{originalExtras:i}:{}}}}}function My(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function Dy(r){let e=/^(JOINTS?|WEIGHTS?|TEXCOORD|COLOR)(?:_(\d+))?$/.exec(r);if(e){let t=e[1].startsWith("JOINT")?"JOINTS":e[1].startsWith("WEIGHT")?"WEIGHTS":e[1],n=Number(e[2]||0);if(!Number.isSafeInteger(n)||n>999999999)throw new Error(`glTF v1: invalid attribute set index ${r}`);return`${t}_${n}`}return["POSITION","NORMAL","TANGENT"].includes(r)||r.startsWith("_")||r.includes(":")?r:`_${r}`}var _E=p(()=>{"use strict"});function AE(r,e,t){for(let[s,i]of(r.animations||[]).entries()){let f=function(d,h,m){try{let b=typeof d=="string"?e(d,h):d,g=h==="accessor"?r.accessors:r.nodes;if(typeof b=="number"&&Number.isSafeInteger(b)&&b>=0&&g?.[b])return b}catch{}return t(`animation ${s} ${m} unresolved ${h} reference`),d};var n=f;let o=i,a=o.parameters||{},c=new Map,u=i.samplers,l=Array.isArray(u)?u.map((d,h)=>[String(h),d]):Object.entries(u||{});i.samplers=l.map(([d,h],m)=>{c.set(d,m);for(let b of["input","output"]){let g=h[b],y=Object.hasOwn(a,g)?a[g]:g;h[b]=f(y,"accessor",`sampler ${d} ${b}`)}return h.interpolation??="LINEAR",h}),delete o.parameters;for(let[d,h]of(i.channels||[]).entries()){if(typeof h.sampler=="string"){let b=c.get(h.sampler);b===void 0?t(`animation ${s} channel ${d} unresolved sampler ${h.sampler}`):h.sampler=b}let m=h.target;m?.id!==void 0?(m.node=f(m.id,"node",`channel ${d} target`),delete m.id):typeof m?.node=="string"&&(m.node=f(m.node,"node",`channel ${d} target`))}}}var vE=p(()=>{"use strict"});function IE(r,e,t){let n=r.nodes||[],s=new Map;for(let[a,c]of n.entries())for(let u of c.children||[])s.set(u,s.has(u)?null:a);let i=[];for(let[a,c]of(r.scenes||[]).entries()){let u=o(c.nodes||[]);if(!u){e(`scene ${a} invalid node hierarchy`);continue}for(let l of Array.from(u)){let f=r.skins?.[n[l].skin];if(!Array.isArray(f?.joints)||!f.joints.length||f.skeleton===void 0||u.has(f.skeleton)&&f.joints.every(b=>u.has(b)))continue;let d=f.skeleton,h=new Set;for(;!h.has(d)&&typeof s.get(d)=="number";)h.add(d),d=s.get(d);let m=o([d]);if(h.has(d)||s.get(d)===null||!m||!f.joints.every(b=>m.has(b))||Array.from(m).some(b=>u.has(b)||n[b].mesh!==void 0||n[b].camera!==void 0||n[b].extensions!==void 0)){e(`scene ${a} skin ${n[l].skin} cannot safely attach detached skeleton`);continue}for(let b of m)u.add(b);i.push(()=>{c.nodes||=[],c.nodes.push(d),t(`Attached detached skeleton root ${d} to scene ${a}.`)})}}for(let a of i)a();function o(a){let c=new Set,u=[...a];for(;u.length;){let l=u.pop();if(!Number.isSafeInteger(l)||!n[l]||c.has(l)||s.get(l)===null)return null;c.add(l),u.push(...n[l].children||[])}return c}}var SE=p(()=>{"use strict"});function EE(r,e){for(let[t,n]of(r.cameras||[]).entries()){let s=n.perspective,i=n.orthographic;(n.type==="perspective"?s&&mu(s.yfov)&&mu(s.znear)&&(s.aspectRatio===void 0||mu(s.aspectRatio))&&(s.zfar===void 0||mu(s.zfar)&&s.zfar>s.znear):n.type==="orthographic"&&i&&Number.isFinite(i.xmag)&&i.xmag!==0&&Number.isFinite(i.ymag)&&i.ymag!==0&&Number.isFinite(i.znear)&&i.znear>=0&&mu(i.zfar)&&i.zfar>i.znear)||e(`camera ${t} invalid projection parameters`)}}function mu(r){return Number.isFinite(r)&&r>0}var LE=p(()=>{"use strict"});function BE(r,e,t){let n=new Map,s=new Set;for(let[i,o]of(r.json.meshes||[]).entries())for(let[a,c]of o.primitives.entries()){let u=`mesh ${i} primitive ${a}`;for(let b of["TEXCOORD","COLOR","JOINTS","WEIGHTS"])Object.keys(c.attributes).filter(y=>y.startsWith(`${b}_`)).map(y=>Number(y.slice(b.length+1))).sort((y,x)=>y-x).some((y,x)=>y!==x)&&t(`${u} ${b} sets must be contiguous starting at zero`);for(let[b,g]of Object.entries(c.attributes)){let y=b.split("_")[0];if(!["NORMAL","TANGENT","COLOR","TEXCOORD","JOINTS","WEIGHTS"].includes(y))continue;let x=`${y}:${g}`;if(s.has(x))continue;s.add(x);let T=e(g,`${b} accessor ${g}`);T&&WC(T,y,`${b} accessor ${g}`,t)}let l=Object.values(c.attributes).map(b=>(Number.isSafeInteger(b)?r.json.accessors?.[b]:void 0)?.count);if(!l.length||l.some(b=>!Number.isSafeInteger(b)||b<1)){t(`${u} requires valid vertex attribute accessors`);continue}l.some(b=>b!==l[0])&&t(`${u} vertex attribute counts do not match`);let f=c.indices===void 0?l[0]:r.json.accessors?.[c.indices]?.count,d=c.mode===void 0?4:c.mode;if(!Number.isInteger(d)||d<0||d>6?t(`${u} requires a primitive mode in [0, 6]`):(!c.extensions||!Object.keys(c.extensions).length)&&(!Number.isSafeInteger(f)||f<1||d===1&&f%2!==0||[2,3].includes(d)&&f<2||d===4&&f%3!==0||[5,6].includes(d)&&f<3)&&t(`${u} draw count ${f} is incompatible with primitive mode ${d}`),c.indices===void 0)continue;let h=e(c.indices,`${u} indices`);if(!h)continue;if(h.accessor.type!=="SCALAR"||![5121,5123,5125].includes(h.accessor.componentType)||h.accessor.normalized){t(`${u} indices require unnormalized unsigned SCALAR data`);continue}let m=n.get(c.indices);if(m===void 0){m=0;for(let b=0;b<h.accessor.count;b++)m=Math.max(m,Xt(h,b,0));n.set(c.indices,m)}l.some(b=>m>=b)&&t(`${u} index ${m} is outside its vertex attribute counts`)}}function WC(r,e,t,n){let s=r.accessor,i=s.componentType===5126&&!s.normalized,o=[5121,5123].includes(s.componentType)&&s.normalized===!0,a=s.normalized===void 0||typeof s.normalized=="boolean",c=e==="NORMAL"?s.type==="VEC3"&&i:e==="TANGENT"?s.type==="VEC4"&&i:e==="JOINTS"?s.type==="VEC4"&&[5121,5123].includes(s.componentType)&&!s.normalized:e==="COLOR"?["VEC3","VEC4"].includes(s.type)&&(i||o):s.type===(e==="TEXCOORD"?"VEC2":"VEC4")&&(i||o);if(!a||!c){n(`${t} has incompatible core attribute shape, component type, or normalization`);return}for(let u=0;u<s.count;u++){let l=Array.from({length:r.rows},(f,d)=>Xt(r,u,d));if(l.some(f=>!Number.isFinite(f))||["NORMAL","TANGENT"].includes(e)&&Math.abs(Math.hypot(...l.slice(0,3))-1)>1e-5||e==="TANGENT"&&l[3]!==1&&l[3]!==-1||["COLOR","WEIGHTS"].includes(e)&&i&&l.some(f=>f<0||f>1)){n(`${t} requires finite core values, unit directions, tangent handedness \xB11, and colors/weights in [0, 1]`);return}}}var FE=p(()=>{"use strict";pu()});function OE(r,e,t){let n=new Map,s=new Set,i=[],o=(f,d)=>{let h=n.get(f);return h===void 0&&(h=hu(r,f),n.set(f,h)),typeof h=="string"?(s.has(f)||(s.add(f),e(`${d}: ${h}`)),null):h},a=new Set;for(let f of r.json.meshes||[])for(let d of f.primitives)d.attributes.POSITION!==void 0&&a.add(d.attributes.POSITION);for(let f of a){let d=o(f,`POSITION accessor ${f}`);if(d){if(!Ed(d,"VEC3")){e(`POSITION accessor ${f} requires unnormalized FLOAT VEC3 data`);continue}u(d,f)}}l(),c(),$C(r,o,e),BE(r,o,e);for(let f of i)f();function c(){for(let[f,d]of(r.json.skins||[]).entries()){if(d.inverseBindMatrices===void 0)continue;let h=`skin ${f} inverse-bind matrices`,m=o(d.inverseBindMatrices,h);if(m){if(!Ed(m,"MAT4")||m.accessor.count<(d.joints?.length||0)){e(`${h} require FLOAT MAT4 data with at least one matrix per joint`);continue}for(let b=0;b<m.accessor.count;b++){let g=Array.from({length:16},(y,x)=>Xt(m,b,x));if(g.some(y=>!Number.isFinite(y))||g[3]!==0||g[7]!==0||g[11]!==0||g[15]!==1){e(`${h} require finite affine matrices`);break}}}}}function u(f,d){let h=new Array(f.rows).fill(1/0),m=new Array(f.rows).fill(-1/0);for(let b=0;b<f.accessor.count;b++)for(let g=0;g<f.rows;g++){let y=Xt(f,b,g);if(!Number.isFinite(y))return e(`accessor ${d} non-finite values cannot supply required bounds`),!1;h[g]=Math.min(h[g],y),m[g]=Math.max(m[g],y)}return(JSON.stringify(f.accessor.min)!==JSON.stringify(h)||JSON.stringify(f.accessor.max)!==JSON.stringify(m))&&i.push(()=>{f.accessor.min=h,f.accessor.max=m,t(`Calculated required bounds for accessor ${d}.`)}),!0}function l(){let f=new Set,d=new Set;for(let[h,m]of(r.json.animations||[]).entries()){let b=new Set;(!m.samplers.length||!m.channels?.length)&&e(`animation ${h} requires samplers and channels`);for(let[g,y]of m.samplers.entries()){let x=`animation ${h} sampler ${g}`;if(["LINEAR","STEP"].includes(y.interpolation??"LINEAR")||e(`${x} unsupported interpolation ${y.interpolation}`),!f.has(y.input)){f.add(y.input);let T=o(y.input,`${x} input`);if(T)if(!Ed(T,"SCALAR"))e(`${x} time input requires unnormalized FLOAT SCALAR data`);else{let _=-1/0,v=!0;for(let I=0;I<T.accessor.count;I++){let N=Xt(T,I,0);(!Number.isFinite(N)||N<0||N<=_)&&(v=!1),_=N}v?u(T,y.input):e(`${x} times must be finite, nonnegative, and strictly increasing`)}}}for(let[g,y]of(m.channels||[]).entries()){let x=`animation ${h} channel ${g}`,T=Number.isSafeInteger(y.sampler)?m.samplers[y.sampler]:void 0,_=y.target,v=Number.isSafeInteger(_?.node)?r.json.nodes?.[_.node]:void 0;if(!T||!v||!["translation","rotation","scale"].includes(_?.path)){e(`${x} invalid sampler, node, or TRS target`);continue}v.matrix!==void 0&&e(`${x} matrix node requires TRS decomposition`);let I=`${_.node}:${_.path}`;if(b.has(I)&&e(`${x} duplicate node/path target`),b.add(I),!["LINEAR","STEP"].includes(T.interpolation??"LINEAR"))continue;let N=r.json.accessors?.[T.input],K=o(T.output,`${x} output`);if(!K)continue;if(!Ed(K,_.path==="rotation"?"VEC4":"VEC3")||K.accessor.count!==N?.count){e(`${x} output shape, type, or count does not match its target and keys`);continue}let ne=`${T.output}:${_.path}`;if(!d.has(ne)){d.add(ne);for(let be=0;be<K.accessor.count;be++){let Re=Array.from({length:K.rows},(ke,ue)=>Xt(K,be,ue));if(Re.some(ke=>!Number.isFinite(ke))||_.path==="rotation"&&Math.abs(Math.hypot(...Re)-1)>1e-5){e(`${x} output requires finite values and unit rotation quaternions`);break}}}}}}}function Ed(r,e){return r.accessor.componentType===5126&&!r.accessor.normalized&&r.accessor.type===e}function $C(r,e,t){let n=new Set;for(let s of r.json.nodes||[]){let i=r.json.skins?.[s.skin],o=r.json.meshes?.[s.mesh];if(!Array.isArray(i?.joints)||!i.joints.length||!o)continue;let a=`${s.mesh}:${s.skin}`;if(!n.has(a)){n.add(a);for(let[c,u]of o.primitives.entries()){let l=`mesh ${s.mesh} primitive ${c} skin ${s.skin}`,f=Object.keys(u.attributes).filter(b=>/^JOINTS_\d+$/.test(b)).map(b=>Number(b.slice(7))).sort((b,g)=>b-g),d=Object.keys(u.attributes).filter(b=>/^WEIGHTS_\d+$/.test(b)).map(b=>Number(b.slice(8))).sort((b,g)=>b-g);if(!f.length&&!d.length){t(`${l} requires JOINTS_0 and WEIGHTS_0 skin influences`);continue}if(JSON.stringify(f)!==JSON.stringify(d)||f.some((b,g)=>b!==g)){t(`${l} requires matching contiguous joint/weight sets starting at zero`);continue}let h=r.json.accessors?.[u.attributes.POSITION]?.count,m=f.map(b=>({joints:e(u.attributes[`JOINTS_${b}`],`${l} joint set ${b}`),weights:e(u.attributes[`WEIGHTS_${b}`],`${l} weight set ${b}`)}));if(!m.some(({joints:b,weights:g})=>!b||!g)){if(m.some(({joints:b,weights:g})=>b.accessor.type!=="VEC4"||g.accessor.type!=="VEC4"||![5121,5123].includes(b.accessor.componentType)||b.accessor.normalized||!(g.accessor.componentType===5126&&!g.accessor.normalized||[5121,5123].includes(g.accessor.componentType)&&g.accessor.normalized)||b.accessor.count!==g.accessor.count||h!==void 0&&b.accessor.count!==h||b.accessor.count!==m[0].joints.accessor.count)){t(`${l} incompatible influence accessor types or vertex counts`);continue}for(let b=0;b<m[0].joints.accessor.count;b++){let g=0,y=0,x=!0,T=new Set;for(let{joints:_,weights:v}of m){let I=v.accessor.normalized?v.accessor.componentType===5121?255:65535:1;for(let N=0;N<4;N++){let K=Xt(_,b,N),ne=Xt(v,b,N)/I;(K>=i.joints.length||!Number.isFinite(ne)||ne<0||ne>1)&&(x=!1),ne>0&&(T.has(K)&&(x=!1),T.add(K),y++),g+=ne}}if(!x||Math.abs(g-1)>2e-7*Math.max(y,1)){t(`${l} invalid palette index, repeated weighted joint, or weights not summing to one at vertex ${b}`);break}}}}}}}var ME=p(()=>{"use strict";pu();FE()});function DE(r,e,t,n){let s=new Map,i=new Map,o=new Map;for(let[c,u]of(r.json.buffers||[]).entries()){let l=`buffer ${c}`,f=r.buffers[c],d=!!(f&&f.arrayBuffer instanceof ArrayBuffer&&Number.isSafeInteger(f.byteOffset)&&f.byteOffset>=0&&Number.isSafeInteger(f.byteLength)&&f.byteLength>=0&&Number.isSafeInteger(f.byteOffset+f.byteLength)&&f.byteOffset+f.byteLength<=f.arrayBuffer.byteLength);f&&!d&&t(`${l} invalid borrowed payload span`);let h=u.byteLength;if(h===void 0&&e.has(c)&&!u.extensions&&d&&f.byteLength>0&&(h=f.byteLength,i.set(c,h)),!Number.isSafeInteger(h)||h<1){t(`${l} requires a positive byteLength; missing lengths require unambiguous loaded URI data`);continue}s.set(c,h),d&&f.byteLength<h&&t(`${l} declared byteLength exceeds its loaded payload`)}let a=Oy(r.json);for(let[c,u]of(r.json.bufferViews||[]).entries()){let l=u.byteOffset===void 0?0:u.byteOffset,f=s.get(u.buffer),d=u.byteLength===void 0&&!a&&f!==void 0?qC(r,c,s):u.byteLength;u.byteLength===void 0&&d!==void 0&&o.set(c,d),(!Number.isSafeInteger(u.buffer)||u.buffer<0||f===void 0||!Number.isSafeInteger(l)||l<0||!Number.isSafeInteger(d)||(d??0)<1||!Number.isSafeInteger(l+(d??0))||l+(d??0)>f)&&t(`bufferView ${c} requires a valid buffer reference and contained positive byte span`)}for(let[c,u]of o)r.json.bufferViews[c].byteLength=u,n(`Inferred bufferView ${c} byteLength from its dense accessor spans.`);for(let[c,u]of i)r.json.buffers[c].byteLength=u,n(`Inferred buffer ${c} byteLength from its loaded URI payload.`)}function qC(r,e,t){let n=r.json.bufferViews[e];if(n.byteOffset!==void 0&&(!Number.isSafeInteger(n.byteOffset)||n.byteOffset<0)||n.byteStride!==void 0&&(!Number.isSafeInteger(n.byteStride)||n.byteStride<0)||r.json.images?.some(a=>a.bufferView===e)||r.json.accessors?.some(a=>!!a.sparse))return;let s=t.get(n.buffer)-(n.byteOffset??0),i={...r,json:{...r.json,buffers:r.json.buffers.map((a,c)=>({...a,byteLength:t.get(c)})),bufferViews:r.json.bufferViews.map((a,c)=>c===e?{...a,byteLength:s}:a)}},o=0;for(let[a,c]of(r.json.accessors||[]).entries()){if(c.bufferView!==e)continue;let u=c;for(let d of[u.byteOffset,u.byteStride])if(d!==void 0&&(!Number.isSafeInteger(d)||d<0))return;let l=hu(i,a);if(typeof l=="string")return;let f=(c.byteOffset??0)+(c.count-1)*l.byteStride+l.rows*l.columns*l.componentSize;o=Math.max(o,f)}return o>0?o:void 0}var RE=p(()=>{"use strict";pu()});function kE(r,e,t){let n=new Map;for(let i of r.animations||[])for(let o of i.channels||[]){let a=o.target?.node;if(!Number.isSafeInteger(a))continue;let c=n.get(a)||new Set;c.add(o.target.path),n.set(a,c)}let s=[];for(let[i,o]of n){let a=r.nodes?.[i];if(a?.matrix===void 0)continue;let c=`animated matrix node ${i}`;if(o.size!==1||!o.has("translation")){e(`${c} rotation or scale animation requires an unambiguous TRS basis`);continue}if(a.translation!==void 0||a.rotation!==void 0||a.scale!==void 0||a.extensions!==void 0){e(`${c} has conflicting TRS fields or opaque extensions`);continue}let u=KC(a.matrix);if(!u){e(`${c} requires a finite affine, nonsingular matrix without shear`);continue}s.push(()=>{Object.assign(a,u),delete a.matrix,t(`Decomposed translation-only animated matrix node ${i}, preserving its linear transform.`)})}for(let i of s)i()}function KC(r){if(!Array.isArray(r)||r.length!==16||Array.from(r).some(a=>!Number.isFinite(a))||r[3]!==0||r[7]!==0||r[11]!==0||r[15]!==1)return null;let e=[0,1,2].map(a=>Math.hypot(...r.slice(a*4,a*4+3)));if(e.some(a=>!Number.isFinite(a)||a===0))return null;let t=e.map((a,c)=>r.slice(c*4,c*4+3).map(u=>u/a));for(let a=0;a<3;a++)for(let c=a+1;c<3;c++)if(Math.abs(t[a].reduce((u,l,f)=>u+l*t[c][f],0))>1e-6)return null;let n=t[0][0]*(t[1][1]*t[2][2]-t[1][2]*t[2][1])-t[1][0]*(t[0][1]*t[2][2]-t[0][2]*t[2][1])+t[2][0]*(t[0][1]*t[1][2]-t[0][2]*t[1][1]);if(Math.abs(Math.abs(n)-1)>1e-6)return null;n<0&&(e[0]=-e[0],t[0]=t[0].map(a=>-a));let s=Array.from(new Gc().fromMatrix3(t.flat()).normalize()),i=r.slice(12,15),o=new Qs().translate(i).multiplyRight(new Qs().fromQuaternion(s)).scale(e);return Array.from(o).some((a,c)=>!Number.isFinite(a)||Math.abs(a-r[c])>1e-6*Math.max(1,Math.abs(r[c])))?null:{translation:i,rotation:s,scale:e}}var NE=p(()=>{"use strict";Uf()});function VE(r,e,t){let n=new Set,s=r.extensionsRequired?.includes(qr)||!1;for(let[o,a]of(r.materials||[]).entries()){let c=a,u=a.extensions?.[qr];if(u===void 0){XC(c,r,e,t);continue}zE(c,u);let l=`material ${o}`;if(!pr(u)||typeof u.technique!="string"||!["CONSTANT","LAMBERT","PHONG","BLINN"].includes(u.technique)){e(`${l} unknown ${qr} technique`);continue}if(u.values!==void 0&&!pr(u.values)){e(`${l} common material values must be an object`);continue}let f=u.values||{},d=Object.keys(u).filter(I=>!["technique","values","doubleSided","transparent","jointCount"].includes(I)),h=Object.keys(f).filter(I=>!["ambient","diffuse","emission","specular","shininess","transparency","doubleSided","transparent"].includes(I));(d.length||h.length)&&e(`${l} unrecognized common material fields ${[...d,...h].join(", ")}`),u.jointCount!==void 0&&(!Number.isSafeInteger(u.jointCount)||Number(u.jointCount)<0)&&e(`${l} invalid common material jointCount`);let m=CE(f.emission,r,`${l} emission`,e),b=u.technique==="CONSTANT",g=b?m:CE(f.diffuse,r,`${l} diffuse`,e),y=f.transparency===void 0?1:f.transparency,x=typeof y=="number"&&Number.isFinite(y)&&y>=0&&y<=1;x||e(`${l} common material transparency must be in [0, 1]`);let T=UE(u,f,"transparent",l,e),_=UE(u,f,"doubleSided",l,e);f.ambient!==void 0&&!PE(f.ambient)&&e(`${l} ambient lighting`),["PHONG","BLINN"].includes(String(u.technique))&&(f.specular!==void 0&&!PE(f.specular)&&e(`${l} specular/shininess lighting`),f.shininess!==void 0&&(typeof f.shininess!="number"||!Number.isFinite(f.shininess)||f.shininess<0)&&e(`${l} invalid common material shininess`)),a.pbrMetallicRoughness||={};let v=a.pbrMetallicRoughness;if(v.metallicFactor??=0,v.roughnessFactor??=1,g){let I=[...g.factor];I[3]*=x?y:1,v.baseColorFactor??=I,g.texture&&(v.baseColorTexture??=g.texture)}a.doubleSided??=_,a.alphaMode??=T?"BLEND":"OPAQUE",b?(a.extensions[Ry]??={},HC(r,Ry,s),t(`Converted ${l} CONSTANT emission to an unlit material.`)):(m&&(a.emissiveFactor??=m.factor.slice(0,3),m.texture&&(a.emissiveTexture??=m.texture)),t(`Approximated ${l} ${String(u.technique)} lighting with rough non-metallic PBR factors.`)),typeof c.technique=="string"?n.add(c.technique):c.technique!==void 0&&e(`${l} invalid fallback technique ID`),delete c.technique,delete c.values,delete a.extensions[qr],Object.keys(a.extensions).length||delete a.extensions}let i=WE(r);return(r.extensions?.[qr]!==void 0||(r.nodes||[]).some(o=>o.extensions?.[qr]!==void 0))&&e(`${qr} lights or scene payloads`),i.has(qr)||(r.extensionsUsed=r.extensionsUsed?.filter(o=>o!==qr),r.extensionsRequired=r.extensionsRequired?.filter(o=>o!==qr)),n}function jE(r,e){if(!e.size||[...WE(r)].some(c=>![qr,Ry].includes(c))||(r.materials||[]).some(c=>c.technique!==void 0||c.values!==void 0))return!1;let t=r;if(["techniques","programs","shaders"].some(c=>t[c]!==void 0&&!pr(t[c])))return!1;let n=pr(t.techniques)?t.techniques:{},s=pr(t.programs)?t.programs:{},i=pr(t.shaders)?t.shaders:{},o=new Set,a=new Set;if(Object.keys(n).some(c=>!e.has(c)))return!1;for(let c of Object.values(n))pr(c)&&typeof c.program=="string"&&o.add(c.program);if(Object.keys(s).some(c=>!o.has(c)))return!1;for(let c of Object.values(s))if(pr(c))for(let u of["vertexShader","fragmentShader"])typeof c[u]=="string"&&a.add(c[u]);return Object.keys(i).every(c=>a.has(c))}function XC(r,e,t,n){zE(r);let s=pr(r.values)?r.values:{},i=s.tex||s.texture2d_0||s.diffuseTex||s.diffuse,o=GE(e,i),a=ky(s.diffuse)?s.diffuse:void 0;if(o!==-1||a){let c=a?[...a]:[1,1,1,1],u=s.transparency;typeof u=="number"&&u>=0&&u<=1&&(c[3]*=u),r.pbrMetallicRoughness||={},r.pbrMetallicRoughness.metallicFactor??=0,r.pbrMetallicRoughness.roughnessFactor??=1,r.pbrMetallicRoughness.baseColorFactor??=c,o!==-1&&(r.pbrMetallicRoughness.baseColorTexture??={index:o}),r.pbrMetallicRoughness.baseColorFactor[3]<1&&(r.alphaMode||="BLEND"),n("Approximated glTF v1 diffuse material values with PBR material factors.")}(r.technique||r.values)&&t(`material technique ${r.technique||"<unnamed>"}`)}function CE(r,e,t,n){if(r===void 0)return{factor:[0,0,0,1]};if(ky(r))return{factor:[...r]};let s=GE(e,r);return s!==-1?{factor:[1,1,1,1],texture:{index:s}}:(n(`${t} requires an RGBA factor in [0, 1] or a resolved texture ID`),null)}function GE(r,e){return typeof e!="string"?-1:(r.textures||[]).findIndex(t=>t.id===e)}function UE(r,e,t,n,s){r[t]!==void 0&&e[t]!==void 0&&r[t]!==e[t]&&s(`${n} conflicting common material ${t}`);let i=e[t]!==void 0?e[t]:r[t]!==void 0?r[t]:!1;return typeof i=="boolean"?i:(s(`${n} common material ${t} must be boolean`),!1)}function zE(r,e){let t=pr(r.extras)?r.extras:r.extras===void 0?{}:{originalExtras:r.extras},n=pr(t.gltf1)?t.gltf1:t.gltf1===void 0?{}:{originalExtras:t.gltf1},s={technique:r.technique,values:r.values,...e===void 0?{}:{commonMaterial:e}},i=Object.keys(s).some(o=>Object.hasOwn(n,o));r.extras={...t,gltf1:{...n,...s,...i?{originalExtras:n}:{}}}}function HC(r,e,t){r.extensionsUsed=[...new Set([...r.extensionsUsed||[],e])],t&&(r.extensionsRequired=[...new Set([...r.extensionsRequired||[],e])])}function WE(r){let e=new Set,t=[r],n=new Set;for(;t.length;){let s=t.pop();if(!(!s||typeof s!="object"||n.has(s))){if(n.add(s),pr(s)&&pr(s.extensions))for(let i of Object.keys(s.extensions))e.add(i);for(let[i,o]of Object.entries(s))i!=="extras"&&t.push(o)}}return e}function ky(r){return Array.isArray(r)&&r.length===4&&r.every(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1)}function PE(r){return ky(r)&&r.slice(0,3).every(e=>e===0)}function pr(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}var qr,Ry,$E=p(()=>{"use strict";qr="KHR_materials_common",Ry="KHR_materials_unlit"});function qE(r,e={}){let t=new Cy;return t.normalize(r,e,!0),()=>t.finishNormalization(r)}var Ny,JC,Cy,KE=p(()=>{"use strict";cE();fE();hE();bE();pu();_E();vE();SE();LE();ME();RE();NE();$E();Ny={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",cameras:"camera",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},JC={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",camera:"cameras",inverseBindMatrices:"accessors",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Cy=class r{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;report={converted:!1,mutated:!1,unsupported:[],warnings:[]};strict=!1;log;finished=!1;pendingAccessors=new Set;accessorConversions=new Map;uriBufferIndices=new Set;normalize(e,t={},n=!1){if(t.mutate===!1){let o={...e,json:JSON.parse(JSON.stringify(e.json))},a=new r().normalize(o,{...t,mutate:!0});return a.mutated=!1,a}this.strict=t.normalize==="strict",this.log=t.log,this.json=e.json;let s=e.json;switch(s.asset&&s.asset.version){case"2.0":case"2.1":return this.report;case void 0:case"1.0":break;default:return this._warning(`Unknown glTF version ${s.asset.version}`),this.report}if(!t.normalize)throw new Error("glTF v1 is not supported.");this.report.converted=!0,this.report.mutated=!0,this.log?.log(1,"glTF: Converting glTF v1 to glTF v2 using experimental normalization.")(),this._addAsset(s),this._orderBinaryBufferPayloads(e),this._convertTopLevelObjectsToArrays(s),aE(e),this._convertObjectIdsToArrayIndices(s),this._updateObjects(s);for(let[o,a]of(s.buffers||[]).entries())typeof a.uri=="string"&&this.uriBufferIndices.add(o);let i=VE(s,o=>this._unsupported(o),o=>this._warning(o));return AE(s,(o,a)=>this._convertIdToIndex(o,a),o=>this._unsupported(o)),EE(s,o=>this._unsupported(o)),kE(s,o=>this._unsupported(o),o=>this._warning(o)),TE(s,o=>this._unsupported(o)),this.accessorConversions=yE(s),lE(s,o=>this.pendingAccessors.add(o)),dE(s,o=>this._convertIdToIndex(o,"node"),o=>this._unsupported(o)),this._updateNodes(s),IE(s,o=>this._unsupported(o),o=>this._warning(o)),this._preserveLegacyResources(s,i),this._removeEmptyCollections(s),n?this.report:this.finishNormalization(e)}finishNormalization(e){return this.report.converted&&!this.finished&&(DE(e,this.uriBufferIndices,t=>this._unsupported(t),t=>this._warning(t)),wE(e,this.accessorConversions,this.pendingAccessors,t=>this._unsupported(t),t=>this._warning(t)),pE(e,t=>this._unsupported(t)),OE(e,t=>this._unsupported(t),t=>this._warning(t)),this._finishReport(),this.log?.log(1,`glTF: Completed glTF v1 normalization (${this.report.unsupported.length} unsupported features).`)(),this.finished=!0),this.report}_unsupported(e){if(this.report.unsupported.push(e),this.log?.warn(`glTF v1 normalization does not support ${e}`)(),this.strict)throw new Error(`glTF v1 normalization does not support ${e}`)}_warning(e){this.report.warnings.push(e),this.log?.warn(`glTF: ${e}`)()}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_orderBinaryBufferPayloads(e){let t=this.json.buffers;if(!t||Array.isArray(t)||!t.binary_glTF)return;let s=Object.keys(t).indexOf("binary_glTF");s>0&&e.buffers?.length&&(e.buffers=[e.buffers[s],...e.buffers.filter((i,o)=>o!==s)])}_convertTopLevelObjectsToArrays(e){for(let t in Ny)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){let n=e[t];if(!n||Array.isArray(n))return;e[t]=[];let s=Object.keys(n),i=t==="buffers"&&s.includes("binary_glTF")?["binary_glTF",...s.filter(o=>o!=="binary_glTF")]:s;for(let o of i){let a=n[o];a.id=a.id||o;let c=e[t].length;e[t].push(a),this.idToIndexMap[t][o]=c}}_convertObjectIdsToArrayIndices(e){for(let t in Ny)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let t of e.textures)this._convertTextureIds(t);for(let t of e.meshes)this._convertMeshIds(t);for(let t of e.nodes)this._convertNodeIds(t);for(let t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let t of e.primitives){let{attributes:n,indices:s,material:i}=t,o=new Map;for(let a in n){let c=Dy(a),u=o.get(c);if(u!==void 0&&n[u]!==n[a])throw new Error(`glTF v1: conflicting attribute aliases ${u} and ${a}`);o.set(c,a)}t.attributes=Object.fromEntries(Object.entries(n).map(([a,c])=>[Dy(a),this._convertIdToIndex(c,"accessor")])),s&&(t.indices=this._convertIdToIndex(s,"accessor")),i&&(t.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(t=>this._convertIdToIndex(t,"node"))),e.meshes&&(e.meshes=e.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(e,t){e[t]||(e[t]=[]);for(let n of e[t])for(let s in n){let i=n[s],o=this._convertIdToIndex(i,s);n[s]=o}}_convertIdToIndex(e,t){let n=JC[t];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][e];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return s}return e}_updateObjects(e){for(let t of this.json.buffers)delete t.type}_updateNodes(e){let t=e.nodes||[];for(let n=0;n<t.length;n++){let s=t[n];if(!Array.isArray(s.meshes))continue;let i=s.meshes;delete s.meshes,s.mesh=i.shift();for(let o of i){let a={...s,mesh:o,children:void 0};delete a.id,delete a.matrix,delete a.translation,delete a.rotation,delete a.scale,t.push(a),s.children||=[],s.children.push(t.length-1)}}}_preserveLegacyResources(e,t){let n=jE(e,t),s={};for(let i of["techniques","programs","shaders"])e[i]&&(s[i]=e[i],delete e[i],n||this._unsupported(`legacy ${i}`));Object.keys(s).length&&(e.extras={...e.extras,gltf1Resources:s},n&&this._warning("Preserved shader resources overridden by converted common materials."))}_removeEmptyCollections(e){for(let t of e.nodes||[])Array.isArray(t.children)&&t.children.length===0&&delete t.children;for(let t of e.scenes||[])Array.isArray(t.nodes)&&t.nodes.length===0&&delete t.nodes;for(let t of[...Object.keys(Ny),"extensionsUsed","extensionsRequired"])Array.isArray(e[t])&&e[t].length===0&&delete e[t]}_finishReport(){this.report.unsupported.length&&this.report.warnings.push(`Converted glTF v1 with unsupported features: ${this.report.unsupported.join(", ")}`)}}});function YC(r,e){let t=r.basis;return{...r,core:{...r.core,mimeType:e},basis:{...t,format:t?.format||"auto"}}}async function XE(r,e,t=0,n,s){return await HE(r,e,t,n,s)}async function HE(r,e,t,n,s,i){QC(r,e,t,n);let o=qE(r,{normalize:n?.gltf?.normalize,log:n?.core?.log});return await nE(r,n,s),n?.gltf?.loadBuffers&&r.json.buffers&&await a3(r,n,s,n.gltf.loadBufferIndices),o(),n?.gltf?.loadFiles&&r.json.files&&await o3(r,n,s),n?.gltf?.loadExternalAssets&&r.json.externalAssets&&await e3(r,n,s,i),n?.gltf?.loadImages&&await c3(r,n,s),await sE(r,n,s),r}function QC(r,e,t,n){if(n.core?.baseUrl&&(r.baseUri=n.core?.baseUrl),e instanceof ArrayBuffer&&!PI(e,t,n.glb)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=sb(e);else if(e instanceof ArrayBuffer){let l={};t=ad(l,e,t,n.glb),H(l.type==="glTF",`Invalid GLB magic string ${l.type}`),r._glb=l,r.json=l.json}else e&&typeof e=="object"?r.json=e:H(!1,"GLTF: must be ArrayBuffer, string, or parsed JSON object");let s=r.json.buffers||[],i=Array.isArray(s)?s:[],o=Array.isArray(s)?[]:Object.keys(s);if(r.buffers=new Array(Array.isArray(s)?s.length:o.length).fill(null),r._glb){let{binChunks:l}=r._glb;for(let g=0;g<i.length;g++){let y=i[g];if(y.chunk===void 0)continue;H(r._glb.version===3,"glTF buffer.chunk requires a GLB v3 container."),H(y.uri===void 0,`glTF buffer ${g} cannot define both uri and chunk.`);let x=l.find(T=>T.chunkIndex===y.chunk);H(x,`glTF buffer ${g} references missing GLB BIN chunk ${y.chunk}.`),H(y.byteLength<=x.byteLength,`glTF buffer ${g} is larger than GLB BIN chunk ${y.chunk}.`),r.buffers[g]={arrayBuffer:x.arrayBuffer,byteOffset:x.byteOffset,byteLength:y.byteLength}}let f=i.map((g,y)=>g.uri===void 0?y:-1).filter(g=>g!==-1),d=l.find(g=>g.chunkIndex===1),h=r._glb.version<3||r._glb.jsonChunkIndex===0&&i[0]?.chunk===void 0&&f.length===1&&f[0]===0&&!!d,m=r._glb.version<3?l[0]:d,b=r._glb.version===1&&!Array.isArray(s)?o.indexOf("binary_glTF"):0;if(h&&m&&b>=0&&(r.buffers[b]={arrayBuffer:m.arrayBuffer,byteOffset:m.byteOffset,byteLength:m.byteLength}),r._glb.version===3)for(let g of f)H(r.buffers[g],`glTF buffer ${g} without a uri must define a valid GLB v3 chunk.`)}if(!r._glb){let l=i.findIndex(f=>f.chunk!==void 0);H(l===-1,`glTF buffer ${l} uses chunk outside a GLB.`)}let a=r.json.images||[];r.images=new Array(a.length).fill({});let c=r.json.files||[];r.files=new Array(c.length).fill(null);let u=r.json.externalAssets||[];r.externalAssets=new Array(u.length).fill(null)}async function e3(r,e,t,n){let s=r.json.externalAssets||[],i=new Set;for(let a of r.json.nodes||[])a.externalAsset!==void 0&&(H(a.externalAsset>=0&&a.externalAsset<s.length,`glTF node references missing external asset ${a.externalAsset}.`),i.add(a.externalAsset));let o=n||r3(t.url?new Set([cd(t.url)]):new Set);for(let a of i)await t3(r,a,e,t,o)}async function t3(r,e,t,n,s){let i=r.json.externalAssets?.[e];if(!i)throw new Error(`Missing glTF external asset ${e}.`);H(Number.isInteger(i.file)&&i.file>=0&&i.file<(r.json.files?.length||0),`glTF external asset ${e} references missing file ${i.file}.`);let o=await fd(r,i.file,t,n),a=o.url;H(!a||!s.ancestors.has(a),`glTF external asset cycle detected at ${a}.`);let c=a?s.cache.get(a):void 0;if(!c){let u=n3(r,o,t,n,s),l={...s,ancestors:new Set(s.ancestors)};a&&l.ancestors.add(a);let f=eo(o.arrayBuffer,o.byteOffset,o.byteLength);c=HE({},f,0,t,u,l),a&&s.cache.set(a,c)}r.externalAssets=r.externalAssets||[],r.externalAssets[e]=await c}function r3(r){return{cache:new Map,ancestors:r,packageIds:{next:0}}}function n3(r,e,t,n,s){if(e.url&&!e.url.startsWith("data:"))return{...n,url:e.url,filename:i3(e.url),baseUrl:s3(e.url)};let i=`${ZC}${s.packageIds.next++}`,o=`${i}/`;return{...n,url:e.name,filename:e.name,baseUrl:i,fetch:async(a,c)=>{let u=a;if(u.startsWith("data:"))return await n.fetch(a,c);let l=u.startsWith(o)?u.slice(o.length):u,f=wg(r,l);H(f>=0,`glTF package does not contain file ${l}.`);let d=await fd(r,f,t,n),h=eo(d.arrayBuffer,d.byteOffset,d.byteLength);return new Response(h,{headers:{"content-type":d.mimeType}})}}}function s3(r){let e=r.lastIndexOf("/");return e>=0?r.slice(0,e):""}function i3(r){let e=r.lastIndexOf("/");return e>=0?r.slice(e+1):r}async function o3(r,e,t){let n=r.json.files||[];await Promise.all(n.map((s,i)=>fd(r,i,e,t)))}async function a3(r,e,t,n){let s=r.json.buffers||[],i=n?new Set(typeof n=="function"?n(r.json):n):void 0;for(let o=0;o<s.length;++o){if(i&&!i.has(o))continue;let a=s[o];if(a.uri){let{fetch:c}=t;H(c);let u=Kn(a.uri,e,t),f=await(await t?.fetch?.(u))?.arrayBuffer?.();r.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete a.uri}else r.buffers[o]===null&&(r.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function c3(r,e,t){let n=u3(r),s=r.json.images||[],i=[];for(let o of n)i.push(l3(r,s[o],o,e,t));return await Promise.all(i)}function u3(r){let e=new Set;r.json.asset.thumbnail!==void 0&&e.add(r.json.asset.thumbnail);let t=r.json.textures||[];for(let n of t)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function l3(r,e,t,n,s){let i;if(e.uri&&!e.hasOwnProperty("bufferView")){let l=Kn(e.uri,n,s),{fetch:f}=s;i=await(await f(l)).arrayBuffer(),e.bufferView={data:i}}if(Number.isFinite(e.bufferView)){let l=hr(r.json,r.buffers,e.bufferView);i=eo(l.buffer,l.byteOffset,l.byteLength)}H(i,"glTF image has no data");let o=YC(n,e.mimeType),a=iu(s);if(!!(a&&!n.gltf?.excludeExtensions?.includes("MSFT_texture_dds")&&r.json.textures?.some(l=>l.source===t&&l.extensions?.MSFT_texture_dds?.source===t))){let l=await Xs(i,a,n,s);H(l.length>0,"MSFT_texture_dds parser returned no texture levels"),r.images=r.images||[],r.images[t]={compressed:!0,mipmaps:!0,width:l[0].width,height:l[0].height,data:l};return}let u=await Xs(i,[Hc,io],o,s);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),r.images=r.images||[],r.images[t]=u}var ZC,JE=p(()=>{"use strict";Ue();qn();qn();oo();bg();Yc();WI();ao();oE();oy();KE();ZC="gltf-package://"});async function YE(r,e={},t){let n={...Uy.options,...e};n.gltf={...Uy.options.gltf,...n.gltf};let s=e?.glb?.byteOffset||0;return await XE({},r,s,n,t)}var Rre,f3,Uy,QE=p(()=>{"use strict";JE();eL();({preload:Rre,...f3}=ZE),Uy={...f3,parse:YE}});var Py={};J(Py,{GLTFLoaderWithParser:()=>Uy,parse:()=>YE});var Vy=p(()=>{"use strict";QE()});async function d3(){let{GLTFLoaderWithParser:r}=await Promise.resolve().then(()=>(Vy(),Py));return r}var ZE,eL=p(()=>{"use strict";Zb();eg();ZE={dataType:null,batchType:null,...Uv,version:Yf,preload:d3,options:{gltf:{normalize:!0,loadBuffers:!0,loadFiles:!1,loadExternalAssets:!1,loadImages:!0,loadAudio:!0,decompressMeshes:!0}}}});async function m3(r,e){return tL(r,e)}function tL(r,e){let t={};return ad(t,r,e?.glb?.byteOffset||0,e?.glb),t}var Gre,h3,p3,rL=p(()=>{"use strict";bg();sL();({preload:Gre,...h3}=nL),p3={...h3,parse:m3,parseSync:tL}});var jy={};J(jy,{GLBLoaderWithParser:()=>p3});var Gy=p(()=>{"use strict";rL()});async function b3(){let{GLBLoaderWithParser:r}=await Promise.resolve().then(()=>(Gy(),jy));return r}var nL,sL=p(()=>{"use strict";Zb();eg();nL={dataType:null,batchType:null,...Pv,version:Yf,preload:b3,options:{glb:{strict:!1}}}});function g3(r){return typeof r=="string"?r.charAt(0).toLowerCase()+r.slice(1):r}function Ld(r){if(Array.isArray(r))return r.map(e=>Ld(e));if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))Object.defineProperty(e,g3(t),{value:Ld(n),enumerable:!0,configurable:!0,writable:!0});return e}return r}var iL=p(()=>{"use strict"});var oL,y3,w3,x3,bu,zy,T3,_3,gu,Wy,Sa,aL=p(()=>{"use strict";oL={ontext:()=>{},onprocessinginstruction:()=>{},onsgmldeclaration:()=>{},ondoctype:()=>{},oncomment:()=>{},onopentagstart:()=>{},onattribute:()=>{},onopentag:()=>{},onclosetag:()=>{},onopencdata:()=>{},oncdata:()=>{},onclosecdata:()=>{},onerror:()=>{},onend:()=>{},onready:()=>{},onscript:()=>{},onopennamespace:()=>{},onclosenamespace:()=>{}},y3={...oL,strict:!1,MAX_BUFFER_LENGTH:64*1024,lowercase:!1,lowercasetags:!1,noscript:!1,strictEntities:!1,preserveCase:!1,caseInsensitiveTags:!1,processEntities:!0,xmlns:void 0,position:void 0,trim:void 0,normalize:void 0},w3=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],x3=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"],bu=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,zy=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,T3=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_3=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,gu={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};Object.keys(gu).forEach(r=>{let e=gu[r];gu[r]=typeof e=="number"?String.fromCharCode(e):e});Wy=class r{EVENTS=w3;ENTITIES={...gu};XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"};S=0;opt;trackPosition=!1;column=0;line=0;c="";error;q="";bufferCheckPosition;closed=!1;tags=[];looseCase="";closedRoot=!1;sawRoot=!1;strict=!1;tag;strictEntities;state;noscript=!1;attribList=[];ns;position=0;STATE={BEGIN:this.S++,BEGIN_WHITESPACE:this.S++,TEXT:this.S++,TEXT_ENTITY:this.S++,OPEN_WAKA:this.S++,SGML_DECL:this.S++,SGML_DECL_QUOTED:this.S++,DOCTYPE:this.S++,DOCTYPE_QUOTED:this.S++,DOCTYPE_DTD:this.S++,DOCTYPE_DTD_QUOTED:this.S++,COMMENT_STARTING:this.S++,COMMENT:this.S++,COMMENT_ENDING:this.S++,COMMENT_ENDED:this.S++,CDATA:this.S++,CDATA_ENDING:this.S++,CDATA_ENDING_2:this.S++,PROC_INST:this.S++,PROC_INST_BODY:this.S++,PROC_INST_ENDING:this.S++,OPEN_TAG:this.S++,OPEN_TAG_SLASH:this.S++,ATTRIB:this.S++,ATTRIB_NAME:this.S++,ATTRIB_NAME_SAW_WHITE:this.S++,ATTRIB_VALUE:this.S++,ATTRIB_VALUE_QUOTED:this.S++,ATTRIB_VALUE_CLOSED:this.S++,ATTRIB_VALUE_UNQUOTED:this.S++,ATTRIB_VALUE_ENTITY_Q:this.S++,ATTRIB_VALUE_ENTITY_U:this.S++,CLOSE_TAG:this.S++,CLOSE_TAG_SAW_WHITE:this.S++,SCRIPT:this.S++,SCRIPT_ENDING:this.S++};BUFFERS=x3;CDATA="[CDATA[";DOCTYPE="DOCTYPE";XML_NAMESPACE="http://www.w3.org/XML/1998/namespace";XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/";rootNS={xml:this.XML_NAMESPACE,xmlns:this.XMLNS_NAMESPACE};comment;sgmlDecl;textNode="";tagName;doctype;procInstName;procInstBody;entity="";attribName;attribValue;cdata="";script="";startTagPosition=0;constructor(){this.S=0;for(let e in this.STATE)this.STATE.hasOwnProperty(e)&&(this.STATE[this.STATE[e]]=e);this.S=this.STATE}static charAt(e,t){let n="";return t<e.length&&(n=e.charAt(t)),n}static isWhitespace(e){return e===" "||e===`
42
+ `),n="",s="",i=0,o=[],a=typeof"".trimLeft=="function";for(let l=0,f=t.length;l<f;l++)if(n=t[l],n=a?n.trimLeft():n.trim(),i=n.length,i!==0&&(s=n.charAt(0),s!=="#"))if(s==="v"){let d=n.split(/\s+/);switch(d[0]){case"v":e.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),d.length>=7&&e.colors.push(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6]));break;case"vn":e.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":e.uvs.push(parseFloat(d[1]),parseFloat(d[2]));break;default:}}else if(s==="f"){let h=n.substr(1).trim().split(/\s+/),m=[];for(let g=0,y=h.length;g<y;g++){let x=h[g];if(x.length>0){let T=x.split("/");m.push(T)}}let b=m[0];for(let g=1,y=m.length-1;g<y;g++){let x=m[g],T=m[g+1];e.addFace(b[0],x[0],T[0],b[1],x[1],T[1],b[2],x[2],T[2])}}else if(s==="l"){let d=n.substring(1).trim().split(" "),h,m=[];if(n.indexOf("/")===-1)h=d;else{h=[];for(let b=0,g=d.length;b<g;b++){let y=d[b].split("/");y[0]!==""&&h.push(y[0]),y[1]!==""&&m.push(y[1])}}e.addLineGeometry(h,m)}else if(s==="p"){let h=n.substr(1).trim().split(" ");e.addPointGeometry(h)}else if(SI.test(n)){o=SI.exec(n)||[];let d=(" "+o[0].substr(1).trim()).substr(1);e.startObject(d)}else if(wR.test(n))e.object.startMaterial(n.substring(7).trim(),e.materialLibraries);else if(yR.test(n))e.materialLibraries.push(n.substring(7).trim());else if(s==="s"){if(o=n.split(" "),o.length>1){let h=o[1].trim().toLowerCase();e.object.smooth=h!=="0"&&h!=="off"}else e.object.smooth=!0;let d=e.object.currentMaterial();d&&(d.smooth=e.object.smooth)}else{if(n==="\0")continue;throw new Error(`Unexpected line: "${n}"`)}e.finalize();let c=[],u=[];for(let l of e.objects){let{geometry:f}=l;if(f.vertices.length===0)continue;let d={header:{vertexCount:f.vertices.length/3},attributes:{}};switch(f.type){case"Points":d.mode=0;break;case"Line":d.mode=1;break;default:d.mode=4;break}d.attributes.POSITION={value:new Float32Array(f.vertices),size:3},f.normals.length>0&&(d.attributes.NORMAL={value:new Float32Array(f.normals),size:3}),f.colors.length>0&&(d.attributes.COLOR_0={value:new Float32Array(f.colors),size:3}),f.uvs.length>0&&(d.attributes.TEXCOORD_0={value:new Float32Array(f.uvs),size:2}),d.materials=[];for(let h of l.materials){let m={name:h.name,flatShading:!h.smooth};d.materials.push(m),u.push(m)}d.name=l.name,c.push(d)}return{meshes:c,materials:u}}var SI,yR,wR,Dg,Rg,kg,LI=p(()=>{"use strict";SI=/^[og]\s*(.+)?/,yR=/^mtllib /,wR=/^usemtl /,Dg=class r{constructor({index:e,name:t="",mtllib:n,smooth:s,groupStart:i}){this.index=e,this.name=t,this.mtllib=n,this.smooth=s,this.groupStart=i,this.groupEnd=-1,this.groupCount=-1,this.inherited=!1}clone(e=this.index){return new r({index:e,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0})}},Rg=class{constructor(e=""){this.name=e,this.geometry={vertices:[],normals:[],colors:[],uvs:[]},this.materials=[],this.smooth=!0,this.fromDeclaration=null}startMaterial(e,t){let n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);let s=new Dg({index:this.materials.length,name:e,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:n!==void 0?n.smooth:this.smooth,groupStart:n!==void 0?n.groupEnd:0});return this.materials.push(s),s}currentMaterial(){if(this.materials.length>0)return this.materials[this.materials.length-1]}_finalize(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let n=this.materials.length-1;n>=0;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),t}},kg=class{constructor(){this.objects=[],this.object=null,this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materialLibraries=[],this.startObject("",!1)}startObject(e,t=!0){if(this.object&&!this.object.fromDeclaration){this.object.name=e,this.object.fromDeclaration=t;return}let n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object=new Rg(e),this.object.fromDeclaration=t,n&&n.name&&typeof n.clone=="function"){let s=n.clone(0);s.inherited=!0,this.object.materials.push(s)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e);return(n>=0?n-1:n+t/2)*2}addVertex(e,t,n){let s=this.vertices,i=this.object.geometry.vertices;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])}addVertexPoint(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])}addVertexLine(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])}addNormal(e,t,n){let s=this.normals,i=this.object.geometry.normals;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])}addColor(e,t,n){let s=this.colors,i=this.object.geometry.colors;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])}addUV(e,t,n){let s=this.uvs,i=this.object.geometry.uvs;i.push(s[e+0],s[e+1]),i.push(s[t+0],s[t+1]),i.push(s[n+0],s[n+1])}addUVLine(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])}addFace(e,t,n,s,i,o,a,c,u){let l=this.vertices.length,f=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),h=this.parseVertexIndex(n,l);if(this.addVertex(f,d,h),s!==void 0&&s!==""){let m=this.uvs.length;f=this.parseUVIndex(s,m),d=this.parseUVIndex(i,m),h=this.parseUVIndex(o,m),this.addUV(f,d,h)}if(a!==void 0&&a!==""){let m=this.normals.length;f=this.parseNormalIndex(a,m),d=a===c?f:this.parseNormalIndex(c,m),h=a===u?f:this.parseNormalIndex(u,m),this.addNormal(f,d,h)}this.colors.length>0&&this.addColor(f,d,h)}addPointGeometry(e){this.object.geometry.type="Points";let t=this.vertices.length;for(let n of e)this.addVertexPoint(this.parseVertexIndex(n,t))}addLineGeometry(e,t){this.object.geometry.type="Line";let n=this.vertices.length,s=this.uvs.length;for(let i of e)this.addVertexLine(this.parseVertexIndex(i,n));for(let i of t)this.addUVLine(this.parseUVIndex(i,s))}}});function Td(r,e){let{meshes:t}=EI(r),n=t.reduce((a,c)=>a+c.header.vertexCount,0),s=xR(t,n),i={vertexCount:n,boundingBox:Lr(s)??void 0},o=xd(s,{mode:4,boundingBox:i.boundingBox});return{loaderData:{header:{}},schema:o,header:i,mode:4,topology:"point-list",attributes:s}}function xR(r,e){let t=new Float32Array(e*3),n,s,i,o=0;for(let c of r){let{POSITION:u,NORMAL:l,COLOR_0:f,TEXCOORD_0:d}=c.attributes;t.set(u.value,o*3),l&&(n=n||new Float32Array(e*3),n.set(l.value,o*3)),f&&(s=s||new Float32Array(e*3),s.set(f.value,o*3)),d&&(i=i||new Float32Array(e*2),i.set(d.value,o*2)),o+=u.value.length/3}let a={};return a.POSITION={value:t,size:3},n&&(a.NORMAL={value:n,size:3}),s&&(a.COLOR_0={value:s,size:3}),i&&(a.TEXCOORD_0={value:i,size:2}),a}var BI=p(()=>{"use strict";gn();LI();Mg()});function FI(r,e){let t=ii(r,"arrow-table");return e?.obj?.shape==="mesh"?bn(t):t}function AR(r){let e=r?.batchSize??r?.core?.batchSize;return typeof e=="number"?e:void 0}function vR(r){return r.split(/\r?\n/).some(e=>{let t=e.trimStart();return t.startsWith("f ")||t.startsWith("l ")})}function*IR(r,e,t){let n=r.split(/\r?\n/).filter(s=>s.trimStart().startsWith("v "));yield*ER(n,e,t)}async function*SR(r,e,t){let n=t||1e3,s=[];for await(let i of r)i.trimStart().startsWith("v ")&&(s.push(i),s.length>=n&&(yield _d(Ng(s),e),s=[]));s.length>0&&(yield _d(Ng(s),e))}function*ER(r,e,t){let n=t||r.length||1;for(let s=0;s<r.length;s+=n){let i=Ng(r.slice(s,s+n));yield _d(i,e)}}function Ng(r){let e=new Float32Array(r.length*3);for(let s=0;s<r.length;s++){let i=r[s].trim().split(/\s+/);e[s*3+0]=Number(i[1]),e[s*3+1]=Number(i[2]),e[s*3+2]=Number(i[3])}let t={POSITION:{value:e,size:3}},n=Lr(t);return{loaderData:{header:{}},schema:xd(t,{mode:0,boundingBox:n??void 0}),header:{vertexCount:r.length,boundingBox:n??void 0},mode:0,topology:"point-list",attributes:t}}function _d(r,e){let t=ii(r,"arrow-table");if(e?.obj?.shape==="mesh"){let n=bn(t);return{shape:"mesh",batchType:"data",data:n,length:n.header?.vertexCount||0}}return ng(t)}function LR(r,e){let t=qm(r);return e?.obj?.shape==="mesh"?bn(t):t}function BR(r,e){let t=qm(r);return e?.obj?.shape!=="mesh"?t:{shape:"mesh",batchType:"data",data:bn(t),length:t.length}}var tee,TR,_R,OI=p(()=>{"use strict";Be();oa();gn();Mg();BI();DI();({preload:tee,...TR}=MI);_R={...TR,parse:async(r,e)=>FI(Td(new TextDecoder().decode(r),e),e),parseTextSync:(r,e)=>FI(Td(r,e),e),parseInBatches:async function*(r,e){let t=AR(e);if(e?.obj?.pointCloud){let i=Zb(r),o=eg(i);yield*SR(o,e,t);return}let n=await tg(r),s=new TextDecoder().decode(n);if(vR(s)){yield _d(Td(s,e),e);return}yield*IR(s,e,t)},serializeWorkerResult:eo,deserializeWorkerResult:LR,serializeWorkerBatch:eo,deserializeWorkerBatch:BR}});var Cg={};J(Cg,{OBJLoaderWithParser:()=>_R});var Ug=p(()=>{"use strict";OI()});async function OR(){let{OBJLoaderWithParser:r}=await Promise.resolve().then(()=>(Ug(),Cg));return r}function MR(r){return r[0]==="v"}var FR,MI,DI=p(()=>{"use strict";eT();oa();FR="5.0.0-beta.8";MI={...Zx,dataType:null,batchType:null,version:FR,worker:!0,workerInBatches:!0,serializeWorkerResult:eo,text:!0,testText:MR,options:{obj:{shape:"arrow-table"}},preload:OR}});var RI,kI=p(()=>{"use strict";RI={name:"MTL",id:"mtl",module:"mtl",encoding:"text",format:"mtl",extensions:["mtl"],mimeTypes:["text/plain"]}});function Pg(r,e){let t=[],n={name:"placeholder"},s=r.split(`
43
+ `);for(let i of s){if(i=i.trim(),i.length===0||i.charAt(0)==="#")continue;let o=i.indexOf(" "),a=o>=0?i.substring(0,o):i;a=a.toLowerCase();let c=o>=0?i.substring(o+1):"";switch(c=c.trim(),a){case"newmtl":n={name:c},t.push(n);break;case"ka":n.ambientColor=Ad(c);break;case"kd":n.diffuseColor=Ad(c);break;case"map_kd":n.diffuseTextureUrl=c;break;case"ks":n.specularColor=Ad(c);break;case"map_ks":n.specularTextureUrl=c;break;case"ke":n.emissiveColor=Ad(c);break;case"map_ke":n.emissiveTextureUrl=c;break;case"ns":n.shininess=parseFloat(c);break;case"map_ns":break;case"ni":n.refraction=parseFloat(c);break;case"illum":n.illumination=parseFloat(c);break;default:break}}return t}function Ad(r,e){let t=r.split(DR,3);return[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}var DR,NI=p(()=>{"use strict";DR=/\s+/});var dee,RR,hee,kR,NR,CR,CI=p(()=>{"use strict";NI();Vg();Vg();({preload:dee,...RR}=vd),{preload:hee,...kR}=vd,NR={...RR},CR={...kR,parse:async(r,e)=>Pg(new TextDecoder().decode(r),e?.mtl),parseTextSync:(r,e)=>Pg(r,e?.mtl)}});var jg={};J(jg,{MTLLoaderWithParser:()=>CR,MTLWorkerLoaderWithParser:()=>NR});var Gg=p(()=>{"use strict";CI()});async function PR(){let{MTLLoaderWithParser:r}=await Promise.resolve().then(()=>(Gg(),jg));return r}var UR,vd,Vg=p(()=>{"use strict";kI();UR="5.0.0-beta.8";vd={...RI,dataType:null,batchType:null,version:UR,worker:!0,text:!0,testText:r=>r.includes("newmtl"),options:{mtl:{}},preload:PR}});var Id,zg=p(()=>{"use strict";Id="5.0.0-beta.8"});var UI,PI,Wg=p(()=>{"use strict";UI={name:"glTF",id:"gltf",module:"scene",encoding:"binary",format:"gltf",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"]},PI={name:"GLB",id:"glb",module:"scene",encoding:"binary",format:"glb",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,tests:["glTF"]}});function VI(r){return!zR(r,"ftyp",4)||(r[8]&96)===0?null:VR(r)}function VR(r){switch(jR(r,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function jR(r,e,t){return String.fromCharCode(...r.slice(e,t))}function GR(r){return[...r].map(e=>e.charCodeAt(0))}function zR(r,e,t=0){let n=GR(e);for(let s=0;s<n.length;++s)if(n[s]!==r[s+t])return!1;return!0}var jI=p(()=>{"use strict"});function Hn(r){let e=fu(r);return $R(e)||HR(e)||qR(e)||KR(e)||WR(e)}function WR(r){let e=new Uint8Array(r instanceof DataView?r.buffer:r),t=VI(e);return t?{mimeType:t.mimeType,width:0,height:0}:null}function $R(r){let e=fu(r);return e.byteLength>=33&&e.getUint32(0,dr)===2303741511&&e.getUint32(4,dr)===218765834&&e.getUint32(8,dr)===13&&e.getUint32(12,dr)===1229472850?{mimeType:"image/png",width:e.getUint32(16,dr),height:e.getUint32(20,dr)}:null}function qR(r){let e=fu(r);return e.byteLength>=10&&e.getUint32(0,dr)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,lu),height:e.getUint16(8,lu)}:null}function KR(r){let e=fu(r);return e.byteLength>=14&&e.getUint16(0,dr)===16973&&e.getUint32(2,lu)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,lu),height:e.getUint32(22,lu)}:null}function HR(r){let e=fu(r);if(!(e.byteLength>=3&&e.getUint16(0,dr)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=XR(),i=2;for(;i+9<e.byteLength;){let o=e.getUint16(i,dr);if(s.has(o))return{mimeType:"image/jpeg",height:e.getUint16(i+5,dr),width:e.getUint16(i+7,dr)};if(!n.has(o))return null;i+=2,i+=e.getUint16(i,dr)}return null}function XR(){let r=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)r.add(t);return{tableMarkers:r,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function fu(r){if(r instanceof DataView)return r;if(ArrayBuffer.isView(r))return new DataView(r.buffer);if(r instanceof ArrayBuffer)return new DataView(r);throw new Error("toDataView")}var dr,lu,Sd=p(()=>{"use strict";jI();dr=!1,lu=!0});var JR,YR,QR,GI,zI=p(()=>{"use strict";Sd();JR=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],YR=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],QR={id:"image",module:"images",name:"Images",encoding:"image",format:"image",mimeTypes:YR,extensions:JR,tests:[r=>!!Hn(new DataView(r))]},GI={...QR,id:"imagebitmap",name:"ImageBitmap",format:"image-bitmap"}});var Ed,$g=p(()=>{"use strict";Ed="5.0.0-beta.8"});function Ta(r){if(!r)return!1;if(ZR.test(r))return!0;for(let e=r.indexOf(".svg");e>=0;e=r.indexOf(".svg",e+4)){let t=r[e+4];if(t===void 0||t==="?"||t==="#")return!0}return!1}function WI(r,e){if(Ta(e)){let n=new TextDecoder().decode(r);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return qg(r,e)}function qg(r,e){if(Ta(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(r)])}var ZR,Ld=p(()=>{"use strict";ZR=/^data:image\/svg\+xml/});async function $I(r,e,t){let n=WI(r,t),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await ek(i||n,e)}finally{i&&s.revokeObjectURL(i)}}async function ek(r,e){let t=new Image;return t.src=r,e?.image?.decode&&t.decode?(await t.decode(),t):await new Promise((n,s)=>{try{t.onload=()=>n(t),t.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var qI=p(()=>{"use strict";Ld()});async function HI(r,e,t){let n;Ta(t)?n=await $I(r,e,t):n=qg(r,t);let s=e&&e.imagebitmap;return await JI(n,s,Kr(e))}async function XI(r,e){let t=e&&e.imagebitmap;return await JI(r,t,Kr(e))}async function JI(r,e=null,t=Kr()){if((tk(e)||!KI)&&(e=null),e)try{return await createImageBitmap(r,e)}catch(n){t.warn(String(n))(),KI=!1}return await createImageBitmap(r)}function tk(r){if(!r)return!0;for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}var KI,YI=p(()=>{"use strict";Be();Ld();qI();KI=!0});async function QI(r,e){let{mimeType:t}=Hn(r)||{},n=globalThis.loaders?.parseImageNode;fr(n);let s=globalThis.loaders?.createImageBitmapNode;if(!s)throw new Error("Install '@loaders.gl/core/polyfills' to parse images under Node.js");let i=await n(r,t);return s(i)}var ZI=p(()=>{"use strict";Be();Sd()});async function Kg(r,e,t){e=e||{},rS(e);let n=!!globalThis.loaders?.parseImageNode;if(!Wn||n)return await QI(r,e);if(typeof ImageBitmap>"u"||typeof createImageBitmap!="function")throw new Error(eS);return await HI(r,e,t?.url)}async function tS(r,e,t){e=e||{},rS(e);let n=!!globalThis.loaders?.parseImageNode;if(!Wn||n||Ta(t?.url)||r.type.startsWith("image/svg+xml"))return await Kg(await r.arrayBuffer(),e,t);if(typeof ImageBitmap>"u"||typeof createImageBitmap!="function")throw new Error(eS);return await XI(r,e)}function rS(r){let e=r.image?.type;if(e&&e!=="imagebitmap")throw new Error(rk)}var rk,eS,nS=p(()=>{"use strict";Be();YI();Ld();ZI();rk="@loaders.gl/images: ImageLoader only accepts options.image.type='imagebitmap'. Remove legacy image/data/auto values and call getImageData(image) if you need raw pixels.",eS="@loaders.gl/images: ImageLoader requires browser ImageBitmap support. Use a browser with createImageBitmap support or load images under Node.js with @loaders.gl/core/polyfills."});var sS={};J(sS,{ImageLoaderWithParser:()=>sk});var zee,nk,sk,iS=p(()=>{"use strict";nS();Hg();({preload:zee,...nk}=du),sk={...nk,parse:Kg,parseBlob:tS}});async function ok(){let{ImageLoaderWithParser:r}=await Promise.resolve().then(()=>(iS(),sS));return r}var ik,du,Hg=p(()=>{"use strict";$g();zI();ik={image:{}};du={dataType:null,batchType:null,...GI,version:Ed,options:ik,preload:ok}});function aS(r){let e=lk(r);if(!e)throw new Error("Not an image");return e}function hu(r){switch(aS(r)){case"data":return r;case"imagebitmap":return ak(r)?ck(r):oS(r);case"image":return oS(r);default:throw new Error("getImageData")}}function ak(r){let e=globalThis.loaders?.isImageBitmapNode;return!!e?.(r)}function ck(r){let e=globalThis.loaders?.getImageBitmapDataNode;if(!e)throw new Error("getImageData");return e(r)}function oS(r){let e=uk(r.width,r.height),t=e.getContext("2d");if(!t)throw new Error("getImageData");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height)}function uk(r,e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(r,e);if(typeof document<"u"){let t=document.createElement("canvas");return t.width=r,t.height=e,t}throw new Error("getImageData")}function lk(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&r instanceof Image?"image":r&&typeof r=="object"&&r.data&&r.width&&r.height?"data":null}var cS=p(()=>{"use strict"});async function Jg(){return Bd?await Bd:(Bd=dk(),await Bd)}async function dk(){let r=new Set;for(let e of fk)(Wn?await mk(e):uS(e))&&r.add(e);return r}function Yg(r){if(Xg[r]===void 0){let e=Wn?hk(r):uS(r);Xg[r]=e}return Xg[r]}function uS(r){let e=["image/png","image/jpeg","image/gif"],t=globalThis.loaders?.imageFormatsNode||e;return!!globalThis.loaders?.parseImageNode&&t.includes(r)}function hk(r){switch(r){case"image/avif":case"image/webp":return bk(r);default:return!0}}async function mk(r){let e=pk[r];return e?await gk(e):!0}function bk(r){try{return document.createElement("canvas").toDataURL(r).indexOf(`data:${r}`)===0}catch{return!1}}async function gk(r){return new Promise(e=>{let t=new Image;t.src=r,t.onload=()=>e(t.height>0),t.onerror=()=>e(!1)})}var fk,Bd,Xg,pk,Qg=p(()=>{"use strict";Be();fk=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/tiff","image/svg","image/svg+xml","image/bmp","image/vnd.microsoft.icon"],Bd=null;Xg={};pk={"image/avif":"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=","image/webp":"data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}});var lS,fS=p(()=>{"use strict";lS={name:"Basis",id:"basis",module:"images",encoding:"image",format:"basis",extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],binary:!0,tests:["sB"]}});function hS(r){if(!Fd){r=r||wk()||void 0,Fd=new Set;for(let e of yk)for(let t in dS)if(r&&r.getExtension(`${e}${t}`))for(let n of dS[t])Fd.add(n)}return Fd}function wk(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var yk,dS,Fd,pS=p(()=>{"use strict";yk=["","WEBKIT_","MOZ_"],dS={WEBGL_compressed_texture_s3tc:["bc1-rgb-unorm-webgl","bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"],WEBGL_compressed_texture_s3tc_srgb:["bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"],EXT_texture_compression_rgtc:["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"],EXT_texture_compression_bptc:["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"],WEBGL_compressed_texture_etc1:["etc1-rgb-unorm-webgl"],WEBGL_compressed_texture_etc:["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"],WEBGL_compressed_texture_pvrtc:["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"],WEBGL_compressed_texture_atc:["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"],WEBGL_compressed_texture_astc:["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]},Fd=null});function bS(r=hS(),e,t={}){let n=new Set(r);if(!e)return Tk(n);if(e.isHDR){let s=mS(e);return t.astcHDR&&(s==="astc-4x4"||s==="astc-6x6")&&Od(n,s.slice(5))?s==="astc-4x4"?"astc-hdr-4x4":"astc-hdr-6x6":n.has("bc6h-rgb-ufloat")?"bc6h":"rgba16f"}if(e.codec==="xubc7")return ey(n)?"bc7":"rgba32";if(e.codec.startsWith("xuastc-ldr-")||e.codec.startsWith("astc-ldr-")){let s=mS(e);return s&&Od(n,s.slice(5))?s:Zg(n,e,["bc7","bc","etc2","atc"])}return e.codec==="uastc-ldr-4x4"?Od(n,"4x4")?"astc-4x4":Zg(n,e,["bc7","bc","etc2","etc1","pvrtc","atc"]):Zg(n,e,["etc2","etc1","bc7","bc","pvrtc","atc"])}function Tk(r){return Od(r,"4x4")?"astc-4x4":ey(r)?"bc7":gS(r)?{alpha:"bc3",noAlpha:"bc1"}:yS(r)?"etc2":r.has("etc1-rgb-unorm-webgl")?{alpha:"rgba32",noAlpha:"etc1"}:wS(r)?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:xS(r)?{alpha:"atc-rgba-interpolated-alpha",noAlpha:"atc-rgb"}:{alpha:"rgba32",noAlpha:"rgb565"}}function Zg(r,e,t){for(let n of t)switch(n){case"bc7":if(ey(r))return"bc7";break;case"bc":if(gS(r))return e.hasAlpha?"bc3":"bc1";break;case"etc2":if(yS(r))return"etc2";break;case"etc1":if(!e.hasAlpha&&r.has("etc1-rgb-unorm-webgl"))return"etc1";break;case"pvrtc":if(wS(r))return e.hasAlpha?"pvrtc1-4-rgba":"pvrtc1-4-rgb";break;case"atc":if(xS(r))return e.hasAlpha?"atc-rgba-interpolated-alpha":"atc-rgb";break;default:break}return e.hasAlpha?"rgba32":"rgb565"}function mS(r){let e=`${r.blockWidth}x${r.blockHeight}`;return xk.includes(e)?`astc-${e}`:null}function Od(r,e){return _a(r,[`astc-${e}-unorm`,`astc-${e}-unorm-srgb`])}function ey(r){return _a(r,["bc7-rgba-unorm","bc7-rgba-unorm-srgb"])}function gS(r){return _a(r,["bc1-rgb-unorm-webgl","bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb"])}function yS(r){return _a(r,["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb"])}function wS(r){return _a(r,["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"])}function xS(r){return _a(r,["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"])}function _a(r,e){return e.some(t=>r.has(t))}var xk,TS=p(()=>{"use strict";pS();xk=["4x4","5x4","5x5","6x5","6x6","8x5","8x6","8x8","10x5","10x6","10x8","10x10","12x10","12x12"]});async function vS(r){lb(r.modules);let e=fb("basis");return e||(AS||=_k(r),await AS)}async function _k(r){let e=null,t=null;return[e,t]=await Promise.all([await pa(_S.TRANSCODER,"images",r,null,"basis_transcoder.mjs"),await pa(_S.TRANSCODER_WASM,"images",r)]),e=e||globalThis.BASIS,await Ak(e,t)}function Ak(r,e){let t={};return e&&(t.wasmBinary=e),ro(()=>r(t),n=>{let{BasisFile:s,KTX2File:i,getBasisTexFormatBlockHeight:o,getBasisTexFormatBlockWidth:a,initializeBasis:c,isFormatSupported:u}=n;return c(),{BasisFile:s,KTX2File:i,getBasisTexFormatBlockHeight:o,getBasisTexFormatBlockWidth:a,isFormatSupported:u}})}var _S,AS,IS=p(()=>{"use strict";Be();ti();_S={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"}});function SS(r){if(r.byteLength<ty.byteLength)return!1;let e=new Uint8Array(r,0,ty.byteLength);return ty.every((t,n)=>e[n]===t)}var ty,ES=p(()=>{"use strict";ty=new Uint8Array([171,75,84,88,32,50,48,187,13,10,26,10])});async function Ek(r){let e=LS,t;LS=new Promise(n=>{t=n}),await e;try{return await r()}finally{t()}}async function FS(r,e={}){return await Ek(async()=>{let t=await vS(mn(e)),n=e.basis?.containerFormat||"auto";if(n==="ktx2"||n==="auto"&&SS(r)){if(!t.KTX2File)throw new Error("The injected Basis transcoder module does not provide KTX2File");return Bk(t,r,e)}return Lk(t,r,e)})}function Lk(r,e,t){let n=new r.BasisFile(new Uint8Array(e));try{let s=MS(n,!1);if(!n.startTranscoding())throw new Error("Failed to start Basis transcoding");let i=[];for(let o=0;o<n.getNumImages();o++){let a=[];for(let c=0;c<n.getNumLevels(o);c++){let u=n.getImageWidth(o,c),l=n.getImageHeight(o,c);a.push(OS(n,s,u,l,t,f=>n.getImageTranscodedSizeInBytes(o,c,f),(f,d)=>n.transcodeImage(f,o,c,d,0,0)))}i.push(a)}return i}finally{n.close(),n.delete()}}function Bk(r,e,t){let n=new r.KTX2File(new Uint8Array(e));try{if(!n.isValid())throw new Error("Invalid KTX2 texture");if(n.getHeader().pixelDepth>0)throw new Error("BasisLoader does not support 3D KTX2 textures");let i=MS(n,!0);if(!n.startTranscoding())throw new Error("Failed to start KTX2 transcoding");let o=Math.max(1,n.getLayers()),a=Math.max(1,n.getFaces()),c=[];for(let u=0;u<o;u++)for(let l=0;l<a;l++){let f=[];for(let d=0;d<n.getLevels();d++){let h=n.getImageLevelInfo(d,u,l);f.push(OS(n,{...i,hasAlpha:!!h.alphaFlag},h.width,h.height,t,m=>n.getImageTranscodedSizeInBytes(d,u,l,m),(m,b)=>n.transcodeImage(m,d,u,l,b,0,-1,-1)))}c.push(f)}return c}finally{n.close(),n.delete()}}function OS(r,e,t,n,s,i,o){let a=Ok(s,e);Fk(e,ry(s,e));let c=i(a.basisFormat),u=Dk(c,a.dataType);if(!o(u,a.basisFormat))throw new Error(`Failed to transcode Basis texture to ${ry(s,e)}`);let l=e.isSRGB&&a.srgbTextureFormat;return{shape:"texture-level",width:t,height:n,data:u,compressed:a.compressed,format:l&&a.srgbFormat||a.format,textureFormat:l?a.srgbTextureFormat:a.textureFormat,levelSize:c,hasAlpha:e.hasAlpha}}function Fk(r,e){let t=e==="bc6h"||e==="rgba16f"||e==="rgb9e5"||e.startsWith("astc-hdr-");if(r.isHDR!==t)throw new Error(`Basis source codec ${r.codec} cannot be transcoded to ${e}`);if(r.codec==="xubc7"&&e!=="bc7"&&e!=="rgba32")throw new Error(`Basis source codec ${r.codec} cannot be transcoded to ${e}`)}function Ok(r,e){let t=ry(r,e),n=BS[t];if(!n)throw new Error(`Unknown Basis format ${t}`);return n}function ry(r,e){let t=r.basis?.format||"auto";return t==="auto"&&(t=bS(r.basis?.supportedTextureFormats,e,r.basis?.supportedTextureFeatures)),typeof t=="object"&&(t=e.hasAlpha?t.alpha:t.noAlpha),t.toLowerCase()}function MS(r,e){let t=r.getBasisTexFormat(),n=Mk[t];if(!n)throw new Error(`Unsupported Basis source texture format ${t}`);return{codec:n,isHDR:!!r.isHDR(),isSRGB:e?!!r.isSRGB():!1,hasAlpha:!!r.getHasAlpha(),blockWidth:r.getBlockWidth(),blockHeight:r.getBlockHeight()}}function Dk(r,e){return e==="uint16"?new Uint16Array(r/Uint16Array.BYTES_PER_ELEMENT):e==="uint32"?new Uint32Array(r/Uint32Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function it(r,e,t){return{basisFormat:r,compressed:!0,format:e,textureFormat:t}}function Aa(r,e,t,n,s){return{basisFormat:r,compressed:!1,format:e,textureFormat:t,srgbFormat:n,srgbTextureFormat:s}}function $t(r,e,t,n){return{...it(r,e,`astc-${n}-unorm`),srgbFormat:t,srgbTextureFormat:`astc-${n}-unorm-srgb`}}var Wt,BS,nre,LS,Mk,DS=p(()=>{"use strict";ti();TS();IS();ES();Wt={"4x4":$t(10,37808,37840,"4x4"),"5x4":$t(28,37809,37841,"5x4"),"5x5":$t(29,37810,37842,"5x5"),"6x5":$t(30,37811,37843,"6x5"),"6x6":$t(31,37812,37844,"6x6"),"8x5":$t(32,37813,37845,"8x5"),"8x6":$t(33,37814,37846,"8x6"),"8x8":$t(36,37815,37847,"8x8"),"10x5":$t(34,37816,37848,"10x5"),"10x6":$t(35,37817,37849,"10x6"),"10x8":$t(37,37818,37850,"10x8"),"10x10":$t(38,37819,37851,"10x10"),"12x10":$t(39,37820,37852,"12x10"),"12x12":$t(40,37821,37853,"12x12")},BS={etc1:it(0,36196,"etc1-rgb-unorm-webgl"),etc2:{...it(1,37493,"etc2-rgba8unorm"),srgbFormat:37495,srgbTextureFormat:"etc2-rgba8unorm-srgb"},bc1:{...it(2,33776,"bc1-rgb-unorm-webgl"),srgbFormat:35916,srgbTextureFormat:"bc1-rgb-unorm-srgb-webgl"},bc3:{...it(3,33779,"bc3-rgba-unorm"),srgbFormat:35919,srgbTextureFormat:"bc3-rgba-unorm-srgb"},bc4:it(4,36283,"bc4-r-unorm"),bc5:it(5,36285,"bc5-rg-unorm"),bc7:{...it(6,36492,"bc7-rgba-unorm"),srgbFormat:36493,srgbTextureFormat:"bc7-rgba-unorm-srgb"},"pvrtc1-4-rgb":it(8,35840,"pvrtc-rgb4unorm-webgl"),"pvrtc1-4-rgba":it(9,35842,"pvrtc-rgba4unorm-webgl"),"astc-4x4":Wt["4x4"],"astc-5x4":Wt["5x4"],"astc-5x5":Wt["5x5"],"astc-6x5":Wt["6x5"],"astc-6x6":Wt["6x6"],"astc-8x5":Wt["8x5"],"astc-8x6":Wt["8x6"],"astc-8x8":Wt["8x8"],"astc-10x5":Wt["10x5"],"astc-10x6":Wt["10x6"],"astc-10x8":Wt["10x8"],"astc-10x10":Wt["10x10"],"astc-12x10":Wt["12x10"],"astc-12x12":Wt["12x12"],"atc-rgb":it(11,35986,"atc-rgb-unorm-webgl"),"atc-rgba-interpolated-alpha":it(12,34798,"atc-rgbai-unorm-webgl"),rgba32:Aa(13,32856,"rgba8unorm",35907,"rgba8unorm-srgb"),rgb565:Aa(14,36194,"rgb565unorm-webgl"),bgr565:Aa(15,36194,"rgb565unorm-webgl"),rgba4444:Aa(16,32854,"rgba4unorm-webgl"),"eac-r11":it(20,37488,"eac-r11unorm"),"eac-rg11":it(21,37490,"eac-rg11unorm"),bc6h:it(22,36495,"bc6h-rgb-ufloat"),"astc-hdr-4x4":it(23,37808,"astc-4x4-unorm"),rgba16f:{...Aa(25,34842,"rgba16float"),dataType:"uint16"},rgb9e5:{...Aa(26,35901,"rgb9e5ufloat"),dataType:"uint32"},"astc-hdr-6x6":it(27,37812,"astc-6x6-unorm")},nre=Object.freeze(Object.keys(BS)),LS=Promise.resolve();Mk={0:"etc1s",1:"uastc-ldr-4x4",2:"uastc-hdr-4x4",3:"astc-hdr-6x6",4:"uastc-hdr-6x6",5:"xuastc-ldr-4x4",6:"xuastc-ldr-5x4",7:"xuastc-ldr-5x5",8:"xuastc-ldr-6x5",9:"xuastc-ldr-6x6",10:"xuastc-ldr-8x5",11:"xuastc-ldr-8x6",12:"xuastc-ldr-10x5",13:"xuastc-ldr-10x6",14:"xuastc-ldr-8x8",15:"xuastc-ldr-10x8",16:"xuastc-ldr-10x10",17:"xuastc-ldr-12x10",18:"xuastc-ldr-12x12",19:"astc-ldr-4x4",20:"astc-ldr-5x4",21:"astc-ldr-5x5",22:"astc-ldr-6x5",23:"astc-ldr-6x6",24:"astc-ldr-8x5",25:"astc-ldr-8x6",26:"astc-ldr-10x5",27:"astc-ldr-10x6",28:"astc-ldr-8x8",29:"astc-ldr-10x8",30:"astc-ldr-10x10",31:"astc-ldr-12x10",32:"astc-ldr-12x12",33:"xubc7"}});var RS={};J(RS,{BasisLoaderWithParser:()=>Ck,BasisWorkerLoaderWithParser:()=>Nk});var cre,Rk,ure,kk,Nk,Ck,kS=p(()=>{"use strict";DS();Md();Md();({preload:cre,...Rk}=fo),{preload:ure,...kk}=fo,Nk={...Rk},Ck={...kk,parse:FS}});async function Uk(){let{BasisLoaderWithParser:r}=await Promise.resolve().then(()=>(kS(),RS));return r}var fo,Md=p(()=>{"use strict";fS();$g();fo={...lS,dataType:null,batchType:null,name:"Basis",id:"basis",module:"images",version:Ed,worker:!0,workerNode:"basis-worker-node.cjs",extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",containerFormat:"auto"}},preload:Uk}});var Xn=p(()=>{"use strict";Hg();Sd();cS();Qg();Qg();Md()});function X(r,e){if(!r)throw new Error(e||"assert failed: gltf")}var ho=p(()=>{"use strict"});function Wk(r,e=0){return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}function PS(r,e=0,t={}){let n=new DataView(r),{magic:s=NS}=t,i=n.getUint32(e,!1);return i===s||i===NS}function kd(r,e,t=0,n={}){let s=new DataView(e),i=Wk(s,t+0),o=s.getUint32(t+4,oi),a=o===3?jS(s,t+8,"GLB byte length"):s.getUint32(t+8,oi);switch(Object.assign(r,{header:{byteOffset:t,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},jsonChunkIndex:-1,binChunks:[]}),r.version){case 1:return $k(r,s,t+Dd);case 2:return qk(r,s,t+Dd,n);case 3:return Kk(r,s,t+US,n);default:throw new Error(`Invalid GLB version ${r.version}. Only supports versions 1, 2 and 3.`)}}function $k(r,e,t){fr(r.header.byteLength>Dd+Rd);let n=r.header.byteOffset+r.header.byteLength;fr(n<=e.byteLength);let s=e.getUint32(t+0,oi),i=e.getUint32(t+4,oi);if(t+=Rd,fr(i===jk),t+s>n)throw new Error("GLB JSON content extends beyond the declared file length.");ny(r,e,t,s,0),t+=s;let o=n-t;return o>0&&sy(r,e,t,o,1),n}function qk(r,e,t,n){return fr(r.header.byteLength>Dd+Rd),VS(r,e,t,Rd,n),r.header.byteOffset+r.header.byteLength}function Kk(r,e,t,n){return fr(r.header.byteLength>=US+CS),VS(r,e,t,CS,n),r.header.byteOffset+r.header.byteLength}function VS(r,e,t,n,s){let i=r.header.byteOffset+r.header.byteLength;fr(i<=e.byteLength);let o=0;for(;t+n<=i;){let a=r.version===3,c=e.getUint32(t+(a?0:4),oi),u=a?e.getUint32(t+4,oi):0,l=a?jS(e,t+8,"GLB chunk length"):e.getUint32(t+0,oi);if(t+=n,u!==0)throw new Error(`Unsupported GLB chunk encoding ${u}.`);if(t+l>i)throw new Error("GLB chunk extends beyond the declared file length.");switch(c){case Pk:(r.version!==3||r.jsonChunkIndex===-1)&&ny(r,e,t,l,o);break;case Vk:sy(r,e,t,l,o);break;case Gk:s.strict||ny(r,e,t,l,o);break;case zk:s.strict||sy(r,e,t,l,o);break;default:break}t+=iy(l),o++}return t}function ny(r,e,t,n,s){let i=new Uint8Array(e.buffer,t,n),a=new TextDecoder("utf8").decode(i);return r.json=JSON.parse(a),r.jsonChunkIndex=s,iy(n)}function sy(r,e,t,n,s){return r.header.hasBinChunk=!0,r.binChunks.push({chunkIndex:s,byteOffset:t,byteLength:n,arrayBuffer:e.buffer}),iy(n)}function jS(r,e,t){let n=r.getBigUint64(e,oi);if(n>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(`${t} exceeds JavaScript's safe integer range.`);return Number(n)}function iy(r){return Math.ceil(r/4)*4}var oi,NS,Dd,US,Rd,CS,Pk,Vk,jk,Gk,zk,oy=p(()=>{"use strict";Be();oi=!0,NS=1735152710,Dd=12,US=16,Rd=8,CS=16,Pk=1313821514,Vk=5130562,jk=0,Gk=0,zk=1});function Jn(r,e,t){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return Nd(r);let s=t?.baseUrl||Hk(e?.core?.baseUrl);if(!s)throw new Error(`'baseUrl' must be provided to resolve relative url ${r}`);let i=s.endsWith("/")?`${s}${r}`:`${s}/${r}`;return Nd(i)}function Nd(r){try{return new URL(r).href}catch{return r}}function Hk(r){if(!r)return;if(r.endsWith("/"))return r;let e=r.lastIndexOf("/");return e>=0?r.slice(0,e+1):""}var pu=p(()=>{"use strict"});var Cd,mu,ay=p(()=>{"use strict";Cd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},mu={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8}});function va(r){return GS[r-1]||GS[0]}function Yn(r){let e=Jk.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function bu(r,e){let t=Zk[r.componentType],n=Yk[r.type],s=Qk[r.componentType],i=r.count*n,o=r.count*n*s;X(o>=0&&o<=e.byteLength);let a=mu[r.componentType],c=Cd[r.type];return{ArrayType:t,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}var GS,Xk,Jk,Yk,Qk,Zk,ai=p(()=>{"use strict";ho();ay();GS=["SCALAR","VEC2","VEC3","VEC4"],Xk=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Int32Array,5124],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130],[BigInt64Array,5134],[BigUint64Array,5135]],Jk=new Map(Xk),Yk={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Qk={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8},Zk={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5124:Int32Array,5125:Uint32Array,5126:Float32Array,5130:Float64Array,5131:Uint16Array,5134:BigInt64Array,5135:BigUint64Array}});function hr(r,e,t){let n=typeof t=="number"?r.bufferViews[t]:t;X(n);let s=n.buffer,i=e[s];X(i),X((n.byteOffset||0)>=0&&n.byteLength>=0),X((n.byteOffset||0)+n.byteLength<=i.byteLength),X(i.byteOffset>=0&&i.byteOffset+i.byteLength<=i.arrayBuffer.byteLength);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function zS(r,e,t){let n=r.images[t];return hr(r,e,n.bufferView)}function Ud(r,e,t){let n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);X(Number.isSafeInteger(n.count)&&n.count>=0);let{ArrayType:s,length:i,numberOfComponentsInElement:o}=bu(n,{byteLength:1/0}),a=n.value,c;ArrayBuffer.isView(a)?(X(a.length===i),c=a):n.bufferView===void 0?c=new s(i):c=cy(r,e,n);let u=n.sparse;if(!u)return c;let l=new s(i);new Uint8Array(l.buffer).set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),X(u.count>=0&&u.count<=n.count),X([5121,5123,5125].includes(u.indices.componentType));let f=cy(r,e,{bufferView:u.indices.bufferView,byteOffset:u.indices.byteOffset,componentType:u.indices.componentType,count:u.count,type:"SCALAR"}),d=cy(r,e,{bufferView:u.values.bufferView,byteOffset:u.values.byteOffset,componentType:n.componentType,count:u.count,type:n.type}),h=-1,m=new Uint8Array(l.buffer),b=o*s.BYTES_PER_ELEMENT,g=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);for(let y=0;y<u.count;y++){let x=Number(f[y]);X(x>h&&x<n.count),m.set(g.subarray(y*b,(y+1)*b),x*b),h=x}return l}function cy(r,e,t){let n=r.bufferViews?.[t.bufferView];if(!n)throw new Error(`No gltf buffer view for accessor ${n}`);let s=e[n.buffer];X(s);let{arrayBuffer:i,byteOffset:o}=s;X((n.byteOffset||0)>=0&&n.byteLength>=0),X((n.byteOffset||0)+n.byteLength<=s.byteLength),X(o>=0&&o+s.byteLength<=i.byteLength),X((t.byteOffset||0)>=0);let a=(o||0)+(t.byteOffset||0)+(n.byteOffset||0),{ArrayType:c,length:u,componentByteSize:l,numberOfComponentsInElement:f}=bu(t,n),d=l*f,h=t.type.startsWith("MAT")?Number(t.type.slice(3)):1,m=_e(h*l,4),b=h>1?h*m:d,g=n.byteStride??b,y=h>1?(h-1)*m+h*l:d;if(X(g>=b),X((t.byteOffset||0)+(t.count===0?0:(t.count-1)*g+y)<=n.byteLength),t.count===0)return new c(0);if(h>1&&m!==h*l){let _=n.byteStride??h*m,v=(h-1)*m+h*l;X((t.byteOffset||0)+(t.count-1)*_+v<=n.byteLength);let I=new c(u),N=new Uint8Array(I.buffer,I.byteOffset,I.byteLength);for(let K=0;K<t.count;K++)for(let ne=0;ne<h;ne++){let be=new Uint8Array(i,a+K*_+ne*m,h*l);N.set(be,K*d+ne*h*l)}return I}let x=n.byteStride||d;if(typeof n.byteStride>"u"||n.byteStride===d){if(a%l!==0){let v=new Uint8Array(i,a,u*l),I=new Uint8Array(v.byteLength);return I.set(v),new c(I.buffer,0,u)}return new c(i,a,u)}let T=new c(u);for(let _=0;_<t.count;_++){let v=a+_*x,I;if(v%l!==0){let N=new Uint8Array(i,v,d),K=new Uint8Array(d);K.set(N),I=new c(K.buffer,0,f)}else I=new c(i,v,f);T.set(I,_*f)}return T}var po=p(()=>{"use strict";ho();Be();ai()});function uy(r,e){let t=r.json.files||[],n=[];for(let s=0;s<t.length;s++){let i=t[s];(i.name===e||i.uri===e)&&n.push(s)}return X(n.length<=1,`glTF package file reference ${e} is ambiguous.`),n[0]??-1}async function Pd(r,e,t,n){let s=r.json.files||[],i=typeof e=="number"?e:uy(r,e);X(Number.isInteger(i)&&i>=0&&i<s.length),r.files=r.files||new Array(s.length).fill(null);let o=r.files[i];if(o)return o;let a=s[i];X(a.mimeType,`glTF file ${i} must define mimeType.`);let c=a.uri!==void 0,u=a.bufferView!==void 0;X(c!==u,`glTF file ${i} must define exactly one of uri or bufferView.`);let l;if(a.uri!==void 0){let f=Jn(a.uri,t,n),d=await n.fetch(f);X(d?.ok,`Failed to fetch glTF file ${a.uri}: HTTP ${d?.status}.`);let h=await d.arrayBuffer();l={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength,mimeType:a.mimeType,name:a.name,url:f}}else{let f=hr(r.json,r.buffers,a.bufferView);l={arrayBuffer:f.buffer,byteOffset:f.byteOffset,byteLength:f.byteLength,mimeType:a.mimeType,name:a.name}}return r.files[i]=l,l}var WS=p(()=>{"use strict";po();pu();ho()});var ly={};J(ly,{name:()=>mo,preprocess:()=>eN});function eN(r){let{json:e}=r;if(!(!e.extensionsUsed?.includes(mo)&&!e.extensionsRequired?.includes(mo))){if(!e.extensionsUsed?.includes(mo)||!e.extensionsRequired?.includes(mo))throw new Error(`${mo}: must be declared in extensionsUsed and extensionsRequired.`);for(let[t,n]of(e.accessors||[]).entries())if(n.componentType===5130&&n.normalized)throw new Error(`${mo}: accessor ${t} must not be normalized.`)}}var mo,$S=p(()=>{"use strict";mo="KHR_accessor_float64"});function tN(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var yn,gu=p(()=>{"use strict";Xn();Be();ho();ai();po();yn=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||tN(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=_e(this.gltf.buffers[0].byteLength,4),this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof t=="string"||typeof n=="string"}getExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if(typeof t=="object")return t;let n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){return hr(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return Ud(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForImageData(e){e=this.getAccessor(e);let t=this.getBufferView(e.bufferView),s=this.getBuffer(t.buffer).data,i=t.byteOffset||0;return new Uint8Array(s,i,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){let s=e.extensions||{};s[t]=n}removeObjectExtension(e,t){let n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(t)||s.push(t)}delete n[t]}addExtension(e,t={}){return X(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return X(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let t=this.json.extensionsRemoved;t.includes(e)||t.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){let{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:t};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:t,indices:n,material:s,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){let n=Hn(e),s=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){let s=e.byteLength;X(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let i={buffer:t,byteOffset:n,byteLength:s};return this.byteLength+=_e(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){let n=t.normalized,s={bufferView:e,...n===void 0?{}:{normalized:n},type:va(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(s),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){let n=this.addBufferView(e),s={min:t.min,max:t.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,t.size));let i={size:t.size,componentType:Yn(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(i,t))}addTexture(e){let{imageIndex:t,samplerIndex:n}=e,s={source:t,...n===void 0?{}:{sampler:n}};return this.json.textures=this.json.textures||[],this.json.textures.push(s),this.json.textures.length-1}addSampler(e){return this.json.samplers=this.json.samplers||[],this.json.samplers.push({...e}),this.json.samplers.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){if(this.byteLength===0&&!this.json.buffers?.length){delete this.json.buffers,delete this.gltf.binary,this.sourceBuffers=[],this.gltf.buffers=[];return}let e=[0],t=this.byteLength;for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&(e[o]=_e(t,8),t=e[o]+_e(a.byteLength,4))}let n=new ArrayBuffer(t),s=new Uint8Array(n),i=0;for(let o of this.sourceBuffers||[])i=ao(o,s,i);for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&ao(a,s,e[o])}for(let o of this.json.bufferViews||[]){let a=e[o.buffer];X(a!==void 0),o.byteOffset=a+(o.byteOffset||0),o.buffer=0;for(let c of["EXT_meshopt_compression","KHR_meshopt_compression"]){let u=o.extensions?.[c];if(u){let l=e[u.buffer];X(l!==void 0),u.byteOffset=l+(u.byteOffset||0),u.buffer=0}}}this.byteLength=t,this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n],this.gltf.buffers=[{arrayBuffer:n,byteOffset:0,byteLength:n.byteLength}]}_removeStringFromArray(e,t){let n=!0;for(;n;){let s=e.indexOf(t);s>-1?e.splice(s,1):n=!1}}_addAttributes(e={}){let t={};for(let n in e){let s=e[n],i=this._getGltfAttributeName(n),o=s.value,a=o.BYTES_PER_ELEMENT*s.size,c=_e(a,4),u;if(c===a)u=this.addBinaryBuffer(o,s);else{let l=o.length/s.size,f=new Uint8Array(l*c),d=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);for(let m=0;m<l;m++)f.set(d.subarray(m*a,(m+1)*a),m*c);let h=this.addBufferView(f);this.json.bufferViews[h].byteStride=c,u=this.addAccessor(h,{...this._getAccessorMinMax(o,s.size),...s,componentType:Yn(o),count:l})}t[i]=u}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){let n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];let s=e.subarray(0,t);for(let i of s)n.min.push(i),n.max.push(i);for(let i=t;i<e.length;i+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[i+o]),n.max[0+o]=Math.max(n.max[0+o],e[i+o]);return n}}});function rN(r){switch(r.type){case"accessor":return{get bufferView(){return r.bufferView?.data}};case"animation":return{get channels(){return bo(r.channels)},get samplers(){return bo(r.samplers)}};case"animationChannel":return{get sampler(){return r.sampler.data},get target(){return r.target.data}};case"animationChannelTarget":return{get node(){return r.node?.data}};case"animationSampler":return{get input(){return r.input.data},get output(){return r.output.data}};case"bufferView":return{get buffer(){return r.buffer.data}};case"externalAsset":return{get file(){return r.file.data}};case"file":case"image":return{get bufferView(){return r.bufferView?.data}};case"material":return{get baseColorTexture(){return r.baseColorTexture?.data},get metallicRoughnessTexture(){return r.metallicRoughnessTexture?.data},get normalTexture(){return r.normalTexture?.data},get occlusionTexture(){return r.occlusionTexture?.data},get emissiveTexture(){return r.emissiveTexture?.data},get textures(){return bo(r.textures)}};case"textureInfo":return{get texture(){return r.texture.data}};case"mesh":return{get primitives(){return bo(r.primitives)}};case"primitive":return{get attributes(){return qS(r.attributes)},get indices(){return r.indices?.data},get material(){return r.material?.data},get targets(){return r.targets.map(qS)}};case"node":return{get camera(){return r.camera?.data},get children(){return bo(r.children)},get skin(){return r.skin?.data},get mesh(){return r.mesh?.data},get externalAsset(){return r.externalAsset?.data}};case"scene":return{get nodes(){return bo(r.nodes)}};case"skin":return{get inverseBindMatrices(){return r.inverseBindMatrices?.data},get skeleton(){return r.skeleton?.data},get joints(){return bo(r.joints)}};case"texture":return{get sampler(){return r.sampler?.data},get source(){return r.source?.data}};default:return{}}}function go(r,e){return(function*(){for(let n=0;n<r.length;n++)yield e(r[n],n)})()}function bo(r){return(function*(){for(let t of r)yield t.data})()}function qS(r){return new Map(Array.from(r,([e,t])=>[e,t.data]))}function nN(r){switch(r){case"bufferView":return"bufferViews";case"externalAsset":return"externalAssets";case"mesh":return"meshes";default:return`${r}s`}}function KS(r,e){if(r)for(let t=r.length-1;t>=0;t--)r[t]===e&&r.splice(t,1)}var Je,ci,fy,dy,hy,py,Vd,my,by,gy,yy,wy,xy,Ty,_y,Ay,vy,Iy,Sy,Ey,Ly,By,ie,Xe=p(()=>{"use strict";po();ai();Je=class{gltf;type;index;data;path;iterator;constructor(e,t,n,s,i){this.iterator=e,this.gltf=e.gltf,this.type=t,this.index=n,this.data=s,this.path=i}},ci=class extends Je{parent;constructor(e,t,n,s,i,o){super(e,t,n,s,i),this.parent=o}},fy=class extends Je{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}},dy=class extends Je{get channels(){return go(this.data.channels,(e,t)=>this.iterator.getOrCreateNested(e,()=>new hy(this.iterator,"animationChannel",t,e,`${this.path}.channels[${t}]`,this)))}get samplers(){return go(this.data.samplers,(e,t)=>this.iterator.getOrCreateNested(e,()=>new Vd(this.iterator,"animationSampler",t,e,`${this.path}.samplers[${t}]`,this)))}},hy=class extends ci{get sampler(){let t=this.parent.data.samplers[this.data.sampler];if(!t)throw new Error(`Invalid glTF reference at ${this.path}.sampler: animation sampler index ${this.data.sampler} is out of range`);return this.iterator.getOrCreateNested(t,()=>new Vd(this.iterator,"animationSampler",this.data.sampler,t,`${this.parent.path}.samplers[${this.data.sampler}]`,this.parent))}get target(){return this.iterator.getOrCreateNested(this.data.target,()=>new py(this.iterator,"animationChannelTarget",0,this.data.target,`${this.path}.target`,this))}},py=class extends ci{get node(){return this.data.node===void 0?void 0:this.iterator.resolveNode(this.data.node,`${this.path}.node`)}},Vd=class extends ci{get input(){return this.iterator.resolveAccessor(this.data.input,`${this.path}.input`)}get output(){return this.iterator.resolveAccessor(this.data.output,`${this.path}.output`)}},my=class extends Je{get loadedBuffer(){return this.gltf.buffers[this.index]}},by=class extends Je{get buffer(){return this.iterator.resolveBuffer(this.data.buffer,`${this.path}.buffer`)}get loadedBufferView(){let e=this.buffer.loadedBuffer;if(!e)return;let t=e.byteOffset+(this.data.byteOffset||0);return new Uint8Array(e.arrayBuffer,t,this.data.byteLength)}},gy=class extends Je{},yy=class extends Je{get file(){return this.iterator.resolveFile(this.data.file,`${this.path}.file`)}get loadedAsset(){return this.gltf.externalAssets?.[this.index]}},wy=class extends Je{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedFile(){return this.gltf.files?.[this.index]}},xy=class extends Je{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedImage(){return this.gltf.images?.[this.index]}},Ty=class extends Je{get baseColorTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.baseColorTexture,0,"pbrMetallicRoughness.baseColorTexture")}get metallicRoughnessTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.metallicRoughnessTexture,1,"pbrMetallicRoughness.metallicRoughnessTexture")}get normalTexture(){return this.getTextureInfo(this.data.normalTexture,2,"normalTexture")}get occlusionTexture(){return this.getTextureInfo(this.data.occlusionTexture,3,"occlusionTexture")}get emissiveTexture(){return this.getTextureInfo(this.data.emissiveTexture,4,"emissiveTexture")}get textures(){return[this.baseColorTexture,this.metallicRoughnessTexture,this.normalTexture,this.occlusionTexture,this.emissiveTexture].filter(t=>!!t).values()}getTextureInfo(e,t,n){return e?this.iterator.getOrCreateNested(e,()=>new _y(this.iterator,"textureInfo",t,e,`${this.path}.${n}`,this)):void 0}},_y=class extends ci{get texture(){return this.iterator.resolveTexture(this.data.index,`${this.path}.index`)}},Ay=class extends Je{get primitives(){return go(this.data.primitives,(e,t)=>this.iterator.getOrCreateNested(e,()=>new vy(this.iterator,"primitive",t,e,`${this.path}.primitives[${t}]`,this)))}},vy=class extends ci{get attributes(){return new Map(Object.entries(this.data.attributes).map(([e,t])=>[e,this.iterator.resolveAccessor(t,`${this.path}.attributes.${e}`)]))}get indices(){return this.data.indices===void 0?void 0:this.iterator.resolveAccessor(this.data.indices,`${this.path}.indices`)}get material(){return this.data.material===void 0?void 0:this.iterator.resolveMaterial(this.data.material,`${this.path}.material`)}get targets(){return(this.data.targets||[]).map((e,t)=>new Map(Object.entries(e).map(([n,s])=>[n,this.iterator.resolveAccessor(s,`${this.path}.targets[${t}].${n}`)])))}},Iy=class extends Je{get camera(){return this.data.camera===void 0?void 0:this.iterator.resolveCamera(this.data.camera,`${this.path}.camera`)}get children(){return go(this.data.children||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.children[${t}]`))}get skin(){return this.data.skin===void 0?void 0:this.iterator.resolveSkin(this.data.skin,`${this.path}.skin`)}get mesh(){return this.data.mesh===void 0?void 0:this.iterator.resolveMesh(this.data.mesh,`${this.path}.mesh`)}get externalAsset(){return this.data.externalAsset===void 0?void 0:this.iterator.resolveExternalAsset(this.data.externalAsset,`${this.path}.externalAsset`)}},Sy=class extends Je{},Ey=class extends Je{get nodes(){return go(this.data.nodes||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.nodes[${t}]`))}},Ly=class extends Je{get inverseBindMatrices(){return this.data.inverseBindMatrices===void 0?void 0:this.iterator.resolveAccessor(this.data.inverseBindMatrices,`${this.path}.inverseBindMatrices`)}get skeleton(){return this.data.skeleton===void 0?void 0:this.iterator.resolveNode(this.data.skeleton,`${this.path}.skeleton`)}get joints(){return go(this.data.joints,(e,t)=>this.iterator.resolveNode(e,`${this.path}.joints[${t}]`))}},By=class extends Je{get sampler(){return this.data.sampler===void 0?void 0:this.iterator.resolveSampler(this.data.sampler,`${this.path}.sampler`)}get source(){return this.data.source===void 0?void 0:this.iterator.resolveImage(this.data.source,`${this.path}.source`)}},ie=class{gltf;objectCache=new WeakMap;referencesCache=new WeakMap;constructor(e){this.gltf=e}get data(){return this.gltf.json}getTypedArrayForBufferView(e){return hr(this.data,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return Ud(this.data,this.gltf.buffers,e)}getTypedArrayForImageData(e){return zS(this.data,this.gltf.buffers,e)}getLoadedBuffer(e){let t=this.getMetadata(e);return this.gltf.buffers[t.index]}getLoadedBufferView(e){let t=this.getReferences(e).buffer,n=this.getLoadedBuffer(t);if(!n)return;let s=n.byteOffset+(e.byteOffset||0);return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getLoadedImage(e){return this.gltf.images?.[this.getMetadata(e).index]}getLoadedFile(e){return this.gltf.files?.[this.getMetadata(e).index]}getLoadedExternalAsset(e){return this.gltf.externalAssets?.[this.getMetadata(e).index]}addBuffer(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return this.gltf.buffers.push({arrayBuffer:t,byteOffset:0,byteLength:e.byteLength}),this.data.buffers||=[],this.data.buffers.push({byteLength:e.byteLength}),this.data.buffers.length-1}addBufferView(e,t,n=0){return this.data.bufferViews||=[],this.data.bufferViews.push({buffer:e,byteOffset:n,byteLength:t}),this.data.bufferViews.length-1}addAccessor(e,t){return this.data.accessors||=[],this.data.accessors.push({bufferView:e,type:va(t.size),componentType:t.componentType,count:t.count,min:t.min,max:t.max}),this.data.accessors.length-1}getReferences(e){let t=this.referencesCache.get(e);if(t)return t;let n=this.getObjectIterator(e),s=rN(n);return this.referencesCache.set(e,s),s}getMetadata(e){let t=this.getObjectIterator(e),n=t instanceof ci?t.parent.data:void 0;return{gltf:this.gltf,type:t.type,index:t.index,parent:n,path:t.path}}get scene(){return this.data.scene===void 0?void 0:this.resolveScene(this.data.scene,"scene").data}get thumbnail(){return this.data.asset.thumbnail===void 0?void 0:this.resolveImage(this.data.asset.thumbnail,"asset.thumbnail").data}get accessors(){return this.iterateCollectionData("accessor")}get animations(){return this.iterateCollectionData("animation")}get buffers(){return this.iterateCollectionData("buffer")}get bufferViews(){return this.iterateCollectionData("bufferView")}get cameras(){return this.iterateCollectionData("camera")}get externalAssets(){return this.iterateCollectionData("externalAsset")}get files(){return this.iterateCollectionData("file")}get images(){return this.iterateCollectionData("image")}get materials(){return this.iterateCollectionData("material")}get meshes(){return this.iterateCollectionData("mesh")}get nodes(){return this.iterateCollectionData("node")}get samplers(){return this.iterateCollectionData("sampler")}get scenes(){return this.iterateCollectionData("scene")}get skins(){return this.iterateCollectionData("skin")}get textures(){return this.iterateCollectionData("texture")}hasExtension(e){return!!this.data.extensionsUsed?.includes(e)||!!this.data.extensionsRequired?.includes(e)}isExtensionRequired(e){return!!this.data.extensionsRequired?.includes(e)}getExtension(e,t){let n=typeof e=="string"?this.data:e,s=typeof e=="string"?e:t;return n.extensions?.[s]}setExtension(e,t,n){let s=typeof e=="string",i=s?this.data:e,o=s?e:t,a=s?t:n,c=s?!!n:!1;i.extensions||={},i.extensions[o]=a,this.registerUsedExtension(o),c&&this.registerRequiredExtension(o)}registerUsedExtension(e){this.data.extensionsUsed||=[],this.data.extensionsUsed.includes(e)||this.data.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.data.extensionsRequired||=[],this.data.extensionsRequired.includes(e)||this.data.extensionsRequired.push(e)}removeExtension(e,t){let n=typeof e=="string",s=n?this.data:e,i=n?e:t;s.extensions?.[i]!==void 0&&(this.recordRemovedExtension(i),delete s.extensions[i]),n&&(KS(this.data.extensionsUsed,i),KS(this.data.extensionsRequired,i))}recordRemovedExtension(e){let t=this.data;t.extensionsRemoved||=[],t.extensionsRemoved.includes(e)||t.extensionsRemoved.push(e)}resolveAccessor(e,t){return this.resolveCollectionObject("accessor",e,t)}resolveBuffer(e,t){return this.resolveCollectionObject("buffer",e,t)}resolveBufferView(e,t){return this.resolveCollectionObject("bufferView",e,t)}resolveCamera(e,t){return this.resolveCollectionObject("camera",e,t)}resolveExternalAsset(e,t){return this.resolveCollectionObject("externalAsset",e,t)}resolveFile(e,t){return this.resolveCollectionObject("file",e,t)}resolveImage(e,t){return this.resolveCollectionObject("image",e,t)}resolveMaterial(e,t){return this.resolveCollectionObject("material",e,t)}resolveMesh(e,t){return this.resolveCollectionObject("mesh",e,t)}resolveNode(e,t){return this.resolveCollectionObject("node",e,t)}resolveSampler(e,t){return this.resolveCollectionObject("sampler",e,t)}resolveScene(e,t){return this.resolveCollectionObject("scene",e,t)}resolveSkin(e,t){return this.resolveCollectionObject("skin",e,t)}resolveTexture(e,t){return this.resolveCollectionObject("texture",e,t)}getOrCreateNested(e,t){return this.getOrCreate(e,t)}iterateCollection(e){let t=this.getCollection(e);return go(t,(n,s)=>this.resolveCollectionObject(e,s,e))}iterateCollectionData(e){return(function*(n){for(let s of n.iterateCollection(e))yield s.data})(this)}getObjectIterator(e){let t=this.objectCache.get(e);if(!t)throw new Error("glTF object is not registered with this iterator");return t}resolveCollectionObject(e,t,n){let i=this.getCollection(e)[t];if(!i)throw new Error(`Invalid glTF reference at ${n}: ${e} index ${t} is out of range`);return this.getOrCreate(i,()=>this.createCollectionObject(e,t,i))}getCollection(e){switch(e){case"accessor":return this.data.accessors||[];case"animation":return this.data.animations||[];case"buffer":return this.data.buffers||[];case"bufferView":return this.data.bufferViews||[];case"camera":return this.data.cameras||[];case"externalAsset":return this.data.externalAssets||[];case"file":return this.data.files||[];case"image":return this.data.images||[];case"material":return this.data.materials||[];case"mesh":return this.data.meshes||[];case"node":return this.data.nodes||[];case"sampler":return this.data.samplers||[];case"scene":return this.data.scenes||[];case"skin":return this.data.skins||[];case"texture":return this.data.textures||[]}}createCollectionObject(e,t,n){let s=`${nN(e)}[${t}]`;switch(e){case"accessor":return new fy(this,e,t,n,s);case"animation":return new dy(this,e,t,n,s);case"buffer":return new my(this,e,t,n,s);case"bufferView":return new by(this,e,t,n,s);case"camera":return new gy(this,e,t,n,s);case"externalAsset":return new yy(this,e,t,n,s);case"file":return new wy(this,e,t,n,s);case"image":return new xy(this,e,t,n,s);case"material":return new Ty(this,e,t,n,s);case"mesh":return new Ay(this,e,t,n,s);case"node":return new Iy(this,e,t,n,s);case"sampler":return new Sy(this,e,t,n,s);case"scene":return new Ey(this,e,t,n,s);case"skin":return new Ly(this,e,t,n,s);case"texture":return new By(this,e,t,n,s)}}getOrCreate(e,t){let n=this.objectCache.get(e);if(n)return n;let s=t();return this.objectCache.set(e,s),s}}});function HS(r){return(r%1+1)%1}function yu(r,e){return JS[e]*XS[r]}function Ia(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;let s=r.getTypedArrayForBufferView(e),i=Sa(s,"SCALAR",t,n+1);if(i instanceof BigInt64Array||i instanceof BigUint64Array){let o=new Float64Array(i.length),a=BigInt(Number.MAX_SAFE_INTEGER);for(let c=0;c<i.length;c++){let u=i[c];if(u<0n||u>a)throw new Error("EXT_structural_metadata: UINT64 offset exceeds the safe integer range");o[c]=Number(u)}return o}return i}function Sa(r,e,t,n=1){let s=XS[e],i=sN[t],o=JS[t],a=n*s,c=a*o,u=r.buffer,l=r.byteOffset;return l%o!==0&&(u=new Uint8Array(u).slice(l,l+c).buffer,l=0),new i(co(u),l,a)}function Ea(r,e,t){let n=`TEXCOORD_${e.texCoord||0}`,s=t.attributes[n],i=r.getTypedArrayForAccessor(s),o=r.gltf.json,a=e.index,c=o.textures?.[a]?.source;if(typeof c<"u"){let u=o.images?.[c]?.mimeType,l=r.gltf.images?.[c];if(l&&typeof l.width<"u"&&!("compressed"in l&&l.compressed)){let f=[];for(let d=0;d<i.length;d+=2){let h=iN(l,u,i,d,e.channels);f.push(h)}return f}}return[]}function jd(r,e,t,n,s){if(!t?.length)return;let i=[];for(let f of t){let d=n.findIndex(h=>h===f);d===-1&&(d=n.push(f)-1),i.push(d)}let o=new Uint32Array(i),a=r instanceof ie?r:new ie(r.gltf),c=a.addBuffer(o),u=a.addBufferView(c,o.byteLength),l=a.addAccessor(u,{size:1,componentType:Yn(o),count:o.length});s.attributes[e]=l}function iN(r,e,t,n,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],a=t[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let u=oN(o,a,r,c),l=0;for(let f of s){let d=typeof f=="number"?Object.values(i)[f]:i[f],h=u+d.offset,m=hu(r);if(m.data.length<=h)throw new Error(`${m.data.length} <= ${h}`);let b=m.data[h];l|=b<<d.shift}return l}function oN(r,e,t,n=1){let s=t.width,i=HS(r)*(s-1),o=Math.round(i),a=t.height,c=HS(e)*(a-1),u=Math.round(c),l=t.components?t.components:n;return(u*s+o)*l}function wu(r,e,t,n=1){let s=[];for(let i=0;i<e;i++){let o=Number(t[i]),a=Number(t[i+1])-o;if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<0||(o+a)*n>r.length)break;let c=o*n,u=a*n;s.push(r.slice(c,c+u))}return s}function xu(r,e,t,n=1){let s=[],i=t*n;for(let o=0;o<e;o++){let a=o*i;s.push(r.slice(a,a+i))}return s}function Gd(r,e,t,n,s){let i=new TextDecoder("utf8");if(t){if(!n)throw new Error("stringOffsets is required for variable-length string arrays");let o=[];for(let a=0;a<r;a++){let c=t[a],u=t[a+1],l=[];for(let f=c;f<u;f++){let d=n[f],h=n[f+1],m=e.subarray(d,h);l.push(i.decode(m))}o.push(l)}return o}if(n){let o=[],a=r*(s||1);for(let c=0;c<a;c++){let u=Number(n[c]),l=Number(n[c+1]);u>=0&&l>=u&&l<=e.length&&o.push(i.decode(e.subarray(u,l)))}return s?Array.from({length:r},(c,u)=>o.slice(u*s,(u+1)*s)):o}return[]}var XS,sN,JS,zd=p(()=>{"use strict";Xe();ai();Xn();Be();XS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},sN={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},JS={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8}});var Fy={};J(Fy,{createExtMeshFeatures:()=>hN,decode:()=>cN,encode:()=>uN,name:()=>aN});async function cN(r,e){let t=new ie(r);lN(t,e)}function uN(r,e){let t=new yn(r);return dN(t,e),t.createBinaryChunk(),t.gltf}function lN(r,e){for(let t of r.meshes)for(let n of r.getReferences(t).primitives)fN(r,n,e)}function fN(r,e,t){let s=r.getExtension(e,La)?.featureIds||[];if(s)for(let i of s){let o;if(typeof i.attribute<"u"){if(!t?.gltf?.loadBuffers)continue;let a=`_FEATURE_ID_${i.attribute}`,c=e.attributes[a];o=r.getTypedArrayForAccessor(c)}else if(typeof i.texture<"u"){if(!t?.gltf?.loadImages)continue;o=Ea(r,i.texture,e)}else{let a=e.attributes.POSITION,c=typeof a=="number"?r.data.accessors?.[a]?.count:a?.count;if(typeof c!="number"||!Number.isInteger(c)||c<0)throw new Error("EXT_mesh_features: implicit feature IDs require a POSITION accessor");if(i.featureCount!==c)throw new Error(`EXT_mesh_features: implicit featureCount ${i.featureCount} does not match vertex count ${c}`);delete i.data,Object.defineProperty(i,"implicit",{configurable:!0,enumerable:!1,writable:!0,value:{start:0,count:c}})}o&&(i.data=o,delete i.implicit)}}function dN(r,e){let t=r.gltf.json.meshes;if(t)for(let n of t)for(let s of n.primitives)pN(r,s)}function hN(r,e,t,n){e.extensions||(e.extensions={});let s=e.extensions[La];s||(s={featureIds:[]},e.extensions[La]=s);let{featureIds:i}=s,o={featureCount:t.length,propertyTable:n,data:t};i.push(o),r.addObjectExtension(e,La,s)}function pN(r,e){let t=e.extensions?.[La];if(!t)return;let n=t.featureIds;n.forEach((s,i)=>{if(s.data){let{accessorKey:o,index:a}=mN(e.attributes),c=new Uint32Array(s.data);n[i]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a};let u=r.addBufferView(c),l=r.addAccessor(u,{size:1,componentType:Yn(c),count:c.length});e.attributes[o]=l}})}function mN(r){let e="_FEATURE_ID_",t=Object.keys(r).filter(i=>i.indexOf(e)===0),n=-1;for(let i of t){let o=Number(i.substring(e.length));o>n&&(n=o)}return n++,{accessorKey:`${e}${n}`,index:n}}var La,aN,YS=p(()=>{"use strict";gu();Xe();zd();ai();La="EXT_mesh_features",aN=La});var Ry={};J(Ry,{createExtStructuralMetadata:()=>VN,decode:()=>gN,encode:()=>yN,name:()=>bN});async function gN(r,e,t){let n=new ie(r),s=n.getExtension(yo);if(e.gltf?.loadBuffers&&s?.schemaUri&&!s.schema){if(!t?.fetch)throw new Error("EXT_structural_metadata: a loader context is required to load schemaUri");let i=Jn(s.schemaUri,e,t),o=await t.fetch(i);if(!o.ok)throw new Error(`EXT_structural_metadata: failed to load schemaUri ${i} (${o.status})`);s.schema=await o.json()}wN(n,e)}function yN(r,e){let t=new yn(r);return UN(t,e),t.createBinaryChunk(),t.gltf}function wN(r,e){if(!e.gltf?.loadBuffers)return;let t=r.getExtension(yo);t&&(e.gltf?.loadImages&&xN(r,t),TN(r,t))}function xN(r,e){let t=e.propertyTextures,n=r.data;if(t&&n.meshes)for(let s of n.meshes)for(let i of s.primitives)_N(r,t,i,e)}function TN(r,e){let t=e.schema;if(!t)return;let n=t.classes,s=e.propertyTables;if(n&&s)for(let i of s)i.class&&n[i.class]&&vN(r,t,i)}function _N(r,e,t,n){if(!e)return;let i=t.extensions?.[yo]?.propertyTextures;if(i)for(let o of i){let a=e[o];AN(r,a,t,n)}}function AN(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let i in e.properties){let o=`${s}_${i}`,a=e.properties?.[i];if(!a)continue;a.data||(a.data=[]);let c=a.data,u=Ea(r,a,t);u!==null&&(jd(r,o,u,c,t),a.data=c,n.dataAttributeNames.push(o))}}function vN(r,e,t){let n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);let s=t.count;for(let i in n.properties){let o=n.properties[i],a=t.properties?.[i];if(a){let c={},u=IN(r,e,o,s,a,c);a.data=u,c.value!==void 0&&Object.defineProperty(a,"rawData",{value:c.value,configurable:!0,enumerable:!1,writable:!0})}}}function IN(r,e,t,n,s,i){let o=[],a=s.values,c=r.getTypedArrayForBufferView(a),u=EN(r,t,s,n),l=LN(r,t,s,n,u);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{let f=BN(t,s,n,c,u);o=f.data,i&&(i.value=f.rawData);break}case"BOOLEAN":{o=SN(t,n,c,u);break}case"STRING":{o=Gd(n,c,u,l,t.array?t.count:void 0);break}case"ENUM":{o=DN(e,t,n,c,u);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return o}function SN(r,e,t,n){return r.array?n?Array.from({length:e},(s,i)=>{let o=Number(n[i]),a=Number(n[i+1]);if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<o)throw new Error("EXT_structural_metadata: invalid BOOLEAN array offsets");return Oy(t,o,a-o)}):r.count===void 0?[]:Array.from({length:e},(s,i)=>Oy(t,i*r.count,r.count)):Oy(t,0,e)}function Oy(r,e,t){if(e+t>r.byteLength*8)throw new Error("EXT_structural_metadata: BOOLEAN values exceed their buffer view");return Array.from({length:t},(n,s)=>{let i=e+s;return!!(r[Math.floor(i/8)]&1<<i%8)})}function EN(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?Ia(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function LN(r,e,t,n,s){if(typeof t.stringOffsets<"u"){let i=s?Number(s[n]):n*(e.array&&e.count||1);return Ia(r,t.stringOffsets,t.stringOffsetType||"UINT32",i)}return null}function BN(r,e,t,n,s){let i=r.array,o=r.count,a={VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}[r.type]||1,c=yu(r.type,r.componentType),u=n.byteLength/c,l;r.componentType?l=Sa(n,r.type,r.componentType,u):l=n;let f=l,d=e.offset??r.offset,h=e.scale??r.scale,m=r.normalized||d!==void 0||h!==void 0?FN(f,r.componentType,r.type,r.normalized,d,h):f;return i?s?{data:wu(m,t,s,a),rawData:wu(f,t,s,a)}:o?{data:xu(m,t,o,a),rawData:xu(f,t,o,a)}:{data:[],rawData:[]}:{data:m,rawData:f}}function FN(r,e,t,n,s,i){let o=MN(e),a=!!(n&&o!==void 0);if(!a&&s===void 0&&i===void 0)return r;let c=ON(t),u=new Float64Array(r.length);for(let l=0;l<r.length;l++){let f=Number(r[l]);a&&(f=e?.startsWith("INT")?Math.max(f/o,-1):f/o);let d=l%c,h=Array.isArray(s)?s[d]??0:s??0,m=Array.isArray(i)?i[d]??1:i??1;u[l]=f*m+h}return u}function ON(r){switch(r){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}}function MN(r){switch(r){case"INT8":return 127;case"UINT8":return 255;case"INT16":return 32767;case"UINT16":return 65535;case"INT32":return 2147483647;case"UINT32":return 4294967295;case"INT64":return 2**63-1;case"UINT64":return 2**64-1;default:return}}function DN(r,e,t,n,s){let i=e.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=r.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let a=o.valueType||"UINT16",c=yu(e.type,a),u=n.byteLength/c,l=Sa(n,e.type,a,u);if(l||(l=n),e.array){if(s)return RN({valuesData:l,numberOfElements:t,arrayOffsets:s,enumEntry:o});let f=e.count;return f?kN(l,t,f,o):[]}return Dy(l,0,t,o)}function RN(r){let{valuesData:e,numberOfElements:t,arrayOffsets:n,enumEntry:s}=r,i=[];for(let o=0;o<t;o++){let a=Number(n[o]),c=Number(n[o+1])-a;if(!Number.isInteger(a)||!Number.isInteger(c)||a<0||c<0||a+c>e.length)break;let u=Dy(e,a,c,s);i.push(u)}return i}function kN(r,e,t,n){let s=[];for(let i=0;i<e;i++){let o=t*i,a=Dy(r,o,t,n);s.push(a)}return s}function Dy(r,e,t,n){let s=[];for(let i=0;i<t;i++){let o=r[e+i],a=NN(n,o);a?s.push(a.name):s.push("")}return s}function NN(r,e){for(let t of r.values)if(typeof e=="bigint"?Number.isSafeInteger(t.value)&&BigInt(t.value)===e:t.value===e)return t;return null}function UN(r,e){let t=r.getExtension(yo);if(t&&t.propertyTables)for(let n of t.propertyTables){let s=n.class,i=t.schema?.classes?.[s];n.properties&&i&&PN(n,i,r)}}function PN(r,e,t){for(let n in r.properties){let s=r.properties[n].data;if(s){let i=e.properties[n];if(i){let o=zN(s,i,t);r.properties[n]=o}}}}function VN(r,e,t=CN){let n=r.getExtension(yo);n||(n=r.addExtension(yo)),n.schema=jN(e,t,n.schema);let s=GN(e,t,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function jN(r,e,t){let n=t??{id:"schema_id"},s={properties:{}};for(let i of r){let o={type:i.elementType,componentType:i.componentType};s.properties[i.name]=o}return n.classes={},n.classes[e]=s,n}function GN(r,e,t){let n={class:e,count:0},s=0,i=t.classes?.[e];for(let o of r){if(s===0&&(s=o.values.length),s!==o.values.length&&o.values.length)throw new Error("Illegal values in attributes");i?.properties[o.name]&&(n.properties||(n.properties={}),n.properties[o.name]={values:0,data:o.values})}return n.count=s,n}function zN(r,e,t){let n={values:0};if(e.type==="STRING"){let{stringData:s,stringOffsets:i}=qN(r);n.stringOffsets=My(i,t),n.values=My(s,t)}else if(e.type==="SCALAR"&&e.componentType){let s=$N(r,e.componentType);n.values=My(s,t)}return n}function $N(r,e){let t=[];for(let s of r)t.push(Number(s));let n=WN[e];if(!n)throw new Error("Illegal component type");return new n(t)}function qN(r){let e=new TextEncoder,t=[],n=0;for(let c of r){let u=e.encode(c);n+=u.length,t.push(u)}let s=new Uint8Array(n),i=[],o=0;for(let c of t)s.set(c,o),i.push(o),o+=c.length;i.push(o);let a=new Uint32Array(i);return{stringData:s,stringOffsets:a}}function My(r,e){return e.addBufferView(r)}var yo,bN,CN,WN,QS=p(()=>{"use strict";gu();Xe();zd();pu();yo="EXT_structural_metadata",bN=yo;CN="schemaClassId";WN={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array}});var Ny={};J(Ny,{SPZ_COMPRESSION_EXTENSION_NAME:()=>Tu,decode:()=>HN,getGaussianSplatPrimitives:()=>ZS,name:()=>ky});async function HN(r,e,t){let n=t?.loaders?.find(o=>o.extensions?.includes("spz")),s=ZS(r),i=new ie(r);for(let[o,a]of(r.json.meshes||[]).entries())for(let[c,u]of a.primitives.entries()){let l=u.extensions?.[ky];if(!l)continue;let f=s.find(b=>b.meshIndex===o&&b.primitiveIndex===c),d=e?.gltf?.legacyGaussianSplatColorSpace,h=d&&l.extensions?.[Tu]?{...l,kernel:l.kernel??"ellipse",colorSpace:l.colorSpace??d}:l;f&&(f.extension=h),JN(r.json,u,h,o,c,i);let m=l.extensions?.[Tu];if(m&&f){let b=e?.gltf?.splatDecoder,g=r.json.bufferViews?.[m.bufferView];if(g&&r.buffers[g.buffer])f.compressedBytes=XN(r,m.bufferView);else if(b||n)throw new Error(`KHR_gaussian_splatting: bufferView ${m.bufferView} is not loaded for SPZ2 decoding.`);n&&t&&f.compressedBytes?f.decoded=await Ys(f.compressedBytes.buffer,n,{...e,splats:{...e.splats,sourceCoordinateSystem:"LUF"}},t):b&&f.compressedBytes&&(f.decoded=await b(f.compressedBytes.buffer,{sourceCoordinateSystem:"LUF"}))}}s.length&&(r.gaussianSplatPrimitives=s)}function XN(r,e){let t=r.json.bufferViews?.[e];if(!t)throw new Error(`KHR_gaussian_splatting: bufferView ${e} is not defined.`);let n=r.buffers[t.buffer];if(!n)throw new Error(`KHR_gaussian_splatting: buffer ${t.buffer} is not loaded for SPZ2 payload.`);let s=n.byteOffset+(t.byteOffset||0);return new Uint8Array(n.arrayBuffer,s,t.byteLength).slice()}function ZS(r){let e="json"in r?r.json:r,t=[];for(let[n,s]of(e.meshes||[]).entries())for(let[i,o]of s.primitives.entries()){let a=o.extensions?.[ky];if(!a)continue;let c=a.extensions?.[Tu]?.bufferView;t.push({meshIndex:n,primitiveIndex:i,attributes:{...o.attributes},extension:a,compressedBufferView:c})}return t}function JN(r,e,t,n,s,i){if((e.mode??4)!==0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} must use POINTS mode.`);if(typeof t.kernel!="string"||t.kernel.length===0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} is missing kernel.`);if(typeof t.colorSpace!="string"||t.colorSpace.length===0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} is missing colorSpace.`);let o=t.extensions?.[Tu]?.bufferView;if(o!==void 0){if(!Number.isInteger(o)||o<0||o>=(r.bufferViews||[]).length)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has an invalid SPZ bufferView.`)}else for(let a of KN)if(e.attributes[a]===void 0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} is missing ${a}.`);for(let[a,c]of Object.entries(e.attributes))if(!Number.isInteger(c)||c<0||c>=(r.accessors||[]).length)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has invalid accessor ${a}.`);YN(r,e,i,n,s);for(let a=1;a<=3;a++){let c=a*2+1,u=Array.from({length:c},(l,f)=>e.attributes[`KHR_gaussian_splatting:SH_DEGREE_${a}_COEF_${f}`]!==void 0);if(u.some(Boolean)&&!u.every(Boolean))throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has incomplete SH degree ${a}.`);if(u.some(Boolean)&&a>1){let l=a-1,f=l*2+1;for(let d=0;d<f;d++)if(e.attributes[`KHR_gaussian_splatting:SH_DEGREE_${l}_COEF_${d}`]===void 0)throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} skips SH degree ${l}.`)}}}function YN(r,e,t,n,s){let i=e.attributes["KHR_gaussian_splatting:SCALE"],o=e.attributes["KHR_gaussian_splatting:OPACITY"];for(let[a,c,u]of[["KHR_gaussian_splatting:SCALE",i,l=>l>=0],["KHR_gaussian_splatting:OPACITY",o,l=>l>=0&&l<=1]]){if(c===void 0||!QN(r,t,c))continue;let l=t.getTypedArrayForAccessor(c);for(let f=0;f<l.length;f++)if(!u(Number(l[f])))throw new Error(`KHR_gaussian_splatting: mesh ${n} primitive ${s} has an invalid ${a} value.`)}}function QN(r,e,t){let n=r.accessors?.[t],s=n?.bufferView===void 0?void 0:r.bufferViews?.[n.bufferView];return!!(s&&e.gltf.buffers[s.buffer])}var ky,Tu,KN,eE=p(()=>{"use strict";Be();Xe();ky="KHR_gaussian_splatting",Tu="KHR_gaussian_splatting_compression_spz_2",KN=["POSITION","KHR_gaussian_splatting:ROTATION","KHR_gaussian_splatting:SCALE","KHR_gaussian_splatting:OPACITY","KHR_gaussian_splatting:SH_DEGREE_0_COEF_0"]});var Uy={};J(Uy,{decode:()=>ZN,getVoxelPrimitives:()=>eC,name:()=>Cy});async function ZN(r){for(let[e,t]of(r.json.meshes||[]).entries())for(let[n,s]of t.primitives.entries()){let i=s.extensions?.[Cy];i&&tC(r.json,s,i,e,n)}}function eC(r){let e="json"in r?r.json:r,t=[];for(let[n,s]of(e.meshes||[]).entries())for(let[i,o]of s.primitives.entries()){let a=o.extensions?.[Cy];a&&t.push({meshIndex:n,primitiveIndex:i,attributes:{...o.attributes},extension:a})}return t}function tC(r,e,t,n,s){if(!Number.isInteger(t.shape)||t.shape<0)throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} has invalid shape.`);if(!Array.isArray(t.dimensions)||t.dimensions.length!==3||t.dimensions.some(i=>!Number.isInteger(i)||i<=0))throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} must provide three positive dimensions.`);if(e.mode!==void 0&&e.mode!==2147483647)throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} must use voxel mode.`);for(let i of Object.keys(e.attributes)){let o=e.attributes[i];if(!Number.isInteger(o)||o<0||o>=(r.accessors||[]).length)throw new Error(`EXT_primitive_voxels: mesh ${n} primitive ${s} has invalid accessor ${i}.`)}}var Cy,tE=p(()=>{"use strict";Cy="EXT_primitive_voxels"});var Py={};J(Py,{decode:()=>nC,getPrimitiveRestartRanges:()=>Wd,name:()=>ui});async function nC(r,e){if(!r.json.extensionsUsed?.includes(ui))return;if(!r.json.extensionsRequired?.includes(ui))throw new Error(`${ui} must be declared in extensionsRequired`);if(!e.gltf?.loadBuffers)return;let t=new ie(r);for(let n of t.meshes)for(let s of t.getReferences(n).primitives)sC(t,s)}function sC(r,e){if(e.indices===void 0)return;let t=e.indices,n=typeof t=="number"?r.data.accessors?.[t]:t;if(!n)throw new Error(`${ui}: primitive references missing indices accessor ${e.indices}`);let s=iC(n),i=r.getTypedArrayForAccessor(e.indices),o=Array.prototype.includes.call(i,s);if(!rC.has(e.mode??4)){if(o)throw new Error(`${ui}: primitive restart is not valid for mode ${e.mode??4}`);return}Object.defineProperty(e,"primitiveRestart",{configurable:!0,enumerable:!1,writable:!0,value:{restartIndex:s,ranges:Wd(i,s)}})}function iC(r){if(r.type!=="SCALAR")throw new Error(`${ui}: indices accessor must have SCALAR type`);switch(r.componentType){case 5121:return 255;case 5123:return 65535;case 5125:return 4294967295;default:throw new Error(`${ui}: indices accessor must use an unsigned integer component type`)}}function Wd(r,e){let t=[],n=0;for(let s=0;s<=r.length;s++)(s===r.length||r[s]===e)&&(s>n&&t.push({offset:n,count:s-n}),n=s+1);return t}var ui,rC,Vy=p(()=>{"use strict";Xe();ui="KHR_mesh_primitive_restart",rC=new Set([2,3,5,6])});var jy={};J(jy,{decode:()=>oC,name:()=>qt});async function oC(r,e){if(!e.gltf?.loadBuffers)return;let t=new ie(r);for(let n of t.meshes)for(let s of t.getReferences(n).primitives){let i=t.getExtension(s,qt);i&&Object.defineProperty(i,"data",{configurable:!0,enumerable:!1,writable:!0,value:aC(t,s,i)})}}function aC(r,e,t){if(!Number.isInteger(t.count)||t.count<1)throw new Error(`${qt}: count must be a positive integer`);if((e.mode??4)!==4||e.indices===void 0)throw new Error(`${qt}: primitive must use TRIANGLES mode with indices`);let n=$d(r,e.indices,"indices"),s=$d(r,t.indicesOffsets,"indicesOffsets",t.count),i=$d(r,t.loopIndices,"loopIndices"),o=$d(r,t.loopIndicesOffsets,"loopIndicesOffsets",t.count),a=r.data.accessors?.[t.loopIndices],c=cC(a.componentType);rE(s,n.length,"indicesOffsets"),rE(o,i.length,"loopIndicesOffsets");let u=[];for(let l=0;l<t.count;l++){let f=Number(s[l]),d=l+1<t.count?Number(s[l+1]):n.length,h=Number(o[l]),m=l+1<t.count?Number(o[l+1]):i.length,b=Array.from(i).slice(h,m),g=Wd(b,c).map(y=>({offset:y.offset+h,count:y.count}));if((d-f)%3!==0)throw new Error(`${qt}: polygon ${l} triangle range must contain complete triangles`);if(g.length===0)throw new Error(`${qt}: polygon ${l} must contain at least one loop`);if(g.some(y=>y.count<3))throw new Error(`${qt}: polygon ${l} loops must contain at least three indices`);u.push({triangleRange:{offset:f,count:d-f},loopRanges:g})}return{indicesOffsets:s,loopIndices:i,loopIndicesOffsets:o,polygons:u}}function $d(r,e,t,n){if(typeof e=="number"&&(!Number.isInteger(e)||e<0))throw new Error(`${qt}: ${t} must reference an accessor`);let s=typeof e=="number"?r.data.accessors?.[e]:e;if(!s)throw new Error(`${qt}: ${t} references missing accessor ${e}`);if(s.type!=="SCALAR"||![5121,5123,5125].includes(s.componentType))throw new Error(`${qt}: ${t} must be an unsigned integer SCALAR accessor`);if(n!==void 0&&s.count!==n)throw new Error(`${qt}: ${t} count must equal polygon count ${n}`);return r.getTypedArrayForAccessor(e)}function rE(r,e,t){if(Number(r[0])!==0)throw new Error(`${qt}: ${t} must begin at zero`);let n=-1;for(let s=0;s<r.length;s++){let i=Number(r[s]);if(!Number.isInteger(i)||i<0||i>=e||i<=n)throw new Error(`${qt}: ${t} must contain increasing in-bounds offsets`);n=i}}function cC(r){switch(r){case 5121:return 255;case 5123:return 65535;case 5125:return 4294967295;default:throw new Error(`${qt}: unsupported loop index component type ${r}`)}}var qt,nE=p(()=>{"use strict";Xe();Vy();qt="EXT_mesh_polygon"});var Gy={};J(Gy,{decode:()=>uC,getSpatialAudio:()=>sE,name:()=>Ba});function sE(r){let e="asset"in r?r:r.json,t=[],n=e.extensions?.[Ba];n&&t.push({nodeIndex:null,extension:n});for(let[s,i]of(e.nodes||[]).entries()){let o=i.extensions?.[Ba];o&&t.push({nodeIndex:s,extension:o})}return t}async function uC(r){let e=sE(r);for(let{extension:t,nodeIndex:n}of e){let s=n===null?"root":`node ${n}`;for(let i of t.sources||[]){if(!Array.isArray(i.accessors)||i.accessors.length===0)throw new Error(`${Ba}: ${s} source ${i.id} requires audio accessors.`);for(let o of i.accessors)if(!Number.isInteger(o)||o<0||!r.json.accessors?.[o])throw new Error(`${Ba}: ${s} source ${i.id} has invalid accessor ${o}.`);if(i.reverbFeedGain&&i.reverbFeedGain.length!==(i.reverbFeed?.length||0))throw new Error(`${Ba}: ${s} source ${i.id} has mismatched reverb feed gains.`)}}e.length&&(r.spatialAudio=e)}var Ba,iE=p(()=>{"use strict";Ba="MPEG_audio_spatial"});var zy={};J(zy,{decode:()=>lC,name:()=>Kt});async function lC(r,e,t){let n=r.json.extensions?.[Kt],s=(n?.audio||[]).map(c=>({audio:c})),i=n?.sources||[],o=n?.emitters||[];for(let c of i)c.audio!==void 0&&qd(s,c.audio,"audio");for(let c of o){if(c.type!=="global"&&c.type!=="positional")throw new Error(`${Kt}: invalid emitter type ${c.type}.`);if(c.type==="global"&&c.positional!==void 0)throw new Error(`${Kt}: global emitters cannot have positional settings.`);for(let u of c.sources||[])qd(i,u,"source")}let a=[];for(let c of["nodes","scenes"])for(let[u,l]of(r.json[c]||[]).entries()){let f=l.extensions?.[Kt];if(f){if(!Array.isArray(f.emitters)||!f.emitters.length)throw new Error(`${Kt}: ${c} ${u} requires emitters.`);for(let d of f.emitters){let h=qd(o,d,"emitter");if(c==="scenes"&&h.type!=="global")throw new Error(`${Kt}: scenes may only reference global emitters.`);a.push({emitterIndex:d,nodeIndex:c==="nodes"?u:null,sceneIndex:c==="scenes"?u:null,emitter:h,sources:(h.sources||[]).map(m=>{let b=i[m];return{sourceIndex:m,source:b,clip:b.audio===void 0?void 0:s[b.audio]}})})}}}if(n){for(let c of s)fC(r,c);e.gltf?.loadAudio!==!1&&await Promise.all(s.map(c=>dC(r,c,e,t))),r.audioClips=s,r.audioEmitters=a}}function qd(r,e,t){if(!Number.isInteger(e)||e<0||!r[e])throw new Error(`${Kt}: invalid ${t} index ${e}.`);return r[e]}function fC(r,e){let{audio:t}=e;if(t.bufferView!==void 0){if(qd(r.json.bufferViews||[],t.bufferView,"bufferView"),!t.mimeType)throw new Error(`${Kt}: buffer-view audio requires mimeType.`)}else if(!t.uri)throw new Error(`${Kt}: audio requires a uri or bufferView.`)}async function dC(r,e,t,n){let{audio:s}=e;if(s.bufferView!==void 0){let a=r.json.bufferViews[s.bufferView],c=r.buffers[a.buffer];if(!c){if(t.gltf?.loadBuffers===!1)return;throw new Error(`${Kt}: audio buffer ${a.buffer} is not loaded.`)}let u=a.byteOffset??0,l=a.byteLength;if(!Number.isSafeInteger(u)||u<0||!Number.isSafeInteger(l)||l<0||u+l>c.byteLength||c.byteOffset+u+l>c.arrayBuffer.byteLength)throw new Error(`${Kt}: audio bufferView exceeds its buffer.`);e.data=new Uint8Array(c.arrayBuffer,c.byteOffset+u,l);return}if(!n?.fetch)throw new Error(`${Kt}: a loader context is required to load audio.`);let i=Jn(s.uri,t,n),o=await n.fetch(i);if(!o.ok)throw new Error(`${Kt}: failed to load audio ${i} (${o.status}).`);e.url=i,e.data=new Uint8Array(await o.arrayBuffer())}var Kt,oE=p(()=>{"use strict";pu();Kt="KHR_audio_emitter"});var aE={};J(aE,{MeshoptDecoder:()=>hC});var hC,cE=p(()=>{"use strict";hC=(function(){var r="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq;X8:kdbk:kYi5ud9:du8Jjjjjbcjq9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCaAcethXaxaDfhiaOaeaoaeao6E9RhQalcl4cifcd4hLazcjdfaAfhKcbhYabaOad2fg8AhEaHh3incbh5dnawTmbaxaYcd4fRbbh5kcbh8Eazcjdfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcjdfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcjdfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaL6mva8FaLfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasaYcd4fRbbgociGPlbedrbkaATmdazaYfh8Fazcjdfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeazaYfhaazcjdfhhcbhoceh8EaKh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaQaocefgofmbka8FaXfh8FcdhoaacdfhaahaXfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8EazaYfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaKhainazcjdfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3aYclfgYad6mbkaza8AaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcjqf8Kjjjjbaok:bsesu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhDaicefgiarfhqdndnaeci9pmbaqhexekcmcsawceSEhkcbhxcbhmaqhecbhlcbhoindndnaiRbbgrc;Ve0mbavc;abfaoarcu7gPcl4fcsGcitfgwydlhsawydbhzdndnarcsGgwak9pmbavalaPfcsGcdtfydbaxawEhraxawTgHfhxxekdnaeaD9nmbc9:hoxokdndnawcsSmbcehHamawcetfcWfhrxekaecefhrae8SbbgwcFeGhPdndnawcu9mmbarhexekaecvfheaPcFbGhPcrhwdninar8SbbgHcFbGawtaPVhPaHcu9kmearcefhrawcrfgwc8J9hmbxdkkarcefhekcehHaPce4cbaPceG9R7amfhrkarhmkavc;abfaocitfgwarBdbawasBdlavalcdtfarBdbavc;abfaocefcsGcitfgwazBdbawarBdlaocdfhoaHalfhldnadcd9hmbabar87elabas87edabaz87ebabcofhbxdkabarBdwabasBdlabazBdbabcxfhbxekdnarcpe0mbavalaDarcsGfRbbgwcl4gP9RcsGcdtfydbaxcefgsaPEhravalaw9RcsGcdtfydbasaPTgzfgsawcsGgPEhwaPThPdndnadcd9hmbabaw87elabar87edabax87ebcohHxekabawBdwabarBdlabaxBdbcxhHkavalcdtfaxBdbavc;abfaocitfgOarBdbaOaxBdlavalcefglcsGcdtfarBdbavc;abfaocefcsGcitfgOawBdbaOarBdlavalazfglcsGcdtfawBdbavc;abfaocdfcsGcitfgraxBdbarawBdlaocifhoabaHfhbalaPfhlasaPfhxxekdnaeaD9nmbc9:hoxlkaxcbaeRbbgwEgHarc;:eSgrfhsawcsGhOdndnawcl4gAmbascefhzxekashzavalaA9RcsGcdtfydbhskdndnaOmbazcefhxxekazhxavalaw9RcsGcdtfydbhzkdndnarTmbaecefhrxekaecdfhrae8SbegPcFeGhwdnaPcu9kmbaecofhHawcFbGhwcrhedninar8SbbgPcFbGaetawVhwaPcu9kmearcefhraecrfgec8J9hmbkaHhrxekarcefhrkawce4cbawceG9R7amfgmhHkdndnaAcsSmbarhwxekarcefhwar8SbbgecFeGhPdnaecu9kmbarcvfhsaPcFbGhPcrhedninaw8SbbgrcFbGaetaPVhParcu9kmeawcefhwaecrfgec8J9hmbkashwxekawcefhwkaPce4cbaPceG9R7amfgmhskdndnaOcsSmbawhexekawcefheaw8SbbgrcFeGhPdnarcu9kmbawcvfhzaPcFbGhPcrhrdninae8SbbgwcFbGartaPVhPawcu9kmeaecefhearcrfgrc8J9hmbkazhexekaecefhekaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabaz87elabas87edabaH87ebcohrxekabazBdwabasBdlabaHBdbcxhrkavc;abfaocitfgwasBdbawaHBdlavalcdtfaHBdbavc;abfaocefcsGcitfgwazBdbawasBdlavalcefglcsGcdtfasBdbavc;abfaocdfcsGcitfgwaHBdbawazBdlavalaATaAcsSVfglcsGcdtfazBdbalaOTaOcsSVfhlaocifhoabarfhbkaocsGhoalcsGhlaicefgiaq6mbkkcbc99aeaDSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:I9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:SBlEud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fgOavcjdfasaeaH9RaHasfae6EgAaAcsfgoc9WGgCSEhXaPaDfhQaocl4cifcd4hLavcj;cbfaCcetfhKavcj;cbfaCci2fhYavcj;cbfaCfh8AcbhEaoc;ab6h3incbh5dnawTmbaPaEcd4fRbbh5kcbh8Eavcj;cbfh8Findndndndna5a8Ecet4ciGgoc9:fPdebdkaxaQ9RaC6mwdnaCTmbavcj;cbfa8EaC2faQaC;8qbbkaQaAfhQxdkaCTmeavcj;cbfa8EaC2fcbaC;8kbxekaxaQ9RaL6moaoclVcbawEhraQaLfhocbhidna3mbaxao9Rc;Gb6mbcbhlina8FalfhidndndndndndnaQalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaoclffa8JRb:q:W:cjbfhoxikaiaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaocwffa8JRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbagaocdffa8JRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaoclffa8JRb:q:W:cjbfhoxikaiczfaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaocwffa8JRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbagaocdffa8JRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaoclffa8JRb:q:W:cjbfhoxikaicafaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbagaocwffa8JRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbagaocdffa8JRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsaap5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsaap5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaC0meaihlaxao9Rc;Fb0mbkkdnaiaC9pmbaici4hlinaxao9RcK6mwa8FaifhqdndndndndndnaQaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLgacdp:meaapmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9oghpxiiiiiiiiiiiiiiiip8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spkbbagaoclffa8JRb:q:W:cjbfhoxikaqaopbbwaopbbbgaclp:meaapmbzeHdOiAlCvXoQrLpxssssssssssssssssp9oghpxssssssssssssssssp8Jgap5b9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbagRb:q:W:cjbggpsaap5e9cjF;8;4;W;G;ab9:9cU1:Ng8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPahaap9spkbbagaocwffa8JRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbggcitpbi:q:G:cjbagRb:q:W:cjbggpsaoRbeg8Jcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbagaocdffa8JRb:q:W:cjbfhokalcdfhlaiczfgiaC6mbkkaohQaoTmoka8FaCfh8Fa8Ecefg8Ecl9hmbkdndndndnawTmbazaEcd4fRbbglciGPlbedwbkaCTmdaXaEfhlavaEfpbdbh8Kcbhoinalavcj;cbfaofpblbg8La8Aaofpblbg8MpmbzeHdOiAlCvXoQrLg8NaKaofpblbgyaYaofpblbg8PpmbzeHdOiAlCvXoQrLgIpmbezHdiOAlvCXorQLgacep9Taapxeeeeeeeeeeeeeeeeghp9op9Hp9rgaa8Kp9Ug8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp9Ug8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp9Ug8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9Abbbaladfgla8Ka8NaIpmwDKYqk8AExm35Ps8E8Fgacep9Taaahp9op9Hp9rgap9Ug8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp9Ug8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp9Ug8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9Abbbaladfgla8Ka8La8MpmwKDYq8AkEx3m5P8Es8Fg8Laya8PpmwKDYq8AkEx3m5P8Es8Fg8MpmbezHdiOAlvCXorQLgacep9Taaahp9op9Hp9rgap9Ug8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp9Ug8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp9Ug8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9Abbbaladfgla8Ka8La8MpmwDKYqk8AExm35Ps8E8Fgacep9Taaahp9op9Hp9rgap9Ughp9Abbbaladfglahaaaapmlvorlvorlvorlvorp9Ughp9AbbbaladfglahaaaapmwDqkwDqkwDqkwDqkp9Ughp9AbbbaladfglahaaaapmxmPsxmPsxmPsxmPsp9Ug8Kp9AbbbaladfhlaoczfgoaC6mbxikkaCTmeaXaEfhlavaEfpbdbh8Kcbhoinalavcj;cbfaofpblbg8La8Aaofpblbg8MpmbzeHdOiAlCvXoQrLg8NaKaofpblbgyaYaofpblbg8PpmbzeHdOiAlCvXoQrLgIpmbezHdiOAlvCXorQLgacep:neaapxebebebebebebebebghp9op:bep9rgaa8Kp:oeg8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp:oeg8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp:oeg8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9Abbbaladfgla8Ka8NaIpmwDKYqk8AExm35Ps8E8Fgacep:neaaahp9op:bep9rgap:oeg8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp:oeg8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp:oeg8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9Abbbaladfgla8Ka8La8MpmwKDYq8AkEx3m5P8Es8Fg8Laya8PpmwKDYq8AkEx3m5P8Es8Fg8MpmbezHdiOAlvCXorQLgacep:neaaahp9op:bep9rgap:oeg8Kp9Abbbaladfgla8Kaaaapmlvorlvorlvorlvorp:oeg8Kp9Abbbaladfgla8KaaaapmwDqkwDqkwDqkwDqkp:oeg8Kp9Abbbaladfgla8KaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9Abbbaladfgla8Ka8La8MpmwDKYqk8AExm35Ps8E8Fgacep:neaaahp9op:bep9rgap:oeghp9Abbbaladfglahaaaapmlvorlvorlvorlvorp:oeghp9AbbbaladfglahaaaapmwDqkwDqkwDqkwDqkp:oeghp9AbbbaladfglahaaaapmxmPsxmPsxmPsxmPsp:oeg8Kp9AbbbaladfhlaoczfgoaC6mbxdkkaCTmbaXaEfhrcbhocbalcl4gl9Rc8FGhiavaEfpbdbhhinaravcj;cbfaofpblbg8Ka8Aaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaKaofpblbg8NaYaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLgaaip:Reaaalp:Tep9qgaahp9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9Abbbaradfgraha8Ma8PpmwDKYqk8AExm35Ps8E8Fgaaip:Reaaalp:Tep9qgap9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9Abbbaradfgraha8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLgaaip:Reaaalp:Tep9qgap9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9Abbbaradfgraha8Ka8LpmwDKYqk8AExm35Ps8E8Fgaaip:Reaaalp:Tep9qgap9rghp9Abbbaradfgrahaaaapmlvorlvorlvorlvorp9rghp9AbbbaradfgrahaaaapmwDqkwDqkwDqkwDqkp9rghp9AbbbaradfgrahaaaapmxmPsxmPsxmPsxmPsp9rghp9AbbbaradfhraoczfgoaC6mbkkaEclfgEad6mbkdnaXavcjdf9hmbaAad2goTmbaOavcjdfao;8qbbkdnammbavaXaAcufad2fad;8qbbkaAaHfhHc9:hoaQhPaQmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkpPesu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhDaicefgiarfhqdndnaeci9pmbaqhexekcmcsawceSEhkcbhxcbhmaqhecbhlcbhoindndnaiRbbgrc;Ve0mbavc;abfaoarcu7gPcl4fcsGcitfgwydlhsawydbhzdndnarcsGgwak9pmbavalaPfcsGcdtfydbaxawEhraxawTgHfhxxekdnaeaD9nmbc9:hoxokdndnawcsSmbcehHamawcetfcWfhrxekaecefhrae8SbbgwcFeGhPdndnawcu9mmbarhexekaecvfheaPcFbGhPcrhwdninar8SbbgHcFbGawtaPVhPaHcu9kmearcefhrawcrfgwc8J9hmbxdkkarcefhekcehHaPce4cbaPceG9R7amfhrkarhmkavc;abfaocitfgwarBdbawasBdlavalcdtfarBdbavc;abfaocefcsGcitfgwazBdbawarBdlaocdfhoaHalfhldnadcd9hmbabar87elabas87edabaz87ebabcofhbxdkabarBdwabasBdlabazBdbabcxfhbxekdnarcpe0mbavalaDarcsGfRbbgwcl4gP9RcsGcdtfydbaxcefgsaPEhravalaw9RcsGcdtfydbasaPTgzfgsawcsGgPEhwaPThPdndnadcd9hmbabaw87elabar87edabax87ebcohHxekabawBdwabarBdlabaxBdbcxhHkavalcdtfaxBdbavc;abfaocitfgOarBdbaOaxBdlavalcefglcsGcdtfarBdbavc;abfaocefcsGcitfgOawBdbaOarBdlavalazfglcsGcdtfawBdbavc;abfaocdfcsGcitfgraxBdbarawBdlaocifhoabaHfhbalaPfhlasaPfhxxekdnaeaD9nmbc9:hoxlkaxcbaeRbbgwEgHarc;:eSgrfhsawcsGhOdndnawcl4gAmbascefhzxekashzavalaA9RcsGcdtfydbhskdndnaOmbazcefhxxekazhxavalaw9RcsGcdtfydbhzkdndnarTmbaecefhrxekaecdfhrae8SbegPcFeGhwdnaPcu9kmbaecofhHawcFbGhwcrhedninar8SbbgPcFbGaetawVhwaPcu9kmearcefhraecrfgec8J9hmbkaHhrxekarcefhrkawce4cbawceG9R7amfgmhHkdndnaAcsSmbarhwxekarcefhwar8SbbgecFeGhPdnaecu9kmbarcvfhsaPcFbGhPcrhedninaw8SbbgrcFbGaetaPVhParcu9kmeawcefhwaecrfgec8J9hmbkashwxekawcefhwkaPce4cbaPceG9R7amfgmhskdndnaOcsSmbawhexekawcefheaw8SbbgrcFeGhPdnarcu9kmbawcvfhzaPcFbGhPcrhrdninae8SbbgwcFbGartaPVhPawcu9kmeaecefhearcrfgrc8J9hmbkazhexekaecefhekaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabaz87elabas87edabaH87ebcohrxekabazBdwabasBdlabaHBdbcxhrkavc;abfaocitfgwasBdbawaHBdlavalcdtfaHBdbavc;abfaocefcsGcitfgwazBdbawasBdlavalcefglcsGcdtfasBdbavc;abfaocdfcsGcitfgwaHBdbawazBdlavalaATaAcsSVfglcsGcdtfazBdbalaOTaOcsSVfhlaocifhoabarfhbkaocsGhoalcsGhlaicefgiaq6mbkkcbc99aeaDSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var s=WebAssembly.validate(t)?a(e):a(r),i,o=WebAssembly.instantiate(s,{}).then(function(y){i=y.instance,i.exports.__wasm_call_ctors()});function a(y){for(var x=new Uint8Array(y.length),T=0;T<y.length;++T){var _=y.charCodeAt(T);x[T]=_>96?_-97:_>64?_-39:_+4}for(var v=0,T=0;T<y.length;++T)x[v++]=x[T]<60?n[x[T]]:(x[T]-60)*64+x[++T];return x.buffer.slice(0,v)}function c(y,x,T,_,v,I,N){var K=y.exports.sbrk,ne=_+3&-4,be=K(ne*v),ke=K(I.length),Ne=new Uint8Array(y.exports.memory.buffer);Ne.set(I,ke);var ue=x(be,_,v,ke,I.length);if(ue==0&&N&&N(be,ne,v),T.set(Ne.subarray(be,be+_*v)),K(be-K(0)),ue!=0)throw new Error("Malformed buffer data: "+ue)}var u={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},f=[],d=0;function h(y){var x={object:new Worker(y),pending:0,requests:{}};return x.object.onmessage=function(T){var _=T.data;x.pending-=_.count,x.requests[_.id][_.action](_.value),delete x.requests[_.id]},x}function m(y){for(var x="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+g.name+";"+c.toString()+g.toString(),T=new Blob([x],{type:"text/javascript"}),_=URL.createObjectURL(T),v=f.length;v<y;++v)f[v]=h(_);for(var v=y;v<f.length;++v)f[v].object.postMessage({});f.length=y,URL.revokeObjectURL(_)}function b(y,x,T,_,v){for(var I=f[0],N=1;N<f.length;++N)f[N].pending<I.pending&&(I=f[N]);return new Promise(function(K,ne){var be=new Uint8Array(T),ke=++d;I.pending+=y,I.requests[ke]={resolve:K,reject:ne},I.object.postMessage({id:ke,count:y,size:x,source:be,mode:_,filter:v},[be.buffer])})}function g(y){var x=y.data;self.ready.then(function(T){if(!x.id)return self.close();try{var _=new Uint8Array(x.count*x.size);c(T,T.exports[x.mode],_,x.count,x.size,x.source,T.exports[x.filter]),self.postMessage({id:x.id,count:x.count,action:"resolve",value:_},[_.buffer])}catch(v){self.postMessage({id:x.id,count:x.count,action:"reject",value:v})}})}return{ready:o,supported:!0,useWorkers:function(y){m(y)},decodeVertexBuffer:function(y,x,T,_,v){c(i,i.exports.meshopt_decodeVertexBuffer,y,x,T,_,i.exports[u[v]])},decodeIndexBuffer:function(y,x,T,_){c(i,i.exports.meshopt_decodeIndexBuffer,y,x,T,_)},decodeIndexSequence:function(y,x,T,_){c(i,i.exports.meshopt_decodeIndexSequence,y,x,T,_)},decodeGltfBuffer:function(y,x,T,_,v,I){c(i,i.exports[l[v]],y,x,T,_,i.exports[u[I]])},decodeGltfBufferAsync:function(y,x,T,_,v){return f.length>0?b(y,x,T,l[_],u[v]):o.then(function(){var I=new Uint8Array(y*x);return c(i,i.exports[l[_]],I,y,x,T,i.exports[u[v]]),I})}}})()});function uE(){return Promise.resolve().then(()=>(cE(),aE))}var lE=p(()=>{"use strict"});async function pC(){return Kd||(Kd=uE().then(async({MeshoptDecoder:r})=>(await r.ready,r),r=>{throw Kd=void 0,new Error("Failed to load the packaged meshopt decoder.",{cause:r})})),Kd}function mC(r){return typeof r=="string"?r:["NONE","OCTAHEDRAL","QUATERNION","EXPONENTIAL","COLOR"][r]}async function fE(r,e,t,n,s,i="NONE"){(await pC()).decodeGltfBuffer(r,e,t,n,s,mC(i))}var Kd,dE=p(()=>{"use strict";lE()});async function Hd(r,e,t){if(!e.gltf?.decompressMeshes&&e.gltf?.decompressBufferViewIndices===void 0||!e.gltf?.loadBuffers)return;bC(r.json);let n=new ie(r),s=e.gltf.decompressBufferViewIndices,i=s?new Set(typeof s=="function"?s(r.json):s):void 0,o=Array.from(n.bufferViews),a=o.map((c,u)=>i?.has(u)===!1?Promise.resolve():gC(n,c,t));if(await Promise.all(a),i){for(let c of i){let u=o[c];u&&n.removeExtension(u,t)}return}for(let c of o)n.removeExtension(c,t);for(let c of n.buffers)n.removeExtension(c,t);n.removeExtension(t)}function bC(r){let e=r.bufferViews||[];for(let n=0;n<e.length;n++){let s=e[n].extensions;if(s?.KHR_meshopt_compression&&s.EXT_meshopt_compression)throw new Error(`glTF bufferView ${n} cannot use both KHR_meshopt_compression and EXT_meshopt_compression.`)}let t=r.buffers||[];for(let n=0;n<t.length;n++){let s=t[n].extensions;if(s?.KHR_meshopt_compression&&s.EXT_meshopt_compression)throw new Error(`glTF buffer ${n} cannot use both KHR_meshopt_compression and EXT_meshopt_compression.`)}}async function gC(r,e,t){let n=r.getExtension(e,t);if(!n)return;let{byteOffset:s=0,byteLength:i,byteStride:o,count:a,mode:c,filter:u="NONE",buffer:l}=n,f=r.gltf.buffers[l],d=r.gltf.buffers[e.buffer],h=new Uint8Array(f.arrayBuffer,f.byteOffset+s,i),m=new Uint8Array(d.arrayBuffer,d.byteOffset+(e.byteOffset||0),e.byteLength);await fE(m,a,o,h,c,u)}var Wy=p(()=>{"use strict";Xe();dE()});var $y={};J($y,{decode:()=>yC,name:()=>hE});async function yC(r,e){await Hd(r,e,hE)}var hE,pE=p(()=>{"use strict";Wy();hE="EXT_meshopt_compression"});var qy={};J(qy,{decode:()=>wC,name:()=>mE});async function wC(r,e){await Hd(r,e,mE)}var mE,bE=p(()=>{"use strict";Wy();mE="KHR_meshopt_compression"});var Ky={};J(Ky,{name:()=>xC,preprocess:()=>TC});function TC(r,e){let t=new ie(r);if(t.hasExtension(wo)){if(!Yg("image/webp")){if(t.isExtensionRequired(wo))throw new Error(`gltf: Required extension ${wo} not supported by browser`);return}for(let n of t.textures){let s=t.getExtension(n,wo);s&&(n.source=s.source),t.removeExtension(n,wo)}t.removeExtension(wo)}}var wo,xC,gE=p(()=>{"use strict";Xn();Xe();wo="EXT_texture_webp",xC=wo});var Hy={};J(Hy,{name:()=>_C,preprocess:()=>AC});async function AC(r,e){let t=new ie(r);if(!t.hasExtension(xo))return;if(!(await Jg()).has("image/avif")){if(t.isExtensionRequired(xo))throw new Error(`gltf: Required extension ${xo} not supported by browser`);return}for(let s of t.textures){let i=t.getExtension(s,xo);i&&(s.source=i.source),t.removeExtension(s,xo)}t.removeExtension(xo)}var xo,_C,yE=p(()=>{"use strict";Xn();Xe();xo="EXT_texture_avif",_C=xo});var Xy={};J(Xy,{decode:()=>IC,getDDSLoader:()=>_u,name:()=>To,preprocess:()=>vC});function _u(r){return r?.loaders?.find(e=>e.extensions?.includes("dds")||e.mimeTypes?.includes("image/vnd-ms.dds"))}function vC(r,e,t){let n=new ie(r);if(n.hasExtension(To)){if(!_u(t)){if(n.isExtensionRequired(To))throw new Error("gltf: Required extension MSFT_texture_dds needs a DDS parser");return}for(let s of n.textures){let i=n.getExtension(s,To);i&&(s.source=i.source)}}}async function IC(r,e,t){if(!_u(t)||e.gltf?.loadImages===!1)return;let n=new ie(r);if(n.hasExtension(To)){for(let s of n.textures)n.removeExtension(s,To);n.removeExtension(To)}}var To,Jy=p(()=>{"use strict";Xe();To="MSFT_texture_dds"});var Yy={};J(Yy,{name:()=>SC,preprocess:()=>EC});function EC(r,e){let t=new ie(r);for(let n of t.textures){let s=t.getExtension(n,Xd);s&&(n.source=s.source,t.removeExtension(n,Xd))}t.removeExtension(Xd)}var Xd,SC,wE=p(()=>{"use strict";Xe();Xd="KHR_texture_basisu",SC=Xd});var Au,Qy=p(()=>{"use strict";Au="5.0.0-beta.8"});var vu,Zy=p(()=>{"use strict";vu={name:"Draco",id:"draco",module:"scene",encoding:"binary",format:"draco",extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"]}});var xE,TE=p(()=>{"use strict";xE={backend:typeof WebAssembly=="object"?"wasm":"javascript",extraAttributes:{},attributeNameEntry:void 0,shape:"arrow-table",decoderProfile:"full"}});async function _o(r,e=null,t={},n=null,s=null){if(He&&t.useLocalLibraries&&!t.CDN&&n&&t.modules?.[n]===void 0){let i=no?"./libs":`modules/${e}/dist/libs`;t={...t,modules:{[n]:`${i}/${n}`,...s?{[s]:`${i}/${s}`}:{},...t.modules}}}return await pa(r,e,t,n,s)}var _E=p(()=>{"use strict";ti()});var LC,BC,Iu,AE,Ae,Ao,vE=p(()=>{"use strict";LC="1.5.7",BC="8786740086a9f4d83f44aa83badfbea4dce7a1b5",Iu=`https://www.gstatic.com/draco/versioned/decoders/${LC}`,AE=`https://cdn.jsdelivr.net/gh/google/draco@${BC}/javascript`,Ae={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",GLTF_DECODER:"draco_wasm_wrapper_gltf.js",GLTF_DECODER_WASM:"draco_decoder_gltf.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js",ENCODER_WASM:"draco_encoder.wasm"},Ao={[Ae.DECODER]:`${Iu}/${Ae.DECODER}`,[Ae.DECODER_WASM]:`${Iu}/${Ae.DECODER_WASM}`,[Ae.GLTF_DECODER]:`${Iu}/${Ae.GLTF_DECODER}`,[Ae.GLTF_DECODER_WASM]:`${Iu}/${Ae.GLTF_DECODER_WASM}`,[Ae.FALLBACK_DECODER]:`${Iu}/${Ae.FALLBACK_DECODER}`,[Ae.ENCODER]:`${AE}/${Ae.ENCODER}`,[Ae.ENCODER_WASM]:`${AE}/${Ae.ENCODER_WASM}`}});async function Jd(r={},e,t="full"){let n=DE(r);return n?await rw(n):await FC(r,e==="js"?"javascript":e,t)}async function FC(r={},e,t="full"){let n=RE(`${e}:${t}`,r),s=IE.get(n);return s||(s=OC(r,e,t),IE.set(n,s)),await s}async function rw(r){let e=RC(r),t=EE.get(e);return t||(t=ro(()=>e.createDecoderModule({}),n=>({draco:n})),EE.set(e,t)),await t}async function nw(r={}){let e=DE(r);if(e){let s=kC(e),i=LE.get(s);return i||(i=ro(()=>s.createEncoderModule({}),o=>({draco:o})),LE.set(s,i)),await i}let t=RE("encoder",r),n=SE.get(t);return n||(n=DC(r),SE.set(t,n)),await n}async function OC(r,e,t){try{return await FE(r,e,t)}catch(n){if(e==="javascript")throw n;try{return await FE(r,"javascript","full")}catch(s){throw new AggregateError([n,s],"Draco decoder could not load either the WebAssembly or JavaScript backend")}}}async function FE(r,e,t){let n=BE.then(()=>MC(r,e,t));return BE=n.then(()=>{},()=>{}),await n}async function MC(r,e,t){if(e==="javascript"){let o;try{o=await _o(Ao[Ae.FALLBACK_DECODER],"scene",r,Ae.FALLBACK_DECODER,"draco_decoder.mjs")}catch(c){if(He||r.useLocalLibraries)throw c;o=await _o(Ao[Ae.FALLBACK_DECODER],"scene",{...r,useLocalLibraries:!0},Ae.FALLBACK_DECODER,"draco_decoder.mjs")}let a=tw(o,"DracoDecoderModule")||globalThis.DracoDecoderModule;return await ew(a)}let n,s;try{[n,s]=await OE(r,t)}catch(o){if(He||r.useLocalLibraries)throw o;[n,s]=await OE({...r,useLocalLibraries:!0},t)}let i=tw(n,"DracoDecoderModule")||globalThis.DracoDecoderModule;return await ew(i,s)}async function OE(r,e){let t=e==="gltf"?Ae.GLTF_DECODER:Ae.DECODER,n=e==="gltf"?Ae.GLTF_DECODER_WASM:Ae.DECODER_WASM;return await Promise.all([_o(Ao[t],"scene",r,t,e==="gltf"?"draco_wasm_wrapper_gltf.mjs":"draco_wasm_wrapper.mjs"),_o(Ao[n],"scene",r,n)])}async function DC(r){let e,t;try{[e,t]=await ME(r)}catch(s){if(He||r.useLocalLibraries)throw s;[e,t]=await ME({...r,useLocalLibraries:!0})}let n=tw(e,"DracoEncoderModule")||globalThis.DracoEncoderModule;return await ew(n,t)}async function ME(r){return await Promise.all([_o(Ao[Ae.ENCODER],"scene",r,Ae.ENCODER,"draco_encoder.mjs"),_o(Ao[Ae.ENCODER_WASM],"scene",r,Ae.ENCODER_WASM)])}function ew(r,e){if(typeof r!="function")throw new Error("Draco module initializer could not be loaded");return ro(t=>r({...e?{wasmBinary:e}:{},onModuleLoaded:t}),t=>({draco:t}))}function tw(r,e){if(typeof r=="function")return r;if(r&&typeof r=="object"){let t=r,n=t[e]||t.default;return typeof n=="function"?n:void 0}}function DE(r){let e=r.modules?.draco3d;if(e){if(typeof e!="object"&&typeof e!="function")throw new Error("Invalid draco3d module");return e}}function RC(r){let e=r;if(typeof e?.createDecoderModule!="function")throw new Error("Invalid draco3d decoder module");return e}function kC(r){let e=r;if(typeof e?.createEncoderModule!="function")throw new Error("Invalid draco3d encoder module");return e}function RE(r,e){let t=Object.entries(e.modules||{}).filter(([n])=>n!=="draco3d").map(([n,s])=>`${n}:${String(s)}`).sort().join("|");return[r,e.useLocalLibraries?"local":"remote",e.CDN||"",t].join("|")}var IE,SE,EE,LE,BE,Su=p(()=>{"use strict";Be();_E();vE();IE=new Map,SE=new Map,EE=new WeakMap,LE=new WeakMap;BE=Promise.resolve()});function NE(r,e,t){let n=CE(e.metadata),s=[],i=NC(e.attributes);for(let o in r){let a=r[o],c=kE(o,a,i[o]);s.push(c)}if(t){let o=kE("indices",t);s.push(o)}return{fields:s,metadata:n}}function NC(r){let e={};for(let t in r){let n=r[t];e[n.name||"undefined"]=n}return e}function kE(r,e,t){let n={...wd(e),...t?CE(t.metadata):{}};return yd(r,e,n)}function CE(r){Object.entries(r);let e={};for(let t in r)e[`${t}.string`]=JSON.stringify(r[t]);return e}var UE=p(()=>{"use strict";gn()});function VC(r,e){switch(e){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32;default:return r.DT_INVALID}}function jC(r){let e=r.size(),t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function GC(r){let e=r.size(),t=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=r.GetValue(n);return t}function zC(r,e){if(!Object.prototype.hasOwnProperty.call(e,r))return r;let t=/^(.*)_([0-9]+)$/.exec(r),n=t?t[1]:r,s=t?BigInt(t[2])+1n:1n;for(;Object.prototype.hasOwnProperty.call(e,`${n}_${s}`);)s++;return`${n}_${s}`}function WC(r){if(r.quantization_transform){let{quantization_bits:e,min_values:t,range:n}=r.quantization_transform;if(e!==void 0&&t&&n!==void 0)return{type:"quantization",bits:e,origin:Array.from(t),range:n}}if(r.octahedron_transform?.quantization_bits!==void 0)return{type:"octahedron",bits:r.octahedron_transform.quantization_bits}}function $C(r){if(r.includeAttributes&&r.excludeAttributes)throw new Error("DracoLoader: includeAttributes and excludeAttributes cannot be combined")}function qC(r,e){for(let t of r.includeAttributes||r.excludeAttributes||[])if(!e.includes(t))throw new Error(`DracoLoader: selected attribute "${t}" does not exist`)}function KC(r){let e=Lr(r);if(!e)throw new Error("Decoded mesh is missing positions");let t=r.POSITION;if(t?.transform?.type!=="quantization")return e;let{bits:n,origin:s,range:i}=t.transform,o=i/(2**n-1);return e.map(a=>a.map((c,u)=>s[u]+c*o))}var PE,CC,UC,PC,Eu,VE=p(()=>{"use strict";Be();gn();UE();PE={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},CC={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},UC=2,PC=4,Eu=class{logger;draco;decoder;metadataQuerier;constructor(e,t=Kr()){this.logger=t,this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){$C(t);let n=ArrayBuffer.isView(e)?new Int8Array(e.buffer,e.byteOffset,e.byteLength):new Int8Array(e);this._disableAttributeTransforms(t);let s=this.decoder.GetEncodedGeometryType(n),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud,o=null;try{switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeArrayToMesh(n,n.byteLength,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeArrayToPointCloud(n,n.byteLength,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let d=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(d)}let a=this._getDracoLoaderData(i,s,t),c=this._getMeshData(i,a,t),u=KC(c.attributes),l=NE(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:u},...c,schema:l}}finally{o&&this.draco.destroy(o),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,t,n){let s=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(e,t){let n={};for(let s=0;s<e.num_attributes();s++){let i=this.decoder.GetAttribute(e,s),o=this._getAttributeMetadata(e,s);n[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,t);a&&(n[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,t);c&&(n[i.unique_id()].octahedron_transform=c)}return n}_getMeshData(e,t,n){let s=this._getMeshAttributes(t,e,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");return e instanceof this.draco.Mesh?n.topology==="triangle-strip"?{topology:"triangle-strip",mode:5,attributes:s,indices:{value:this._getTriangleStripIndices(e),size:1}}:{topology:"triangle-list",mode:4,attributes:s,indices:{value:this._getTriangleListIndices(e),size:1}}:{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(e,t,n){let s={},i={},a=Object.values(e.attributes).sort((c,u)=>c.attribute_index-u.attribute_index).map(c=>{let u=this._deduceAttributeName(c,n),l=zC(u,i);return i[l]=!0,c.name=l,{attributeName:l,loaderAttribute:c}});qC(n,Object.keys(i));for(let{attributeName:c,loaderAttribute:u}of a){if(!this._shouldExtractAttribute(c,u,n))continue;let l=this._getAttributeValues(t,u);if(l){let{value:f,size:d}=l;s[c]={value:f,size:d,byteOffset:u.byte_offset,byteStride:u.byte_stride,normalized:u.normalized,transform:WC(u)}}}return s}_shouldExtractAttribute(e,t,n){if(t.attribute_type===this.draco.POSITION){if(n.excludeAttributes?.includes(e))throw new Error(`DracoLoader: position attribute "${e}" cannot be excluded`);return!0}return n.includeAttributes&&!n.includeAttributes.includes(e)?!1:!n.excludeAttributes?.includes(e)}_getTriangleListIndices(e){let n=e.num_faces()*3,s=e.num_points()<=65536,i=n*(s?UC:PC),o=this.draco._malloc(i);try{if(s){if(!this.decoder.GetTrianglesUInt16Array(e,i,o))throw new Error("DRACO: Failed to decode triangle indices.");return new Uint16Array(this.draco.HEAPU8.buffer,o,n).slice()}if(!this.decoder.GetTrianglesUInt32Array(e,i,o))throw new Error("DRACO: Failed to decode triangle indices.");return new Uint32Array(this.draco.HEAPU8.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(e){let t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),GC(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){let n=CC[t.data_type];if(!n)return this.logger.warn(`DRACO: Unsupported attribute type ${t.data_type}`)(),null;let s=t.num_components,o=e.num_points()*s,a=o*n.BYTES_PER_ELEMENT,c=VC(this.draco,n),u,l=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(e,t.attribute_index);if(!this.decoder.GetAttributeDataArrayForAllPoints(e,f,c,a,l))throw new Error(`DRACO: Failed to decode attribute ${t.unique_id}.`);u=new n(this.draco.HEAPU8.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:u,size:s}}_deduceAttributeName(e,t){let n=e.unique_id;for(let[o,a]of Object.entries(t.extraAttributes||{}))if(a===n)return o;let s=t.attributeNameEntry||"name";if(e.metadata[s]){let o=e.metadata[s].string;return o==="COLOR"?"COLOR_0":o==="TEX_COORD"?"TEXCOORD_0":o}let i=e.attribute_type;for(let o in PE)if(this.draco[o]===i)return PE[o];return`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){let t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){let n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let t={},n=this.metadataQuerier.NumEntries(e);for(let s=0;s<n;s++){let i=this.metadataQuerier.GetEntryName(e,s);t[i]=this._getDracoMetadataField(e,i)}return t}_getDracoMetadataField(e,t){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);let s=jC(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){let{quantizedAttributes:t=[],octahedronAttributes:n=[]}=e,s=[...t,...n];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(e,t){let{quantizedAttributes:n=[]}=t,s=e.attribute_type();if(n.map(o=>this.draco[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:Float32Array.from({length:e.num_components()},(a,c)=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(e,t){let{octahedronAttributes:n=[]}=t,s=e.attribute_type();if(n.map(o=>this.draco[o]).includes(s)){let o=new this.draco.AttributeOctahedronTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}}});async function Fa(r,e,t,n){let s=n?.reportProgress||e?.onProgress;s?.({phase:"decode",completed:0,total:1,unit:"tasks"});let{draco:i}=await t();(e?.signal||n?.signal)?.throwIfAborted();let o=new Eu(i,Kr(e));try{let a=o.parseSync(r,e?.draco);return s?.({phase:"decode",completed:1,total:1,unit:"tasks"}),e?.draco?.shape==="arrow-table"?ii(a,"arrow-table"):a}finally{o.destroy()}}var Yd=p(()=>{"use strict";Be();gn();VE()});var Jne,HC,XC,jE=p(()=>{"use strict";ti();Su();Yd();Lu();({preload:Jne,...HC}=Qn),XC={...HC,parse:async(r,e,t)=>await Fa(r,e,async()=>await Jd(mn(e),"wasm",e?.draco?.decoderProfile),t)}});var sw={};J(sw,{DracoWASMLoaderWithParser:()=>XC});var iw=p(()=>{"use strict";jE()});var nse,JC,YC,GE=p(()=>{"use strict";ti();Su();Yd();Lu();({preload:nse,...JC}=Qn),YC={...JC,parse:async(r,e,t)=>await Fa(r,e,async()=>await Jd(mn(e),"js"),t)}});var ow={};J(ow,{DracoJavaScriptLoaderWithParser:()=>YC});var aw=p(()=>{"use strict";GE()});function e3(r){let e=r?.modules?.draco3d;if(!e)throw new Error('DracoLoader: backend "draco3d" requires options.modules.draco3d');return e}var use,QC,ZC,zE=p(()=>{"use strict";Su();Yd();Lu();({preload:use,...QC}=Qn),ZC={...QC,parse:async(r,e,t)=>await Fa(r,e,async()=>await rw(e3(e)),t)}});var cw={};J(cw,{Draco3DLoaderWithParser:()=>ZC});var uw=p(()=>{"use strict";zE()});async function t3(r,e){let t=e;switch(r3(t)){case"wasm":{let{DracoWASMLoaderWithParser:n}=await Promise.resolve().then(()=>(iw(),sw));return n}case"javascript":{let{DracoJavaScriptLoaderWithParser:n}=await Promise.resolve().then(()=>(aw(),ow));return n}case"draco3d":{let{Draco3DLoaderWithParser:n}=await Promise.resolve().then(()=>(uw(),cw));return n}default:throw new Error(`DracoLoader: unsupported backend "${t?.draco?.backend}"`)}}function r3(r){return r?.draco?.backend?r.draco.backend==="js"?"javascript":r.draco.backend:Qn.options.draco.backend}var Qn,Lu=p(()=>{"use strict";oa();Qy();Zy();TE();Qn={dataType:null,batchType:null,...vu,version:Au,worker:!0,workerSourceNode:"draco/workers/draco-worker-node.ts",serializeWorkerResult:Sf,deserializeWorkerResult:Ef,options:{draco:xE},preload:t3}});var WE=p(()=>{"use strict";Lu()});function $E(r){let e={};for(let t in r){let n=r[t];if(t!=="indices"){let s=lw(n);e[t]=s}}return e}function lw(r){let{buffer:e,size:t,count:n}=n3(r);return{value:e,size:t,byteOffset:0,count:n,type:va(t),componentType:Yn(e)}}function n3(r){let e=r,t=1,n=0;return r&&r.value&&(e=r.value,t=r.size||1),e&&(ArrayBuffer.isView(e)||(e=s3(e,Float32Array)),n=e.length/t),{buffer:e,size:t,count:n}}function s3(r,e,t=!1){return r?Array.isArray(r)?new e(r):t&&!(r instanceof e)?new e(r):r:null}var qE=p(()=>{"use strict";ai()});var fw={};J(fw,{decode:()=>a3,name:()=>i3,preprocess:()=>o3});function o3(r,e,t){let n=new ie(r);for(let s of n.meshes)for(let i of n.getReferences(s).primitives)n.getExtension(i,Oa)}async function a3(r,e,t){if(!e?.gltf?.decompressMeshes)return;let n=new ie(r),s=[];for(let i of n.meshes)for(let o of n.getReferences(i).primitives)n.getExtension(o,Oa)&&s.push(c3(n,o,e,t));await Promise.all(s),n.removeExtension(Oa)}async function c3(r,e,t,n){let s=r.getExtension(e,Oa);if(!s)return;let i=hr(r.data,r.gltf.buffers,s.bufferView),o=oo(i.buffer,i.byteOffset,i.byteLength),a={...t,draco:{...t.draco,shape:"mesh",topology:"triangle-list",decoderProfile:t.draco?.decoderProfile||"gltf",extraAttributes:s.attributes}};delete a["3d-tiles"];let c=await Ys(o,Qn,a,n),u=$E(c.attributes);for(let l of Object.keys(s.attributes))if(!Object.hasOwn(u,l))throw new Error(`glTF: Draco decompression did not produce attribute ${l}`);for(let[l,f]of Object.entries(u))if(l in e.attributes){let d=e.attributes[l],h=r.data.accessors?.[d];h?.normalized!==void 0&&(f.normalized=h.normalized),h?.min&&h?.max&&(f.min=h.min,f.max=h.max)}e.attributes={...e.attributes,...u},c.indices&&(e.indices=lw(c.indices),e.mode=4),r.removeExtension(e,Oa),u3(e)}function u3(r){if(!r.attributes||Object.keys(r.attributes).length===0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}var Oa,i3,KE=p(()=>{"use strict";Be();WE();Xe();qE();po();Oa="KHR_draco_mesh_compression",i3=Oa});var hw={};J(hw,{decode:()=>h3,name:()=>l3});async function h3(r,e){let t=new ie(r);if(!t.hasExtension(Ma)||!e.gltf?.loadBuffers)return;let s=r.json.materials||[];for(let i=0;i<s.length;i++)p3(i,r,t);s.some(i=>dw(i).length>0)||t.removeExtension(Ma)}function p3(r,e,t){let n=e.json.materials?.[r],s=dw(n),i=new Map,o=b3(e);for(let a of s){let c=a.extensions?.[Ma];if(c){let u=c.texCoord??a.texCoord??0,l=g3(u,c),f=i.get(l);if(!f){if(f={sourceTexCoord:u,texCoord:o,matrix:T3(c)},!y3(e,r,f))continue;o++,i.set(l,f)}a.texCoord=f.texCoord,m3(t,a,Ma),a.extensions&&Object.keys(a.extensions).length===0&&delete a.extensions}}}function m3(r,e,t){e.extensions?.[t]!==void 0&&(r.recordRemovedExtension(t),delete e.extensions[t])}function dw(r){if(!r||typeof r!="object")return[];let e=r,t=[],n=e.extensions;Number.isFinite(e.index)&&n?.[Ma]&&t.push(e);for(let[s,i]of Object.entries(e))s!=="extras"&&t.push(...dw(i));return t}function b3(r){let e=-1;for(let t of r.json.meshes||[])for(let n of t.primitives)for(let s of Object.keys(n.attributes)){let i=/^TEXCOORD_(\d+)$/.exec(s);i&&(e=Math.max(e,Number(i[1])))}return e+1}function g3(r,e){let{offset:t=[0,0],rotation:n=0,scale:s=[1,1]}=e;return JSON.stringify([r,t,n,s])}function y3(r,e,t){let n=[],s=r.json.meshes||[];for(let i of s)for(let o of i.primitives){let a=o.material;Number.isFinite(a)&&e===a&&n.push(o)}if(n.length===0||n.some(i=>!w3(r,i,t.sourceTexCoord)))return!1;for(let i of n)x3(r,i,t);return!0}function w3(r,e,t){let n=e.attributes[`TEXCOORD_${t}`],s=n;if(ArrayBuffer.isView(s?.value))return!0;if(!Number.isFinite(n))return!1;let i=r.json.accessors?.[n];if(!i||i.bufferView===void 0||i.sparse)return!1;let o=r.json.bufferViews?.[i.bufferView];return!!(o&&r.buffers[o.buffer])}function x3(r,e,t){let{sourceTexCoord:n,texCoord:s,matrix:i}=t,o=e.attributes[`TEXCOORD_${n}`],a=o;if(ArrayBuffer.isView(a?.value)){let c=new Float32Array(a.count*2);for(let u=0;u<a.count;u++)HE(a.value.subarray(u*2,u*2+2),a,i,c,u*2);XE(s,a,e,r,c);return}if(Number.isFinite(o)){let c=r.json.accessors?.[o];if(c&&c.bufferView!==void 0){let u=r.json.bufferViews?.[c.bufferView];if(u){let{arrayBuffer:l,byteOffset:f}=r.buffers[u.buffer],d=(f||0)+(c.byteOffset||0)+(u.byteOffset||0),{ArrayType:h,length:m}=bu(c,u),b=mu[c.componentType],g=Cd[c.type],y=u.byteStride||b*g,x=new Float32Array(m);for(let T=0;T<c.count;T++){let _=new h(l,d+T*y,2);HE(_,c,i,x,T*g)}XE(s,c,e,r,x)}}}}function HE(r,e,t,n,s){let i=e.componentType===5120||e.componentType===5122,o=2**(mu[e.componentType]*8-(i?1:0))-1;Qd.set(e.normalized?Math.max(r[0]/o,-1):r[0],e.normalized?Math.max(r[1]/o,-1):r[1],1),Qd.transformByMatrix3(t),n.set([Qd[0],Qd[1]],s)}function XE(r,e,t,n,s){n.buffers.push({arrayBuffer:co(s.buffer),byteOffset:0,byteLength:s.buffer.byteLength}),n.json.bufferViews=n.json.bufferViews||[];let i=n.json.bufferViews;i.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),t.attributes[`TEXCOORD_${r}`]=o.length-1)}function T3(r){let{offset:e=[0,0],rotation:t=0,scale:n=[1,1]}=r,s=new qn().set(1,0,0,0,1,0,e[0],e[1],1),i=f3.set(Math.cos(t),Math.sin(t),0,-Math.sin(t),Math.cos(t),0,0,0,1),o=d3.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var Ma,l3,Qd,f3,d3,JE=p(()=>{"use strict";dd();ai();ay();Xe();Be();Ma="KHR_texture_transform",l3=Ma,Qd=new su,f3=new qn,d3=new qn});var pw={};J(pw,{decode:()=>A3,encode:()=>v3,name:()=>_3});async function A3(r){let e=new ie(r),t=e.getExtension(vo);t&&(e.data.lights=t.lights,e.removeExtension(vo));for(let n of e.nodes){let s=e.getExtension(n,vo);s&&(n.light=s.light),e.removeExtension(n,vo)}}async function v3(r){let e=new yn(r),{json:t}=e;if(t.lights){let n=e.addExtension(vo);X(!n.lights),n.lights=t.lights,delete t.lights}if(e.json.lights){for(let n of e.json.lights){let s=n.node;e.addObjectExtension(s,vo,n)}delete e.json.lights}}var vo,_3,YE=p(()=>{"use strict";ho();Xe();gu();vo="KHR_lights_punctual",_3=vo});var mw={};J(mw,{decode:()=>S3,encode:()=>E3,name:()=>I3});async function S3(r){let e=new ie(r);for(let t of e.materials)e.getExtension(t,Da)&&(t.unlit=!0),e.removeExtension(t,Da);e.removeExtension(Da)}function E3(r){let e=new yn(r);for(let t of r.json.materials||[]){let n=t;n.unlit&&(delete n.unlit,e.addObjectExtension(t,Da,{}),e.registerRequiredExtension(Da))}for(let t of["extensionsUsed","extensionsRequired"])r.json[t]?.length===0&&delete r.json[t]}var Da,I3,QE=p(()=>{"use strict";Xe();gu();Da="KHR_materials_unlit",I3=Da});var bw={};J(bw,{decode:()=>B3,encode:()=>F3,name:()=>L3});async function B3(r){let e=new ie(r),t=e.getExtension(Bu);if(t){let n=O3(t,e);for(let s of e.materials){let i=e.getExtension(s,Bu);i&&(s.technique=Object.assign({},i,n[i.technique]),s.technique.values=M3(s.technique,e)),e.removeExtension(s,Bu)}e.removeExtension(Bu)}}async function F3(r,e){}function O3(r,e){let{programs:t=[],shaders:n=[],techniques:s=[]}=r,i=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(hr(e.data,e.gltf.buffers,o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),t.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),s.forEach(o=>{o.program=t[o.program]}),s}function M3(r,e){let t=Object.assign({},r.values);return Object.keys(r.uniforms||{}).forEach(n=>{r.uniforms[n].value&&!(n in t)&&(t[n]=r.uniforms[n].value)}),Object.keys(t).forEach(n=>{typeof t[n]=="object"&&t[n].index!==void 0&&(t[n].texture=e.resolveTexture(t[n].index,`technique.values.${n}.index`))}),t}var Bu,L3,ZE=p(()=>{"use strict";Xe();po();Bu="KHR_techniques_webgl",L3=Bu});var gw={};J(gw,{decode:()=>R3,name:()=>D3});async function R3(r,e){let t=new ie(r);k3(t,e)}function k3(r,e){if(!e.gltf?.loadBuffers)return;let t=r.getExtension(eL);t&&(e.gltf?.loadImages&&N3(r,t),C3(r,t))}function N3(r,e){let t=e.schema;if(!t)return;let n=t.classes,{featureTextures:s}=e;if(n&&s)for(let i in n){let o=n[i],a=P3(s,i);a&&j3(r,a,o)}}function C3(r,e){let t=e.schema;if(!t)return;let n=t.classes,s=e.featureTables;if(n&&s)for(let i in n){let o=U3(s,i);o&&V3(r,t,o)}}function U3(r,e){for(let t in r){let n=r[t];if(n.class===e)return n}return null}function P3(r,e){for(let t in r){let n=r[t];if(n.class===e)return n}return null}function V3(r,e,t){if(!t.class)return;let n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);let s=t.count;for(let i in n.properties){let o=n.properties[i],a=t.properties?.[i];if(a){let c=G3(r,e,o,s,a);a.data=c}}}function j3(r,e,t){let n=e.class;for(let s in t.properties){let i=e?.properties?.[s];if(i){let o=K3(r,i,n);i.data=o}}}function G3(r,e,t,n,s){let i=[],o=s.bufferView,a=r.getTypedArrayForBufferView(o),c=z3(r,t,s,n),u=W3(r,t,s,n,c);return t.type==="STRING"||t.componentType==="STRING"?i=Gd(n,a,c,u,t.type==="ARRAY"?t.componentCount:void 0):$3(t)&&(i=q3(t,n,a,c)),i}function z3(r,e,t,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof t.arrayOffsetBufferView<"u"?Ia(r,t.arrayOffsetBufferView,t.offsetType||"UINT32",n):null}function W3(r,e,t,n,s){if(typeof t.stringOffsetBufferView<"u"){let i=s?Number(s[n]):n*(e.type==="ARRAY"&&e.componentCount||1);return Ia(r,t.stringOffsetBufferView,t.offsetType||"UINT32",i)}return null}function $3(r){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(r.type)||typeof r.componentType<"u"&&e.includes(r.componentType)}function q3(r,e,t,n){let s=r.type==="ARRAY",i=r.componentCount,o="SCALAR",a=r.componentType||r.type,c=yu(o,a),u=t.byteLength/c,l=Sa(t,o,a,u);return s?n?wu(l,e,n):i?xu(l,e,i):[]:l}function K3(r,e,t){let n=r.data;if(!n.meshes)return[];let s=[];for(let i of n.meshes)for(let o of i.primitives)H3(r,t,e,s,o);return s}function H3(r,e,t,n,s){let i={channels:t.channels,...t.texture},o=Ea(r,i,s);o&&jd(r,e,o,n,s)}var eL,D3,tL=p(()=>{"use strict";Xe();zd();eL="EXT_feature_metadata",D3=eL});async function nL(r,e={},t){let n=rL.filter(s=>iL(s.name,e));for(let s of n)await s.preprocess?.(r,e,t)}async function sL(r,e={},t){let n=rL.filter(s=>iL(s.name,e));for(let s of n)await s.decode?.(r,e,t)}function iL(r,e){let t=e?.gltf?.excludeExtensions||{};return Array.isArray(t)?!t.includes(r):!(r in t&&!t[r])}var rL,oL=p(()=>{"use strict";$S();YS();QS();eE();tE();nE();iE();oE();pE();bE();gE();yE();Jy();wE();KE();JE();Vy();YE();QE();ZE();tL();rL=[ly,qy,$y,fw,Ry,Fy,Ny,Uy,Py,jy,Gy,zy,Ky,Hy,Xy,Yy,pw,mw,bw,hw,gw]});function aL(r){let e=new ie(r);for(let t of e.images){let n=e.getExtension(t,yw);n&&(t.bufferView=n.bufferView,t.mimeType=n.mimeType,delete t.uri),e.removeExtension(t,yw)}for(let t of e.data.buffers||[])t.id==="binary_glTF"&&delete t.uri;e.removeExtension(yw)}var yw,cL=p(()=>{"use strict";Xe();yw="KHR_binary_glTF"});function lL(r,e){let t=r.accessors||[],n=r.bufferViews||[],s=J3(r),i=new Map;for(let[o,a]of t.entries()){let c=a.bufferView;if(c===void 0&&!a.byteStride){delete a.byteStride;continue}let u=n[c],l=s.get(o)||"unused",f=Y3(a),d=a.byteStride===0?f:a.byteStride??f,h=a.byteOffset??0,m=u?.byteOffset??0,b=typeof a.componentType=="number"&&Object.hasOwn(Zd,a.componentType)?Zd[a.componentType]:0,g=l==="vertex",y=g?d>=f&&d>=4&&d<=252&&d%4===0&&h%4===0&&(m+h)%4===0:d===f;if(!u||!f||l==="mixed"||!Number.isInteger(d)||!y||g&&d>u.byteLength||!Number.isInteger(a.count)||a.count<1||!Number.isInteger(h)||h<0||!Number.isInteger(m)||m<0||h%b!==0||(m+h)%b!==0||a.type.startsWith("MAT")&&(m+h)%4!==0||!Number.isInteger(u.byteLength)||h+(a.count-1)*d+f>u.byteLength){e(o);continue}let x=`${c}:${l}:${g?d:0}`,T=i.get(x);if(T===void 0){let _={...u};delete _.id,delete _.byteStride,delete _.target,g?(_.byteStride=d,_.target=34962):l==="indices"&&(_.target=34963),T=n.length,n.push(_),i.set(x,T)}a.bufferView=T,delete a.byteStride}}function J3(r){let e=new Map,t=(n,s)=>{if(n===void 0)return;let i=e.get(n);e.set(n,i&&i!==s?"mixed":s)};for(let n of r.meshes||[])for(let s of n.primitives){for(let i of Object.values(s.attributes))t(i,"vertex");t(s.indices,"indices")}for(let n of r.animations||[])for(let s of n.samplers)t(s.input,"animation"),t(s.output,"animation");for(let n of r.skins||[])t(n.inverseBindMatrices,"inverseBind");return e}function Y3(r){let e=typeof r.componentType=="number"&&Object.hasOwn(Zd,r.componentType)?Zd[r.componentType]:0,t=Object.hasOwn(uL,r.type)?uL[r.type]:0;if(!e||!t)return 0;let n=r.type==="MAT2"?2:r.type==="MAT3"?3:4;return r.type.startsWith("MAT")&&n*e%4!==0?0:(e||0)*t}var Zd,uL,fL=p(()=>{"use strict";Zd={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},uL={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}});function dL(r,e,t){let n=r.nodes||[],s=r.skins||[],i=s.length,o=!1;for(let a=0;a<i;a++){let c=s[a],u=c.jointNames;if(!Array.isArray(u)||u.length===0||u.some(m=>typeof m!="string"||!m)||new Set(u).size!==u.length){t(`skin ${a} has invalid joint names`),o=!0;continue}let l=n.flatMap((m,b)=>m.skin===a?[b]:[]),f=(l.length?l:[void 0]).map(m=>Q3(n,u,m,e,b=>t(`skin ${a} ${b}`))),d=f.some(m=>!m);o||=d;let h=new Map;for(let m of f){if(!m)continue;let b=`${m.skeletonIndex}:${m.jointIndices.join(",")}`,g=h.get(b);if(g===void 0){let y={...c,joints:m.jointIndices,skeleton:m.skeletonIndex};delete y.jointNames,c.bindShapeMatrix!==void 0&&t8(c.bindShapeMatrix)&&delete y.bindShapeMatrix,!d&&h.size===0?(g=a,s[a]=y):(delete y.id,g=s.length,s.push(y)),h.set(b,g)}m.nodeIndex!==void 0&&(n[m.nodeIndex].skin=g,delete n[m.nodeIndex].skeletons)}}if(!o)for(let a of n)delete a.jointName}function Q3(r,e,t,n,s){let i=t===void 0?void 0:r[t].skeletons;if(i!==void 0&&(!Array.isArray(i)||i.some(f=>typeof f!="string"||!f)||new Set(i).size!==i.length))return s("has invalid skeleton roots"),null;let o=(i||[]).map(n),a=o.length?Z3(r,o):r.map((f,d)=>d);if(!a)return s("has invalid or overlapping skeleton subtrees"),null;let c=[],u=new Map;for(let f of a){let d=r[f].jointName;if(d===void 0)continue;let h=u.get(d)||[];h.push(f),u.set(d,h)}for(let f of e){let d=u.get(f)||[];if(d.length!==1)return s(`cannot uniquely resolve joint ${f}`),null;c.push(d[0])}let l=e8(r,[...c,...o]);return l===void 0?(s("joints have no unambiguous common hierarchy root"),null):{nodeIndex:t,jointIndices:c,skeletonIndex:o.length===1?o[0]:l}}function Z3(r,e){let t=new Set,n=[...e];for(;n.length;){let s=n.pop();if(!Number.isSafeInteger(s)||!r[s]||t.has(s))return null;t.add(s),n.push(...r[s].children||[])}return Array.from(t)}function e8(r,e){let t=new Map;for(let[i,o]of r.entries())for(let a of o.children||[]){if(!Number.isSafeInteger(a)||!r[a]||t.has(a))return;t.set(a,i)}let n=e.map(i=>{let o=[],a=new Set,c=i;for(;c!==void 0;){if(a.has(c))return[];a.add(c),o.push(c),c=t.get(c)}return o}),s=n.map(i=>new Set(i));return n[0].find(i=>s.every(o=>o.has(i)))}function t8(r){return Array.isArray(r)&&r.length===16&&Array.from(r).every((e,t)=>e===(t%5===0?1:0))}var hL=p(()=>{"use strict"});function eh(r,e){if(!e.length)return;let t=new Map;for(let n of e){let s=t.get(n.bufferIndex)||[];s.push(n),t.set(n.bufferIndex,s)}r.buffers=[...r.buffers],r.json.bufferViews||=[];for(let[n,s]of t){let i=r.json.buffers[n],o=r.buffers[n],a=_e(i.byteLength,4),c=a+s.reduce((f,d)=>f+_e(d.bytes.byteLength,4),0),u=new ArrayBuffer(c),l=new Uint8Array(u);l.set(new Uint8Array(o.arrayBuffer,o.byteOffset,i.byteLength));for(let f of s){l.set(new Uint8Array(f.bytes),a);let d=r.json.bufferViews.length;r.json.bufferViews.push({buffer:n,byteOffset:a,byteLength:f.bytes.byteLength,...f.byteStride===void 0?{}:{byteStride:f.byteStride},...f.target===void 0?{}:{target:f.target}}),f.apply(d),a+=_e(f.bytes.byteLength,4)}i.byteLength=c,i.uri!==void 0&&(i.uri=`data:application/octet-stream;base64,${Qb(u)}`),r.buffers[n]={arrayBuffer:u,byteOffset:0,byteLength:c}}}var ww=p(()=>{"use strict";Be()});function pL(r,e){let t=new Map;for(let[n,s]of(r.json.skins||[]).entries()){if(s.bindShapeMatrix===void 0)continue;let i=s.bindShapeMatrix;if(!mL(i)){e(`skin ${n} non-identity bindShapeMatrix requires a finite affine matrix`);continue}let o=`${s.inverseBindMatrices}:${i.join(",")}`,a=t.get(o);if(a){if((s.joints||s.jointNames||[]).length>a.count){e(`skin ${n} non-identity bindShapeMatrix has too few inverse-bind matrices`);continue}a.skins.push(s);continue}let c=r8(r,s,i);if(typeof c=="string"){e(`skin ${n} non-identity bindShapeMatrix ${c}`);continue}t.set(o,c)}eh(r,Array.from(t.values(),n=>({bufferIndex:n.bufferIndex,bytes:n.matrixBytes,apply:s=>{r.json.accessors||=[];let i=r.json.accessors.length;r.json.accessors.push({bufferView:s,byteOffset:0,componentType:5126,count:n.count,type:"MAT4"});for(let o of n.skins)o.inverseBindMatrices=i,delete o.bindShapeMatrix}})))}function r8(r,e,t){let n=r.json.accessors?.[e.inverseBindMatrices],s=(e.joints||e.jointNames||[]).length;if(!n||n.componentType!==5126||n.type!=="MAT4"||n.normalized||n.sparse||n.extensions||Object.hasOwn(n,"byteStride")||!Number.isSafeInteger(n.count)||n.count<1)return"requires packed FLOAT MAT4 inverse-bind matrices";if(n.count<s)return"has too few inverse-bind matrices";let i=r.json.bufferViews?.[n.bufferView],o=i?.buffer,a=r.json.buffers?.[o],c=r.buffers[o];if(!i||o===void 0||!a||!c)return"requires a loaded inverse-bind buffer";if(i.extensions)return"does not support inverse-bind buffer-view extensions";let u=i.byteOffset??0,l=n.byteOffset??0,f=n.count*64;if(!(c.arrayBuffer instanceof ArrayBuffer)||!Number.isSafeInteger(a.byteLength)||a.byteLength<1||!Number.isSafeInteger(c.byteOffset)||c.byteOffset<0||!Number.isSafeInteger(c.byteLength)||c.byteLength<a.byteLength||c.byteOffset+c.byteLength>c.arrayBuffer.byteLength||!Number.isSafeInteger(u)||u<0||u%4!==0||!Number.isSafeInteger(i.byteLength)||i.byteLength<1||i.byteStride!==void 0||u+i.byteLength>a.byteLength||!Number.isSafeInteger(l)||l<0||l%4!==0||l+f>i.byteLength)return"has an invalid inverse-bind buffer layout";let d=new DataView(c.arrayBuffer),h=c.byteOffset+u+l,m=new ArrayBuffer(f),b=new DataView(m);for(let g=0;g<n.count;g++){let y=Array.from({length:16},(x,T)=>d.getFloat32(h+g*64+T*4,!0));if(!mL(y))return"requires finite affine inverse-bind matrices";for(let x=0;x<4;x++)for(let T=0;T<4;T++){let _=0;for(let v=0;v<4;v++)_+=y[v*4+T]*t[x*4+v];if(!Number.isFinite(Math.fround(_)))return"produces non-finite FLOAT matrix values";b.setFloat32(g*64+(x*4+T)*4,_,!0)}}return{bufferIndex:o,count:n.count,matrixBytes:m,skins:[e]}}function mL(r){if(!Array.isArray(r)||r.length!==16)return!1;for(let e=0;e<16;e++)if(!Number.isFinite(r[e]))return!1;return r[3]===0&&r[7]===0&&r[11]===0&&r[15]===1}var bL=p(()=>{"use strict";ww()});function yL(r){let e=r.accessors||[],t=new Map,n=new Map,s=Tw(r),i=(o,a)=>{if(!Number.isSafeInteger(o)||o<0||!Object.hasOwn(e,o))return o;let c=e[o];if(!c)return o;let u=t.get(o)||new Map,l=`${a.usage}:${a.mode}:${["unit","signed","direction"].includes(a.mode)?a.semantic?.split("_")[0]:""}:${a.hasOpaqueConsumer?"opaque":""}`,f=u.get(l);return f===void 0&&(f=u.size?e.length:o,u.size&&e.push({...c}),u.set(l,f),n.set(f,a),t.set(o,u)),f};for(let o of r.meshes||[])for(let a of o.primitives){for(let[c,u]of Object.entries(a.attributes)){let l=e[u],f=["NORMAL","TANGENT"].includes(c)&&l&&[5120,5121,5122,5123].includes(l.componentType)?"direction":/^JOINTS_\d+$/.test(c)?"joints":/^(COLOR|WEIGHTS|TEXCOORD)_\d+$/.test(c)&&l&&[5120,5122].includes(l.componentType)?"signed":/^(COLOR|WEIGHTS|TEXCOORD)_\d+$/.test(c)&&l&&[5121,5123].includes(l.componentType)&&!l.normalized?"unit":/^WEIGHTS_\d+$/.test(c)?"weights":"copy";a.attributes[c]=i(u,{usage:"vertex",mode:f,semantic:c,...["signed","direction"].includes(f)?{hasOpaqueConsumer:s}:{}})}a.indices!==void 0&&(a.indices=i(a.indices,{usage:"indices",mode:"copy",hasOpaqueConsumer:a.extensions!==void 0}))}for(let o of r.animations||[])for(let a of o.samplers)a.input=i(a.input,{usage:"animation",mode:"copy"}),a.output=i(a.output,{usage:"animation",mode:"copy"});for(let o of r.skins||[])o.inverseBindMatrices!==void 0&&(o.inverseBindMatrices=i(o.inverseBindMatrices,{usage:"inverseBind",mode:"copy"}));for(let o=0;o<e.length;o++)n.has(o)||n.set(o,{usage:"unused",mode:"copy"});return n}function wL(r,e,t,n,s){let i=[],o=[];for(let[a,c]of e){let u=r.json.accessors[a],l=c.mode==="joints"||c.mode==="weights"||c.semantic?.startsWith("WEIGHTS_"),f=!!(l&&["SCALAR","VEC2","VEC3"].includes(u.type)),d=c.mode==="weights"&&(u.type!=="VEC4"||![5121,5123,5126].includes(u.componentType)||u.componentType===5126&&u.normalized),h=c.mode==="signed",m=c.mode==="direction",b=h||m,g=c.mode==="joints"&&(![5121,5123].includes(u.componentType)||u.normalized||u.type!=="VEC4");if(!t.has(a)&&!g&&!d&&!b&&!f&&c.usage!=="indices"&&c.mode!=="unit")continue;let y=Fu(r,a);if(typeof y=="string"){n(`accessor ${a} layout requires binary repacking: ${y}`);continue}if(l&&!["SCALAR","VEC2","VEC3","VEC4"].includes(u.type)){n(`accessor ${a} skin influences require scalar/vector data`);continue}if(c.mode==="weights"&&(![5121,5123,5126].includes(u.componentType)||u.componentType===5126&&u.normalized||u.componentType!==5126&&!u.normalized)){n(`accessor ${a} weights require FLOAT or normalized unsigned data`);continue}let x=u.componentType,T=u.normalized;if(b){if(c.hasOpaqueConsumer){n(`accessor ${a} integer conversion cannot interpret opaque extension consumers`);continue}if(!(m?[c.semantic==="NORMAL"?"VEC3":"VEC4"]:c.semantic?.startsWith("COLOR_")?["VEC3","VEC4"]:c.semantic?.startsWith("WEIGHTS_")?["SCALAR","VEC2","VEC3","VEC4"]:["VEC2"]).includes(u.type)||T!==void 0&&typeof T!="boolean"){n(`accessor ${a} integer ${c.semantic} has incompatible shape or normalization`);continue}let oe=!0;for(let xe=0;xe<u.count;xe++)if(m){let Rt=Math.hypot(Math.fround(Ra(y,xe,0)),Math.fround(Ra(y,xe,1)),Math.fround(Ra(y,xe,2)));(Math.abs(Rt-1)>1e-5||c.semantic==="TANGENT"&&![-1,1].includes(Ra(y,xe,3)))&&(oe=!1)}else if(!c.semantic?.startsWith("TEXCOORD_"))for(let Rt=0;Rt<y.rows;Rt++){let mr=Ra(y,xe,Rt);(mr<0||mr>1)&&(oe=!1)}if(!oe){n(m?`accessor ${a} integer ${c.semantic} requires unit directions and tangent handedness of +/-1; values are not repaired`:`accessor ${a} signed ${c.semantic} values must remain in [0, 1]`);continue}x=5126,T=!1}if(c.usage==="indices"){if(u.type!=="SCALAR"||![5121,5123,5125].includes(x)||T){n(`index accessor ${a} requires unnormalized unsigned SCALAR data`);continue}let ue=0;for(let xe=0;xe<u.count;xe++)ue=Math.max(ue,Ht(y,xe,0));if(ue===(x===5121?255:x===5123?65535:4294967295)){if(c.hasOpaqueConsumer){n(`index accessor ${a} cannot widen opaque primitive extension semantics`);continue}if(x===5125){n(`index accessor ${a} contains the unrepresentable uint32 restart value`);continue}x=x===5121?5123:5125}if(!t.has(a)&&x===u.componentType)continue}if(g||c.mode==="unit"){if(g&&u.normalized){n(`accessor ${a} joint indices require unnormalized scalar/vector data`);continue}if(c.mode==="unit"&&!(c.semantic?.startsWith("COLOR_")?["VEC3","VEC4"]:c.semantic?.startsWith("WEIGHTS_")?["SCALAR","VEC2","VEC3","VEC4"]:["VEC2"]).includes(u.type)){n(`accessor ${a} integer ${c.semantic} has an incompatible shape`);continue}let ue=0,oe=!0;for(let xe=0;xe<u.count;xe++)for(let Rt=0;Rt<y.rows*y.columns;Rt++){let mr=Ht(y,xe,Rt);(!Number.isInteger(mr)||mr<0||g&&mr>65535)&&(oe=!1),ue=Math.max(ue,mr)}if(!oe){n(`accessor ${a} joint indices require finite integers in [0, 65535]`);continue}if(g)x=ue<=255?5121:5123,T=!1;else if(ue<=1)x=5126,T=!1;else if(n(`accessor ${a} ambiguous integer attribute normalization; best effort assumes normalized unsigned values`),T=!0,!t.has(a)&&!f){o.push(()=>{u.normalized=!0});continue}}let _=f?4:y.rows,v=xw[x],I=y.columns>1?_e(y.rows*v,4):_*v,N=I*y.columns,K=c.usage==="vertex"?_e(N,4):N,ne=new ArrayBuffer(u.count*K),be=new Uint8Array(ne),ke=new Uint8Array(y.data.buffer),Ne=new DataView(ne);for(let ue=0;ue<u.count;ue++)for(let oe=0;oe<y.columns;oe++)if(x===u.componentType){let xe=y.byteOffset+ue*y.byteStride+oe*y.rows*y.componentSize;be.set(ke.subarray(xe,xe+y.rows*y.componentSize),ue*K+oe*I)}else for(let xe=0;xe<y.rows;xe++){let Rt=(b?Ra:Ht)(y,ue,oe*y.rows+xe),mr=ue*K+oe*I+xe*v;x===5126?Ne.setFloat32(mr,Rt,!0):x===5121?Ne.setUint8(mr,Rt):x===5125?Ne.setUint32(mr,Rt,!0):Ne.setUint16(mr,Rt,!0)}i.push({bufferIndex:y.bufferIndex,bytes:ne,...c.usage==="vertex"?{byteStride:K,target:34962}:c.usage==="indices"?{target:34963}:{},apply:ue=>{b&&s(`Converted ${h?"signed":"integer"} ${c.semantic} accessor ${a} to FLOAT, preserving ${y.accessor.normalized?"explicitly normalized":"literal"} values.`),c.usage==="indices"&&x!==u.componentType&&s(`Widened index accessor ${a} to preserve a glTF 1 index reserved by glTF 2.`),u.bufferView=ue,u.byteOffset=0,delete u.byteStride,(x!==u.componentType||f)&&(delete u.min,delete u.max),u.componentType=x,f&&(u.type="VEC4"),T?u.normalized=!0:delete u.normalized}})}eh(r,i);for(let a of o)a()}function Ra(r,e,t){let n=Ht(r,e,t);if(r.accessor.normalized!==!0)return n;let s=n8[r.accessor.componentType];return Math.max(n/s,-1)}function Tw(r){let e=[r],t=new Set;for(;e.length;){let n=e.pop();if(!(!n||typeof n!="object"||t.has(n))){t.add(n);for(let[s,i]of Object.entries(n))if(s!=="extras"){if(s==="extensions"&&i&&typeof i=="object"&&Object.keys(i).some(o=>!["KHR_materials_unlit","KHR_materials_common"].includes(o)))return!0;e.push(i)}}}return!1}function Fu(r,e){let t=r.json.accessors?.[e];if(!t||!Number.isSafeInteger(e)||e<0)return"invalid accessor reference";let n=typeof t.componentType=="number"&&Object.hasOwn(xw,t.componentType)?xw[t.componentType]:void 0,s=typeof t.type=="string"&&Object.hasOwn(gL,t.type)?gL[t.type]:void 0;if(!n||!s||!Number.isSafeInteger(t.count)||t.count<1)return"invalid component type, shape, or count";let[i,o]=s,a=r.json.bufferViews?.[t.bufferView],c=r.json.buffers?.[a?.buffer],u=r.buffers[a?.buffer];if(!a||!c||!u)return"requires a loaded accessor buffer";if(t.sparse||t.extensions||a.extensions)return"sparse or extension-bearing data is unsupported";let l=i*o*n,f=t.byteStride??a.byteStride??l,d=f===0?l:f,h=t.byteOffset??0,m=a.byteOffset??0;return!(u.arrayBuffer instanceof ArrayBuffer)||!Number.isSafeInteger(d)||d<l||t.byteStride!==void 0&&t.byteStride>255||!Number.isSafeInteger(h)||h<0||!Number.isSafeInteger(m)||m<0||!Number.isSafeInteger(a.byteLength)||a.byteLength<1||!Number.isSafeInteger(c.byteLength)||c.byteLength<1||m+a.byteLength>c.byteLength||h+(t.count-1)*d+l>a.byteLength||!Number.isSafeInteger(u.byteOffset)||u.byteOffset<0||!Number.isSafeInteger(u.byteLength)||u.byteLength<c.byteLength||u.byteOffset+u.byteLength>u.arrayBuffer.byteLength?"invalid source buffer span or stride":{accessor:t,bufferIndex:a.buffer,componentSize:n,rows:i,columns:o,byteStride:d,data:new DataView(u.arrayBuffer),byteOffset:u.byteOffset+m+h}}function Ht(r,e,t){let n=r.byteOffset+e*r.byteStride+t*r.componentSize;switch(r.accessor.componentType){case 5120:return r.data.getInt8(n);case 5121:return r.data.getUint8(n);case 5122:return r.data.getInt16(n,!0);case 5123:return r.data.getUint16(n,!0);case 5125:return r.data.getUint32(n,!0);default:return r.data.getFloat32(n,!0)}}var xw,n8,gL,Ou=p(()=>{"use strict";Be();ww();xw={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},n8={5120:127,5121:255,5122:32767,5123:65535},gL={SCALAR:[1,1],VEC2:[2,1],VEC3:[3,1],VEC4:[4,1],MAT2:[2,2],MAT3:[3,3],MAT4:[4,4]}});function TL(r,e){let t=r.asset;t.premultipliedAlpha&&e("asset premultipliedAlpha rendering"),xL(t,["profile","premultipliedAlpha"]);for(let[n,s]of(r.textures||[]).entries()){let i=s;for(let[o,a]of Object.entries({format:6408,internalFormat:6408,target:3553,type:5121}))i[o]!==void 0&&i[o]!==a&&e(`texture ${n} non-default ${o} rendering`);xL(i,["format","internalFormat","target","type"])}}function xL(r,e){let t={};for(let a of e)Object.hasOwn(r,a)&&(t[a]=r[a],delete r[a]);if(!Object.keys(t).length)return;let n=_w(r.extras)?r.extras:r.extras===void 0?{}:{originalExtras:r.extras},s=_w(n.gltf1)?n.gltf1:n.gltf1===void 0?{}:{originalExtras:n.gltf1},i=_w(s.legacyFields)?s.legacyFields:s.legacyFields===void 0?{}:{originalExtras:s.legacyFields},o=Object.keys(t).some(a=>Object.hasOwn(i,a));r.extras={...n,gltf1:{...s,legacyFields:{...i,...t,...o?{originalExtras:i}:{}}}}}function _w(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function Aw(r){let e=/^(JOINTS?|WEIGHTS?|TEXCOORD|COLOR)(?:_(\d+))?$/.exec(r);if(e){let t=e[1].startsWith("JOINT")?"JOINTS":e[1].startsWith("WEIGHT")?"WEIGHTS":e[1],n=Number(e[2]||0);if(!Number.isSafeInteger(n)||n>999999999)throw new Error(`glTF v1: invalid attribute set index ${r}`);return`${t}_${n}`}return["POSITION","NORMAL","TANGENT"].includes(r)||r.startsWith("_")||r.includes(":")?r:`_${r}`}var _L=p(()=>{"use strict"});function AL(r,e,t){for(let[s,i]of(r.animations||[]).entries()){let f=function(d,h,m){try{let b=typeof d=="string"?e(d,h):d,g=h==="accessor"?r.accessors:r.nodes;if(typeof b=="number"&&Number.isSafeInteger(b)&&b>=0&&g?.[b])return b}catch{}return t(`animation ${s} ${m} unresolved ${h} reference`),d};var n=f;let o=i,a=o.parameters||{},c=new Map,u=i.samplers,l=Array.isArray(u)?u.map((d,h)=>[String(h),d]):Object.entries(u||{});i.samplers=l.map(([d,h],m)=>{c.set(d,m);for(let b of["input","output"]){let g=h[b],y=Object.hasOwn(a,g)?a[g]:g;h[b]=f(y,"accessor",`sampler ${d} ${b}`)}return h.interpolation??="LINEAR",h}),delete o.parameters;for(let[d,h]of(i.channels||[]).entries()){if(typeof h.sampler=="string"){let b=c.get(h.sampler);b===void 0?t(`animation ${s} channel ${d} unresolved sampler ${h.sampler}`):h.sampler=b}let m=h.target;m?.id!==void 0?(m.node=f(m.id,"node",`channel ${d} target`),delete m.id):typeof m?.node=="string"&&(m.node=f(m.node,"node",`channel ${d} target`))}}}var vL=p(()=>{"use strict"});function IL(r,e,t){let n=r.nodes||[],s=new Map;for(let[a,c]of n.entries())for(let u of c.children||[])s.set(u,s.has(u)?null:a);let i=[];for(let[a,c]of(r.scenes||[]).entries()){let u=o(c.nodes||[]);if(!u){e(`scene ${a} invalid node hierarchy`);continue}for(let l of Array.from(u)){let f=r.skins?.[n[l].skin];if(!Array.isArray(f?.joints)||!f.joints.length||f.skeleton===void 0||u.has(f.skeleton)&&f.joints.every(b=>u.has(b)))continue;let d=f.skeleton,h=new Set;for(;!h.has(d)&&typeof s.get(d)=="number";)h.add(d),d=s.get(d);let m=o([d]);if(h.has(d)||s.get(d)===null||!m||!f.joints.every(b=>m.has(b))||Array.from(m).some(b=>u.has(b)||n[b].mesh!==void 0||n[b].camera!==void 0||n[b].extensions!==void 0)){e(`scene ${a} skin ${n[l].skin} cannot safely attach detached skeleton`);continue}for(let b of m)u.add(b);i.push(()=>{c.nodes||=[],c.nodes.push(d),t(`Attached detached skeleton root ${d} to scene ${a}.`)})}}for(let a of i)a();function o(a){let c=new Set,u=[...a];for(;u.length;){let l=u.pop();if(!Number.isSafeInteger(l)||!n[l]||c.has(l)||s.get(l)===null)return null;c.add(l),u.push(...n[l].children||[])}return c}}var SL=p(()=>{"use strict"});function EL(r,e){for(let[t,n]of(r.cameras||[]).entries()){let s=n.perspective,i=n.orthographic;(n.type==="perspective"?s&&Mu(s.yfov)&&Mu(s.znear)&&(s.aspectRatio===void 0||Mu(s.aspectRatio))&&(s.zfar===void 0||Mu(s.zfar)&&s.zfar>s.znear):n.type==="orthographic"&&i&&Number.isFinite(i.xmag)&&i.xmag!==0&&Number.isFinite(i.ymag)&&i.ymag!==0&&Number.isFinite(i.znear)&&i.znear>=0&&Mu(i.zfar)&&i.zfar>i.znear)||e(`camera ${t} invalid projection parameters`)}}function Mu(r){return Number.isFinite(r)&&r>0}var LL=p(()=>{"use strict"});function BL(r,e,t){let n=new Map,s=new Set;for(let[i,o]of(r.json.meshes||[]).entries())for(let[a,c]of o.primitives.entries()){let u=`mesh ${i} primitive ${a}`;for(let b of["TEXCOORD","COLOR","JOINTS","WEIGHTS"])Object.keys(c.attributes).filter(y=>y.startsWith(`${b}_`)).map(y=>Number(y.slice(b.length+1))).sort((y,x)=>y-x).some((y,x)=>y!==x)&&t(`${u} ${b} sets must be contiguous starting at zero`);for(let[b,g]of Object.entries(c.attributes)){let y=b.split("_")[0];if(!["NORMAL","TANGENT","COLOR","TEXCOORD","JOINTS","WEIGHTS"].includes(y))continue;let x=`${y}:${g}`;if(s.has(x))continue;s.add(x);let T=e(g,`${b} accessor ${g}`);T&&s8(T,y,`${b} accessor ${g}`,t)}let l=Object.values(c.attributes).map(b=>(Number.isSafeInteger(b)?r.json.accessors?.[b]:void 0)?.count);if(!l.length||l.some(b=>!Number.isSafeInteger(b)||b<1)){t(`${u} requires valid vertex attribute accessors`);continue}l.some(b=>b!==l[0])&&t(`${u} vertex attribute counts do not match`);let f=c.indices===void 0?l[0]:r.json.accessors?.[c.indices]?.count,d=c.mode===void 0?4:c.mode;if(!Number.isInteger(d)||d<0||d>6?t(`${u} requires a primitive mode in [0, 6]`):(!c.extensions||!Object.keys(c.extensions).length)&&(!Number.isSafeInteger(f)||f<1||d===1&&f%2!==0||[2,3].includes(d)&&f<2||d===4&&f%3!==0||[5,6].includes(d)&&f<3)&&t(`${u} draw count ${f} is incompatible with primitive mode ${d}`),c.indices===void 0)continue;let h=e(c.indices,`${u} indices`);if(!h)continue;if(h.accessor.type!=="SCALAR"||![5121,5123,5125].includes(h.accessor.componentType)||h.accessor.normalized){t(`${u} indices require unnormalized unsigned SCALAR data`);continue}let m=n.get(c.indices);if(m===void 0){m=0;for(let b=0;b<h.accessor.count;b++)m=Math.max(m,Ht(h,b,0));n.set(c.indices,m)}l.some(b=>m>=b)&&t(`${u} index ${m} is outside its vertex attribute counts`)}}function s8(r,e,t,n){let s=r.accessor,i=s.componentType===5126&&!s.normalized,o=[5121,5123].includes(s.componentType)&&s.normalized===!0,a=s.normalized===void 0||typeof s.normalized=="boolean",c=e==="NORMAL"?s.type==="VEC3"&&i:e==="TANGENT"?s.type==="VEC4"&&i:e==="JOINTS"?s.type==="VEC4"&&[5121,5123].includes(s.componentType)&&!s.normalized:e==="COLOR"?["VEC3","VEC4"].includes(s.type)&&(i||o):s.type===(e==="TEXCOORD"?"VEC2":"VEC4")&&(i||o);if(!a||!c){n(`${t} has incompatible core attribute shape, component type, or normalization`);return}for(let u=0;u<s.count;u++){let l=Array.from({length:r.rows},(f,d)=>Ht(r,u,d));if(l.some(f=>!Number.isFinite(f))||["NORMAL","TANGENT"].includes(e)&&Math.abs(Math.hypot(...l.slice(0,3))-1)>1e-5||e==="TANGENT"&&l[3]!==1&&l[3]!==-1||["COLOR","WEIGHTS"].includes(e)&&i&&l.some(f=>f<0||f>1)){n(`${t} requires finite core values, unit directions, tangent handedness \xB11, and colors/weights in [0, 1]`);return}}}var FL=p(()=>{"use strict";Ou()});function OL(r,e,t){let n=new Map,s=new Set,i=[],o=(f,d)=>{let h=n.get(f);return h===void 0&&(h=Fu(r,f),n.set(f,h)),typeof h=="string"?(s.has(f)||(s.add(f),e(`${d}: ${h}`)),null):h},a=new Set;for(let f of r.json.meshes||[])for(let d of f.primitives)d.attributes.POSITION!==void 0&&a.add(d.attributes.POSITION);for(let f of a){let d=o(f,`POSITION accessor ${f}`);if(d){if(!th(d,"VEC3")){e(`POSITION accessor ${f} requires unnormalized FLOAT VEC3 data`);continue}u(d,f)}}l(),c(),i8(r,o,e),BL(r,o,e);for(let f of i)f();function c(){for(let[f,d]of(r.json.skins||[]).entries()){if(d.inverseBindMatrices===void 0)continue;let h=`skin ${f} inverse-bind matrices`,m=o(d.inverseBindMatrices,h);if(m){if(!th(m,"MAT4")||m.accessor.count<(d.joints?.length||0)){e(`${h} require FLOAT MAT4 data with at least one matrix per joint`);continue}for(let b=0;b<m.accessor.count;b++){let g=Array.from({length:16},(y,x)=>Ht(m,b,x));if(g.some(y=>!Number.isFinite(y))||g[3]!==0||g[7]!==0||g[11]!==0||g[15]!==1){e(`${h} require finite affine matrices`);break}}}}}function u(f,d){let h=new Array(f.rows).fill(1/0),m=new Array(f.rows).fill(-1/0);for(let b=0;b<f.accessor.count;b++)for(let g=0;g<f.rows;g++){let y=Ht(f,b,g);if(!Number.isFinite(y))return e(`accessor ${d} non-finite values cannot supply required bounds`),!1;h[g]=Math.min(h[g],y),m[g]=Math.max(m[g],y)}return(JSON.stringify(f.accessor.min)!==JSON.stringify(h)||JSON.stringify(f.accessor.max)!==JSON.stringify(m))&&i.push(()=>{f.accessor.min=h,f.accessor.max=m,t(`Calculated required bounds for accessor ${d}.`)}),!0}function l(){let f=new Set,d=new Set;for(let[h,m]of(r.json.animations||[]).entries()){let b=new Set;(!m.samplers.length||!m.channels?.length)&&e(`animation ${h} requires samplers and channels`);for(let[g,y]of m.samplers.entries()){let x=`animation ${h} sampler ${g}`;if(["LINEAR","STEP"].includes(y.interpolation??"LINEAR")||e(`${x} unsupported interpolation ${y.interpolation}`),!f.has(y.input)){f.add(y.input);let T=o(y.input,`${x} input`);if(T)if(!th(T,"SCALAR"))e(`${x} time input requires unnormalized FLOAT SCALAR data`);else{let _=-1/0,v=!0;for(let I=0;I<T.accessor.count;I++){let N=Ht(T,I,0);(!Number.isFinite(N)||N<0||N<=_)&&(v=!1),_=N}v?u(T,y.input):e(`${x} times must be finite, nonnegative, and strictly increasing`)}}}for(let[g,y]of(m.channels||[]).entries()){let x=`animation ${h} channel ${g}`,T=Number.isSafeInteger(y.sampler)?m.samplers[y.sampler]:void 0,_=y.target,v=Number.isSafeInteger(_?.node)?r.json.nodes?.[_.node]:void 0;if(!T||!v||!["translation","rotation","scale"].includes(_?.path)){e(`${x} invalid sampler, node, or TRS target`);continue}v.matrix!==void 0&&e(`${x} matrix node requires TRS decomposition`);let I=`${_.node}:${_.path}`;if(b.has(I)&&e(`${x} duplicate node/path target`),b.add(I),!["LINEAR","STEP"].includes(T.interpolation??"LINEAR"))continue;let N=r.json.accessors?.[T.input],K=o(T.output,`${x} output`);if(!K)continue;if(!th(K,_.path==="rotation"?"VEC4":"VEC3")||K.accessor.count!==N?.count){e(`${x} output shape, type, or count does not match its target and keys`);continue}let ne=`${T.output}:${_.path}`;if(!d.has(ne)){d.add(ne);for(let be=0;be<K.accessor.count;be++){let ke=Array.from({length:K.rows},(Ne,ue)=>Ht(K,be,ue));if(ke.some(Ne=>!Number.isFinite(Ne))||_.path==="rotation"&&Math.abs(Math.hypot(...ke)-1)>1e-5){e(`${x} output requires finite values and unit rotation quaternions`);break}}}}}}}function th(r,e){return r.accessor.componentType===5126&&!r.accessor.normalized&&r.accessor.type===e}function i8(r,e,t){let n=new Set;for(let s of r.json.nodes||[]){let i=r.json.skins?.[s.skin],o=r.json.meshes?.[s.mesh];if(!Array.isArray(i?.joints)||!i.joints.length||!o)continue;let a=`${s.mesh}:${s.skin}`;if(!n.has(a)){n.add(a);for(let[c,u]of o.primitives.entries()){let l=`mesh ${s.mesh} primitive ${c} skin ${s.skin}`,f=Object.keys(u.attributes).filter(b=>/^JOINTS_\d+$/.test(b)).map(b=>Number(b.slice(7))).sort((b,g)=>b-g),d=Object.keys(u.attributes).filter(b=>/^WEIGHTS_\d+$/.test(b)).map(b=>Number(b.slice(8))).sort((b,g)=>b-g);if(!f.length&&!d.length){t(`${l} requires JOINTS_0 and WEIGHTS_0 skin influences`);continue}if(JSON.stringify(f)!==JSON.stringify(d)||f.some((b,g)=>b!==g)){t(`${l} requires matching contiguous joint/weight sets starting at zero`);continue}let h=r.json.accessors?.[u.attributes.POSITION]?.count,m=f.map(b=>({joints:e(u.attributes[`JOINTS_${b}`],`${l} joint set ${b}`),weights:e(u.attributes[`WEIGHTS_${b}`],`${l} weight set ${b}`)}));if(!m.some(({joints:b,weights:g})=>!b||!g)){if(m.some(({joints:b,weights:g})=>b.accessor.type!=="VEC4"||g.accessor.type!=="VEC4"||![5121,5123].includes(b.accessor.componentType)||b.accessor.normalized||!(g.accessor.componentType===5126&&!g.accessor.normalized||[5121,5123].includes(g.accessor.componentType)&&g.accessor.normalized)||b.accessor.count!==g.accessor.count||h!==void 0&&b.accessor.count!==h||b.accessor.count!==m[0].joints.accessor.count)){t(`${l} incompatible influence accessor types or vertex counts`);continue}for(let b=0;b<m[0].joints.accessor.count;b++){let g=0,y=0,x=!0,T=new Set;for(let{joints:_,weights:v}of m){let I=v.accessor.normalized?v.accessor.componentType===5121?255:65535:1;for(let N=0;N<4;N++){let K=Ht(_,b,N),ne=Ht(v,b,N)/I;(K>=i.joints.length||!Number.isFinite(ne)||ne<0||ne>1)&&(x=!1),ne>0&&(T.has(K)&&(x=!1),T.add(K),y++),g+=ne}}if(!x||Math.abs(g-1)>2e-7*Math.max(y,1)){t(`${l} invalid palette index, repeated weighted joint, or weights not summing to one at vertex ${b}`);break}}}}}}}var ML=p(()=>{"use strict";Ou();FL()});function DL(r,e,t,n){let s=new Map,i=new Map,o=new Map;for(let[c,u]of(r.json.buffers||[]).entries()){let l=`buffer ${c}`,f=r.buffers[c],d=!!(f&&f.arrayBuffer instanceof ArrayBuffer&&Number.isSafeInteger(f.byteOffset)&&f.byteOffset>=0&&Number.isSafeInteger(f.byteLength)&&f.byteLength>=0&&Number.isSafeInteger(f.byteOffset+f.byteLength)&&f.byteOffset+f.byteLength<=f.arrayBuffer.byteLength);f&&!d&&t(`${l} invalid borrowed payload span`);let h=u.byteLength;if(h===void 0&&e.has(c)&&!u.extensions&&d&&f.byteLength>0&&(h=f.byteLength,i.set(c,h)),!Number.isSafeInteger(h)||h<1){t(`${l} requires a positive byteLength; missing lengths require unambiguous loaded URI data`);continue}s.set(c,h),d&&f.byteLength<h&&t(`${l} declared byteLength exceeds its loaded payload`)}let a=Tw(r.json);for(let[c,u]of(r.json.bufferViews||[]).entries()){let l=u.byteOffset===void 0?0:u.byteOffset,f=s.get(u.buffer),d=u.byteLength===void 0&&!a&&f!==void 0?o8(r,c,s):u.byteLength;u.byteLength===void 0&&d!==void 0&&o.set(c,d),(!Number.isSafeInteger(u.buffer)||u.buffer<0||f===void 0||!Number.isSafeInteger(l)||l<0||!Number.isSafeInteger(d)||(d??0)<1||!Number.isSafeInteger(l+(d??0))||l+(d??0)>f)&&t(`bufferView ${c} requires a valid buffer reference and contained positive byte span`)}for(let[c,u]of o)r.json.bufferViews[c].byteLength=u,n(`Inferred bufferView ${c} byteLength from its dense accessor spans.`);for(let[c,u]of i)r.json.buffers[c].byteLength=u,n(`Inferred buffer ${c} byteLength from its loaded URI payload.`)}function o8(r,e,t){let n=r.json.bufferViews[e];if(n.byteOffset!==void 0&&(!Number.isSafeInteger(n.byteOffset)||n.byteOffset<0)||n.byteStride!==void 0&&(!Number.isSafeInteger(n.byteStride)||n.byteStride<0)||r.json.images?.some(a=>a.bufferView===e)||r.json.accessors?.some(a=>!!a.sparse))return;let s=t.get(n.buffer)-(n.byteOffset??0),i={...r,json:{...r.json,buffers:r.json.buffers.map((a,c)=>({...a,byteLength:t.get(c)})),bufferViews:r.json.bufferViews.map((a,c)=>c===e?{...a,byteLength:s}:a)}},o=0;for(let[a,c]of(r.json.accessors||[]).entries()){if(c.bufferView!==e)continue;let u=c;for(let d of[u.byteOffset,u.byteStride])if(d!==void 0&&(!Number.isSafeInteger(d)||d<0))return;let l=Fu(i,a);if(typeof l=="string")return;let f=(c.byteOffset??0)+(c.count-1)*l.byteStride+l.rows*l.columns*l.componentSize;o=Math.max(o,f)}return o>0?o:void 0}var RL=p(()=>{"use strict";Ou()});function kL(r,e,t){let n=new Map;for(let i of r.animations||[])for(let o of i.channels||[]){let a=o.target?.node;if(!Number.isSafeInteger(a))continue;let c=n.get(a)||new Set;c.add(o.target.path),n.set(a,c)}let s=[];for(let[i,o]of n){let a=r.nodes?.[i];if(a?.matrix===void 0)continue;let c=`animated matrix node ${i}`;if(o.size!==1||!o.has("translation")){e(`${c} rotation or scale animation requires an unambiguous TRS basis`);continue}if(a.translation!==void 0||a.rotation!==void 0||a.scale!==void 0||a.extensions!==void 0){e(`${c} has conflicting TRS fields or opaque extensions`);continue}let u=a8(a.matrix);if(!u){e(`${c} requires a finite affine, nonsingular matrix without shear`);continue}s.push(()=>{Object.assign(a,u),delete a.matrix,t(`Decomposed translation-only animated matrix node ${i}, preserving its linear transform.`)})}for(let i of s)i()}function a8(r){if(!Array.isArray(r)||r.length!==16||Array.from(r).some(a=>!Number.isFinite(a))||r[3]!==0||r[7]!==0||r[11]!==0||r[15]!==1)return null;let e=[0,1,2].map(a=>Math.hypot(...r.slice(a*4,a*4+3)));if(e.some(a=>!Number.isFinite(a)||a===0))return null;let t=e.map((a,c)=>r.slice(c*4,c*4+3).map(u=>u/a));for(let a=0;a<3;a++)for(let c=a+1;c<3;c++)if(Math.abs(t[a].reduce((u,l,f)=>u+l*t[c][f],0))>1e-6)return null;let n=t[0][0]*(t[1][1]*t[2][2]-t[1][2]*t[2][1])-t[1][0]*(t[0][1]*t[2][2]-t[0][2]*t[2][1])+t[2][0]*(t[0][1]*t[1][2]-t[0][2]*t[1][1]);if(Math.abs(Math.abs(n)-1)>1e-6)return null;n<0&&(e[0]=-e[0],t[0]=t[0].map(a=>-a));let s=Array.from(new iu().fromMatrix3(t.flat()).normalize()),i=r.slice(12,15),o=new ni().translate(i).multiplyRight(new ni().fromQuaternion(s)).scale(e);return Array.from(o).some((a,c)=>!Number.isFinite(a)||Math.abs(a-r[c])>1e-6*Math.max(1,Math.abs(r[c])))?null:{translation:i,rotation:s,scale:e}}var NL=p(()=>{"use strict";dd()});function VL(r,e,t){let n=new Set,s=r.extensionsRequired?.includes(Hr)||!1;for(let[o,a]of(r.materials||[]).entries()){let c=a,u=a.extensions?.[Hr];if(u===void 0){c8(c,r,e,t);continue}zL(c,u);let l=`material ${o}`;if(!pr(u)||typeof u.technique!="string"||!["CONSTANT","LAMBERT","PHONG","BLINN"].includes(u.technique)){e(`${l} unknown ${Hr} technique`);continue}if(u.values!==void 0&&!pr(u.values)){e(`${l} common material values must be an object`);continue}let f=u.values||{},d=Object.keys(u).filter(I=>!["technique","values","doubleSided","transparent","jointCount"].includes(I)),h=Object.keys(f).filter(I=>!["ambient","diffuse","emission","specular","shininess","transparency","doubleSided","transparent"].includes(I));(d.length||h.length)&&e(`${l} unrecognized common material fields ${[...d,...h].join(", ")}`),u.jointCount!==void 0&&(!Number.isSafeInteger(u.jointCount)||Number(u.jointCount)<0)&&e(`${l} invalid common material jointCount`);let m=CL(f.emission,r,`${l} emission`,e),b=u.technique==="CONSTANT",g=b?m:CL(f.diffuse,r,`${l} diffuse`,e),y=f.transparency===void 0?1:f.transparency,x=typeof y=="number"&&Number.isFinite(y)&&y>=0&&y<=1;x||e(`${l} common material transparency must be in [0, 1]`);let T=UL(u,f,"transparent",l,e),_=UL(u,f,"doubleSided",l,e);f.ambient!==void 0&&!PL(f.ambient)&&e(`${l} ambient lighting`),["PHONG","BLINN"].includes(String(u.technique))&&(f.specular!==void 0&&!PL(f.specular)&&e(`${l} specular/shininess lighting`),f.shininess!==void 0&&(typeof f.shininess!="number"||!Number.isFinite(f.shininess)||f.shininess<0)&&e(`${l} invalid common material shininess`)),a.pbrMetallicRoughness||={};let v=a.pbrMetallicRoughness;if(v.metallicFactor??=0,v.roughnessFactor??=1,g){let I=[...g.factor];I[3]*=x?y:1,v.baseColorFactor??=I,g.texture&&(v.baseColorTexture??=g.texture)}a.doubleSided??=_,a.alphaMode??=T?"BLEND":"OPAQUE",b?(a.extensions[vw]??={},u8(r,vw,s),t(`Converted ${l} CONSTANT emission to an unlit material.`)):(m&&(a.emissiveFactor??=m.factor.slice(0,3),m.texture&&(a.emissiveTexture??=m.texture)),t(`Approximated ${l} ${String(u.technique)} lighting with rough non-metallic PBR factors.`)),typeof c.technique=="string"?n.add(c.technique):c.technique!==void 0&&e(`${l} invalid fallback technique ID`),delete c.technique,delete c.values,delete a.extensions[Hr],Object.keys(a.extensions).length||delete a.extensions}let i=WL(r);return(r.extensions?.[Hr]!==void 0||(r.nodes||[]).some(o=>o.extensions?.[Hr]!==void 0))&&e(`${Hr} lights or scene payloads`),i.has(Hr)||(r.extensionsUsed=r.extensionsUsed?.filter(o=>o!==Hr),r.extensionsRequired=r.extensionsRequired?.filter(o=>o!==Hr)),n}function jL(r,e){if(!e.size||[...WL(r)].some(c=>![Hr,vw].includes(c))||(r.materials||[]).some(c=>c.technique!==void 0||c.values!==void 0))return!1;let t=r;if(["techniques","programs","shaders"].some(c=>t[c]!==void 0&&!pr(t[c])))return!1;let n=pr(t.techniques)?t.techniques:{},s=pr(t.programs)?t.programs:{},i=pr(t.shaders)?t.shaders:{},o=new Set,a=new Set;if(Object.keys(n).some(c=>!e.has(c)))return!1;for(let c of Object.values(n))pr(c)&&typeof c.program=="string"&&o.add(c.program);if(Object.keys(s).some(c=>!o.has(c)))return!1;for(let c of Object.values(s))if(pr(c))for(let u of["vertexShader","fragmentShader"])typeof c[u]=="string"&&a.add(c[u]);return Object.keys(i).every(c=>a.has(c))}function c8(r,e,t,n){zL(r);let s=pr(r.values)?r.values:{},i=s.tex||s.texture2d_0||s.diffuseTex||s.diffuse,o=GL(e,i),a=Iw(s.diffuse)?s.diffuse:void 0;if(o!==-1||a){let c=a?[...a]:[1,1,1,1],u=s.transparency;typeof u=="number"&&u>=0&&u<=1&&(c[3]*=u),r.pbrMetallicRoughness||={},r.pbrMetallicRoughness.metallicFactor??=0,r.pbrMetallicRoughness.roughnessFactor??=1,r.pbrMetallicRoughness.baseColorFactor??=c,o!==-1&&(r.pbrMetallicRoughness.baseColorTexture??={index:o}),r.pbrMetallicRoughness.baseColorFactor[3]<1&&(r.alphaMode||="BLEND"),n("Approximated glTF v1 diffuse material values with PBR material factors.")}(r.technique||r.values)&&t(`material technique ${r.technique||"<unnamed>"}`)}function CL(r,e,t,n){if(r===void 0)return{factor:[0,0,0,1]};if(Iw(r))return{factor:[...r]};let s=GL(e,r);return s!==-1?{factor:[1,1,1,1],texture:{index:s}}:(n(`${t} requires an RGBA factor in [0, 1] or a resolved texture ID`),null)}function GL(r,e){return typeof e!="string"?-1:(r.textures||[]).findIndex(t=>t.id===e)}function UL(r,e,t,n,s){r[t]!==void 0&&e[t]!==void 0&&r[t]!==e[t]&&s(`${n} conflicting common material ${t}`);let i=e[t]!==void 0?e[t]:r[t]!==void 0?r[t]:!1;return typeof i=="boolean"?i:(s(`${n} common material ${t} must be boolean`),!1)}function zL(r,e){let t=pr(r.extras)?r.extras:r.extras===void 0?{}:{originalExtras:r.extras},n=pr(t.gltf1)?t.gltf1:t.gltf1===void 0?{}:{originalExtras:t.gltf1},s={technique:r.technique,values:r.values,...e===void 0?{}:{commonMaterial:e}},i=Object.keys(s).some(o=>Object.hasOwn(n,o));r.extras={...t,gltf1:{...n,...s,...i?{originalExtras:n}:{}}}}function u8(r,e,t){r.extensionsUsed=[...new Set([...r.extensionsUsed||[],e])],t&&(r.extensionsRequired=[...new Set([...r.extensionsRequired||[],e])])}function WL(r){let e=new Set,t=[r],n=new Set;for(;t.length;){let s=t.pop();if(!(!s||typeof s!="object"||n.has(s))){if(n.add(s),pr(s)&&pr(s.extensions))for(let i of Object.keys(s.extensions))e.add(i);for(let[i,o]of Object.entries(s))i!=="extras"&&t.push(o)}}return e}function Iw(r){return Array.isArray(r)&&r.length===4&&r.every(e=>typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1)}function PL(r){return Iw(r)&&r.slice(0,3).every(e=>e===0)}function pr(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}var Hr,vw,$L=p(()=>{"use strict";Hr="KHR_materials_common",vw="KHR_materials_unlit"});function qL(r,e={}){let t=new Ew;return t.normalize(r,e,!0),()=>t.finishNormalization(r)}var Sw,l8,Ew,KL=p(()=>{"use strict";cL();fL();hL();bL();Ou();_L();vL();SL();LL();ML();RL();NL();$L();Sw={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",cameras:"camera",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},l8={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",camera:"cameras",inverseBindMatrices:"accessors",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Ew=class r{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;report={converted:!1,mutated:!1,unsupported:[],warnings:[]};strict=!1;log;finished=!1;pendingAccessors=new Set;accessorConversions=new Map;uriBufferIndices=new Set;normalize(e,t={},n=!1){if(t.mutate===!1){let o={...e,json:JSON.parse(JSON.stringify(e.json))},a=new r().normalize(o,{...t,mutate:!0});return a.mutated=!1,a}this.strict=t.normalize==="strict",this.log=t.log,this.json=e.json;let s=e.json;switch(s.asset&&s.asset.version){case"2.0":case"2.1":return this.report;case void 0:case"1.0":break;default:return this._warning(`Unknown glTF version ${s.asset.version}`),this.report}if(!t.normalize)throw new Error("glTF v1 is not supported.");this.report.converted=!0,this.report.mutated=!0,this.log?.log(1,"glTF: Converting glTF v1 to glTF v2 using experimental normalization.")(),this._addAsset(s),this._orderBinaryBufferPayloads(e),this._convertTopLevelObjectsToArrays(s),aL(e),this._convertObjectIdsToArrayIndices(s),this._updateObjects(s);for(let[o,a]of(s.buffers||[]).entries())typeof a.uri=="string"&&this.uriBufferIndices.add(o);let i=VL(s,o=>this._unsupported(o),o=>this._warning(o));return AL(s,(o,a)=>this._convertIdToIndex(o,a),o=>this._unsupported(o)),EL(s,o=>this._unsupported(o)),kL(s,o=>this._unsupported(o),o=>this._warning(o)),TL(s,o=>this._unsupported(o)),this.accessorConversions=yL(s),lL(s,o=>this.pendingAccessors.add(o)),dL(s,o=>this._convertIdToIndex(o,"node"),o=>this._unsupported(o)),this._updateNodes(s),IL(s,o=>this._unsupported(o),o=>this._warning(o)),this._preserveLegacyResources(s,i),this._removeEmptyCollections(s),n?this.report:this.finishNormalization(e)}finishNormalization(e){return this.report.converted&&!this.finished&&(DL(e,this.uriBufferIndices,t=>this._unsupported(t),t=>this._warning(t)),wL(e,this.accessorConversions,this.pendingAccessors,t=>this._unsupported(t),t=>this._warning(t)),pL(e,t=>this._unsupported(t)),OL(e,t=>this._unsupported(t),t=>this._warning(t)),this._finishReport(),this.log?.log(1,`glTF: Completed glTF v1 normalization (${this.report.unsupported.length} unsupported features).`)(),this.finished=!0),this.report}_unsupported(e){if(this.report.unsupported.push(e),this.log?.warn(`glTF v1 normalization does not support ${e}`)(),this.strict)throw new Error(`glTF v1 normalization does not support ${e}`)}_warning(e){this.report.warnings.push(e),this.log?.warn(`glTF: ${e}`)()}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_orderBinaryBufferPayloads(e){let t=this.json.buffers;if(!t||Array.isArray(t)||!t.binary_glTF)return;let s=Object.keys(t).indexOf("binary_glTF");s>0&&e.buffers?.length&&(e.buffers=[e.buffers[s],...e.buffers.filter((i,o)=>o!==s)])}_convertTopLevelObjectsToArrays(e){for(let t in Sw)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){let n=e[t];if(!n||Array.isArray(n))return;e[t]=[];let s=Object.keys(n),i=t==="buffers"&&s.includes("binary_glTF")?["binary_glTF",...s.filter(o=>o!=="binary_glTF")]:s;for(let o of i){let a=n[o];a.id=a.id||o;let c=e[t].length;e[t].push(a),this.idToIndexMap[t][o]=c}}_convertObjectIdsToArrayIndices(e){for(let t in Sw)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let t of e.textures)this._convertTextureIds(t);for(let t of e.meshes)this._convertMeshIds(t);for(let t of e.nodes)this._convertNodeIds(t);for(let t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let t of e.primitives){let{attributes:n,indices:s,material:i}=t,o=new Map;for(let a in n){let c=Aw(a),u=o.get(c);if(u!==void 0&&n[u]!==n[a])throw new Error(`glTF v1: conflicting attribute aliases ${u} and ${a}`);o.set(c,a)}t.attributes=Object.fromEntries(Object.entries(n).map(([a,c])=>[Aw(a),this._convertIdToIndex(c,"accessor")])),s&&(t.indices=this._convertIdToIndex(s,"accessor")),i&&(t.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(t=>this._convertIdToIndex(t,"node"))),e.meshes&&(e.meshes=e.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(e,t){e[t]||(e[t]=[]);for(let n of e[t])for(let s in n){let i=n[s],o=this._convertIdToIndex(i,s);n[s]=o}}_convertIdToIndex(e,t){let n=l8[t];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][e];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return s}return e}_updateObjects(e){for(let t of this.json.buffers)delete t.type}_updateNodes(e){let t=e.nodes||[];for(let n=0;n<t.length;n++){let s=t[n];if(!Array.isArray(s.meshes))continue;let i=s.meshes;delete s.meshes,s.mesh=i.shift();for(let o of i){let a={...s,mesh:o,children:void 0};delete a.id,delete a.matrix,delete a.translation,delete a.rotation,delete a.scale,t.push(a),s.children||=[],s.children.push(t.length-1)}}}_preserveLegacyResources(e,t){let n=jL(e,t),s={};for(let i of["techniques","programs","shaders"])e[i]&&(s[i]=e[i],delete e[i],n||this._unsupported(`legacy ${i}`));Object.keys(s).length&&(e.extras={...e.extras,gltf1Resources:s},n&&this._warning("Preserved shader resources overridden by converted common materials."))}_removeEmptyCollections(e){for(let t of e.nodes||[])Array.isArray(t.children)&&t.children.length===0&&delete t.children;for(let t of e.scenes||[])Array.isArray(t.nodes)&&t.nodes.length===0&&delete t.nodes;for(let t of[...Object.keys(Sw),"extensionsUsed","extensionsRequired"])Array.isArray(e[t])&&e[t].length===0&&delete e[t]}_finishReport(){this.report.unsupported.length&&this.report.warnings.push(`Converted glTF v1 with unsupported features: ${this.report.unsupported.join(", ")}`)}}});function f8(r,e){let t=r.basis;return{...r,core:{...r.core,mimeType:e},basis:{...t,format:t?.format||"auto"}}}async function HL(r,e,t=0,n,s){return await XL(r,e,t,n,s)}async function XL(r,e,t,n,s,i){d8(r,e,t,n);let o=qL(r,{normalize:n?.gltf?.normalize,log:Kr(n)});return await nL(r,n,s),n?.gltf?.loadBuffers&&r.json.buffers&&await T8(r,n,s,n.gltf.loadBufferIndices),o(),n?.gltf?.loadFiles&&r.json.files&&await x8(r,n,s),n?.gltf?.loadExternalAssets&&r.json.externalAssets&&await p8(r,n,s,i),n?.gltf?.loadImages&&await _8(r,n,s),await sL(r,n,s),r}function d8(r,e,t,n){if(n.core?.baseUrl&&(r.baseUri=n.core?.baseUrl),e instanceof ArrayBuffer&&!PS(e,t,n.glb)&&(e=new TextDecoder().decode(e)),typeof e=="string")r.json=Hb(e);else if(e instanceof ArrayBuffer){let l={};t=kd(l,e,t,n.glb),X(l.type==="glTF",`Invalid GLB magic string ${l.type}`),r._glb=l,r.json=l.json}else e&&typeof e=="object"?r.json=e:X(!1,"GLTF: must be ArrayBuffer, string, or parsed JSON object");let s=r.json.buffers||[],i=Array.isArray(s)?s:[],o=Array.isArray(s)?[]:Object.keys(s);if(r.buffers=new Array(Array.isArray(s)?s.length:o.length).fill(null),r._glb){let{binChunks:l}=r._glb;for(let g=0;g<i.length;g++){let y=i[g];if(y.chunk===void 0)continue;X(r._glb.version===3,"glTF buffer.chunk requires a GLB v3 container."),X(y.uri===void 0,`glTF buffer ${g} cannot define both uri and chunk.`);let x=l.find(T=>T.chunkIndex===y.chunk);X(x,`glTF buffer ${g} references missing GLB BIN chunk ${y.chunk}.`),X(y.byteLength<=x.byteLength,`glTF buffer ${g} is larger than GLB BIN chunk ${y.chunk}.`),r.buffers[g]={arrayBuffer:x.arrayBuffer,byteOffset:x.byteOffset,byteLength:y.byteLength}}let f=i.map((g,y)=>g.uri===void 0?y:-1).filter(g=>g!==-1),d=l.find(g=>g.chunkIndex===1),h=r._glb.version<3||r._glb.jsonChunkIndex===0&&i[0]?.chunk===void 0&&f.length===1&&f[0]===0&&!!d,m=r._glb.version<3?l[0]:d,b=r._glb.version===1&&!Array.isArray(s)?o.indexOf("binary_glTF"):0;if(h&&m&&b>=0&&(r.buffers[b]={arrayBuffer:m.arrayBuffer,byteOffset:m.byteOffset,byteLength:m.byteLength}),r._glb.version===3)for(let g of f)X(r.buffers[g],`glTF buffer ${g} without a uri must define a valid GLB v3 chunk.`)}if(!r._glb){let l=i.findIndex(f=>f.chunk!==void 0);X(l===-1,`glTF buffer ${l} uses chunk outside a GLB.`)}let a=r.json.images||[];r.images=new Array(a.length).fill({});let c=r.json.files||[];r.files=new Array(c.length).fill(null);let u=r.json.externalAssets||[];r.externalAssets=new Array(u.length).fill(null)}async function p8(r,e,t,n){let s=r.json.externalAssets||[],i=new Set;for(let a of r.json.nodes||[])a.externalAsset!==void 0&&(X(a.externalAsset>=0&&a.externalAsset<s.length,`glTF node references missing external asset ${a.externalAsset}.`),i.add(a.externalAsset));let o=n||b8(t.url?new Set([Nd(t.url)]):new Set);for(let a of i)await m8(r,a,e,t,o)}async function m8(r,e,t,n,s){let i=r.json.externalAssets?.[e];if(!i)throw new Error(`Missing glTF external asset ${e}.`);X(Number.isInteger(i.file)&&i.file>=0&&i.file<(r.json.files?.length||0),`glTF external asset ${e} references missing file ${i.file}.`);let o=await Pd(r,i.file,t,n),a=o.url;X(!a||!s.ancestors.has(a),`glTF external asset cycle detected at ${a}.`);let c=a?s.cache.get(a):void 0;if(!c){let u=g8(r,o,t,n,s),l={...s,ancestors:new Set(s.ancestors)};a&&l.ancestors.add(a);let f=oo(o.arrayBuffer,o.byteOffset,o.byteLength);c=XL({},f,0,t,u,l),a&&s.cache.set(a,c)}r.externalAssets=r.externalAssets||[],r.externalAssets[e]=await c}function b8(r){return{cache:new Map,ancestors:r,packageIds:{next:0}}}function g8(r,e,t,n,s){if(e.url&&!e.url.startsWith("data:"))return{...n,url:e.url,filename:w8(e.url),baseUrl:y8(e.url)};let i=`${h8}${s.packageIds.next++}`,o=`${i}/`;return{...n,url:e.name,filename:e.name,baseUrl:i,fetch:async(a,c)=>{let u=a;if(u.startsWith("data:"))return await n.fetch(a,c);let l=u.startsWith(o)?u.slice(o.length):u,f=uy(r,l);X(f>=0,`glTF package does not contain file ${l}.`);let d=await Pd(r,f,t,n),h=oo(d.arrayBuffer,d.byteOffset,d.byteLength);return new Response(h,{headers:{"content-type":d.mimeType}})}}}function y8(r){let e=r.lastIndexOf("/");return e>=0?r.slice(0,e):""}function w8(r){let e=r.lastIndexOf("/");return e>=0?r.slice(e+1):r}async function x8(r,e,t){let n=r.json.files||[];await Promise.all(n.map((s,i)=>Pd(r,i,e,t)))}async function T8(r,e,t,n){let s=r.json.buffers||[],i=n?new Set(typeof n=="function"?n(r.json):n):void 0;for(let o=0;o<s.length;++o){if(i&&!i.has(o))continue;let a=s[o];if(a.uri){let{fetch:c}=t;X(c);let u=Jn(a.uri,e,t),f=await(await t?.fetch?.(u))?.arrayBuffer?.();r.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete a.uri}else r.buffers[o]===null&&(r.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function _8(r,e,t){let n=A8(r),s=r.json.images||[],i=[];for(let o of n)i.push(v8(r,s[o],o,e,t));return await Promise.all(i)}function A8(r){let e=new Set;r.json.asset.thumbnail!==void 0&&e.add(r.json.asset.thumbnail);let t=r.json.textures||[];for(let n of t)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function v8(r,e,t,n,s){let i;if(e.uri&&!e.hasOwnProperty("bufferView")){let l=Jn(e.uri,n,s),{fetch:f}=s;i=await(await f(l)).arrayBuffer(),e.bufferView={data:i}}if(Number.isFinite(e.bufferView)){let l=hr(r.json,r.buffers,e.bufferView);i=oo(l.buffer,l.byteOffset,l.byteLength)}X(i,"glTF image has no data");let o=f8(n,e.mimeType),a=_u(s);if(!!(a&&!n.gltf?.excludeExtensions?.includes("MSFT_texture_dds")&&r.json.textures?.some(l=>l.source===t&&l.extensions?.MSFT_texture_dds?.source===t))){let l=await Ys(i,a,n,s);X(l.length>0,"MSFT_texture_dds parser returned no texture levels"),r.images=r.images||[],r.images[t]={compressed:!0,mipmaps:!0,width:l[0].width,height:l[0].height,data:l};return}let u=await Ys(i,[du,fo],o,s);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),r.images=r.images||[],r.images[t]=u}var h8,JL=p(()=>{"use strict";Be();Be();Xn();Xn();ho();oy();pu();WS();po();oL();Jy();KL();h8="gltf-package://"});async function YL(r,e={},t){let n={...Lw.options,...e};n.gltf={...Lw.options.gltf,...n.gltf};let s=e?.glb?.byteOffset||0;return await HL({},r,s,n,t)}var Pie,I8,Lw,QL=p(()=>{"use strict";JL();eB();({preload:Pie,...I8}=ZL),Lw={...I8,parse:YL}});var Bw={};J(Bw,{GLTFLoaderWithParser:()=>Lw,parse:()=>YL});var Fw=p(()=>{"use strict";QL()});async function S8(){let{GLTFLoaderWithParser:r}=await Promise.resolve().then(()=>(Fw(),Bw));return r}var ZL,eB=p(()=>{"use strict";zg();Wg();ZL={dataType:null,batchType:null,...UI,version:Id,preload:S8,options:{gltf:{normalize:!0,loadBuffers:!0,loadFiles:!1,loadExternalAssets:!1,loadImages:!0,loadAudio:!0,decompressMeshes:!0}}}});async function B8(r,e){return tB(r,e)}function tB(r,e){let t={};return kd(t,r,e?.glb?.byteOffset||0,e?.glb),t}var Kie,E8,L8,rB=p(()=>{"use strict";oy();sB();({preload:Kie,...E8}=nB),L8={...E8,parse:B8,parseSync:tB}});var Ow={};J(Ow,{GLBLoaderWithParser:()=>L8});var Mw=p(()=>{"use strict";rB()});async function F8(){let{GLBLoaderWithParser:r}=await Promise.resolve().then(()=>(Mw(),Ow));return r}var nB,sB=p(()=>{"use strict";zg();Wg();nB={dataType:null,batchType:null,...PI,version:Id,preload:F8,options:{glb:{strict:!1}}}});function O8(r){return typeof r=="string"?r.charAt(0).toLowerCase()+r.slice(1):r}function rh(r){if(Array.isArray(r))return r.map(e=>rh(e));if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))Object.defineProperty(e,O8(t),{value:rh(n),enumerable:!0,configurable:!0,writable:!0});return e}return r}var iB=p(()=>{"use strict"});var oB,M8,D8,R8,Du,Dw,k8,N8,Ru,Rw,ka,aB=p(()=>{"use strict";oB={ontext:()=>{},onprocessinginstruction:()=>{},onsgmldeclaration:()=>{},ondoctype:()=>{},oncomment:()=>{},onopentagstart:()=>{},onattribute:()=>{},onopentag:()=>{},onclosetag:()=>{},onopencdata:()=>{},oncdata:()=>{},onclosecdata:()=>{},onerror:()=>{},onend:()=>{},onready:()=>{},onscript:()=>{},onopennamespace:()=>{},onclosenamespace:()=>{}},M8={...oB,strict:!1,MAX_BUFFER_LENGTH:64*1024,lowercase:!1,lowercasetags:!1,noscript:!1,strictEntities:!1,preserveCase:!1,caseInsensitiveTags:!1,processEntities:!0,xmlns:void 0,position:void 0,trim:void 0,normalize:void 0},D8=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],R8=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"],Du=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Dw=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,k8=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,N8=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,Ru={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};Object.keys(Ru).forEach(r=>{let e=Ru[r];Ru[r]=typeof e=="number"?String.fromCharCode(e):e});Rw=class r{EVENTS=D8;ENTITIES={...Ru};XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"};S=0;opt;trackPosition=!1;column=0;line=0;c="";error;q="";bufferCheckPosition;closed=!1;tags=[];looseCase="";closedRoot=!1;sawRoot=!1;strict=!1;tag;strictEntities;state;noscript=!1;attribList=[];ns;position=0;STATE={BEGIN:this.S++,BEGIN_WHITESPACE:this.S++,TEXT:this.S++,TEXT_ENTITY:this.S++,OPEN_WAKA:this.S++,SGML_DECL:this.S++,SGML_DECL_QUOTED:this.S++,DOCTYPE:this.S++,DOCTYPE_QUOTED:this.S++,DOCTYPE_DTD:this.S++,DOCTYPE_DTD_QUOTED:this.S++,COMMENT_STARTING:this.S++,COMMENT:this.S++,COMMENT_ENDING:this.S++,COMMENT_ENDED:this.S++,CDATA:this.S++,CDATA_ENDING:this.S++,CDATA_ENDING_2:this.S++,PROC_INST:this.S++,PROC_INST_BODY:this.S++,PROC_INST_ENDING:this.S++,OPEN_TAG:this.S++,OPEN_TAG_SLASH:this.S++,ATTRIB:this.S++,ATTRIB_NAME:this.S++,ATTRIB_NAME_SAW_WHITE:this.S++,ATTRIB_VALUE:this.S++,ATTRIB_VALUE_QUOTED:this.S++,ATTRIB_VALUE_CLOSED:this.S++,ATTRIB_VALUE_UNQUOTED:this.S++,ATTRIB_VALUE_ENTITY_Q:this.S++,ATTRIB_VALUE_ENTITY_U:this.S++,CLOSE_TAG:this.S++,CLOSE_TAG_SAW_WHITE:this.S++,SCRIPT:this.S++,SCRIPT_ENDING:this.S++};BUFFERS=R8;CDATA="[CDATA[";DOCTYPE="DOCTYPE";XML_NAMESPACE="http://www.w3.org/XML/1998/namespace";XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/";rootNS={xml:this.XML_NAMESPACE,xmlns:this.XMLNS_NAMESPACE};comment;sgmlDecl;textNode="";tagName;doctype;procInstName;procInstBody;entity="";attribName;attribValue;cdata="";script="";startTagPosition=0;constructor(){this.S=0;for(let e in this.STATE)this.STATE.hasOwnProperty(e)&&(this.STATE[this.STATE[e]]=e);this.S=this.STATE}static charAt(e,t){let n="";return t<e.length&&(n=e.charAt(t)),n}static isWhitespace(e){return e===" "||e===`
44
44
  `||e==="\r"||e===" "}static isQuote(e){return e==='"'||e==="'"}static isAttribEnd(e){return e===">"||r.isWhitespace(e)}static isMatch(e,t){return e.test(t)}static notMatch(e,t){return!r.isMatch(e,t)}static qname(e,t){let s=e.indexOf(":")<0?["",e]:e.split(":"),i=s[0],o=s[1];return t&&e==="xmlns"&&(i="xmlns",o=""),{prefix:i,local:o}}write(e){if(this.error)throw this.error;if(this.closed)return this.errorFunction("Cannot write after close. Assign an onready handler.");if(e===null)return this.end();typeof e=="object"&&(e=e.toString());let t=0,n;for(;n=r.charAt(e,t++),this.c=n,!!n;)switch(this.trackPosition&&(this.position++,n===`
45
45
  `?(this.line++,this.column=0):this.column++),this.state){case this.S.BEGIN:if(this.state=this.S.BEGIN_WHITESPACE,n==="\uFEFF")continue;this.beginWhiteSpace(n);continue;case this.S.BEGIN_WHITESPACE:this.beginWhiteSpace(n);continue;case this.S.TEXT:if(this.sawRoot&&!this.closedRoot){let o=t-1;for(;n&&n!=="<"&&n!=="&";)n=r.charAt(e,t++),n&&this.trackPosition&&(this.position++,n===`
46
- `?(this.line++,this.column=0):this.column++);this.textNode+=e.substring(o,t-1)}n==="<"&&!(this.sawRoot&&this.closedRoot&&!this.strict)?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):(!r.isWhitespace(n)&&(!this.sawRoot||this.closedRoot)&&this.strictFail("Text data outside of root node."),n==="&"?this.state=this.S.TEXT_ENTITY:this.textNode+=n);continue;case this.S.SCRIPT:n==="<"?this.state=this.S.SCRIPT_ENDING:this.script+=n;continue;case this.S.SCRIPT_ENDING:n==="/"?this.state=this.S.CLOSE_TAG:(this.script+=`<${n}`,this.state=this.S.SCRIPT);continue;case this.S.OPEN_WAKA:if(n==="!")this.state=this.S.SGML_DECL,this.sgmlDecl="";else if(!r.isWhitespace(n))if(r.isMatch(bu,n))this.state=this.S.OPEN_TAG,this.tagName=n;else if(n==="/")this.state=this.S.CLOSE_TAG,this.tagName="";else if(n==="?")this.state=this.S.PROC_INST,this.procInstName=this.procInstBody="";else{if(this.strictFail("Unencoded <"),this.startTagPosition+1<this.position){let o=this.position-this.startTagPosition;n=new Array(o).join(" ")+n}this.textNode+=`<${n}`,this.state=this.S.TEXT}continue;case this.S.SGML_DECL:(this.sgmlDecl+n).toUpperCase()===this.CDATA?(this.emitNode("onopencdata"),this.state=this.S.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+n==="--"?(this.state=this.S.COMMENT,this.comment="",this.sgmlDecl=""):(this.sgmlDecl+n).toUpperCase()===this.DOCTYPE?(this.state=this.S.DOCTYPE,(this.doctype||this.sawRoot)&&this.strictFail("Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):n===">"?(this.emitNode("onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=this.S.TEXT):r.isQuote(n)?(this.state=this.S.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case this.S.SGML_DECL_QUOTED:n===this.q&&(this.state=this.S.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case this.S.DOCTYPE:n===">"?(this.state=this.S.TEXT,this.emitNode("ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,n==="["?this.state=this.S.DOCTYPE_DTD:r.isQuote(n)&&(this.state=this.S.DOCTYPE_QUOTED,this.q=n));continue;case this.S.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=this.S.DOCTYPE);continue;case this.S.DOCTYPE_DTD:this.doctype+=n,n==="]"?this.state=this.S.DOCTYPE:r.isQuote(n)&&(this.state=this.S.DOCTYPE_DTD_QUOTED,this.q=n);continue;case this.S.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=this.S.DOCTYPE_DTD,this.q="");continue;case this.S.COMMENT:n==="-"?this.state=this.S.COMMENT_ENDING:this.comment+=n;continue;case this.S.COMMENT_ENDING:n==="-"?(this.state=this.S.COMMENT_ENDED,this.comment=this.textApplyOptions(this.comment),this.comment&&this.emitNode("oncomment",this.comment),this.comment=""):(this.comment+=`-${n}`,this.state=this.S.COMMENT);continue;case this.S.COMMENT_ENDED:n!==">"?(this.strictFail("Malformed comment"),this.comment+=`--${n}`,this.state=this.S.COMMENT):this.state=this.S.TEXT;continue;case this.S.CDATA:n==="]"?this.state=this.S.CDATA_ENDING:this.cdata+=n;continue;case this.S.CDATA_ENDING:n==="]"?this.state=this.S.CDATA_ENDING_2:(this.cdata+=`]${n}`,this.state=this.S.CDATA);continue;case this.S.CDATA_ENDING_2:n===">"?(this.cdata&&this.emitNode("oncdata",this.cdata),this.emitNode("onclosecdata"),this.cdata="",this.state=this.S.TEXT):n==="]"?this.cdata+="]":(this.cdata+=`]]${n}`,this.state=this.S.CDATA);continue;case this.S.PROC_INST:n==="?"?this.state=this.S.PROC_INST_ENDING:r.isWhitespace(n)?this.state=this.S.PROC_INST_BODY:this.procInstName+=n;continue;case this.S.PROC_INST_BODY:if(!this.procInstBody&&r.isWhitespace(n))continue;n==="?"?this.state=this.S.PROC_INST_ENDING:this.procInstBody+=n;continue;case this.S.PROC_INST_ENDING:n===">"?(this.emitNode("onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=this.S.TEXT):(this.procInstBody+=`?${n}`,this.state=this.S.PROC_INST_BODY);continue;case this.S.OPEN_TAG:r.isMatch(zy,n)?this.tagName+=n:(this.newTag(),n===">"?this.openTag():n==="/"?this.state=this.S.OPEN_TAG_SLASH:(r.isWhitespace(n)||this.strictFail("Invalid character in tag name"),this.state=this.S.ATTRIB));continue;case this.S.OPEN_TAG_SLASH:n===">"?(this.openTag(!0),this.closeTag()):(this.strictFail("Forward-slash in opening tag not followed by >"),this.state=this.S.ATTRIB);continue;case this.S.ATTRIB:if(r.isWhitespace(n))continue;n===">"?this.openTag():n==="/"?this.state=this.S.OPEN_TAG_SLASH:r.isMatch(bu,n)?(this.attribName=n,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME:n==="="?this.state=this.S.ATTRIB_VALUE:n===">"?(this.strictFail("Attribute without value"),this.attribValue=this.attribName,this.attrib(),this.openTag()):r.isWhitespace(n)?this.state=this.S.ATTRIB_NAME_SAW_WHITE:r.isMatch(zy,n)?this.attribName+=n:this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME_SAW_WHITE:if(n==="=")this.state=this.S.ATTRIB_VALUE;else{if(r.isWhitespace(n))continue;this.strictFail("Attribute without value"),Object.defineProperty(this.tag.attributes,this.attribName,{value:"",enumerable:!0,configurable:!0,writable:!0}),this.attribValue="",this.emitNode("onattribute",{name:this.attribName,value:""}),this.attribName="",n===">"?this.openTag():r.isMatch(bu,n)?(this.attribName=n,this.state=this.S.ATTRIB_NAME):(this.strictFail("Invalid attribute name"),this.state=this.S.ATTRIB)}continue;case this.S.ATTRIB_VALUE:if(r.isWhitespace(n))continue;r.isQuote(n)?(this.q=n,this.state=this.S.ATTRIB_VALUE_QUOTED):(this.strictFail("Unquoted attribute value"),this.state=this.S.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case this.S.ATTRIB_VALUE_QUOTED:if(n!==this.q){n==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}this.attrib(),this.q="",this.state=this.S.ATTRIB_VALUE_CLOSED;continue;case this.S.ATTRIB_VALUE_CLOSED:r.isWhitespace(n)?this.state=this.S.ATTRIB:n===">"?this.openTag():n==="/"?this.state=this.S.OPEN_TAG_SLASH:r.isMatch(bu,n)?(this.strictFail("No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_VALUE_UNQUOTED:if(!r.isAttribEnd(n)){n==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}this.attrib(),n===">"?this.openTag():this.state=this.S.ATTRIB;continue;case this.S.CLOSE_TAG:if(this.tagName)n===">"?this.closeTag():r.isMatch(zy,n)?this.tagName+=n:this.script?(this.script+=`</${this.tagName}`,this.tagName="",this.state=this.S.SCRIPT):(r.isWhitespace(n)||this.strictFail("Invalid tagname in closing tag"),this.state=this.S.CLOSE_TAG_SAW_WHITE);else{if(r.isWhitespace(n))continue;r.notMatch(bu,n)?this.script?(this.script+=`</${n}`,this.state=this.S.SCRIPT):this.strictFail("Invalid tagname in closing tag."):this.tagName=n}continue;case this.S.CLOSE_TAG_SAW_WHITE:if(r.isWhitespace(n))continue;n===">"?this.closeTag():this.strictFail("Invalid characters in closing tag");continue;case this.S.TEXT_ENTITY:case this.S.ATTRIB_VALUE_ENTITY_Q:case this.S.ATTRIB_VALUE_ENTITY_U:let s,i;switch(this.state){case this.S.TEXT_ENTITY:s=this.S.TEXT,i="textNode";break;case this.S.ATTRIB_VALUE_ENTITY_Q:s=this.S.ATTRIB_VALUE_QUOTED,i="attribValue";break;case this.S.ATTRIB_VALUE_ENTITY_U:s=this.S.ATTRIB_VALUE_UNQUOTED,i="attribValue";break;default:throw new Error(`Unknown state: ${this.state}`)}n===";"?(this[i]+=this.parseEntity(),this.entity="",this.state=s):r.isMatch(this.entity.length?_3:T3,n)?this.entity+=n:(this.strictFail("Invalid character in entity name"),this[i]+=`&${this.entity}${n}`,this.entity="",this.state=s);continue;default:throw new Error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&this.checkBufferLength(),this}emit(e,t){if(this.events.hasOwnProperty(e)){let n=e.replace(/^on/,"");this.events[e](t,n,this)}}clearBuffers(){for(let e=0,t=this.BUFFERS.length;e<t;e++)this[this[e]]=""}flushBuffers(){this.closeText(),this.cdata!==""&&(this.emitNode("oncdata",this.cdata),this.cdata=""),this.script!==""&&(this.emitNode("onscript",this.script),this.script="")}end(){return this.sawRoot&&!this.closedRoot&&this.strictFail("Unclosed root tag"),this.strict&&this.state!==this.S.BEGIN&&this.state!==this.S.BEGIN_WHITESPACE&&this.state!==this.S.TEXT&&this.errorFunction("Unexpected end"),this.closeText(),this.c="",this.closed=!0,this.emit("onend"),new Sa(this.opt)}errorFunction(e){this.closeText(),this.trackPosition&&(e+=`
46
+ `?(this.line++,this.column=0):this.column++);this.textNode+=e.substring(o,t-1)}n==="<"&&!(this.sawRoot&&this.closedRoot&&!this.strict)?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):(!r.isWhitespace(n)&&(!this.sawRoot||this.closedRoot)&&this.strictFail("Text data outside of root node."),n==="&"?this.state=this.S.TEXT_ENTITY:this.textNode+=n);continue;case this.S.SCRIPT:n==="<"?this.state=this.S.SCRIPT_ENDING:this.script+=n;continue;case this.S.SCRIPT_ENDING:n==="/"?this.state=this.S.CLOSE_TAG:(this.script+=`<${n}`,this.state=this.S.SCRIPT);continue;case this.S.OPEN_WAKA:if(n==="!")this.state=this.S.SGML_DECL,this.sgmlDecl="";else if(!r.isWhitespace(n))if(r.isMatch(Du,n))this.state=this.S.OPEN_TAG,this.tagName=n;else if(n==="/")this.state=this.S.CLOSE_TAG,this.tagName="";else if(n==="?")this.state=this.S.PROC_INST,this.procInstName=this.procInstBody="";else{if(this.strictFail("Unencoded <"),this.startTagPosition+1<this.position){let o=this.position-this.startTagPosition;n=new Array(o).join(" ")+n}this.textNode+=`<${n}`,this.state=this.S.TEXT}continue;case this.S.SGML_DECL:(this.sgmlDecl+n).toUpperCase()===this.CDATA?(this.emitNode("onopencdata"),this.state=this.S.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+n==="--"?(this.state=this.S.COMMENT,this.comment="",this.sgmlDecl=""):(this.sgmlDecl+n).toUpperCase()===this.DOCTYPE?(this.state=this.S.DOCTYPE,(this.doctype||this.sawRoot)&&this.strictFail("Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):n===">"?(this.emitNode("onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=this.S.TEXT):r.isQuote(n)?(this.state=this.S.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case this.S.SGML_DECL_QUOTED:n===this.q&&(this.state=this.S.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case this.S.DOCTYPE:n===">"?(this.state=this.S.TEXT,this.emitNode("ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,n==="["?this.state=this.S.DOCTYPE_DTD:r.isQuote(n)&&(this.state=this.S.DOCTYPE_QUOTED,this.q=n));continue;case this.S.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=this.S.DOCTYPE);continue;case this.S.DOCTYPE_DTD:this.doctype+=n,n==="]"?this.state=this.S.DOCTYPE:r.isQuote(n)&&(this.state=this.S.DOCTYPE_DTD_QUOTED,this.q=n);continue;case this.S.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=this.S.DOCTYPE_DTD,this.q="");continue;case this.S.COMMENT:n==="-"?this.state=this.S.COMMENT_ENDING:this.comment+=n;continue;case this.S.COMMENT_ENDING:n==="-"?(this.state=this.S.COMMENT_ENDED,this.comment=this.textApplyOptions(this.comment),this.comment&&this.emitNode("oncomment",this.comment),this.comment=""):(this.comment+=`-${n}`,this.state=this.S.COMMENT);continue;case this.S.COMMENT_ENDED:n!==">"?(this.strictFail("Malformed comment"),this.comment+=`--${n}`,this.state=this.S.COMMENT):this.state=this.S.TEXT;continue;case this.S.CDATA:n==="]"?this.state=this.S.CDATA_ENDING:this.cdata+=n;continue;case this.S.CDATA_ENDING:n==="]"?this.state=this.S.CDATA_ENDING_2:(this.cdata+=`]${n}`,this.state=this.S.CDATA);continue;case this.S.CDATA_ENDING_2:n===">"?(this.cdata&&this.emitNode("oncdata",this.cdata),this.emitNode("onclosecdata"),this.cdata="",this.state=this.S.TEXT):n==="]"?this.cdata+="]":(this.cdata+=`]]${n}`,this.state=this.S.CDATA);continue;case this.S.PROC_INST:n==="?"?this.state=this.S.PROC_INST_ENDING:r.isWhitespace(n)?this.state=this.S.PROC_INST_BODY:this.procInstName+=n;continue;case this.S.PROC_INST_BODY:if(!this.procInstBody&&r.isWhitespace(n))continue;n==="?"?this.state=this.S.PROC_INST_ENDING:this.procInstBody+=n;continue;case this.S.PROC_INST_ENDING:n===">"?(this.emitNode("onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=this.S.TEXT):(this.procInstBody+=`?${n}`,this.state=this.S.PROC_INST_BODY);continue;case this.S.OPEN_TAG:r.isMatch(Dw,n)?this.tagName+=n:(this.newTag(),n===">"?this.openTag():n==="/"?this.state=this.S.OPEN_TAG_SLASH:(r.isWhitespace(n)||this.strictFail("Invalid character in tag name"),this.state=this.S.ATTRIB));continue;case this.S.OPEN_TAG_SLASH:n===">"?(this.openTag(!0),this.closeTag()):(this.strictFail("Forward-slash in opening tag not followed by >"),this.state=this.S.ATTRIB);continue;case this.S.ATTRIB:if(r.isWhitespace(n))continue;n===">"?this.openTag():n==="/"?this.state=this.S.OPEN_TAG_SLASH:r.isMatch(Du,n)?(this.attribName=n,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME:n==="="?this.state=this.S.ATTRIB_VALUE:n===">"?(this.strictFail("Attribute without value"),this.attribValue=this.attribName,this.attrib(),this.openTag()):r.isWhitespace(n)?this.state=this.S.ATTRIB_NAME_SAW_WHITE:r.isMatch(Dw,n)?this.attribName+=n:this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME_SAW_WHITE:if(n==="=")this.state=this.S.ATTRIB_VALUE;else{if(r.isWhitespace(n))continue;this.strictFail("Attribute without value"),Object.defineProperty(this.tag.attributes,this.attribName,{value:"",enumerable:!0,configurable:!0,writable:!0}),this.attribValue="",this.emitNode("onattribute",{name:this.attribName,value:""}),this.attribName="",n===">"?this.openTag():r.isMatch(Du,n)?(this.attribName=n,this.state=this.S.ATTRIB_NAME):(this.strictFail("Invalid attribute name"),this.state=this.S.ATTRIB)}continue;case this.S.ATTRIB_VALUE:if(r.isWhitespace(n))continue;r.isQuote(n)?(this.q=n,this.state=this.S.ATTRIB_VALUE_QUOTED):(this.strictFail("Unquoted attribute value"),this.state=this.S.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case this.S.ATTRIB_VALUE_QUOTED:if(n!==this.q){n==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}this.attrib(),this.q="",this.state=this.S.ATTRIB_VALUE_CLOSED;continue;case this.S.ATTRIB_VALUE_CLOSED:r.isWhitespace(n)?this.state=this.S.ATTRIB:n===">"?this.openTag():n==="/"?this.state=this.S.OPEN_TAG_SLASH:r.isMatch(Du,n)?(this.strictFail("No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_VALUE_UNQUOTED:if(!r.isAttribEnd(n)){n==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}this.attrib(),n===">"?this.openTag():this.state=this.S.ATTRIB;continue;case this.S.CLOSE_TAG:if(this.tagName)n===">"?this.closeTag():r.isMatch(Dw,n)?this.tagName+=n:this.script?(this.script+=`</${this.tagName}`,this.tagName="",this.state=this.S.SCRIPT):(r.isWhitespace(n)||this.strictFail("Invalid tagname in closing tag"),this.state=this.S.CLOSE_TAG_SAW_WHITE);else{if(r.isWhitespace(n))continue;r.notMatch(Du,n)?this.script?(this.script+=`</${n}`,this.state=this.S.SCRIPT):this.strictFail("Invalid tagname in closing tag."):this.tagName=n}continue;case this.S.CLOSE_TAG_SAW_WHITE:if(r.isWhitespace(n))continue;n===">"?this.closeTag():this.strictFail("Invalid characters in closing tag");continue;case this.S.TEXT_ENTITY:case this.S.ATTRIB_VALUE_ENTITY_Q:case this.S.ATTRIB_VALUE_ENTITY_U:let s,i;switch(this.state){case this.S.TEXT_ENTITY:s=this.S.TEXT,i="textNode";break;case this.S.ATTRIB_VALUE_ENTITY_Q:s=this.S.ATTRIB_VALUE_QUOTED,i="attribValue";break;case this.S.ATTRIB_VALUE_ENTITY_U:s=this.S.ATTRIB_VALUE_UNQUOTED,i="attribValue";break;default:throw new Error(`Unknown state: ${this.state}`)}n===";"?(this[i]+=this.parseEntity(),this.entity="",this.state=s):r.isMatch(this.entity.length?N8:k8,n)?this.entity+=n:(this.strictFail("Invalid character in entity name"),this[i]+=`&${this.entity}${n}`,this.entity="",this.state=s);continue;default:throw new Error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&this.checkBufferLength(),this}emit(e,t){if(this.events.hasOwnProperty(e)){let n=e.replace(/^on/,"");this.events[e](t,n,this)}}clearBuffers(){for(let e=0,t=this.BUFFERS.length;e<t;e++)this[this[e]]=""}flushBuffers(){this.closeText(),this.cdata!==""&&(this.emitNode("oncdata",this.cdata),this.cdata=""),this.script!==""&&(this.emitNode("onscript",this.script),this.script="")}end(){return this.sawRoot&&!this.closedRoot&&this.strictFail("Unclosed root tag"),this.strict&&this.state!==this.S.BEGIN&&this.state!==this.S.BEGIN_WHITESPACE&&this.state!==this.S.TEXT&&this.errorFunction("Unexpected end"),this.closeText(),this.c="",this.closed=!0,this.emit("onend"),new ka(this.opt)}errorFunction(e){this.closeText(),this.trackPosition&&(e+=`
47
47
  Line: ${this.line}
48
48
  Column: ${this.column}
49
49
  Char: ${this.c}`);let t=new Error(e);return this.error=t,this.emit("onerror",t),this}attrib(){if(!this.strict&&!this.opt.preserveCase&&(this.attribName=this.attribName[this.looseCase]()),this.attribList.indexOf(this.attribName)!==-1||Object.hasOwn(this.tag.attributes,this.attribName)){this.strictFail("Duplicate attribute"),this.attribName=this.attribValue="";return}if(this.opt.xmlns){let e=r.qname(this.attribName,!0),t=e.prefix,n=e.local;if(t==="xmlns")if(n==="xml"&&this.attribValue!==this.XML_NAMESPACE)this.strictFail(`xml: prefix must be bound to ${this.XML_NAMESPACE}
50
50
  Actual: ${this.attribValue}`);else if(n==="xmlns"&&this.attribValue!==this.XMLNS_NAMESPACE)this.strictFail(`xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE}
51
- Actual: ${this.attribValue}`);else{let s=this.tag,i=this.tags[this.tags.length-1]||this;s.ns===i.ns&&(s.ns=Object.create(i.ns)),s.ns[n]=this.attribValue}this.attribList.push([this.attribName,this.attribValue])}else Object.defineProperty(this.tag.attributes,this.attribName,{value:this.attribValue,enumerable:!0,configurable:!0,writable:!0}),this.emitNode("onattribute",{name:this.attribName,value:this.attribValue});this.attribName=this.attribValue=""}newTag(){!this.strict&&!this.opt.preserveCase&&(this.tagName=this.tagName[this.looseCase]());let e=this.tags[this.tags.length-1]||this,t={name:this.tagName,attributes:{}};this.tag=t,this.opt.xmlns&&(t.ns=e.ns),this.attribList.length=0,this.emitNode("onopentagstart",t)}parseEntity(){let e=this.decodeEntity();return this.opt.processEntities===!1?`&${this.entity};`:e}decodeEntity(){let e=this.entity,t=e.toLowerCase(),n=NaN,s="";return typeof this.ENTITIES[e]=="string"||typeof this.ENTITIES[e]=="number"?this.ENTITIES[e]:typeof this.ENTITIES[t]=="string"||typeof this.ENTITIES[t]=="number"?this.ENTITIES[t]:(e=t,e.charAt(0)==="#"&&(e.charAt(1)==="x"?(e=e.slice(2),n=parseInt(e,16),s=n.toString(16)):(e=e.slice(1),n=parseInt(e,10),s=n.toString(10))),e=e.replace(/^0+/,""),Number.isNaN(n)||s.toLowerCase()!==e?(this.strictFail("Invalid character entity"),`&${this.entity};`):n<0||n>1114111||n>=55296&&n<=57343||n<32&&![9,10,13].includes(n)||n===65534||n===65535?(this.strictFail("Invalid character entity"),`&${this.entity};`):String.fromCodePoint(n))}beginWhiteSpace(e){e==="<"?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):r.isWhitespace(e)||(this.strictFail("Non-whitespace before first tag."),this.textNode=e,this.state=this.S.TEXT)}strictFail(e){if(typeof this!="object"||!(this instanceof Sa))throw new Error("bad call to strictFail");this.strict&&this.errorFunction(e)}textApplyOptions(e){return this.opt.trim&&(e=e.trim()),this.opt.normalize&&(e=e.replace(/\s+/g," ")),e}emitNode(e,t){this.textNode&&this.closeText(),this.emit(e,t)}closeText(){this.textNode=this.textApplyOptions(this.textNode),this.textNode!==void 0&&this.textNode!==""&&this.textNode!=="undefined"&&this.emit("ontext",this.textNode),this.textNode=""}checkBufferLength(){let e=Math.max(this.opt.MAX_BUFFER_LENGTH,10),t=0;for(let s=0,i=this.BUFFERS.length;s<i;s++){let o=this[this.BUFFERS[s]]?.length||0;if(o>e)switch(this.BUFFERS[s]){case"textNode":this.closeText();break;case"cdata":this.emitNode("oncdata",this.cdata),this.cdata="";break;case"script":this.emitNode("onscript",this.script),this.script="";break;default:this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[s]}`)}t=Math.max(t,o)}let n=this.opt.MAX_BUFFER_LENGTH-t;this.bufferCheckPosition=n+this.position}openTag(e){if(this.opt.xmlns){let t=this.tag,n=r.qname(this.tagName);t.prefix=n.prefix,t.local=n.local,t.uri=t.ns[n.prefix]||"",t.prefix&&!t.uri&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`),t.uri=n.prefix);let s=this.tags[this.tags.length-1]||this;if(t.ns&&s.ns!==t.ns){let i=this;Object.keys(t.ns).forEach(o=>{i.emitNode("onopennamespace",{prefix:o,uri:t.ns[o]})})}for(let i=0,o=this.attribList.length;i<o;i++){let a=this.attribList[i],c=a[0],u=a[1],l=r.qname(c,!0),f=l.prefix,d=l.local,h=f===""?"":t.ns[f]||"",m={name:c,value:u,prefix:f,local:d,uri:h};f&&f!=="xmlns"&&!h&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(f)}`),m.uri=f),Object.defineProperty(this.tag.attributes,c,{value:m,enumerable:!0,configurable:!0,writable:!0}),this.emitNode("onattribute",m)}this.attribList.length=0}this.tag.isSelfClosing=!!e,this.sawRoot=!0,this.tags.push(this.tag),this.emitNode("onopentag",this.tag),e||(!this.noscript&&this.tagName.toLowerCase()==="script"?this.state=this.S.SCRIPT:this.state=this.S.TEXT,this.tag=null,this.tagName=""),this.attribName=this.attribValue="",this.attribList.length=0}closeTag(){if(!this.tagName){this.strictFail("Weird empty close tag."),this.textNode+="</>",this.state=this.S.TEXT;return}let e=!this.strict&&(this.opt.caseInsensitiveTags||!this.opt.preserveCase);if(this.script){if((e?this.tagName.toLowerCase():this.tagName)!=="script"){this.script+=`</${this.tagName}>`,this.tagName="",this.state=this.S.SCRIPT;return}this.emitNode("onscript",this.script),this.script=""}let t=this.tags.length,n=this.tagName,s=e?n.toLowerCase():n;for(;t--;){let o=this.tags[t];if((e?o.name.toLowerCase():o.name)!==s)this.strictFail("Unexpected close tag");else break}if(t<0){this.strictFail(`Unmatched closing tag: ${this.tagName}`),this.textNode+=`</${this.tagName}>`,this.state=this.S.TEXT;return}this.tagName=n;let i=this.tags.length;for(;i-- >t;){let o=this.tags.pop();this.tag=o,this.tagName=this.tag.name,this.emitNode("onclosetag",this.tagName);let a={};for(let u in o.ns)o.ns.hasOwnProperty(u)&&(a[u]=o.ns[u]);let c=this.tags[this.tags.length-1]||this;if(this.opt.xmlns&&o.ns!==c.ns){let u=this;Object.keys(o.ns).forEach(l=>{let f=o.ns[l];u.emitNode("onclosenamespace",{prefix:l,uri:f})})}}t===0&&(this.closedRoot=!0),this.tagName=this.attribValue=this.attribName="",this.attribList.length=0,this.state=this.S.TEXT}},Sa=class extends Wy{static ENTITIES=gu;opt=y3;events=oL;constructor(e){super(),this.clearBuffers(),this.opt=e={...this.opt,...e},this.events={...this.events,...e},this.q=this.c="",this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.bufferCheckPosition=this.opt.MAX_BUFFER_LENGTH,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!this.opt.strict,this.noscript=!!(this.opt.strict||this.opt.noscript),this.state=this.S.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(this.XML_ENTITIES):Object.create(this.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(this.rootNS)),this.trackPosition=this.opt.position!==!1,this.trackPosition&&(this.position=this.line=this.column=0),this.emit("onready")}resume(){return this.error=null,this}close(){return this.write(null)}flush(){this.flushBuffers()}}});function Ea(r,e,t){Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0})}function cL(r,e={}){if(e.strict!==!1&&/[^\u0009\u000a\u000d\u0020-\ud7ff\ue000-\ufffd\u{10000}-\u{10ffff}]/u.test(r))throw new Error("XML: invalid XML character");let t=e.maxDepth??256;if(!Number.isSafeInteger(t)||t<1||t>4096)throw new Error("XML: maxDepth must be an integer between 1 and 4096");let n=new $y(e,t);if(new Sa({strict:e.strict!==!1,strictEntities:!e.htmlEntities,preserveCase:!0,caseInsensitiveTags:e.strict===!1,processEntities:e.processEntities!==!1,onopentag:i=>n.openElement(i.name,i.attributes||{}),ontext:i=>n.addText(i),oncdata:i=>n.addText(i),onscript:i=>n.addText(i),onclosetag:()=>n.closeElement(),onerror:i=>{throw i}}).write(r).close(),e.strict===!1)for(;n.stack.length;)n.closeElement();if(n.result===void 0)throw new Error("XML: document requires a root element");return n.result}var $y,uL=p(()=>{"use strict";aL();$y=class{options;maximumDepth;stack=[];result;constructor(e,t){this.options=e,this.maximumDepth=t}openElement(e,t){if(this.stack.length>=this.maximumDepth)throw new Error("XML: maximum nesting depth exceeded");if(!this.stack.length&&this.result!==void 0&&this.options.strict!==!1)throw new Error("XML: document requires a single root element");let n=this.normalizeName(e),s=this.stack[this.stack.length-1];this.stack.push({name:n,path:s?`${s.path}.${n}`:n,attributes:this.normalizeAttributes(t),children:{},orderedChildren:[],text:""})}addText(e){let t=this.stack[this.stack.length-1];t&&(t.text+=e)}closeElement(){let e=this.stack.pop();if(!e)return;let t=this.finalizeElement(e),n=this.stack[this.stack.length-1];if(this.options.preserveOrder){n?n.orderedChildren.push(t):this.result=t;return}n?this.addChild(n.children,e.name,e.path,t):(this.result===void 0&&(this.result={}),this.addChild(this.result,e.name,e.path,t))}finalizeElement(e){let t=this.options.trimValues===!1?e.text:e.text.trim();if(this.options.preserveOrder)return{name:e.name,attributes:e.attributes,children:e.orderedChildren,text:t};let n=Object.keys(e.attributes).length>0;if(!n&&!Object.keys(e.children).length)return this.parseValue(t,this.options.parseTagValue!==!1);let s=e.children;if(t&&Ea(s,this.options.textNodeName??"value",this.parseValue(t,this.options.parseTagValue!==!1)),n&&this.options.attributesGroupName)Ea(s,this.options.attributesGroupName,e.attributes);else for(let[i,o]of Object.entries(e.attributes))Ea(s,i,o);return s}addChild(e,t,n,s){if(!Object.hasOwn(e,t))Ea(e,t,this.options.arrayPaths?.includes(n)?[s]:s);else{let i=e[t];Array.isArray(i)?i.push(s):Ea(e,t,[i,s])}}normalizeAttributes(e){let t={};if(this.options.ignoreAttributes)return t;for(let[n,s]of Object.entries(e)){if(this.options.removeNSPrefix&&(n==="xmlns"||n.startsWith("xmlns:")))continue;let i=this.options.trimValues===!1?s:s.trim();Ea(t,(this.options.attributeNamePrefix??"")+this.normalizeName(n),this.parseValue(i,this.options.parseAttributeValue===!0))}return t}normalizeName(e){return this.options.removeNSPrefix?e.slice(e.indexOf(":")+1):e}parseValue(e,t){return t?e==="true"||e==="false"?e==="true":e!==""&&e.trim()!==""&&Number.isFinite(Number(e))?Number(e):e:e}}});function qy(r,e={}){if(Object.hasOwn(e,"_fastXML")||Object.hasOwn(e,"_sax"))throw new Error("XML: backend-specific options were removed; use native XML options");if(e._parser&&!["internal","sax"].includes(e._parser))throw new Error("XML: unsupported parser backend; use the native documents parser");let t=cL(r,e);return e.uncapitalizeKeys?Ld(t):t}var lL=p(()=>{"use strict";iL();uL()});var fL=p(()=>{"use strict";lL()});function yu(r){if(/<!DOCTYPE|<!ENTITY/i.test(r))throw new Error("MaterialX: document types and entity declarations are unsupported.");let e;try{e=qy(r,{preserveOrder:!0,parseAttributeValue:!1,trimValues:!1})}catch(n){throw new Error("MaterialX: malformed XML.",{cause:n})}if(e.name!=="materialx")throw new Error("MaterialX: expected a materialx root element.");let t=e.attributes.version;if(!t||!/^1\.\d+$/.test(t))throw new Error("MaterialX: expected a MaterialX 1.x version.");return{version:t,root:dL(e,0)}}function dL(r,e){return{category:r.name,attributes:r.attributes,children:r.children.map(t=>dL(t,e+1))}}var hL=p(()=>{"use strict";fL()});var Ky={};J(Ky,{MaterialXLoaderWithParser:()=>v3});var cne,A3,v3,Xy=p(()=>{"use strict";mL();hL();({preload:cne,...A3}=pL),v3={...A3,parse:async r=>yu(new TextDecoder().decode(r)),parseSync:r=>yu(new TextDecoder().decode(r)),parseText:async r=>yu(r),parseTextSync:yu}});async function I3(){let{MaterialXLoaderWithParser:r}=await Promise.resolve().then(()=>(Xy(),Ky));return r}var pL,mL=p(()=>{"use strict";pL={name:"MaterialX",id:"materialx",module:"scene",version:"latest",extensions:["mtlx"],mimeTypes:["application/xml"],text:!0,dataType:null,batchType:null,options:{},preload:I3}});function Hy(r){let e=new DataView(r),t=r.byteLength>=84&&84+e.getUint32(80,!0)*50===r.byteLength,n,s,i;if(t){let a=e.getUint32(80,!0);n=new Float32Array(a*9),s=new Float32Array(a*9),i=new TextDecoder().decode(r.slice(0,80));for(let c=0;c<a;c++){let u=84+c*50;for(let l=0;l<9;l++)n[c*9+l]=e.getFloat32(u+12+l*4,!0),s[c*9+l]=e.getFloat32(u+l%3*4,!0)}}else{let a=new TextDecoder().decode(r).trim().split(/\r?\n/).map(f=>f.trim()).filter(Boolean),c=[],u=[];i=a[0]||"";let l=0;for(;l<a.length;){if(!/^solid(?:\s|$)/i.test(a[l++]))throw new Error("STL: expected solid header or exact binary length");for(;l<a.length&&!/^endsolid(?:\s|$)/i.test(a[l]);){let f=bL(a[l++],"facet normal");if(!/^outer\s+loop$/i.test(a[l++]||""))throw new Error("STL: expected outer loop");for(let d=0;d<3;d++)c.push(...bL(a[l++],"vertex")),u.push(...f);if(!/^endloop$/i.test(a[l++]||"")||!/^endfacet$/i.test(a[l++]||""))throw new Error("STL: incomplete facet")}if(l>=a.length)throw new Error("STL: missing endsolid");l++}if(!a.length)throw new Error("STL: empty input");n=new Float32Array(c),s=new Float32Array(u)}if(!n.every(Number.isFinite)||!s.every(Number.isFinite))throw new Error("STL: non-finite coordinates");let o={POSITION:{value:n,size:3},NORMAL:{value:s,size:3}};return{topology:"triangle-list",mode:4,attributes:o,schema:jb(o),header:{vertexCount:n.length/3,boundingBox:Er(o)??void 0},loaderData:{header:i,format:t?"binary":"ascii"}}}function bL(r,e){let t=r?.split(/\s+/)||[],n=e.split(" "),s=t.slice(n.length);if(n.some((i,o)=>t[o]?.toLowerCase()!==i)||s.length!==3||s.some(i=>!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(i)))throw new Error(`STL: invalid ${e} record`);return s.map(Number)}var gL=p(()=>{"use strict";mn()});var Jy={};J(Jy,{STLLoaderWithParser:()=>E3});var pne,S3,E3,Yy=p(()=>{"use strict";wL();gL();({preload:pne,...S3}=yL),E3={...S3,parse:async r=>Hy(r),parseSync:Hy}});async function B3(){let{STLLoaderWithParser:r}=await Promise.resolve().then(()=>(Yy(),Jy));return r}var L3,yL,wL=p(()=>{"use strict";L3="5.0.0-beta.7";yL={name:"STL",id:"stl",module:"scene",version:L3,extensions:["stl"],mimeTypes:["model/stl"],binary:!0,dataType:null,batchType:null,options:{},preload:B3}});function ML(r){let e=r.size(),t=new ArrayBuffer(e),n=new Int8Array(t);for(let s=0;s<e;++s)n[s]=r.GetValue(s);return t}function J3(r){return r instanceof Map?r.entries():Object.entries(r)}function Tu(r){return ArrayBuffer.isView(r)?r:r&&typeof r=="object"&&"value"in r&&ArrayBuffer.isView(r.value)?r.value:null}function Dd(r,e){return ArrayBuffer.isView(r)?e:r.size}function Y3(r,e){for(let t of r)if(!Number.isInteger(t)||t<0||t>=e)throw new Error(`DracoWriter: triangle index ${t} is outside vertex range 0-${e-1}`)}function DL(r){return!!(r.attributeQuantization&&Object.keys(r.attributeQuantization).length)}function Rd(r,e,t){if(!Number.isInteger(e)||e<1||e>30)throw new Error(`DracoWriter: quantization bits for "${r}" must be an integer from 1 to 30`);if(t==="NORMAL"&&(e<2||e>29))throw new Error(`DracoWriter: quantization bits for NORMAL attribute "${r}" must be an integer from 2 to 29`)}function Q3(r,e,t){if(Rd(r,t.bits),!Array.isArray(t.origin)||t.origin.length!==e)throw new Error(`DracoWriter: quantization origin for "${r}" must contain ${e} values`);if(!t.origin.every(Number.isFinite))throw new Error(`DracoWriter: quantization origin for "${r}" must be finite`);if(!Number.isFinite(t.range)||t.range<=0)throw new Error(`DracoWriter: quantization range for "${r}" must be positive`)}function RL(r,e){for(let t of["POSITION","NORMAL","COLOR","TEX_COORD","GENERIC"])if(r[t]===e)return t;return"GENERIC"}function Z3(r){let e={gltf:{method:"MESH_EDGEBREAKER_ENCODING",speed:[5,5],quantization:{POSITION:14,NORMAL:10,TEX_COORD:12}},webgpu:{method:"MESH_SEQUENTIAL_ENCODING",speed:[5,5],quantization:{POSITION:14,NORMAL:10,TEX_COORD:12}},balanced:{method:"MESH_EDGEBREAKER_ENCODING",speed:[5,5],quantization:{POSITION:12,NORMAL:10,TEX_COORD:10}}},t=r.preset?e[r.preset]:{};return{...t,...r,quantization:{...t.quantization,...r.quantization}}}var H3,OL,Ma,kL=p(()=>{"use strict";H3={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},OL=()=>{},Ma=class{draco;dracoEncoder;dracoMeshBuilder;dracoMetadataBuilder;log=OL;constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder)}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,t={}){return this._encodeSync(e,t,!1).data}encodeSyncWithReport(e,t={}){return this._encodeSync(e,t,!0)}_encodeSync(e,t,n){return t=Z3(t),this.log=t.log||OL,t.pointcloud?this._encodePointCloud(e,t,n):this._encodeMesh(e,t,n)}_getAttributesFromMesh(e){return{...e.indices?{indices:e.indices}:{},...e.attributes}}_encodePointCloud(e,t,n){let s=new this.draco.PointCloud,i=new this.draco.DracoInt8Array,o=null;try{t.metadata&&this._addGeometryMetadata(s,t.metadata);let a=this._getAttributesFromMesh(e),c=this._createDracoPointCloud(s,a,t),u=DL(t),l,f;if(u?(o=new this.draco.ExpertEncoder(s),this._setExpertOptions(o,c,t),f=o,n&&f.SetTrackEncodedProperties(!0),l=o.EncodeToDracoBuffer(t.deduplicateValues??!1,i)):(this._setOptions(t),f=this.dracoEncoder,n&&f.SetTrackEncodedProperties(!0),l=this.dracoEncoder.EncodePointCloudToDracoBuffer(s,t.deduplicateValues??!1,i)),!(l>0))throw new Error("Draco encoding failed.");this.log(`DRACO encoded ${s.num_points()} points
52
- with ${s.num_attributes()} attributes into ${l} bytes`);let d=ML(i);return{data:d,report:this._getEncodingReport("point-cloud",d.byteLength,s,f,c,t,n)}}finally{this.destroyEncodedObject(o),this.destroyEncodedObject(i),this.destroyEncodedObject(s)}}_encodeMesh(e,t,n){let s=new this.draco.Mesh,i=new this.draco.DracoInt8Array,o=null;try{t.metadata&&this._addGeometryMetadata(s,t.metadata);let a=this._getAttributesFromMesh(e),c=this._createDracoMesh(s,a,t),u=DL(t),l,f;if(u?(o=new this.draco.ExpertEncoder(s),this._setExpertOptions(o,c,t),f=o,n&&f.SetTrackEncodedProperties(!0),l=o.EncodeToDracoBuffer(!1,i)):(this._setOptions(t),f=this.dracoEncoder,n&&f.SetTrackEncodedProperties(!0),l=this.dracoEncoder.EncodeMeshToDracoBuffer(s,i)),l<=0)throw new Error("Draco encoding failed.");this.log(`DRACO encoded ${s.num_points()} points
53
- with ${s.num_attributes()} attributes into ${l} bytes`);let d=ML(i);return{data:d,report:this._getEncodingReport("mesh",d.byteLength,s,f,c,t,n)}}finally{this.destroyEncodedObject(o),this.destroyEncodedObject(i),this.destroyEncodedObject(s)}}_setOptions(e){if(e.speed&&this.dracoEncoder.SetSpeedOptions(...e.speed),e.method){let t=this.draco[e.method];this.dracoEncoder.SetEncodingMethod(t)}if(e.quantization)for(let t in e.quantization){let n=t,s=e.quantization[n];s!==void 0&&(Rd(n,s,n),this.dracoEncoder.SetAttributeQuantization(this.draco[n],s))}}_setExpertOptions(e,t,n){n.speed&&e.SetSpeedOptions(...n.speed),n.method&&e.SetEncodingMethod(this.draco[n.method]);let s=this._getAttributeQuantization(t,n);for(let[i,o]of s){let a=t[i];typeof o=="number"?e.SetAttributeQuantization(a.attributeId,o):e.SetAttributeExplicitQuantization(a.attributeId,o.bits,a.componentCount,o.origin,o.range)}}_getAttributeQuantization(e,t){let n=new Map;for(let i of Object.keys(t.quantization||{})){let o=t.quantization?.[i];o!==void 0&&(Rd(i,o,i),n.set(this.draco[i],o))}let s=new Map;for(let[i,o]of Object.entries(e)){let a=n.get(o.attributeType);a!==void 0&&s.set(i,a)}for(let[i,o]of Object.entries(t.attributeQuantization||{})){let a=e[i];if(!a)throw new Error(`DracoWriter: quantized attribute "${i}" does not exist`);if(typeof o=="number")Rd(i,o,a.attributeTypeName);else{if(a.attributeTypeName==="NORMAL")throw new Error(`DracoWriter: explicit quantization transforms are not supported for NORMAL attribute "${i}"`);Q3(i,e[i].componentCount,o)}s.set(i,o)}for(let i of s.keys())if(!e[i].supportsQuantization)throw new Error(`DracoWriter: quantization for "${i}" requires floating-point attribute data`);return s}_getEncodingReport(e,t,n,s,i,o,a){let c=this._getAttributeQuantization(i,o),u={};for(let[l,f]of Object.entries(i))u[l]={id:f.attributeId,type:f.attributeTypeName,componentCount:f.componentCount,...c.has(l)?{quantization:c.get(l)}:{}};return{geometryType:e,byteLength:t,pointCount:a?s.GetNumberOfEncodedPoints():n.num_points(),faceCount:a?s.GetNumberOfEncodedFaces():e==="mesh"&&typeof n.num_faces=="function"?n.num_faces():0,attributeCount:n.num_attributes(),...o.method?{method:o.method}:{},...o.speed?{speed:o.speed}:{},attributes:u}}_createDracoMesh(e,t,n){let s=n.attributesMetadata||{},i={},o=this._getVertexCount(t,n);for(let[a,c]of Object.entries(t)){let u=this._addAttributeToMesh(e,a,c,o,n);if(u!==-1){let l=Tu(c),f=this._getDracoAttributeType(a,n.attributeTypes);i[a]={attributeId:u,attributeType:f,attributeTypeName:RL(this.draco,f),componentCount:Dd(c,l.length/o),supportsQuantization:l instanceof Float32Array},this._addAttributeMetadata(e,u,{[n.attributeNameEntry||"name"]:a,...s[a]||{}})}}return i}_createDracoPointCloud(e,t,n){let s=n.attributesMetadata||{},i={},o=this._getVertexCount(t,n);for(let[a,c]of Object.entries(t)){let u=this._addAttributeToMesh(e,a,c,o,n);if(u!==-1){let l=Tu(c),f=this._getDracoAttributeType(a,n.attributeTypes);i[a]={attributeId:u,attributeType:f,attributeTypeName:RL(this.draco,f),componentCount:Dd(c,l.length/o),supportsQuantization:l instanceof Float32Array},this._addAttributeMetadata(e,u,{[n.attributeNameEntry||"name"]:a,...s[a]||{}})}}return i}_addAttributeToMesh(e,t,n,s,i={}){let o=Tu(n);if(!o)throw new Error(`DracoWriter: attribute "${t}" must contain a typed array`);let a=this._getDracoAttributeType(t,i.attributeTypes),c=Dd(n,o.length/s);if(a==="indices"){if(o.length%3!==0)throw new Error("DracoWriter: triangle indices length must be divisible by 3");Y3(o,s);let f=o.length/3;this.log(`Adding attribute ${t}, size ${f}`);let d=o instanceof Uint16Array||o instanceof Uint32Array?o:Uint32Array.from(o);return this.dracoMeshBuilder.AddFacesToMesh(e,f,d),-1}if(!Number.isInteger(c)||c<=0||o.length!==s*c)throw new Error(`DracoWriter: attribute "${t}" has ${o.length} values, expected ${s*c}`);this.log(`Adding attribute ${t}, size ${c}`);let u=this.dracoMeshBuilder,l=-1;if(o instanceof Int8Array)l=u.AddInt8Attribute(e,a,s,c,o);else if(o instanceof Int16Array)l=u.AddInt16Attribute(e,a,s,c,o);else if(o instanceof Int32Array)l=u.AddInt32Attribute(e,a,s,c,o);else if(o instanceof Uint8Array)l=u.AddUInt8Attribute(e,a,s,c,o);else if(o instanceof Uint8ClampedArray){let f=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);l=u.AddUInt8Attribute(e,a,s,c,f)}else if(o instanceof Uint16Array)l=u.AddUInt16Attribute(e,a,s,c,o);else if(o instanceof Uint32Array)l=u.AddUInt32Attribute(e,a,s,c,o);else if(o instanceof Float32Array)l=u.AddFloatAttribute(e,a,s,c,o);else throw new Error(`DracoWriter: attribute "${t}" uses unsupported ${o.constructor.name}`);return!ArrayBuffer.isView(n)&&n.normalized!==void 0&&u.SetNormalizedFlagForAttribute(e,l,n.normalized),l}_getDracoAttributeType(e,t={}){if(e.toLowerCase()==="indices")return"indices";let n=t[e];if(n)return this.draco[n];let s=H3[e];if(s)return this.draco[s];switch(e.toLowerCase()){case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return/^color_\d+$/i.test(e)?this.draco.COLOR:/^texcoord_\d+$/i.test(e)?this.draco.TEX_COORD:this.draco.GENERIC}}_getVertexCount(e,t){let n=this._getPositionAttribute(e,t.attributeTypes),s=n&&Tu(n);if(!n||!s)throw new Error("DracoWriter: POSITION attribute is required");let i=Dd(n,3);if(!Number.isInteger(i)||i<=0||s.length%i!==0)throw new Error("DracoWriter: POSITION attribute has an invalid size or value count");return s.length/i}_getPositionAttribute(e,t={}){for(let n in e){let s=e[n];if(this._getDracoAttributeType(n,t)===this.draco.POSITION&&Tu(s))return s}return null}_addGeometryMetadata(e,t){let n=new this.draco.Metadata;this._populateDracoMetadata(n,t),this.dracoMeshBuilder.AddMetadata(e,n)}_addAttributeMetadata(e,t,n){let s=new this.draco.Metadata;this._populateDracoMetadata(s,n),this.dracoMeshBuilder.SetMetadataForAttribute(e,t,s)}_populateDracoMetadata(e,t){for(let[n,s]of J3(t))switch(typeof s){case"number":Math.trunc(s)===s?this.dracoMetadataBuilder.AddIntEntry(e,n,s):this.dracoMetadataBuilder.AddDoubleEntry(e,n,s);break;case"object":s instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,n,s,s.length);break;default:this.dracoMetadataBuilder.AddStringEntry(e,n,s)}}}});async function r8(r,e={}){return(await NL(r,e)).data}async function NL(r,e={}){let{draco:t}=await hy(hn(e)),n=new Ma(t);try{return n.encodeSyncWithReport(PL(r),e.draco)}finally{n.destroy()}}async function n8(r,e={}){UL(e.signal);let t=[],n=0;for await(let s of aw([r],e))t.push(s),n++,e.onProgress?.({completed:n,total:r.length});return t}function aw(r,e={}){let t=i8(r);if(nb(ow,e)){let{onProgress:n,...s}=e;return eb(ow,t,s)}return CL(t,e)}async function*s8(r,e={}){let t=(async function*(){for await(let n of r)yield[n]})();for await(let n of aw(t,e))yield n.data}async function*CL(r,e={}){let{draco:t}=await hy(hn(e)),n=new Ma(t);try{for await(let s of r)for(let i of s)UL(e.signal),yield n.encodeSyncWithReport(i,e.draco)}finally{n.destroy()}}async function*i8(r){for await(let e of r)yield e.map(PL)}function UL(r){if(!r?.aborted)return;if(r.reason!==void 0)throw r.reason;let e=new Error("Draco batch encoding aborted");throw e.name="AbortError",e}function PL(r){if(o8(r))return pn(r);if(a8(r))return r;let{indices:e,...t}=r;return{attributes:t,...e?{indices:e}:{}}}function o8(r){return typeof r=="object"&&r!==null&&"shape"in r&&r.shape==="arrow-table"}function a8(r){return typeof r=="object"&&r!==null&&"attributes"in r&&typeof r.attributes=="object"&&r.attributes!==null&&!ArrayBuffer.isView(r.attributes)}var e8,ow,t8,VL=p(()=>{"use strict";Ue();mn();Js();kL();uu();cy();uy();e8={pointcloud:!1,attributeNameEntry:"name"},ow={...au,id:"draco-writer",name:"Draco compressed geometry writer",module:"scene",version:ou,worker:!0,workerNode:"draco-writer-worker-node.cjs",workerSourceNode:"draco/workers/draco-writer-worker-node.ts",options:{draco:{}}},t8={...au,name:"DRACO",version:ou,options:{draco:e8},encode:r8,encodeInBatches:s8}});var jL={};J(jL,{DracoWriter:()=>t8,DracoWriterWorker:()=>ow,encodeDraco:()=>NL,encodeDracoBatch:()=>n8,encodeDracoInBatches:()=>aw,encodeDracoInBatchesLocally:()=>CL});var GL=p(()=>{"use strict";VL()});var wU={};J(wU,{DRACO_EXTERNAL_LIBRARIES:()=>xt,DRACO_EXTERNAL_LIBRARY_URLS:()=>lB,DracoFormat:()=>Ud,DracoLoader:()=>Pd,DracoWorkerLoader:()=>cB,FetchError:()=>A.FetchError,GLBFormat:()=>Fa,GLBLoader:()=>nB,GLBWriter:()=>iB,GLTFFormat:()=>Ba,GLTFLoader:()=>IL,GLTFWriter:()=>rB,JSONLoader:()=>A.JSONLoader,MTLFormat:()=>Bd,MTLLoader:()=>Zy,MTLWorkerLoader:()=>TL,MaterialXLoader:()=>fB,NullLoader:()=>A.NullLoader,NullWorkerLoader:()=>A.NullWorkerLoader,OBJFormat:()=>La,OBJLoader:()=>Qy,OBJWorkerLoader:()=>xL,OBJWriter:()=>AL,RequestScheduler:()=>A.RequestScheduler,STLLoader:()=>dB,USDLoader:()=>Na,_BrowserFileSystem:()=>A._BrowserFileSystem,_fetchProgress:()=>A._fetchProgress,_selectSource:()=>A._selectSource,_unregisterLoaders:()=>A._unregisterLoaders,assert:()=>A.assert,concatenateArrayBuffersAsync:()=>A.concatenateArrayBuffersAsync,coreApi:()=>A.coreApi,createDataSource:()=>A.createDataSource,document:()=>A.document,encode:()=>A.encode,encodeInBatches:()=>A.encodeInBatches,encodeSync:()=>A.encodeSync,encodeTable:()=>A.encodeTable,encodeTableAsText:()=>A.encodeTableAsText,encodeTableInBatches:()=>A.encodeTableInBatches,encodeText:()=>A.encodeText,encodeTextSync:()=>A.encodeTextSync,encodeURLtoURL:()=>A.encodeURLtoURL,fetchFile:()=>A.fetchFile,forEach:()=>A.forEach,getLoaderOptions:()=>A.getLoaderOptions,getPathPrefix:()=>A.getPathPrefix,global:()=>A.global,isAsyncIterable:()=>A.isAsyncIterable,isBrowser:()=>A.isBrowser,isIterable:()=>A.isIterable,isIterator:()=>A.isIterator,isPromise:()=>A.isPromise,isPureObject:()=>A.isPureObject,isReadableStream:()=>A.isReadableStream,isResponse:()=>A.isResponse,isWorker:()=>A.isWorker,isWritableStream:()=>A.isWritableStream,load:()=>A.load,loadInBatches:()=>A.loadInBatches,makeIterator:()=>A.makeIterator,makeLineIterator:()=>A.makeLineIterator,makeNumberedLineIterator:()=>A.makeNumberedLineIterator,makeStream:()=>A.makeStream,makeTextDecoderIterator:()=>A.makeTextDecoderIterator,makeTextEncoderIterator:()=>A.makeTextEncoderIterator,parse:()=>A.parse,parseFile:()=>A.parseFile,parseInBatches:()=>A.parseInBatches,parseSync:()=>A.parseSync,preload:()=>A.preload,preloadSync:()=>A.preloadSync,readArrayBuffer:()=>A.readArrayBuffer,registerLoaders:()=>A.registerLoaders,resolvePath:()=>A.resolvePath,selectLoader:()=>A.selectLoader,selectLoaderSync:()=>A.selectLoaderSync,self:()=>A.self,setLoaderOptions:()=>A.setLoaderOptions,setPathPrefix:()=>A.setPathPrefix,window:()=>A.window});var A=wB(jw(),1);Yd();var La={name:"OBJ",id:"obj",module:"scene",encoding:"text",format:"obj",extensions:["obj"],mimeTypes:["text/plain"]};ea();var F3=typeof __VERSION__<"u"?__VERSION__:"latest";async function O3(){let{OBJLoaderWithParser:r}=await Promise.resolve().then(()=>(Xb(),Kb));return r}var Qy={...La,dataType:null,batchType:null,version:F3,worker:!0,workerInBatches:!0,serializeWorkerResult:Hi,text:!0,testText:M3,options:{obj:{shape:"arrow-table"}},preload:O3};function M3(r){return r[0]==="v"}var xL=Qy;var Bd={name:"MTL",id:"mtl",module:"mtl",encoding:"text",format:"mtl",extensions:["mtl"],mimeTypes:["text/plain"]};var D3=typeof __VERSION__<"u"?__VERSION__:"latest";async function R3(){let{MTLLoaderWithParser:r}=await Promise.resolve().then(()=>(Qb(),Yb));return r}var Zy={...Bd,dataType:null,batchType:null,version:D3,worker:!0,text:!0,testText:r=>r.includes("newmtl"),options:{mtl:{}},preload:R3},TL=Zy;mn();var k3=typeof __VERSION__<"u"?__VERSION__:"latest",AL={...La,dataType:null,batchType:null,version:k3,options:{obj:{}},text:!0,encode:async(r,e)=>_L(r,e),encodeSync:_L,encodeTextSync:vL};function _L(r,e){let t=vL(r,e);return new TextEncoder().encode(t).buffer}function vL(r,e){let t=pn(N3(r)),n=C3(t,"POSITION"),s=t.attributes.NORMAL,i=t.attributes.TEXCOORD_0,o=t.attributes.COLOR_0,a=n.value.length/n.size,c=["# loaders.gl OBJ"];for(let l=0;l<a;l++){let f=[Jn(n,l,0),Jn(n,l,1),Jn(n,l,2)];o&&f.push(ew(o,l,0),ew(o,l,1),ew(o,l,2)),c.push(`v ${f.join(" ")}`)}if(i)for(let l=0;l<a;l++)c.push(`vt ${Jn(i,l,0)} ${Jn(i,l,1)}`);if(s)for(let l=0;l<a;l++)c.push(`vn ${Jn(s,l,0)} ${Jn(s,l,1)} ${Jn(s,l,2)}`);let u=U3(t,a);for(let l=0;l<u.length;l+=3){let f=[tw(u[l],!!i,!!s),tw(u[l+1],!!i,!!s),tw(u[l+2],!!i,!!s)];c.push(`f ${f.join(" ")}`)}return`${c.join(`
51
+ Actual: ${this.attribValue}`);else{let s=this.tag,i=this.tags[this.tags.length-1]||this;s.ns===i.ns&&(s.ns=Object.create(i.ns)),s.ns[n]=this.attribValue}this.attribList.push([this.attribName,this.attribValue])}else Object.defineProperty(this.tag.attributes,this.attribName,{value:this.attribValue,enumerable:!0,configurable:!0,writable:!0}),this.emitNode("onattribute",{name:this.attribName,value:this.attribValue});this.attribName=this.attribValue=""}newTag(){!this.strict&&!this.opt.preserveCase&&(this.tagName=this.tagName[this.looseCase]());let e=this.tags[this.tags.length-1]||this,t={name:this.tagName,attributes:{}};this.tag=t,this.opt.xmlns&&(t.ns=e.ns),this.attribList.length=0,this.emitNode("onopentagstart",t)}parseEntity(){let e=this.decodeEntity();return this.opt.processEntities===!1?`&${this.entity};`:e}decodeEntity(){let e=this.entity,t=e.toLowerCase(),n=NaN,s="";return typeof this.ENTITIES[e]=="string"||typeof this.ENTITIES[e]=="number"?this.ENTITIES[e]:typeof this.ENTITIES[t]=="string"||typeof this.ENTITIES[t]=="number"?this.ENTITIES[t]:(e=t,e.charAt(0)==="#"&&(e.charAt(1)==="x"?(e=e.slice(2),n=parseInt(e,16),s=n.toString(16)):(e=e.slice(1),n=parseInt(e,10),s=n.toString(10))),e=e.replace(/^0+/,""),Number.isNaN(n)||s.toLowerCase()!==e?(this.strictFail("Invalid character entity"),`&${this.entity};`):n<0||n>1114111||n>=55296&&n<=57343||n<32&&![9,10,13].includes(n)||n===65534||n===65535?(this.strictFail("Invalid character entity"),`&${this.entity};`):String.fromCodePoint(n))}beginWhiteSpace(e){e==="<"?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):r.isWhitespace(e)||(this.strictFail("Non-whitespace before first tag."),this.textNode=e,this.state=this.S.TEXT)}strictFail(e){if(typeof this!="object"||!(this instanceof ka))throw new Error("bad call to strictFail");this.strict&&this.errorFunction(e)}textApplyOptions(e){return this.opt.trim&&(e=e.trim()),this.opt.normalize&&(e=e.replace(/\s+/g," ")),e}emitNode(e,t){this.textNode&&this.closeText(),this.emit(e,t)}closeText(){this.textNode=this.textApplyOptions(this.textNode),this.textNode!==void 0&&this.textNode!==""&&this.textNode!=="undefined"&&this.emit("ontext",this.textNode),this.textNode=""}checkBufferLength(){let e=Math.max(this.opt.MAX_BUFFER_LENGTH,10),t=0;for(let s=0,i=this.BUFFERS.length;s<i;s++){let o=this[this.BUFFERS[s]]?.length||0;if(o>e)switch(this.BUFFERS[s]){case"textNode":this.closeText();break;case"cdata":this.emitNode("oncdata",this.cdata),this.cdata="";break;case"script":this.emitNode("onscript",this.script),this.script="";break;default:this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[s]}`)}t=Math.max(t,o)}let n=this.opt.MAX_BUFFER_LENGTH-t;this.bufferCheckPosition=n+this.position}openTag(e){if(this.opt.xmlns){let t=this.tag,n=r.qname(this.tagName);t.prefix=n.prefix,t.local=n.local,t.uri=t.ns[n.prefix]||"",t.prefix&&!t.uri&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`),t.uri=n.prefix);let s=this.tags[this.tags.length-1]||this;if(t.ns&&s.ns!==t.ns){let i=this;Object.keys(t.ns).forEach(o=>{i.emitNode("onopennamespace",{prefix:o,uri:t.ns[o]})})}for(let i=0,o=this.attribList.length;i<o;i++){let a=this.attribList[i],c=a[0],u=a[1],l=r.qname(c,!0),f=l.prefix,d=l.local,h=f===""?"":t.ns[f]||"",m={name:c,value:u,prefix:f,local:d,uri:h};f&&f!=="xmlns"&&!h&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(f)}`),m.uri=f),Object.defineProperty(this.tag.attributes,c,{value:m,enumerable:!0,configurable:!0,writable:!0}),this.emitNode("onattribute",m)}this.attribList.length=0}this.tag.isSelfClosing=!!e,this.sawRoot=!0,this.tags.push(this.tag),this.emitNode("onopentag",this.tag),e||(!this.noscript&&this.tagName.toLowerCase()==="script"?this.state=this.S.SCRIPT:this.state=this.S.TEXT,this.tag=null,this.tagName=""),this.attribName=this.attribValue="",this.attribList.length=0}closeTag(){if(!this.tagName){this.strictFail("Weird empty close tag."),this.textNode+="</>",this.state=this.S.TEXT;return}let e=!this.strict&&(this.opt.caseInsensitiveTags||!this.opt.preserveCase);if(this.script){if((e?this.tagName.toLowerCase():this.tagName)!=="script"){this.script+=`</${this.tagName}>`,this.tagName="",this.state=this.S.SCRIPT;return}this.emitNode("onscript",this.script),this.script=""}let t=this.tags.length,n=this.tagName,s=e?n.toLowerCase():n;for(;t--;){let o=this.tags[t];if((e?o.name.toLowerCase():o.name)!==s)this.strictFail("Unexpected close tag");else break}if(t<0){this.strictFail(`Unmatched closing tag: ${this.tagName}`),this.textNode+=`</${this.tagName}>`,this.state=this.S.TEXT;return}this.tagName=n;let i=this.tags.length;for(;i-- >t;){let o=this.tags.pop();this.tag=o,this.tagName=this.tag.name,this.emitNode("onclosetag",this.tagName);let a={};for(let u in o.ns)o.ns.hasOwnProperty(u)&&(a[u]=o.ns[u]);let c=this.tags[this.tags.length-1]||this;if(this.opt.xmlns&&o.ns!==c.ns){let u=this;Object.keys(o.ns).forEach(l=>{let f=o.ns[l];u.emitNode("onclosenamespace",{prefix:l,uri:f})})}}t===0&&(this.closedRoot=!0),this.tagName=this.attribValue=this.attribName="",this.attribList.length=0,this.state=this.S.TEXT}},ka=class extends Rw{static ENTITIES=Ru;opt=M8;events=oB;constructor(e){super(),this.clearBuffers(),this.opt=e={...this.opt,...e},this.events={...this.events,...e},this.q=this.c="",this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.bufferCheckPosition=this.opt.MAX_BUFFER_LENGTH,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!this.opt.strict,this.noscript=!!(this.opt.strict||this.opt.noscript),this.state=this.S.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(this.XML_ENTITIES):Object.create(this.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(this.rootNS)),this.trackPosition=this.opt.position!==!1,this.trackPosition&&(this.position=this.line=this.column=0),this.emit("onready")}resume(){return this.error=null,this}close(){return this.write(null)}flush(){this.flushBuffers()}}});function Na(r,e,t){Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0})}function cB(r,e={}){if(e.strict!==!1&&/[^\u0009\u000a\u000d\u0020-\ud7ff\ue000-\ufffd\u{10000}-\u{10ffff}]/u.test(r))throw new Error("XML: invalid XML character");let t=e.maxDepth??256;if(!Number.isSafeInteger(t)||t<1||t>4096)throw new Error("XML: maxDepth must be an integer between 1 and 4096");let n=new kw(e,t);if(new ka({strict:e.strict!==!1,strictEntities:!e.htmlEntities,preserveCase:!0,caseInsensitiveTags:e.strict===!1,processEntities:e.processEntities!==!1,onopentag:i=>n.openElement(i.name,i.attributes||{}),ontext:i=>n.addText(i),oncdata:i=>n.addText(i),onscript:i=>n.addText(i),onclosetag:()=>n.closeElement(),onerror:i=>{throw i}}).write(r).close(),e.strict===!1)for(;n.stack.length;)n.closeElement();if(n.result===void 0)throw new Error("XML: document requires a root element");return n.result}var kw,uB=p(()=>{"use strict";aB();kw=class{options;maximumDepth;stack=[];result;constructor(e,t){this.options=e,this.maximumDepth=t}openElement(e,t){if(this.stack.length>=this.maximumDepth)throw new Error("XML: maximum nesting depth exceeded");if(!this.stack.length&&this.result!==void 0&&this.options.strict!==!1)throw new Error("XML: document requires a single root element");let n=this.normalizeName(e),s=this.stack[this.stack.length-1];this.stack.push({name:n,path:s?`${s.path}.${n}`:n,attributes:this.normalizeAttributes(t),children:{},orderedChildren:[],text:""})}addText(e){let t=this.stack[this.stack.length-1];t&&(t.text+=e)}closeElement(){let e=this.stack.pop();if(!e)return;let t=this.finalizeElement(e),n=this.stack[this.stack.length-1];if(this.options.preserveOrder){n?n.orderedChildren.push(t):this.result=t;return}n?this.addChild(n.children,e.name,e.path,t):(this.result===void 0&&(this.result={}),this.addChild(this.result,e.name,e.path,t))}finalizeElement(e){let t=this.options.trimValues===!1?e.text:e.text.trim();if(this.options.preserveOrder)return{name:e.name,attributes:e.attributes,children:e.orderedChildren,text:t};let n=Object.keys(e.attributes).length>0;if(!n&&!Object.keys(e.children).length)return this.parseValue(t,this.options.parseTagValue!==!1);let s=e.children;if(t&&Na(s,this.options.textNodeName??"value",this.parseValue(t,this.options.parseTagValue!==!1)),n&&this.options.attributesGroupName)Na(s,this.options.attributesGroupName,e.attributes);else for(let[i,o]of Object.entries(e.attributes))Na(s,i,o);return s}addChild(e,t,n,s){if(!Object.hasOwn(e,t))Na(e,t,this.options.arrayPaths?.includes(n)?[s]:s);else{let i=e[t];Array.isArray(i)?i.push(s):Na(e,t,[i,s])}}normalizeAttributes(e){let t={};if(this.options.ignoreAttributes)return t;for(let[n,s]of Object.entries(e)){if(this.options.removeNSPrefix&&(n==="xmlns"||n.startsWith("xmlns:")))continue;let i=this.options.trimValues===!1?s:s.trim();Na(t,(this.options.attributeNamePrefix??"")+this.normalizeName(n),this.parseValue(i,this.options.parseAttributeValue===!0))}return t}normalizeName(e){return this.options.removeNSPrefix?e.slice(e.indexOf(":")+1):e}parseValue(e,t){return t?e==="true"||e==="false"?e==="true":e!==""&&e.trim()!==""&&Number.isFinite(Number(e))?Number(e):e:e}}});function Nw(r,e={}){if(Object.hasOwn(e,"_fastXML")||Object.hasOwn(e,"_sax"))throw new Error("XML: backend-specific options were removed; use native XML options");if(e._parser&&!["internal","sax"].includes(e._parser))throw new Error("XML: unsupported parser backend; use the native documents parser");let t=cB(r,e);return e.uncapitalizeKeys?rh(t):t}var lB=p(()=>{"use strict";iB();uB()});var fB=p(()=>{"use strict";lB()});function ku(r){if(/<!DOCTYPE|<!ENTITY/i.test(r))throw new Error("MaterialX: document types and entity declarations are unsupported.");let e;try{e=Nw(r,{preserveOrder:!0,parseAttributeValue:!1,trimValues:!1})}catch(n){throw new Error("MaterialX: malformed XML.",{cause:n})}if(e.name!=="materialx")throw new Error("MaterialX: expected a materialx root element.");let t=e.attributes.version;if(!t||!/^1\.\d+$/.test(t))throw new Error("MaterialX: expected a MaterialX 1.x version.");return{version:t,root:dB(e,0)}}function dB(r,e){return{category:r.name,attributes:r.attributes,children:r.children.map(t=>dB(t,e+1))}}var hB=p(()=>{"use strict";fB()});var Cw={};J(Cw,{MaterialXLoaderWithParser:()=>U8});var hoe,C8,U8,Uw=p(()=>{"use strict";mB();hB();({preload:hoe,...C8}=pB),U8={...C8,parse:async r=>ku(new TextDecoder().decode(r)),parseSync:r=>ku(new TextDecoder().decode(r)),parseText:async r=>ku(r),parseTextSync:ku}});async function P8(){let{MaterialXLoaderWithParser:r}=await Promise.resolve().then(()=>(Uw(),Cw));return r}var pB,mB=p(()=>{"use strict";pB={name:"MaterialX",id:"materialx",module:"scene",version:"latest",extensions:["mtlx"],mimeTypes:["application/xml"],text:!0,dataType:null,batchType:null,options:{},preload:P8}});function Pw(r){let e=new DataView(r),t=r.byteLength>=84&&84+e.getUint32(80,!0)*50===r.byteLength,n,s,i;if(t){let a=e.getUint32(80,!0);n=new Float32Array(a*9),s=new Float32Array(a*9),i=new TextDecoder().decode(r.slice(0,80));for(let c=0;c<a;c++){let u=84+c*50;for(let l=0;l<9;l++)n[c*9+l]=e.getFloat32(u+12+l*4,!0),s[c*9+l]=e.getFloat32(u+l%3*4,!0)}}else{let a=new TextDecoder().decode(r).trim().split(/\r?\n/).map(f=>f.trim()).filter(Boolean),c=[],u=[];i=a[0]||"";let l=0;for(;l<a.length;){if(!/^solid(?:\s|$)/i.test(a[l++]))throw new Error("STL: expected solid header or exact binary length");for(;l<a.length&&!/^endsolid(?:\s|$)/i.test(a[l]);){let f=bB(a[l++],"facet normal");if(!/^outer\s+loop$/i.test(a[l++]||""))throw new Error("STL: expected outer loop");for(let d=0;d<3;d++)c.push(...bB(a[l++],"vertex")),u.push(...f);if(!/^endloop$/i.test(a[l++]||"")||!/^endfacet$/i.test(a[l++]||""))throw new Error("STL: incomplete facet")}if(l>=a.length)throw new Error("STL: missing endsolid");l++}if(!a.length)throw new Error("STL: empty input");n=new Float32Array(c),s=new Float32Array(u)}if(!n.every(Number.isFinite)||!s.every(Number.isFinite))throw new Error("STL: non-finite coordinates");let o={POSITION:{value:n,size:3},NORMAL:{value:s,size:3}};return{topology:"triangle-list",mode:4,attributes:o,schema:Og(o),header:{vertexCount:n.length/3,boundingBox:Lr(o)??void 0},loaderData:{header:i,format:t?"binary":"ascii"}}}function bB(r,e){let t=r?.split(/\s+/)||[],n=e.split(" "),s=t.slice(n.length);if(n.some((i,o)=>t[o]?.toLowerCase()!==i)||s.length!==3||s.some(i=>!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(i)))throw new Error(`STL: invalid ${e} record`);return s.map(Number)}var gB=p(()=>{"use strict";gn()});var Vw={};J(Vw,{STLLoaderWithParser:()=>j8});var woe,V8,j8,jw=p(()=>{"use strict";wB();gB();({preload:woe,...V8}=yB),j8={...V8,parse:async r=>Pw(r),parseSync:Pw}});async function z8(){let{STLLoaderWithParser:r}=await Promise.resolve().then(()=>(jw(),Vw));return r}var G8,yB,wB=p(()=>{"use strict";G8="5.0.0-beta.8";yB={name:"STL",id:"stl",module:"scene",version:G8,extensions:["stl"],mimeTypes:["model/stl"],binary:!0,dataType:null,batchType:null,options:{},preload:z8}});function MB(r){let e=r.size(),t=new ArrayBuffer(e),n=new Int8Array(t);for(let s=0;s<e;++s)n[s]=r.GetValue(s);return t}function lU(r){return r instanceof Map?r.entries():Object.entries(r)}function Uu(r){return ArrayBuffer.isView(r)?r:r&&typeof r=="object"&&"value"in r&&ArrayBuffer.isView(r.value)?r.value:null}function ah(r,e){return ArrayBuffer.isView(r)?e:r.size}function fU(r,e){for(let t of r)if(!Number.isInteger(t)||t<0||t>=e)throw new Error(`DracoWriter: triangle index ${t} is outside vertex range 0-${e-1}`)}function DB(r){return!!(r.attributeQuantization&&Object.keys(r.attributeQuantization).length)}function ch(r,e,t){if(!Number.isInteger(e)||e<1||e>30)throw new Error(`DracoWriter: quantization bits for "${r}" must be an integer from 1 to 30`);if(t==="NORMAL"&&(e<2||e>29))throw new Error(`DracoWriter: quantization bits for NORMAL attribute "${r}" must be an integer from 2 to 29`)}function dU(r,e,t){if(ch(r,t.bits),!Array.isArray(t.origin)||t.origin.length!==e)throw new Error(`DracoWriter: quantization origin for "${r}" must contain ${e} values`);if(!t.origin.every(Number.isFinite))throw new Error(`DracoWriter: quantization origin for "${r}" must be finite`);if(!Number.isFinite(t.range)||t.range<=0)throw new Error(`DracoWriter: quantization range for "${r}" must be positive`)}function RB(r,e){for(let t of["POSITION","NORMAL","COLOR","TEX_COORD","GENERIC"])if(r[t]===e)return t;return"GENERIC"}function hU(r){let e={gltf:{method:"MESH_EDGEBREAKER_ENCODING",speed:[5,5],quantization:{POSITION:14,NORMAL:10,TEX_COORD:12}},webgpu:{method:"MESH_SEQUENTIAL_ENCODING",speed:[5,5],quantization:{POSITION:14,NORMAL:10,TEX_COORD:12}},balanced:{method:"MESH_EDGEBREAKER_ENCODING",speed:[5,5],quantization:{POSITION:12,NORMAL:10,TEX_COORD:10}}},t=r.preset?e[r.preset]:{};return{...t,...r,quantization:{...t.quantization,...r.quantization}}}var uU,OB,ja,kB=p(()=>{"use strict";uU={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},OB=()=>{},ja=class{draco;dracoEncoder;dracoMeshBuilder;dracoMetadataBuilder;log=OB;constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder)}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,t={}){return this._encodeSync(e,t,!1).data}encodeSyncWithReport(e,t={}){return this._encodeSync(e,t,!0)}_encodeSync(e,t,n){return t=hU(t),this.log=t.log||OB,t.pointcloud?this._encodePointCloud(e,t,n):this._encodeMesh(e,t,n)}_getAttributesFromMesh(e){return{...e.indices?{indices:e.indices}:{},...e.attributes}}_encodePointCloud(e,t,n){let s=new this.draco.PointCloud,i=new this.draco.DracoInt8Array,o=null;try{t.metadata&&this._addGeometryMetadata(s,t.metadata);let a=this._getAttributesFromMesh(e),c=this._createDracoPointCloud(s,a,t),u=DB(t),l,f;if(u?(o=new this.draco.ExpertEncoder(s),this._setExpertOptions(o,c,t),f=o,n&&f.SetTrackEncodedProperties(!0),l=o.EncodeToDracoBuffer(t.deduplicateValues??!1,i)):(this._setOptions(t),f=this.dracoEncoder,n&&f.SetTrackEncodedProperties(!0),l=this.dracoEncoder.EncodePointCloudToDracoBuffer(s,t.deduplicateValues??!1,i)),!(l>0))throw new Error("Draco encoding failed.");this.log(`DRACO encoded ${s.num_points()} points
52
+ with ${s.num_attributes()} attributes into ${l} bytes`);let d=MB(i);return{data:d,report:this._getEncodingReport("point-cloud",d.byteLength,s,f,c,t,n)}}finally{this.destroyEncodedObject(o),this.destroyEncodedObject(i),this.destroyEncodedObject(s)}}_encodeMesh(e,t,n){let s=new this.draco.Mesh,i=new this.draco.DracoInt8Array,o=null;try{t.metadata&&this._addGeometryMetadata(s,t.metadata);let a=this._getAttributesFromMesh(e),c=this._createDracoMesh(s,a,t),u=DB(t),l,f;if(u?(o=new this.draco.ExpertEncoder(s),this._setExpertOptions(o,c,t),f=o,n&&f.SetTrackEncodedProperties(!0),l=o.EncodeToDracoBuffer(!1,i)):(this._setOptions(t),f=this.dracoEncoder,n&&f.SetTrackEncodedProperties(!0),l=this.dracoEncoder.EncodeMeshToDracoBuffer(s,i)),l<=0)throw new Error("Draco encoding failed.");this.log(`DRACO encoded ${s.num_points()} points
53
+ with ${s.num_attributes()} attributes into ${l} bytes`);let d=MB(i);return{data:d,report:this._getEncodingReport("mesh",d.byteLength,s,f,c,t,n)}}finally{this.destroyEncodedObject(o),this.destroyEncodedObject(i),this.destroyEncodedObject(s)}}_setOptions(e){if(e.speed&&this.dracoEncoder.SetSpeedOptions(...e.speed),e.method){let t=this.draco[e.method];this.dracoEncoder.SetEncodingMethod(t)}if(e.quantization)for(let t in e.quantization){let n=t,s=e.quantization[n];s!==void 0&&(ch(n,s,n),this.dracoEncoder.SetAttributeQuantization(this.draco[n],s))}}_setExpertOptions(e,t,n){n.speed&&e.SetSpeedOptions(...n.speed),n.method&&e.SetEncodingMethod(this.draco[n.method]);let s=this._getAttributeQuantization(t,n);for(let[i,o]of s){let a=t[i];typeof o=="number"?e.SetAttributeQuantization(a.attributeId,o):e.SetAttributeExplicitQuantization(a.attributeId,o.bits,a.componentCount,o.origin,o.range)}}_getAttributeQuantization(e,t){let n=new Map;for(let i of Object.keys(t.quantization||{})){let o=t.quantization?.[i];o!==void 0&&(ch(i,o,i),n.set(this.draco[i],o))}let s=new Map;for(let[i,o]of Object.entries(e)){let a=n.get(o.attributeType);a!==void 0&&s.set(i,a)}for(let[i,o]of Object.entries(t.attributeQuantization||{})){let a=e[i];if(!a)throw new Error(`DracoWriter: quantized attribute "${i}" does not exist`);if(typeof o=="number")ch(i,o,a.attributeTypeName);else{if(a.attributeTypeName==="NORMAL")throw new Error(`DracoWriter: explicit quantization transforms are not supported for NORMAL attribute "${i}"`);dU(i,e[i].componentCount,o)}s.set(i,o)}for(let i of s.keys())if(!e[i].supportsQuantization)throw new Error(`DracoWriter: quantization for "${i}" requires floating-point attribute data`);return s}_getEncodingReport(e,t,n,s,i,o,a){let c=this._getAttributeQuantization(i,o),u={};for(let[l,f]of Object.entries(i))u[l]={id:f.attributeId,type:f.attributeTypeName,componentCount:f.componentCount,...c.has(l)?{quantization:c.get(l)}:{}};return{geometryType:e,byteLength:t,pointCount:a?s.GetNumberOfEncodedPoints():n.num_points(),faceCount:a?s.GetNumberOfEncodedFaces():e==="mesh"&&typeof n.num_faces=="function"?n.num_faces():0,attributeCount:n.num_attributes(),...o.method?{method:o.method}:{},...o.speed?{speed:o.speed}:{},attributes:u}}_createDracoMesh(e,t,n){let s=n.attributesMetadata||{},i={},o=this._getVertexCount(t,n);for(let[a,c]of Object.entries(t)){let u=this._addAttributeToMesh(e,a,c,o,n);if(u!==-1){let l=Uu(c),f=this._getDracoAttributeType(a,n.attributeTypes);i[a]={attributeId:u,attributeType:f,attributeTypeName:RB(this.draco,f),componentCount:ah(c,l.length/o),supportsQuantization:l instanceof Float32Array},this._addAttributeMetadata(e,u,{[n.attributeNameEntry||"name"]:a,...s[a]||{}})}}return i}_createDracoPointCloud(e,t,n){let s=n.attributesMetadata||{},i={},o=this._getVertexCount(t,n);for(let[a,c]of Object.entries(t)){let u=this._addAttributeToMesh(e,a,c,o,n);if(u!==-1){let l=Uu(c),f=this._getDracoAttributeType(a,n.attributeTypes);i[a]={attributeId:u,attributeType:f,attributeTypeName:RB(this.draco,f),componentCount:ah(c,l.length/o),supportsQuantization:l instanceof Float32Array},this._addAttributeMetadata(e,u,{[n.attributeNameEntry||"name"]:a,...s[a]||{}})}}return i}_addAttributeToMesh(e,t,n,s,i={}){let o=Uu(n);if(!o)throw new Error(`DracoWriter: attribute "${t}" must contain a typed array`);let a=this._getDracoAttributeType(t,i.attributeTypes),c=ah(n,o.length/s);if(a==="indices"){if(o.length%3!==0)throw new Error("DracoWriter: triangle indices length must be divisible by 3");fU(o,s);let f=o.length/3;this.log(`Adding attribute ${t}, size ${f}`);let d=o instanceof Uint16Array||o instanceof Uint32Array?o:Uint32Array.from(o);return this.dracoMeshBuilder.AddFacesToMesh(e,f,d),-1}if(!Number.isInteger(c)||c<=0||o.length!==s*c)throw new Error(`DracoWriter: attribute "${t}" has ${o.length} values, expected ${s*c}`);this.log(`Adding attribute ${t}, size ${c}`);let u=this.dracoMeshBuilder,l=-1;if(o instanceof Int8Array)l=u.AddInt8Attribute(e,a,s,c,o);else if(o instanceof Int16Array)l=u.AddInt16Attribute(e,a,s,c,o);else if(o instanceof Int32Array)l=u.AddInt32Attribute(e,a,s,c,o);else if(o instanceof Uint8Array)l=u.AddUInt8Attribute(e,a,s,c,o);else if(o instanceof Uint8ClampedArray){let f=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);l=u.AddUInt8Attribute(e,a,s,c,f)}else if(o instanceof Uint16Array)l=u.AddUInt16Attribute(e,a,s,c,o);else if(o instanceof Uint32Array)l=u.AddUInt32Attribute(e,a,s,c,o);else if(o instanceof Float32Array)l=u.AddFloatAttribute(e,a,s,c,o);else throw new Error(`DracoWriter: attribute "${t}" uses unsupported ${o.constructor.name}`);return!ArrayBuffer.isView(n)&&n.normalized!==void 0&&u.SetNormalizedFlagForAttribute(e,l,n.normalized),l}_getDracoAttributeType(e,t={}){if(e.toLowerCase()==="indices")return"indices";let n=t[e];if(n)return this.draco[n];let s=uU[e];if(s)return this.draco[s];switch(e.toLowerCase()){case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return/^color_\d+$/i.test(e)?this.draco.COLOR:/^texcoord_\d+$/i.test(e)?this.draco.TEX_COORD:this.draco.GENERIC}}_getVertexCount(e,t){let n=this._getPositionAttribute(e,t.attributeTypes),s=n&&Uu(n);if(!n||!s)throw new Error("DracoWriter: POSITION attribute is required");let i=ah(n,3);if(!Number.isInteger(i)||i<=0||s.length%i!==0)throw new Error("DracoWriter: POSITION attribute has an invalid size or value count");return s.length/i}_getPositionAttribute(e,t={}){for(let n in e){let s=e[n];if(this._getDracoAttributeType(n,t)===this.draco.POSITION&&Uu(s))return s}return null}_addGeometryMetadata(e,t){let n=new this.draco.Metadata;this._populateDracoMetadata(n,t),this.dracoMeshBuilder.AddMetadata(e,n)}_addAttributeMetadata(e,t,n){let s=new this.draco.Metadata;this._populateDracoMetadata(s,n),this.dracoMeshBuilder.SetMetadataForAttribute(e,t,s)}_populateDracoMetadata(e,t){for(let[n,s]of lU(t))switch(typeof s){case"number":Math.trunc(s)===s?this.dracoMetadataBuilder.AddIntEntry(e,n,s):this.dracoMetadataBuilder.AddDoubleEntry(e,n,s);break;case"object":s instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,n,s,s.length);break;default:this.dracoMetadataBuilder.AddStringEntry(e,n,s)}}}});async function bU(r,e={}){return(await NB(r,e)).data}async function NB(r,e={}){let{draco:t}=await nw(mn(e)),n=new ja(t);try{return n.encodeSyncWithReport(PB(r),e.draco)}finally{n.destroy()}}async function gU(r,e={}){UB(e.signal);let t=[],n=0;for await(let s of Yw([r],e))t.push(s),n++,e.onProgress?.({completed:n,total:r.length});return t}function Yw(r,e={}){let t=wU(r);if(Kb(Jw,e)){let{onProgress:n,...s}=e;return Wb(Jw,t,s)}return CB(t,e)}async function*yU(r,e={}){let t=(async function*(){for await(let n of r)yield[n]})();for await(let n of Yw(t,e))yield n.data}async function*CB(r,e={}){let{draco:t}=await nw(mn(e)),n=new ja(t);try{for await(let s of r)for(let i of s)UB(e.signal),yield n.encodeSyncWithReport(i,e.draco)}finally{n.destroy()}}async function*wU(r){for await(let e of r)yield e.map(PB)}function UB(r){if(!r?.aborted)return;if(r.reason!==void 0)throw r.reason;let e=new Error("Draco batch encoding aborted");throw e.name="AbortError",e}function PB(r){if(xU(r))return bn(r);if(TU(r))return r;let{indices:e,...t}=r;return{attributes:t,...e?{indices:e}:{}}}function xU(r){return typeof r=="object"&&r!==null&&"shape"in r&&r.shape==="arrow-table"}function TU(r){return typeof r=="object"&&r!==null&&"attributes"in r&&typeof r.attributes=="object"&&r.attributes!==null&&!ArrayBuffer.isView(r.attributes)}var pU,Jw,mU,VB=p(()=>{"use strict";Be();gn();ti();kB();Su();Qy();Zy();pU={pointcloud:!1,attributeNameEntry:"name"},Jw={...vu,id:"draco-writer",name:"Draco compressed geometry writer",module:"scene",version:Au,worker:!0,workerNode:"draco-writer-worker-node.cjs",workerSourceNode:"draco/workers/draco-writer-worker-node.ts",options:{draco:{}}},mU={...vu,name:"DRACO",version:Au,options:{draco:pU},encode:bU,encodeInBatches:yU}});var jB={};J(jB,{DracoWriter:()=>mU,DracoWriterWorker:()=>Jw,encodeDraco:()=>NB,encodeDracoBatch:()=>gU,encodeDracoInBatches:()=>Yw,encodeDracoInBatchesLocally:()=>CB});var GB=p(()=>{"use strict";VB()});var DP={};J(DP,{DRACO_EXTERNAL_LIBRARIES:()=>xt,DRACO_EXTERNAL_LIBRARY_URLS:()=>lF,DracoFormat:()=>dh,DracoLoader:()=>hh,DracoWorkerLoader:()=>cF,FetchError:()=>A.FetchError,GLBFormat:()=>Pa,GLBLoader:()=>nF,GLBWriter:()=>iF,GLTFFormat:()=>Ua,GLTFLoader:()=>IB,GLTFWriter:()=>rF,JSONLoader:()=>A.JSONLoader,MTLFormat:()=>nh,MTLLoader:()=>zw,MTLWorkerLoader:()=>TB,MaterialXLoader:()=>fF,NullLoader:()=>A.NullLoader,NullWorkerLoader:()=>A.NullWorkerLoader,OBJFormat:()=>Ca,OBJLoader:()=>Gw,OBJWorkerLoader:()=>xB,OBJWriter:()=>AB,RequestScheduler:()=>A.RequestScheduler,STLLoader:()=>dF,USDLoader:()=>$a,_BrowserFileSystem:()=>A._BrowserFileSystem,_fetchProgress:()=>A._fetchProgress,_selectSource:()=>A._selectSource,_unregisterLoaders:()=>A._unregisterLoaders,assert:()=>A.assert,concatenateArrayBuffersAsync:()=>A.concatenateArrayBuffersAsync,coreApi:()=>A.coreApi,createDataSource:()=>A.createDataSource,createDataSourceSync:()=>A.createDataSourceSync,document:()=>A.document,encode:()=>A.encode,encodeInBatches:()=>A.encodeInBatches,encodeSync:()=>A.encodeSync,encodeTable:()=>A.encodeTable,encodeTableAsText:()=>A.encodeTableAsText,encodeTableInBatches:()=>A.encodeTableInBatches,encodeText:()=>A.encodeText,encodeTextSync:()=>A.encodeTextSync,encodeURLtoURL:()=>A.encodeURLtoURL,fetchFile:()=>A.fetchFile,forEach:()=>A.forEach,getLoaderOptions:()=>A.getLoaderOptions,getPathPrefix:()=>A.getPathPrefix,global:()=>A.global,isAsyncIterable:()=>A.isAsyncIterable,isBrowser:()=>A.isBrowser,isIterable:()=>A.isIterable,isIterator:()=>A.isIterator,isPromise:()=>A.isPromise,isPureObject:()=>A.isPureObject,isReadableStream:()=>A.isReadableStream,isResponse:()=>A.isResponse,isWorker:()=>A.isWorker,isWritableStream:()=>A.isWritableStream,load:()=>A.load,loadInBatches:()=>A.loadInBatches,makeIterator:()=>A.makeIterator,makeLineIterator:()=>A.makeLineIterator,makeNumberedLineIterator:()=>A.makeNumberedLineIterator,makeStream:()=>A.makeStream,makeTextDecoderIterator:()=>A.makeTextDecoderIterator,makeTextEncoderIterator:()=>A.makeTextEncoderIterator,parse:()=>A.parse,parseFile:()=>A.parseFile,parseInBatches:()=>A.parseInBatches,parseSync:()=>A.parseSync,preload:()=>A.preload,preloadSync:()=>A.preloadSync,readArrayBuffer:()=>A.readArrayBuffer,registerLoaders:()=>A.registerLoaders,resolvePath:()=>A.resolvePath,selectLoader:()=>A.selectLoader,selectLoaderSync:()=>A.selectLoaderSync,self:()=>A.self,setLoaderOptions:()=>A.setLoaderOptions,setPathPrefix:()=>A.setPathPrefix,window:()=>A.window});var A=wF(Ox(),1);Ih();var Ca={name:"OBJ",id:"obj",module:"scene",encoding:"text",format:"obj",extensions:["obj"],mimeTypes:["text/plain"]};oa();var W8=typeof __VERSION__<"u"?__VERSION__:"latest";async function $8(){let{OBJLoaderWithParser:r}=await Promise.resolve().then(()=>(Ug(),Cg));return r}var Gw={...Ca,dataType:null,batchType:null,version:W8,worker:!0,workerInBatches:!0,serializeWorkerResult:eo,text:!0,testText:q8,options:{obj:{shape:"arrow-table"}},preload:$8};function q8(r){return r[0]==="v"}var xB=Gw;var nh={name:"MTL",id:"mtl",module:"mtl",encoding:"text",format:"mtl",extensions:["mtl"],mimeTypes:["text/plain"]};var K8=typeof __VERSION__<"u"?__VERSION__:"latest";async function H8(){let{MTLLoaderWithParser:r}=await Promise.resolve().then(()=>(Gg(),jg));return r}var zw={...nh,dataType:null,batchType:null,version:K8,worker:!0,text:!0,testText:r=>r.includes("newmtl"),options:{mtl:{}},preload:H8},TB=zw;gn();var X8=typeof __VERSION__<"u"?__VERSION__:"latest",AB={...Ca,dataType:null,batchType:null,version:X8,options:{obj:{}},text:!0,encode:async(r,e)=>_B(r,e),encodeSync:_B,encodeTextSync:vB};function _B(r,e){let t=vB(r,e);return new TextEncoder().encode(t).buffer}function vB(r,e){let t=bn(J8(r)),n=Y8(t,"POSITION"),s=t.attributes.NORMAL,i=t.attributes.TEXCOORD_0,o=t.attributes.COLOR_0,a=n.value.length/n.size,c=["# loaders.gl OBJ"];for(let l=0;l<a;l++){let f=[Zn(n,l,0),Zn(n,l,1),Zn(n,l,2)];o&&f.push(Ww(o,l,0),Ww(o,l,1),Ww(o,l,2)),c.push(`v ${f.join(" ")}`)}if(i)for(let l=0;l<a;l++)c.push(`vt ${Zn(i,l,0)} ${Zn(i,l,1)}`);if(s)for(let l=0;l<a;l++)c.push(`vn ${Zn(s,l,0)} ${Zn(s,l,1)} ${Zn(s,l,2)}`);let u=Q8(t,a);for(let l=0;l<u.length;l+=3){let f=[$w(u[l],!!i,!!s),$w(u[l+1],!!i,!!s),$w(u[l+2],!!i,!!s)];c.push(`f ${f.join(" ")}`)}return`${c.join(`
54
54
  `)}
55
- `}function N3(r){return"shape"in r&&r.shape==="arrow-table"?r:ei(r,"arrow-table")}function C3(r,e){let t=r.attributes[e];if(!t)throw new Error(`OBJWriter: ${e} attribute is required`);return t}function Jn(r,e,t){return r.value[e*r.size+t]||0}function ew(r,e,t){let n=Jn(r,e,t);return r.normalized||n>1?n/255:n}function U3(r,e){if(r.indices?.value?.length)return Array.from(r.indices.value);if(r.mode!==4&&r.topology!=="triangle-list")return[];let t=[];for(let n=0;n+2<e;n+=3)t.push(n,n+1,n+2);return t}function tw(r,e,t){let n=r+1;return e&&t?`${n}/${n}/${n}`:e?`${n}/${n}`:t?`${n}//${n}`:String(n)}var ii=typeof __VERSION__<"u"?__VERSION__:"latest";var Ba={name:"glTF",id:"gltf",module:"scene",encoding:"binary",format:"gltf",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"]},Fa={name:"GLB",id:"glb",module:"scene",encoding:"binary",format:"glb",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,tests:["glTF"]};async function P3(){let{GLTFLoaderWithParser:r}=await Promise.resolve().then(()=>(Vy(),Py));return r}var IL={dataType:null,batchType:null,...Ba,version:ii,preload:P3,options:{gltf:{normalize:!0,loadBuffers:!0,loadFiles:!1,loadExternalAssets:!1,loadImages:!0,loadAudio:!0,decompressMeshes:!0}}};Ue();var V3=1179937895,SL=1313821514,rw=5130562,Dt=!0;function wu(r,e,t=0,n={}){let s=V3,i=n.version??("version"in r?r.version:2),o=r.json??{};if(i===3)return j3(r,e,t,s,o);if(i!==2)throw new Error(`Unsupported GLB writer version ${i}.`);let a="binChunks"in r?r.binary?new Uint8Array(r.binary):r.binChunks?.[0]&&Od(r.binChunks[0]):r.buffers?.[0]&&Od(r.buffers[0]),c=t;e&&(e.setUint32(t+0,s,Dt),e.setUint32(t+4,i,Dt),e.setUint32(t+8,0,Dt));let u=t+8;t+=12;let l=t;e&&(e.setUint32(t+0,0,Dt),e.setUint32(t+4,SL,Dt)),t+=8;let f=JSON.stringify(o);if(t=xf(e,t,f,4),e){let d=t-l-8;e.setUint32(l+0,d,Dt)}if(a){let d=t;if(e&&(e.setUint32(t+0,0,Dt),e.setUint32(t+4,rw,Dt)),t+=8,t=Uc(e,t,a,4),e){let h=t-d-8;e.setUint32(d+0,h,Dt)}}if(e){let d=t-c;e.setUint32(u,d,Dt)}return t}function j3(r,e,t,n,s){let i=t,o=[{type:SL,arrayBuffer:G3(s)},...("chunks"in r?r.chunks:[])??[],..."binChunks"in r?(r.binChunks??[]).map(a=>({type:rw,arrayBuffer:Od(a).slice().buffer})):(r.buffers??[]).map(a=>({type:rw,arrayBuffer:Od(a).slice().buffer}))];e&&(e.setUint32(t,n,Dt),e.setUint32(t+4,3,Dt),Fd(e,t+8,0,"GLB file length")),t+=16;for(let a of o){let c=a.encoding??0;if(c!==0)throw new Error(`Unsupported GLB chunk encoding ${c}.`);let u=t;e&&(e.setUint32(t,a.type,Dt),e.setUint32(t+4,c,Dt),Fd(e,t+8,0,"GLB chunk length")),t+=16,t=Uc(e,t,new Uint8Array(a.arrayBuffer),4),e&&Fd(e,u+8,t-u-16,"GLB chunk length")}return e&&Fd(e,i+8,t-i,"GLB file length"),t}function Od(r){return new Uint8Array(r.arrayBuffer,r.byteOffset,r.byteLength)}function G3(r){let e=JSON.stringify(r),t=new TextEncoder().encode(e).byteLength,n=Math.ceil(t/4)*4,s=new ArrayBuffer(n),i=new DataView(s);return xf(i,0,e,4),s}function Fd(r,e,t,n){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${n} is outside the safe integer range.`);r.setBigUint64(e,BigInt(t),Dt)}function nw(r,e,t,n){return z3(r),wu(r,e,t,n)}function z3(r){if(r.buffers&&r.buffers.length>1)throw new Error("encodeGLTF: multiple buffers not yet implemented")}function ve(r,e){if(!r)throw new Error(e||"assert failed: gltf")}Ue();var EL={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},LL={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8};var BL=["SCALAR","VEC2","VEC3","VEC4"],W3=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Int32Array,5124],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130],[BigInt64Array,5134],[BigUint64Array,5135]],$3=new Map(W3),q3={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},K3={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8},X3={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5124:Int32Array,5125:Uint32Array,5126:Float32Array,5130:Float64Array,5131:Uint16Array,5134:BigInt64Array,5135:BigUint64Array};function Md(r){return BL[r-1]||BL[0]}function wo(r){let e=$3.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function sw(r,e){let t=X3[r.componentType],n=q3[r.type],s=K3[r.componentType],i=r.count*n,o=r.count*n*s;ve(o>=0&&o<=e.byteLength);let a=LL[r.componentType],c=EL[r.type];return{ArrayType:t,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function xu(r,e,t){let n=typeof t=="number"?r.bufferViews[t]:t;ve(n);let s=n.buffer,i=e[s];ve(i),ve((n.byteOffset||0)>=0&&n.byteLength>=0),ve((n.byteOffset||0)+n.byteLength<=i.byteLength),ve(i.byteOffset>=0&&i.byteOffset+i.byteLength<=i.arrayBuffer.byteLength);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function FL(r,e,t){let n=r.images[t];return xu(r,e,n.bufferView)}function Oa(r,e,t){let n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);ve(Number.isSafeInteger(n.count)&&n.count>=0);let{ArrayType:s,length:i,numberOfComponentsInElement:o}=sw(n,{byteLength:1/0}),a=n.value,c;ArrayBuffer.isView(a)?(ve(a.length===i),c=a):n.bufferView===void 0?c=new s(i):c=iw(r,e,n);let u=n.sparse;if(!u)return c;let l=new s(i);new Uint8Array(l.buffer).set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),ve(u.count>=0&&u.count<=n.count),ve([5121,5123,5125].includes(u.indices.componentType));let f=iw(r,e,{bufferView:u.indices.bufferView,byteOffset:u.indices.byteOffset,componentType:u.indices.componentType,count:u.count,type:"SCALAR"}),d=iw(r,e,{bufferView:u.values.bufferView,byteOffset:u.values.byteOffset,componentType:n.componentType,count:u.count,type:n.type}),h=-1,m=new Uint8Array(l.buffer),b=o*s.BYTES_PER_ELEMENT,g=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);for(let y=0;y<u.count;y++){let x=Number(f[y]);ve(x>h&&x<n.count),m.set(g.subarray(y*b,(y+1)*b),x*b),h=x}return l}function iw(r,e,t){let n=r.bufferViews?.[t.bufferView];if(!n)throw new Error(`No gltf buffer view for accessor ${n}`);let s=e[n.buffer];ve(s);let{arrayBuffer:i,byteOffset:o}=s;ve((n.byteOffset||0)>=0&&n.byteLength>=0),ve((n.byteOffset||0)+n.byteLength<=s.byteLength),ve(o>=0&&o+s.byteLength<=i.byteLength),ve((t.byteOffset||0)>=0);let a=(o||0)+(t.byteOffset||0)+(n.byteOffset||0),{ArrayType:c,length:u,componentByteSize:l,numberOfComponentsInElement:f}=sw(t,n),d=l*f,h=t.type.startsWith("MAT")?Number(t.type.slice(3)):1,m=_e(h*l,4),b=h>1?h*m:d,g=n.byteStride??b,y=h>1?(h-1)*m+h*l:d;if(ve(g>=b),ve((t.byteOffset||0)+(t.count===0?0:(t.count-1)*g+y)<=n.byteLength),t.count===0)return new c(0);if(h>1&&m!==h*l){let _=n.byteStride??h*m,v=(h-1)*m+h*l;ve((t.byteOffset||0)+(t.count-1)*_+v<=n.byteLength);let I=new c(u),N=new Uint8Array(I.buffer,I.byteOffset,I.byteLength);for(let K=0;K<t.count;K++)for(let ne=0;ne<h;ne++){let be=new Uint8Array(i,a+K*_+ne*m,h*l);N.set(be,K*d+ne*h*l)}return I}let x=n.byteStride||d;if(typeof n.byteStride>"u"||n.byteStride===d){if(a%l!==0){let v=new Uint8Array(i,a,u*l),I=new Uint8Array(v.byteLength);return I.set(v),new c(I.buffer,0,u)}return new c(i,a,u)}let T=new c(u);for(let _=0;_<t.count;_++){let v=a+_*x,I;if(v%l!==0){let N=new Uint8Array(i,v,d),K=new Uint8Array(d);K.set(N),I=new c(K.buffer,0,f)}else I=new c(i,v,f);T.set(I,_*f)}return T}var cw="KHR_draco_mesh_compression";async function WL(r,e={}){let t=e.gltf?.draco;if(!t?.enabled)return r;if((r.buffers?.length||0)>1)throw new Error("GLTF Draco writer requires a single buffer");let n=u8(r.json),s=l8(r.buffers||[]),i={...r,json:n,buffers:s},o=[];for(let d of n.meshes||[])for(let h of d.primitives||[]){let m=h.mode??4;if(m!==4){if(t.skipUnsupportedPrimitives??!0)continue;throw new Error(`GLTF Draco writer cannot compress primitive mode ${m}; only TRIANGLES (4) is supported`)}if(h.extensions?.[cw])throw new Error("GLTF Draco writer refuses to replace an existing Draco extension");let b=c8(r,h),{encodeDraco:g}=await Promise.resolve().then(()=>(GL(),jL)),y=await g(b,{core:e.core,modules:e.modules,draco:t});o.push({primitive:h,result:y})}if(o.length===0)return i;let a=f8(s),c=a.byteLength;for(let{result:d}of o)c=uw(c)+d.data.byteLength;let u=new Uint8Array(c);u.set(a),n.bufferViews=n.bufferViews||[],n.buffers=n.buffers||[{byteLength:0}];let l=uw(a.byteLength);for(let{primitive:d,result:h}of o){new Uint8Array(u.buffer,l,h.data.byteLength).set(new Uint8Array(h.data));let m=n.bufferViews.length;n.bufferViews.push({buffer:0,byteOffset:l,byteLength:h.data.byteLength}),d.extensions={...d.extensions||{},[cw]:{bufferView:m,attributes:Object.fromEntries(Object.entries(h.report.attributes).map(([b,g])=>[b,g.id]))}},l=uw(l+h.data.byteLength)}let f=u;return i.buffers[0]={...i.buffers[0]||{byteOffset:0},arrayBuffer:f.buffer,byteOffset:0,byteLength:f.byteLength},n.buffers[0]={...n.buffers[0]||{},byteLength:f.byteLength},n.extensionsUsed=d8(n.extensionsUsed,cw),i}function c8(r,e){if(!e.attributes||e.attributes.POSITION===void 0)throw new Error("GLTF Draco writer requires a POSITION attribute");let t={};for(let[s,i]of Object.entries(e.attributes)){let o=r.json.accessors?.[i];if(!o)throw new Error(`GLTF Draco writer could not resolve accessor ${i}`);if(o.sparse)throw new Error(`GLTF Draco writer does not support sparse accessor ${i}`);let a=zL(r,i,o.componentType);t[s]={value:a,size:h8(o.type),...o.normalized===void 0?{}:{normalized:o.normalized}}}let n;if(e.indices!==void 0){let s=r.json.accessors?.[e.indices];if(!s)throw new Error(`GLTF Draco writer could not resolve index accessor ${e.indices}`);if(s.sparse)throw new Error(`GLTF Draco writer does not support sparse accessor ${e.indices}`);n=zL(r,e.indices,s.componentType)}else{let s=r.json.accessors?.[e.attributes.POSITION];if(!s||s.count%3!==0)throw new Error("GLTF Draco writer requires triangle-aligned POSITION data without indices");n=new Uint32Array(s.count);for(let i=0;i<n.length;i++)n[i]=i}return{attributes:t,indices:n}}function zL(r,e,t){let n=Oa(r.json,r.buffers,e);if(n instanceof BigInt64Array||n instanceof BigUint64Array||n instanceof Float64Array)throw new Error(`GLTF Draco writer does not support 64-bit accessor ${e} (componentType ${t}); the official 1.5.7 encoder binding has no 64-bit attribute API`);return n}function u8(r){return JSON.parse(JSON.stringify(r))}function l8(r){return r.map(e=>({...e,arrayBuffer:e.arrayBuffer.slice(0)}))}function f8(r){let e=r[0]||{arrayBuffer:new ArrayBuffer(0),byteOffset:0,byteLength:0};return new Uint8Array(e.arrayBuffer,e.byteOffset||0,e.byteLength)}function uw(r){return Math.ceil(r/4)*4}function d8(r,e){return r?.includes(e)?r:[...r||[],e]}function h8(r){switch(r){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:throw new Error(`GLTF Draco writer does not recognize accessor type ${r}`)}}var Dw={};J(Dw,{createExtMeshFeatures:()=>S8,decode:()=>T8,encode:()=>_8,name:()=>x8});qn();Ue();function p8(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var oi=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||p8(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=_e(this.gltf.buffers[0].byteLength,4),this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof t=="string"||typeof n=="string"}getExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if(typeof t=="object")return t;let n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){return xu(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return Oa(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForImageData(e){e=this.getAccessor(e);let t=this.getBufferView(e.bufferView),s=this.getBuffer(t.buffer).data,i=t.byteOffset||0;return new Uint8Array(s,i,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){let s=e.extensions||{};s[t]=n}removeObjectExtension(e,t){let n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(t)||s.push(t)}delete n[t]}addExtension(e,t={}){return ve(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return ve(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let t=this.json.extensionsRemoved;t.includes(e)||t.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){let{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:t};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:t,indices:n,material:s,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){let n=$n(e),s=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){let s=e.byteLength;ve(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let i={buffer:t,byteOffset:n,byteLength:s};return this.byteLength+=_e(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){let n=t.normalized,s={bufferView:e,...n===void 0?{}:{normalized:n},type:Md(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(s),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){let n=this.addBufferView(e),s={min:t.min,max:t.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,t.size));let i={size:t.size,componentType:wo(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(i,t))}addTexture(e){let{imageIndex:t,samplerIndex:n}=e,s={source:t,...n===void 0?{}:{sampler:n}};return this.json.textures=this.json.textures||[],this.json.textures.push(s),this.json.textures.length-1}addSampler(e){return this.json.samplers=this.json.samplers||[],this.json.samplers.push({...e}),this.json.samplers.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){if(this.byteLength===0&&!this.json.buffers?.length){delete this.json.buffers,delete this.gltf.binary,this.sourceBuffers=[],this.gltf.buffers=[];return}let e=[0],t=this.byteLength;for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&(e[o]=_e(t,8),t=e[o]+_e(a.byteLength,4))}let n=new ArrayBuffer(t),s=new Uint8Array(n),i=0;for(let o of this.sourceBuffers||[])i=to(o,s,i);for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&to(a,s,e[o])}for(let o of this.json.bufferViews||[]){let a=e[o.buffer];ve(a!==void 0),o.byteOffset=a+(o.byteOffset||0),o.buffer=0;for(let c of["EXT_meshopt_compression","KHR_meshopt_compression"]){let u=o.extensions?.[c];if(u){let l=e[u.buffer];ve(l!==void 0),u.byteOffset=l+(u.byteOffset||0),u.buffer=0}}}this.byteLength=t,this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n],this.gltf.buffers=[{arrayBuffer:n,byteOffset:0,byteLength:n.byteLength}]}_removeStringFromArray(e,t){let n=!0;for(;n;){let s=e.indexOf(t);s>-1?e.splice(s,1):n=!1}}_addAttributes(e={}){let t={};for(let n in e){let s=e[n],i=this._getGltfAttributeName(n),o=s.value,a=o.BYTES_PER_ELEMENT*s.size,c=_e(a,4),u;if(c===a)u=this.addBinaryBuffer(o,s);else{let l=o.length/s.size,f=new Uint8Array(l*c),d=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);for(let m=0;m<l;m++)f.set(d.subarray(m*a,(m+1)*a),m*c);let h=this.addBufferView(f);this.json.bufferViews[h].byteStride=c,u=this.addAccessor(h,{...this._getAccessorMinMax(o,s.size),...s,componentType:wo(o),count:l})}t[i]=u}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){let n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];let s=e.subarray(0,t);for(let i of s)n.min.push(i),n.max.push(i);for(let i=t;i<e.length;i+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[i+o]),n.max[0+o]=Math.max(n.max[0+o],e[i+o]);return n}};var Ye=class{gltf;type;index;data;path;iterator;constructor(e,t,n,s,i){this.iterator=e,this.gltf=e.gltf,this.type=t,this.index=n,this.data=s,this.path=i}},ai=class extends Ye{parent;constructor(e,t,n,s,i,o){super(e,t,n,s,i),this.parent=o}},lw=class extends Ye{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}},fw=class extends Ye{get channels(){return To(this.data.channels,(e,t)=>this.iterator.getOrCreateNested(e,()=>new dw(this.iterator,"animationChannel",t,e,`${this.path}.channels[${t}]`,this)))}get samplers(){return To(this.data.samplers,(e,t)=>this.iterator.getOrCreateNested(e,()=>new kd(this.iterator,"animationSampler",t,e,`${this.path}.samplers[${t}]`,this)))}},dw=class extends ai{get sampler(){let t=this.parent.data.samplers[this.data.sampler];if(!t)throw new Error(`Invalid glTF reference at ${this.path}.sampler: animation sampler index ${this.data.sampler} is out of range`);return this.iterator.getOrCreateNested(t,()=>new kd(this.iterator,"animationSampler",this.data.sampler,t,`${this.parent.path}.samplers[${this.data.sampler}]`,this.parent))}get target(){return this.iterator.getOrCreateNested(this.data.target,()=>new hw(this.iterator,"animationChannelTarget",0,this.data.target,`${this.path}.target`,this))}},hw=class extends ai{get node(){return this.data.node===void 0?void 0:this.iterator.resolveNode(this.data.node,`${this.path}.node`)}},kd=class extends ai{get input(){return this.iterator.resolveAccessor(this.data.input,`${this.path}.input`)}get output(){return this.iterator.resolveAccessor(this.data.output,`${this.path}.output`)}},pw=class extends Ye{get loadedBuffer(){return this.gltf.buffers[this.index]}},mw=class extends Ye{get buffer(){return this.iterator.resolveBuffer(this.data.buffer,`${this.path}.buffer`)}get loadedBufferView(){let e=this.buffer.loadedBuffer;if(!e)return;let t=e.byteOffset+(this.data.byteOffset||0);return new Uint8Array(e.arrayBuffer,t,this.data.byteLength)}},bw=class extends Ye{},gw=class extends Ye{get file(){return this.iterator.resolveFile(this.data.file,`${this.path}.file`)}get loadedAsset(){return this.gltf.externalAssets?.[this.index]}},yw=class extends Ye{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedFile(){return this.gltf.files?.[this.index]}},ww=class extends Ye{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedImage(){return this.gltf.images?.[this.index]}},xw=class extends Ye{get baseColorTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.baseColorTexture,0,"pbrMetallicRoughness.baseColorTexture")}get metallicRoughnessTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.metallicRoughnessTexture,1,"pbrMetallicRoughness.metallicRoughnessTexture")}get normalTexture(){return this.getTextureInfo(this.data.normalTexture,2,"normalTexture")}get occlusionTexture(){return this.getTextureInfo(this.data.occlusionTexture,3,"occlusionTexture")}get emissiveTexture(){return this.getTextureInfo(this.data.emissiveTexture,4,"emissiveTexture")}get textures(){return[this.baseColorTexture,this.metallicRoughnessTexture,this.normalTexture,this.occlusionTexture,this.emissiveTexture].filter(t=>!!t).values()}getTextureInfo(e,t,n){return e?this.iterator.getOrCreateNested(e,()=>new Tw(this.iterator,"textureInfo",t,e,`${this.path}.${n}`,this)):void 0}},Tw=class extends ai{get texture(){return this.iterator.resolveTexture(this.data.index,`${this.path}.index`)}},_w=class extends Ye{get primitives(){return To(this.data.primitives,(e,t)=>this.iterator.getOrCreateNested(e,()=>new Aw(this.iterator,"primitive",t,e,`${this.path}.primitives[${t}]`,this)))}},Aw=class extends ai{get attributes(){return new Map(Object.entries(this.data.attributes).map(([e,t])=>[e,this.iterator.resolveAccessor(t,`${this.path}.attributes.${e}`)]))}get indices(){return this.data.indices===void 0?void 0:this.iterator.resolveAccessor(this.data.indices,`${this.path}.indices`)}get material(){return this.data.material===void 0?void 0:this.iterator.resolveMaterial(this.data.material,`${this.path}.material`)}get targets(){return(this.data.targets||[]).map((e,t)=>new Map(Object.entries(e).map(([n,s])=>[n,this.iterator.resolveAccessor(s,`${this.path}.targets[${t}].${n}`)])))}},vw=class extends Ye{get camera(){return this.data.camera===void 0?void 0:this.iterator.resolveCamera(this.data.camera,`${this.path}.camera`)}get children(){return To(this.data.children||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.children[${t}]`))}get skin(){return this.data.skin===void 0?void 0:this.iterator.resolveSkin(this.data.skin,`${this.path}.skin`)}get mesh(){return this.data.mesh===void 0?void 0:this.iterator.resolveMesh(this.data.mesh,`${this.path}.mesh`)}get externalAsset(){return this.data.externalAsset===void 0?void 0:this.iterator.resolveExternalAsset(this.data.externalAsset,`${this.path}.externalAsset`)}},Iw=class extends Ye{},Sw=class extends Ye{get nodes(){return To(this.data.nodes||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.nodes[${t}]`))}},Ew=class extends Ye{get inverseBindMatrices(){return this.data.inverseBindMatrices===void 0?void 0:this.iterator.resolveAccessor(this.data.inverseBindMatrices,`${this.path}.inverseBindMatrices`)}get skeleton(){return this.data.skeleton===void 0?void 0:this.iterator.resolveNode(this.data.skeleton,`${this.path}.skeleton`)}get joints(){return To(this.data.joints,(e,t)=>this.iterator.resolveNode(e,`${this.path}.joints[${t}]`))}},Lw=class extends Ye{get sampler(){return this.data.sampler===void 0?void 0:this.iterator.resolveSampler(this.data.sampler,`${this.path}.sampler`)}get source(){return this.data.source===void 0?void 0:this.iterator.resolveImage(this.data.source,`${this.path}.source`)}},Kr=class{gltf;objectCache=new WeakMap;referencesCache=new WeakMap;constructor(e){this.gltf=e}get data(){return this.gltf.json}getTypedArrayForBufferView(e){return xu(this.data,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return Oa(this.data,this.gltf.buffers,e)}getTypedArrayForImageData(e){return FL(this.data,this.gltf.buffers,e)}getLoadedBuffer(e){let t=this.getMetadata(e);return this.gltf.buffers[t.index]}getLoadedBufferView(e){let t=this.getReferences(e).buffer,n=this.getLoadedBuffer(t);if(!n)return;let s=n.byteOffset+(e.byteOffset||0);return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getLoadedImage(e){return this.gltf.images?.[this.getMetadata(e).index]}getLoadedFile(e){return this.gltf.files?.[this.getMetadata(e).index]}getLoadedExternalAsset(e){return this.gltf.externalAssets?.[this.getMetadata(e).index]}addBuffer(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return this.gltf.buffers.push({arrayBuffer:t,byteOffset:0,byteLength:e.byteLength}),this.data.buffers||=[],this.data.buffers.push({byteLength:e.byteLength}),this.data.buffers.length-1}addBufferView(e,t,n=0){return this.data.bufferViews||=[],this.data.bufferViews.push({buffer:e,byteOffset:n,byteLength:t}),this.data.bufferViews.length-1}addAccessor(e,t){return this.data.accessors||=[],this.data.accessors.push({bufferView:e,type:Md(t.size),componentType:t.componentType,count:t.count,min:t.min,max:t.max}),this.data.accessors.length-1}getReferences(e){let t=this.referencesCache.get(e);if(t)return t;let n=this.getObjectIterator(e),s=m8(n);return this.referencesCache.set(e,s),s}getMetadata(e){let t=this.getObjectIterator(e),n=t instanceof ai?t.parent.data:void 0;return{gltf:this.gltf,type:t.type,index:t.index,parent:n,path:t.path}}get scene(){return this.data.scene===void 0?void 0:this.resolveScene(this.data.scene,"scene").data}get thumbnail(){return this.data.asset.thumbnail===void 0?void 0:this.resolveImage(this.data.asset.thumbnail,"asset.thumbnail").data}get accessors(){return this.iterateCollectionData("accessor")}get animations(){return this.iterateCollectionData("animation")}get buffers(){return this.iterateCollectionData("buffer")}get bufferViews(){return this.iterateCollectionData("bufferView")}get cameras(){return this.iterateCollectionData("camera")}get externalAssets(){return this.iterateCollectionData("externalAsset")}get files(){return this.iterateCollectionData("file")}get images(){return this.iterateCollectionData("image")}get materials(){return this.iterateCollectionData("material")}get meshes(){return this.iterateCollectionData("mesh")}get nodes(){return this.iterateCollectionData("node")}get samplers(){return this.iterateCollectionData("sampler")}get scenes(){return this.iterateCollectionData("scene")}get skins(){return this.iterateCollectionData("skin")}get textures(){return this.iterateCollectionData("texture")}hasExtension(e){return!!this.data.extensionsUsed?.includes(e)||!!this.data.extensionsRequired?.includes(e)}isExtensionRequired(e){return!!this.data.extensionsRequired?.includes(e)}getExtension(e,t){let n=typeof e=="string"?this.data:e,s=typeof e=="string"?e:t;return n.extensions?.[s]}setExtension(e,t,n){let s=typeof e=="string",i=s?this.data:e,o=s?e:t,a=s?t:n,c=s?!!n:!1;i.extensions||={},i.extensions[o]=a,this.registerUsedExtension(o),c&&this.registerRequiredExtension(o)}registerUsedExtension(e){this.data.extensionsUsed||=[],this.data.extensionsUsed.includes(e)||this.data.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.data.extensionsRequired||=[],this.data.extensionsRequired.includes(e)||this.data.extensionsRequired.push(e)}removeExtension(e,t){let n=typeof e=="string",s=n?this.data:e,i=n?e:t;s.extensions?.[i]!==void 0&&(this.recordRemovedExtension(i),delete s.extensions[i]),n&&(qL(this.data.extensionsUsed,i),qL(this.data.extensionsRequired,i))}recordRemovedExtension(e){let t=this.data;t.extensionsRemoved||=[],t.extensionsRemoved.includes(e)||t.extensionsRemoved.push(e)}resolveAccessor(e,t){return this.resolveCollectionObject("accessor",e,t)}resolveBuffer(e,t){return this.resolveCollectionObject("buffer",e,t)}resolveBufferView(e,t){return this.resolveCollectionObject("bufferView",e,t)}resolveCamera(e,t){return this.resolveCollectionObject("camera",e,t)}resolveExternalAsset(e,t){return this.resolveCollectionObject("externalAsset",e,t)}resolveFile(e,t){return this.resolveCollectionObject("file",e,t)}resolveImage(e,t){return this.resolveCollectionObject("image",e,t)}resolveMaterial(e,t){return this.resolveCollectionObject("material",e,t)}resolveMesh(e,t){return this.resolveCollectionObject("mesh",e,t)}resolveNode(e,t){return this.resolveCollectionObject("node",e,t)}resolveSampler(e,t){return this.resolveCollectionObject("sampler",e,t)}resolveScene(e,t){return this.resolveCollectionObject("scene",e,t)}resolveSkin(e,t){return this.resolveCollectionObject("skin",e,t)}resolveTexture(e,t){return this.resolveCollectionObject("texture",e,t)}getOrCreateNested(e,t){return this.getOrCreate(e,t)}iterateCollection(e){let t=this.getCollection(e);return To(t,(n,s)=>this.resolveCollectionObject(e,s,e))}iterateCollectionData(e){return(function*(n){for(let s of n.iterateCollection(e))yield s.data})(this)}getObjectIterator(e){let t=this.objectCache.get(e);if(!t)throw new Error("glTF object is not registered with this iterator");return t}resolveCollectionObject(e,t,n){let i=this.getCollection(e)[t];if(!i)throw new Error(`Invalid glTF reference at ${n}: ${e} index ${t} is out of range`);return this.getOrCreate(i,()=>this.createCollectionObject(e,t,i))}getCollection(e){switch(e){case"accessor":return this.data.accessors||[];case"animation":return this.data.animations||[];case"buffer":return this.data.buffers||[];case"bufferView":return this.data.bufferViews||[];case"camera":return this.data.cameras||[];case"externalAsset":return this.data.externalAssets||[];case"file":return this.data.files||[];case"image":return this.data.images||[];case"material":return this.data.materials||[];case"mesh":return this.data.meshes||[];case"node":return this.data.nodes||[];case"sampler":return this.data.samplers||[];case"scene":return this.data.scenes||[];case"skin":return this.data.skins||[];case"texture":return this.data.textures||[]}}createCollectionObject(e,t,n){let s=`${b8(e)}[${t}]`;switch(e){case"accessor":return new lw(this,e,t,n,s);case"animation":return new fw(this,e,t,n,s);case"buffer":return new pw(this,e,t,n,s);case"bufferView":return new mw(this,e,t,n,s);case"camera":return new bw(this,e,t,n,s);case"externalAsset":return new gw(this,e,t,n,s);case"file":return new yw(this,e,t,n,s);case"image":return new ww(this,e,t,n,s);case"material":return new xw(this,e,t,n,s);case"mesh":return new _w(this,e,t,n,s);case"node":return new vw(this,e,t,n,s);case"sampler":return new Iw(this,e,t,n,s);case"scene":return new Sw(this,e,t,n,s);case"skin":return new Ew(this,e,t,n,s);case"texture":return new Lw(this,e,t,n,s)}}getOrCreate(e,t){let n=this.objectCache.get(e);if(n)return n;let s=t();return this.objectCache.set(e,s),s}};function m8(r){switch(r.type){case"accessor":return{get bufferView(){return r.bufferView?.data}};case"animation":return{get channels(){return xo(r.channels)},get samplers(){return xo(r.samplers)}};case"animationChannel":return{get sampler(){return r.sampler.data},get target(){return r.target.data}};case"animationChannelTarget":return{get node(){return r.node?.data}};case"animationSampler":return{get input(){return r.input.data},get output(){return r.output.data}};case"bufferView":return{get buffer(){return r.buffer.data}};case"externalAsset":return{get file(){return r.file.data}};case"file":case"image":return{get bufferView(){return r.bufferView?.data}};case"material":return{get baseColorTexture(){return r.baseColorTexture?.data},get metallicRoughnessTexture(){return r.metallicRoughnessTexture?.data},get normalTexture(){return r.normalTexture?.data},get occlusionTexture(){return r.occlusionTexture?.data},get emissiveTexture(){return r.emissiveTexture?.data},get textures(){return xo(r.textures)}};case"textureInfo":return{get texture(){return r.texture.data}};case"mesh":return{get primitives(){return xo(r.primitives)}};case"primitive":return{get attributes(){return $L(r.attributes)},get indices(){return r.indices?.data},get material(){return r.material?.data},get targets(){return r.targets.map($L)}};case"node":return{get camera(){return r.camera?.data},get children(){return xo(r.children)},get skin(){return r.skin?.data},get mesh(){return r.mesh?.data},get externalAsset(){return r.externalAsset?.data}};case"scene":return{get nodes(){return xo(r.nodes)}};case"skin":return{get inverseBindMatrices(){return r.inverseBindMatrices?.data},get skeleton(){return r.skeleton?.data},get joints(){return xo(r.joints)}};case"texture":return{get sampler(){return r.sampler?.data},get source(){return r.source?.data}};default:return{}}}function To(r,e){return(function*(){for(let n=0;n<r.length;n++)yield e(r[n],n)})()}function xo(r){return(function*(){for(let t of r)yield t.data})()}function $L(r){return new Map(Array.from(r,([e,t])=>[e,t.data]))}function b8(r){switch(r){case"bufferView":return"bufferViews";case"externalAsset":return"externalAssets";case"mesh":return"meshes";default:return`${r}s`}}function qL(r,e){if(r)for(let t=r.length-1;t>=0;t--)r[t]===e&&r.splice(t,1)}qn();Ue();function KL(r){return(r%1+1)%1}var XL={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},g8={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},HL={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Bw(r,e){return HL[e]*XL[r]}function Fw(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;let s=r.getTypedArrayForBufferView(e),i=Nd(s,"SCALAR",t,n+1);if(i instanceof BigInt64Array||i instanceof BigUint64Array){let o=new Float64Array(i.length),a=BigInt(Number.MAX_SAFE_INTEGER);for(let c=0;c<i.length;c++){let u=i[c];if(u<0n||u>a)throw new Error("EXT_structural_metadata: UINT64 offset exceeds the safe integer range");o[c]=Number(u)}return o}return i}function Nd(r,e,t,n=1){let s=XL[e],i=g8[t],o=HL[t],a=n*s,c=a*o,u=r.buffer,l=r.byteOffset;return l%o!==0&&(u=new Uint8Array(u).slice(l,l+c).buffer,l=0),new i(ro(u),l,a)}function Cd(r,e,t){let n=`TEXCOORD_${e.texCoord||0}`,s=t.attributes[n],i=r.getTypedArrayForAccessor(s),o=r.gltf.json,a=e.index,c=o.textures?.[a]?.source;if(typeof c<"u"){let u=o.images?.[c]?.mimeType,l=r.gltf.images?.[c];if(l&&typeof l.width<"u"&&!("compressed"in l&&l.compressed)){let f=[];for(let d=0;d<i.length;d+=2){let h=y8(l,u,i,d,e.channels);f.push(h)}return f}}return[]}function JL(r,e,t,n,s){if(!t?.length)return;let i=[];for(let f of t){let d=n.findIndex(h=>h===f);d===-1&&(d=n.push(f)-1),i.push(d)}let o=new Uint32Array(i),a=r instanceof Kr?r:new Kr(r.gltf),c=a.addBuffer(o),u=a.addBufferView(c,o.byteLength),l=a.addAccessor(u,{size:1,componentType:wo(o),count:o.length});s.attributes[e]=l}function y8(r,e,t,n,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],a=t[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let u=w8(o,a,r,c),l=0;for(let f of s){let d=typeof f=="number"?Object.values(i)[f]:i[f],h=u+d.offset,m=Jc(r);if(m.data.length<=h)throw new Error(`${m.data.length} <= ${h}`);let b=m.data[h];l|=b<<d.shift}return l}function w8(r,e,t,n=1){let s=t.width,i=KL(r)*(s-1),o=Math.round(i),a=t.height,c=KL(e)*(a-1),u=Math.round(c),l=t.components?t.components:n;return(u*s+o)*l}function Ow(r,e,t,n=1){let s=[];for(let i=0;i<e;i++){let o=Number(t[i]),a=Number(t[i+1])-o;if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<0||(o+a)*n>r.length)break;let c=o*n,u=a*n;s.push(r.slice(c,c+u))}return s}function Mw(r,e,t,n=1){let s=[],i=t*n;for(let o=0;o<e;o++){let a=o*i;s.push(r.slice(a,a+i))}return s}function YL(r,e,t,n,s){let i=new TextDecoder("utf8");if(t){if(!n)throw new Error("stringOffsets is required for variable-length string arrays");let o=[];for(let a=0;a<r;a++){let c=t[a],u=t[a+1],l=[];for(let f=c;f<u;f++){let d=n[f],h=n[f+1],m=e.subarray(d,h);l.push(i.decode(m))}o.push(l)}return o}if(n){let o=[],a=r*(s||1);for(let c=0;c<a;c++){let u=Number(n[c]),l=Number(n[c+1]);u>=0&&l>=u&&l<=e.length&&o.push(i.decode(e.subarray(u,l)))}return s?Array.from({length:r},(c,u)=>o.slice(u*s,(u+1)*s)):o}return[]}var Da="EXT_mesh_features",x8=Da;async function T8(r,e){let t=new Kr(r);A8(t,e)}function _8(r,e){let t=new oi(r);return I8(t,e),t.createBinaryChunk(),t.gltf}function A8(r,e){for(let t of r.meshes)for(let n of r.getReferences(t).primitives)v8(r,n,e)}function v8(r,e,t){let s=r.getExtension(e,Da)?.featureIds||[];if(s)for(let i of s){let o;if(typeof i.attribute<"u"){if(!t?.gltf?.loadBuffers)continue;let a=`_FEATURE_ID_${i.attribute}`,c=e.attributes[a];o=r.getTypedArrayForAccessor(c)}else if(typeof i.texture<"u"){if(!t?.gltf?.loadImages)continue;o=Cd(r,i.texture,e)}else{let a=e.attributes.POSITION,c=typeof a=="number"?r.data.accessors?.[a]?.count:a?.count;if(typeof c!="number"||!Number.isInteger(c)||c<0)throw new Error("EXT_mesh_features: implicit feature IDs require a POSITION accessor");if(i.featureCount!==c)throw new Error(`EXT_mesh_features: implicit featureCount ${i.featureCount} does not match vertex count ${c}`);delete i.data,Object.defineProperty(i,"implicit",{configurable:!0,enumerable:!1,writable:!0,value:{start:0,count:c}})}o&&(i.data=o,delete i.implicit)}}function I8(r,e){let t=r.gltf.json.meshes;if(t)for(let n of t)for(let s of n.primitives)E8(r,s)}function S8(r,e,t,n){e.extensions||(e.extensions={});let s=e.extensions[Da];s||(s={featureIds:[]},e.extensions[Da]=s);let{featureIds:i}=s,o={featureCount:t.length,propertyTable:n,data:t};i.push(o),r.addObjectExtension(e,Da,s)}function E8(r,e){let t=e.extensions?.[Da];if(!t)return;let n=t.featureIds;n.forEach((s,i)=>{if(s.data){let{accessorKey:o,index:a}=L8(e.attributes),c=new Uint32Array(s.data);n[i]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a};let u=r.addBufferView(c),l=r.addAccessor(u,{size:1,componentType:wo(c),count:c.length});e.attributes[o]=l}})}function L8(r){let e="_FEATURE_ID_",t=Object.keys(r).filter(i=>i.indexOf(e)===0),n=-1;for(let i of t){let o=Number(i.substring(e.length));o>n&&(n=o)}return n++,{accessorKey:`${e}${n}`,index:n}}var Cw={};J(Cw,{createExtStructuralMetadata:()=>eU,decode:()=>O8,encode:()=>M8,name:()=>F8});function ZL(r,e,t){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return QL(r);let s=t?.baseUrl||B8(e?.core?.baseUrl);if(!s)throw new Error(`'baseUrl' must be provided to resolve relative url ${r}`);let i=s.endsWith("/")?`${s}${r}`:`${s}/${r}`;return QL(i)}function QL(r){try{return new URL(r).href}catch{return r}}function B8(r){if(!r)return;if(r.endsWith("/"))return r;let e=r.lastIndexOf("/");return e>=0?r.slice(0,e+1):""}var _o="EXT_structural_metadata",F8=_o;async function O8(r,e,t){let n=new Kr(r),s=n.getExtension(_o);if(e.gltf?.loadBuffers&&s?.schemaUri&&!s.schema){if(!t?.fetch)throw new Error("EXT_structural_metadata: a loader context is required to load schemaUri");let i=ZL(s.schemaUri,e,t),o=await t.fetch(i);if(!o.ok)throw new Error(`EXT_structural_metadata: failed to load schemaUri ${i} (${o.status})`);s.schema=await o.json()}D8(n,e)}function M8(r,e){let t=new oi(r);return Q8(t,e),t.createBinaryChunk(),t.gltf}function D8(r,e){if(!e.gltf?.loadBuffers)return;let t=r.getExtension(_o);t&&(e.gltf?.loadImages&&R8(r,t),k8(r,t))}function R8(r,e){let t=e.propertyTextures,n=r.data;if(t&&n.meshes)for(let s of n.meshes)for(let i of s.primitives)N8(r,t,i,e)}function k8(r,e){let t=e.schema;if(!t)return;let n=t.classes,s=e.propertyTables;if(n&&s)for(let i of s)i.class&&n[i.class]&&U8(r,t,i)}function N8(r,e,t,n){if(!e)return;let i=t.extensions?.[_o]?.propertyTextures;if(i)for(let o of i){let a=e[o];C8(r,a,t,n)}}function C8(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let i in e.properties){let o=`${s}_${i}`,a=e.properties?.[i];if(!a)continue;a.data||(a.data=[]);let c=a.data,u=Cd(r,a,t);u!==null&&(JL(r,o,u,c,t),a.data=c,n.dataAttributeNames.push(o))}}function U8(r,e,t){let n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);let s=t.count;for(let i in n.properties){let o=n.properties[i],a=t.properties?.[i];if(a){let c={},u=P8(r,e,o,s,a,c);a.data=u,c.value!==void 0&&Object.defineProperty(a,"rawData",{value:c.value,configurable:!0,enumerable:!1,writable:!0})}}}function P8(r,e,t,n,s,i){let o=[],a=s.values,c=r.getTypedArrayForBufferView(a),u=j8(r,t,s,n),l=G8(r,t,s,n,u);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{let f=z8(t,s,n,c,u);o=f.data,i&&(i.value=f.rawData);break}case"BOOLEAN":{o=V8(t,n,c,u);break}case"STRING":{o=YL(n,c,u,l,t.array?t.count:void 0);break}case"ENUM":{o=K8(e,t,n,c,u);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return o}function V8(r,e,t,n){return r.array?n?Array.from({length:e},(s,i)=>{let o=Number(n[i]),a=Number(n[i+1]);if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<o)throw new Error("EXT_structural_metadata: invalid BOOLEAN array offsets");return Rw(t,o,a-o)}):r.count===void 0?[]:Array.from({length:e},(s,i)=>Rw(t,i*r.count,r.count)):Rw(t,0,e)}function Rw(r,e,t){if(e+t>r.byteLength*8)throw new Error("EXT_structural_metadata: BOOLEAN values exceed their buffer view");return Array.from({length:t},(n,s)=>{let i=e+s;return!!(r[Math.floor(i/8)]&1<<i%8)})}function j8(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?Fw(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function G8(r,e,t,n,s){if(typeof t.stringOffsets<"u"){let i=s?Number(s[n]):n*(e.array&&e.count||1);return Fw(r,t.stringOffsets,t.stringOffsetType||"UINT32",i)}return null}function z8(r,e,t,n,s){let i=r.array,o=r.count,a={VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}[r.type]||1,c=Bw(r.type,r.componentType),u=n.byteLength/c,l;r.componentType?l=Nd(n,r.type,r.componentType,u):l=n;let f=l,d=e.offset??r.offset,h=e.scale??r.scale,m=r.normalized||d!==void 0||h!==void 0?W8(f,r.componentType,r.type,r.normalized,d,h):f;return i?s?{data:Ow(m,t,s,a),rawData:Ow(f,t,s,a)}:o?{data:Mw(m,t,o,a),rawData:Mw(f,t,o,a)}:{data:[],rawData:[]}:{data:m,rawData:f}}function W8(r,e,t,n,s,i){let o=q8(e),a=!!(n&&o!==void 0);if(!a&&s===void 0&&i===void 0)return r;let c=$8(t),u=new Float64Array(r.length);for(let l=0;l<r.length;l++){let f=Number(r[l]);a&&(f=e?.startsWith("INT")?Math.max(f/o,-1):f/o);let d=l%c,h=Array.isArray(s)?s[d]??0:s??0,m=Array.isArray(i)?i[d]??1:i??1;u[l]=f*m+h}return u}function $8(r){switch(r){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}}function q8(r){switch(r){case"INT8":return 127;case"UINT8":return 255;case"INT16":return 32767;case"UINT16":return 65535;case"INT32":return 2147483647;case"UINT32":return 4294967295;case"INT64":return 2**63-1;case"UINT64":return 2**64-1;default:return}}function K8(r,e,t,n,s){let i=e.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=r.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let a=o.valueType||"UINT16",c=Bw(e.type,a),u=n.byteLength/c,l=Nd(n,e.type,a,u);if(l||(l=n),e.array){if(s)return X8({valuesData:l,numberOfElements:t,arrayOffsets:s,enumEntry:o});let f=e.count;return f?H8(l,t,f,o):[]}return Nw(l,0,t,o)}function X8(r){let{valuesData:e,numberOfElements:t,arrayOffsets:n,enumEntry:s}=r,i=[];for(let o=0;o<t;o++){let a=Number(n[o]),c=Number(n[o+1])-a;if(!Number.isInteger(a)||!Number.isInteger(c)||a<0||c<0||a+c>e.length)break;let u=Nw(e,a,c,s);i.push(u)}return i}function H8(r,e,t,n){let s=[];for(let i=0;i<e;i++){let o=t*i,a=Nw(r,o,t,n);s.push(a)}return s}function Nw(r,e,t,n){let s=[];for(let i=0;i<t;i++){let o=r[e+i],a=J8(n,o);a?s.push(a.name):s.push("")}return s}function J8(r,e){for(let t of r.values)if(typeof e=="bigint"?Number.isSafeInteger(t.value)&&BigInt(t.value)===e:t.value===e)return t;return null}var Y8="schemaClassId";function Q8(r,e){let t=r.getExtension(_o);if(t&&t.propertyTables)for(let n of t.propertyTables){let s=n.class,i=t.schema?.classes?.[s];n.properties&&i&&Z8(n,i,r)}}function Z8(r,e,t){for(let n in r.properties){let s=r.properties[n].data;if(s){let i=e.properties[n];if(i){let o=nU(s,i,t);r.properties[n]=o}}}}function eU(r,e,t=Y8){let n=r.getExtension(_o);n||(n=r.addExtension(_o)),n.schema=tU(e,t,n.schema);let s=rU(e,t,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function tU(r,e,t){let n=t??{id:"schema_id"},s={properties:{}};for(let i of r){let o={type:i.elementType,componentType:i.componentType};s.properties[i.name]=o}return n.classes={},n.classes[e]=s,n}function rU(r,e,t){let n={class:e,count:0},s=0,i=t.classes?.[e];for(let o of r){if(s===0&&(s=o.values.length),s!==o.values.length&&o.values.length)throw new Error("Illegal values in attributes");i?.properties[o.name]&&(n.properties||(n.properties={}),n.properties[o.name]={values:0,data:o.values})}return n.count=s,n}function nU(r,e,t){let n={values:0};if(e.type==="STRING"){let{stringData:s,stringOffsets:i}=oU(r);n.stringOffsets=kw(i,t),n.values=kw(s,t)}else if(e.type==="SCALAR"&&e.componentType){let s=iU(r,e.componentType);n.values=kw(s,t)}return n}var sU={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function iU(r,e){let t=[];for(let s of r)t.push(Number(s));let n=sU[e];if(!n)throw new Error("Illegal component type");return new n(t)}function oU(r){let e=new TextEncoder,t=[],n=0;for(let c of r){let u=e.encode(c);n+=u.length,t.push(u)}let s=new Uint8Array(n),i=[],o=0;for(let c of t)s.set(c,o),i.push(o),o+=c.length;i.push(o);let a=new Uint32Array(i);return{stringData:s,stringOffsets:a}}function kw(r,e){return e.addBufferView(r)}var Uw={};J(Uw,{decode:()=>cU,encode:()=>uU,name:()=>aU});var Ra="KHR_materials_unlit",aU=Ra;async function cU(r){let e=new Kr(r);for(let t of e.materials)e.getExtension(t,Ra)&&(t.unlit=!0),e.removeExtension(t,Ra);e.removeExtension(Ra)}function uU(r){let e=new oi(r);for(let t of r.json.materials||[]){let n=t;n.unlit&&(delete n.unlit,e.addObjectExtension(t,Ra,{}),e.registerRequiredExtension(Ra))}for(let t of["extensionsUsed","extensionsRequired"])r.json[t]?.length===0&&delete r.json[t]}var lU=[Uw,Cw,Dw];function eB(r,e={}){for(let t of lU)r=t.encode?.(r,e)??r;return r}var rB={dataType:null,batchType:null,...Ba,version:ii,options:{gltf:{}},encode:async(r,e={})=>{let t=await WL(r,e),n={...e};return n.gltf=e.gltf?{...e.gltf,draco:void 0}:void 0,tB(t,n)},encodeSync:tB};function tB(r,e={}){if(e.gltf?.draco?.enabled)throw new Error("GLTFWriter Draco compression is asynchronous; use encode() instead of encodeSync()");let{byteOffset:t=0}=e,n=eB(r);r.buffers=n.buffers,r.binary=n.binary;let s=nw(n,null,t,e),i=new ArrayBuffer(s),o=new DataView(i);return nw(n,o,t,e),i}async function fU(){let{GLBLoaderWithParser:r}=await Promise.resolve().then(()=>(Gy(),jy));return r}var nB={dataType:null,batchType:null,...Fa,version:ii,preload:fU,options:{glb:{strict:!1}}};var iB={...Fa,version:ii,options:{glb:{}},encode:async(r,e={})=>sB(r,e),encodeSync:sB};function sB(r,e){let{byteOffset:t=0}=e??{},n=e?.glb??{},s=wu(r,null,t,n),i=new ArrayBuffer(s),o=new DataView(i);return wu(r,o,t,n),i}ea();var oB=typeof __VERSION__<"u"?__VERSION__:"latest";var Ud={name:"Draco",id:"draco",module:"scene",encoding:"binary",format:"draco",extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"]};var aB={backend:typeof WebAssembly=="object"?"wasm":"javascript",extraAttributes:{},attributeNameEntry:void 0,shape:"arrow-table",decoderProfile:"full"};async function dU(r,e){let t=e;switch(hU(t)){case"wasm":{let{DracoWASMLoaderWithParser:n}=await Promise.resolve().then(()=>(my(),py));return n}case"javascript":{let{DracoJavaScriptLoaderWithParser:n}=await Promise.resolve().then(()=>(gy(),by));return n}case"draco3d":{let{Draco3DLoaderWithParser:n}=await Promise.resolve().then(()=>(wy(),yy));return n}default:throw new Error(`DracoLoader: unsupported backend "${t?.draco?.backend}"`)}}var Pd={dataType:null,batchType:null,...Ud,version:oB,worker:!0,workerSourceNode:"draco/workers/draco-worker-node.ts",serializeWorkerResult:af,deserializeWorkerResult:cf,options:{draco:aB},preload:dU},cB=Pd;function hU(r){return r?.draco?.backend?r.draco.backend==="js"?"javascript":r.draco.backend:Pd.options.draco.backend}var pU="1.5.7",mU="8786740086a9f4d83f44aa83badfbea4dce7a1b5",_u=`https://www.gstatic.com/draco/versioned/decoders/${pU}`,uB=`https://cdn.jsdelivr.net/gh/google/draco@${mU}/javascript`,xt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",GLTF_DECODER:"draco_wasm_wrapper_gltf.js",GLTF_DECODER_WASM:"draco_decoder_gltf.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js",ENCODER_WASM:"draco_encoder.wasm"},lB={[xt.DECODER]:`${_u}/${xt.DECODER}`,[xt.DECODER_WASM]:`${_u}/${xt.DECODER_WASM}`,[xt.GLTF_DECODER]:`${_u}/${xt.GLTF_DECODER}`,[xt.GLTF_DECODER_WASM]:`${_u}/${xt.GLTF_DECODER_WASM}`,[xt.FALLBACK_DECODER]:`${_u}/${xt.FALLBACK_DECODER}`,[xt.ENCODER]:`${uB}/${xt.ENCODER}`,[xt.ENCODER_WASM]:`${uB}/${xt.ENCODER_WASM}`};async function bU(){let{MaterialXLoaderWithParser:r}=await Promise.resolve().then(()=>(Xy(),Ky));return r}var fB={name:"MaterialX",id:"materialx",module:"scene",version:"latest",extensions:["mtlx"],mimeTypes:["application/xml"],text:!0,dataType:null,batchType:null,options:{},preload:bU};var gU=typeof __VERSION__<"u"?__VERSION__:"latest";async function yU(){let{STLLoaderWithParser:r}=await Promise.resolve().then(()=>(Yy(),Jy));return r}var dB={name:"STL",id:"stl",module:"scene",version:gU,extensions:["stl"],mimeTypes:["model/stl"],binary:!0,dataType:null,batchType:null,options:{},preload:yU};return xB(wU);})();
55
+ `}function J8(r){return"shape"in r&&r.shape==="arrow-table"?r:ii(r,"arrow-table")}function Y8(r,e){let t=r.attributes[e];if(!t)throw new Error(`OBJWriter: ${e} attribute is required`);return t}function Zn(r,e,t){return r.value[e*r.size+t]||0}function Ww(r,e,t){let n=Zn(r,e,t);return r.normalized||n>1?n/255:n}function Q8(r,e){if(r.indices?.value?.length)return Array.from(r.indices.value);if(r.mode!==4&&r.topology!=="triangle-list")return[];let t=[];for(let n=0;n+2<e;n+=3)t.push(n,n+1,n+2);return t}function $w(r,e,t){let n=r+1;return e&&t?`${n}/${n}/${n}`:e?`${n}/${n}`:t?`${n}//${n}`:String(n)}var li=typeof __VERSION__<"u"?__VERSION__:"latest";var Ua={name:"glTF",id:"gltf",module:"scene",encoding:"binary",format:"gltf",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"]},Pa={name:"GLB",id:"glb",module:"scene",encoding:"binary",format:"glb",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,tests:["glTF"]};async function Z8(){let{GLTFLoaderWithParser:r}=await Promise.resolve().then(()=>(Fw(),Bw));return r}var IB={dataType:null,batchType:null,...Ua,version:li,preload:Z8,options:{gltf:{normalize:!0,loadBuffers:!0,loadFiles:!1,loadExternalAssets:!1,loadImages:!0,loadAudio:!0,decompressMeshes:!0}}};Be();var eU=1179937895,SB=1313821514,qw=5130562,Dt=!0;function Nu(r,e,t=0,n={}){let s=eU,i=n.version??("version"in r?r.version:2),o=r.json??{};if(i===3)return tU(r,e,t,s,o);if(i!==2)throw new Error(`Unsupported GLB writer version ${i}.`);let a="binChunks"in r?r.binary?new Uint8Array(r.binary):r.binChunks?.[0]&&ih(r.binChunks[0]):r.buffers?.[0]&&ih(r.buffers[0]),c=t;e&&(e.setUint32(t+0,s,Dt),e.setUint32(t+4,i,Dt),e.setUint32(t+8,0,Dt));let u=t+8;t+=12;let l=t;e&&(e.setUint32(t+0,0,Dt),e.setUint32(t+4,SB,Dt)),t+=8;let f=JSON.stringify(o);if(t=Hf(e,t,f,4),e){let d=t-l-8;e.setUint32(l+0,d,Dt)}if(a){let d=t;if(e&&(e.setUint32(t+0,0,Dt),e.setUint32(t+4,qw,Dt)),t+=8,t=tu(e,t,a,4),e){let h=t-d-8;e.setUint32(d+0,h,Dt)}}if(e){let d=t-c;e.setUint32(u,d,Dt)}return t}function tU(r,e,t,n,s){let i=t,o=[{type:SB,arrayBuffer:rU(s)},...("chunks"in r?r.chunks:[])??[],..."binChunks"in r?(r.binChunks??[]).map(a=>({type:qw,arrayBuffer:ih(a).slice().buffer})):(r.buffers??[]).map(a=>({type:qw,arrayBuffer:ih(a).slice().buffer}))];e&&(e.setUint32(t,n,Dt),e.setUint32(t+4,3,Dt),sh(e,t+8,0,"GLB file length")),t+=16;for(let a of o){let c=a.encoding??0;if(c!==0)throw new Error(`Unsupported GLB chunk encoding ${c}.`);let u=t;e&&(e.setUint32(t,a.type,Dt),e.setUint32(t+4,c,Dt),sh(e,t+8,0,"GLB chunk length")),t+=16,t=tu(e,t,new Uint8Array(a.arrayBuffer),4),e&&sh(e,u+8,t-u-16,"GLB chunk length")}return e&&sh(e,i+8,t-i,"GLB file length"),t}function ih(r){return new Uint8Array(r.arrayBuffer,r.byteOffset,r.byteLength)}function rU(r){let e=JSON.stringify(r),t=new TextEncoder().encode(e).byteLength,n=Math.ceil(t/4)*4,s=new ArrayBuffer(n),i=new DataView(s);return Hf(i,0,e,4),s}function sh(r,e,t,n){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${n} is outside the safe integer range.`);r.setBigUint64(e,BigInt(t),Dt)}function Kw(r,e,t,n){return nU(r),Nu(r,e,t,n)}function nU(r){if(r.buffers&&r.buffers.length>1)throw new Error("encodeGLTF: multiple buffers not yet implemented")}function ve(r,e){if(!r)throw new Error(e||"assert failed: gltf")}Be();var EB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},LB={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8};var BB=["SCALAR","VEC2","VEC3","VEC4"],sU=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Int32Array,5124],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130],[BigInt64Array,5134],[BigUint64Array,5135]],iU=new Map(sU),oU={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},aU={5120:1,5121:1,5122:2,5123:2,5124:4,5125:4,5126:4,5130:8,5131:2,5134:8,5135:8},cU={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5124:Int32Array,5125:Uint32Array,5126:Float32Array,5130:Float64Array,5131:Uint16Array,5134:BigInt64Array,5135:BigUint64Array};function oh(r){return BB[r-1]||BB[0]}function Io(r){let e=iU.get(r.constructor);if(!e)throw new Error("Illegal typed array");return e}function Hw(r,e){let t=cU[r.componentType],n=oU[r.type],s=aU[r.componentType],i=r.count*n,o=r.count*n*s;ve(o>=0&&o<=e.byteLength);let a=LB[r.componentType],c=EB[r.type];return{ArrayType:t,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function Cu(r,e,t){let n=typeof t=="number"?r.bufferViews[t]:t;ve(n);let s=n.buffer,i=e[s];ve(i),ve((n.byteOffset||0)>=0&&n.byteLength>=0),ve((n.byteOffset||0)+n.byteLength<=i.byteLength),ve(i.byteOffset>=0&&i.byteOffset+i.byteLength<=i.arrayBuffer.byteLength);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function FB(r,e,t){let n=r.images[t];return Cu(r,e,n.bufferView)}function Va(r,e,t){let n=typeof t=="number"?r.accessors?.[t]:t;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(t)}`);ve(Number.isSafeInteger(n.count)&&n.count>=0);let{ArrayType:s,length:i,numberOfComponentsInElement:o}=Hw(n,{byteLength:1/0}),a=n.value,c;ArrayBuffer.isView(a)?(ve(a.length===i),c=a):n.bufferView===void 0?c=new s(i):c=Xw(r,e,n);let u=n.sparse;if(!u)return c;let l=new s(i);new Uint8Array(l.buffer).set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),ve(u.count>=0&&u.count<=n.count),ve([5121,5123,5125].includes(u.indices.componentType));let f=Xw(r,e,{bufferView:u.indices.bufferView,byteOffset:u.indices.byteOffset,componentType:u.indices.componentType,count:u.count,type:"SCALAR"}),d=Xw(r,e,{bufferView:u.values.bufferView,byteOffset:u.values.byteOffset,componentType:n.componentType,count:u.count,type:n.type}),h=-1,m=new Uint8Array(l.buffer),b=o*s.BYTES_PER_ELEMENT,g=new Uint8Array(d.buffer,d.byteOffset,d.byteLength);for(let y=0;y<u.count;y++){let x=Number(f[y]);ve(x>h&&x<n.count),m.set(g.subarray(y*b,(y+1)*b),x*b),h=x}return l}function Xw(r,e,t){let n=r.bufferViews?.[t.bufferView];if(!n)throw new Error(`No gltf buffer view for accessor ${n}`);let s=e[n.buffer];ve(s);let{arrayBuffer:i,byteOffset:o}=s;ve((n.byteOffset||0)>=0&&n.byteLength>=0),ve((n.byteOffset||0)+n.byteLength<=s.byteLength),ve(o>=0&&o+s.byteLength<=i.byteLength),ve((t.byteOffset||0)>=0);let a=(o||0)+(t.byteOffset||0)+(n.byteOffset||0),{ArrayType:c,length:u,componentByteSize:l,numberOfComponentsInElement:f}=Hw(t,n),d=l*f,h=t.type.startsWith("MAT")?Number(t.type.slice(3)):1,m=_e(h*l,4),b=h>1?h*m:d,g=n.byteStride??b,y=h>1?(h-1)*m+h*l:d;if(ve(g>=b),ve((t.byteOffset||0)+(t.count===0?0:(t.count-1)*g+y)<=n.byteLength),t.count===0)return new c(0);if(h>1&&m!==h*l){let _=n.byteStride??h*m,v=(h-1)*m+h*l;ve((t.byteOffset||0)+(t.count-1)*_+v<=n.byteLength);let I=new c(u),N=new Uint8Array(I.buffer,I.byteOffset,I.byteLength);for(let K=0;K<t.count;K++)for(let ne=0;ne<h;ne++){let be=new Uint8Array(i,a+K*_+ne*m,h*l);N.set(be,K*d+ne*h*l)}return I}let x=n.byteStride||d;if(typeof n.byteStride>"u"||n.byteStride===d){if(a%l!==0){let v=new Uint8Array(i,a,u*l),I=new Uint8Array(v.byteLength);return I.set(v),new c(I.buffer,0,u)}return new c(i,a,u)}let T=new c(u);for(let _=0;_<t.count;_++){let v=a+_*x,I;if(v%l!==0){let N=new Uint8Array(i,v,d),K=new Uint8Array(d);K.set(N),I=new c(K.buffer,0,f)}else I=new c(i,v,f);T.set(I,_*f)}return T}var Qw="KHR_draco_mesh_compression";async function WB(r,e={}){let t=e.gltf?.draco;if(!t?.enabled)return r;if((r.buffers?.length||0)>1)throw new Error("GLTF Draco writer requires a single buffer");let n=AU(r.json),s=vU(r.buffers||[]),i={...r,json:n,buffers:s},o=[];for(let d of n.meshes||[])for(let h of d.primitives||[]){let m=h.mode??4;if(m!==4){if(t.skipUnsupportedPrimitives??!0)continue;throw new Error(`GLTF Draco writer cannot compress primitive mode ${m}; only TRIANGLES (4) is supported`)}if(h.extensions?.[Qw])throw new Error("GLTF Draco writer refuses to replace an existing Draco extension");let b=_U(r,h),{encodeDraco:g}=await Promise.resolve().then(()=>(GB(),jB)),y=await g(b,{core:e.core,modules:e.modules,draco:t});o.push({primitive:h,result:y})}if(o.length===0)return i;let a=IU(s),c=a.byteLength;for(let{result:d}of o)c=Zw(c)+d.data.byteLength;let u=new Uint8Array(c);u.set(a),n.bufferViews=n.bufferViews||[],n.buffers=n.buffers||[{byteLength:0}];let l=Zw(a.byteLength);for(let{primitive:d,result:h}of o){new Uint8Array(u.buffer,l,h.data.byteLength).set(new Uint8Array(h.data));let m=n.bufferViews.length;n.bufferViews.push({buffer:0,byteOffset:l,byteLength:h.data.byteLength}),d.extensions={...d.extensions||{},[Qw]:{bufferView:m,attributes:Object.fromEntries(Object.entries(h.report.attributes).map(([b,g])=>[b,g.id]))}},l=Zw(l+h.data.byteLength)}let f=u;return i.buffers[0]={...i.buffers[0]||{byteOffset:0},arrayBuffer:f.buffer,byteOffset:0,byteLength:f.byteLength},n.buffers[0]={...n.buffers[0]||{},byteLength:f.byteLength},n.extensionsUsed=SU(n.extensionsUsed,Qw),i}function _U(r,e){if(!e.attributes||e.attributes.POSITION===void 0)throw new Error("GLTF Draco writer requires a POSITION attribute");let t={};for(let[s,i]of Object.entries(e.attributes)){let o=r.json.accessors?.[i];if(!o)throw new Error(`GLTF Draco writer could not resolve accessor ${i}`);if(o.sparse)throw new Error(`GLTF Draco writer does not support sparse accessor ${i}`);let a=zB(r,i,o.componentType);t[s]={value:a,size:EU(o.type),...o.normalized===void 0?{}:{normalized:o.normalized}}}let n;if(e.indices!==void 0){let s=r.json.accessors?.[e.indices];if(!s)throw new Error(`GLTF Draco writer could not resolve index accessor ${e.indices}`);if(s.sparse)throw new Error(`GLTF Draco writer does not support sparse accessor ${e.indices}`);n=zB(r,e.indices,s.componentType)}else{let s=r.json.accessors?.[e.attributes.POSITION];if(!s||s.count%3!==0)throw new Error("GLTF Draco writer requires triangle-aligned POSITION data without indices");n=new Uint32Array(s.count);for(let i=0;i<n.length;i++)n[i]=i}return{attributes:t,indices:n}}function zB(r,e,t){let n=Va(r.json,r.buffers,e);if(n instanceof BigInt64Array||n instanceof BigUint64Array||n instanceof Float64Array)throw new Error(`GLTF Draco writer does not support 64-bit accessor ${e} (componentType ${t}); the official 1.5.7 encoder binding has no 64-bit attribute API`);return n}function AU(r){return JSON.parse(JSON.stringify(r))}function vU(r){return r.map(e=>({...e,arrayBuffer:e.arrayBuffer.slice(0)}))}function IU(r){let e=r[0]||{arrayBuffer:new ArrayBuffer(0),byteOffset:0,byteLength:0};return new Uint8Array(e.arrayBuffer,e.byteOffset||0,e.byteLength)}function Zw(r){return Math.ceil(r/4)*4}function SU(r,e){return r?.includes(e)?r:[...r||[],e]}function EU(r){switch(r){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:throw new Error(`GLTF Draco writer does not recognize accessor type ${r}`)}}var Ax={};J(Ax,{createExtMeshFeatures:()=>VU,decode:()=>kU,encode:()=>NU,name:()=>RU});Xn();Be();function LU(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var fi=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||LU(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=_e(this.gltf.buffers[0].byteLength,4),this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof t=="string"||typeof n=="string"}getExtension(e){let t=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return t?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if(typeof t=="object")return t;let n=this.json[e]&&this.json[e][t];if(!n)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return n}getTypedArrayForBufferView(e){return Cu(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return Va(this.gltf.json,this.gltf.buffers,e)}getTypedArrayForImageData(e){e=this.getAccessor(e);let t=this.getBufferView(e.bufferView),s=this.getBuffer(t.buffer).data,i=t.byteOffset||0;return new Uint8Array(s,i,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}setObjectExtension(e,t,n){let s=e.extensions||{};s[t]=n}removeObjectExtension(e,t){let n=e?.extensions||{};if(n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(t)||s.push(t)}delete n[t]}addExtension(e,t={}){return ve(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return ve(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let t=this.json.extensionsRemoved;t.includes(e)||t.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){let{meshIndex:t,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:t};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:t,indices:n,material:s,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,t){let n=Hn(e),s=t||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e,t=0,n=this.byteLength){let s=e.byteLength;ve(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let i={buffer:t,byteOffset:n,byteLength:s};return this.byteLength+=_e(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){let n=t.normalized,s={bufferView:e,...n===void 0?{}:{normalized:n},type:oh(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(s),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){let n=this.addBufferView(e),s={min:t.min,max:t.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,t.size));let i={size:t.size,componentType:Io(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(i,t))}addTexture(e){let{imageIndex:t,samplerIndex:n}=e,s={source:t,...n===void 0?{}:{sampler:n}};return this.json.textures=this.json.textures||[],this.json.textures.push(s),this.json.textures.length-1}addSampler(e){return this.json.samplers=this.json.samplers||[],this.json.samplers.push({...e}),this.json.samplers.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){if(this.byteLength===0&&!this.json.buffers?.length){delete this.json.buffers,delete this.gltf.binary,this.sourceBuffers=[],this.gltf.buffers=[];return}let e=[0],t=this.byteLength;for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&(e[o]=_e(t,8),t=e[o]+_e(a.byteLength,4))}let n=new ArrayBuffer(t),s=new Uint8Array(n),i=0;for(let o of this.sourceBuffers||[])i=ao(o,s,i);for(let o=1;o<this.gltf.buffers.length;o++){let a=this.gltf.buffers[o];a&&ao(a,s,e[o])}for(let o of this.json.bufferViews||[]){let a=e[o.buffer];ve(a!==void 0),o.byteOffset=a+(o.byteOffset||0),o.buffer=0;for(let c of["EXT_meshopt_compression","KHR_meshopt_compression"]){let u=o.extensions?.[c];if(u){let l=e[u.buffer];ve(l!==void 0),u.byteOffset=l+(u.byteOffset||0),u.buffer=0}}}this.byteLength=t,this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n],this.gltf.buffers=[{arrayBuffer:n,byteOffset:0,byteLength:n.byteLength}]}_removeStringFromArray(e,t){let n=!0;for(;n;){let s=e.indexOf(t);s>-1?e.splice(s,1):n=!1}}_addAttributes(e={}){let t={};for(let n in e){let s=e[n],i=this._getGltfAttributeName(n),o=s.value,a=o.BYTES_PER_ELEMENT*s.size,c=_e(a,4),u;if(c===a)u=this.addBinaryBuffer(o,s);else{let l=o.length/s.size,f=new Uint8Array(l*c),d=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);for(let m=0;m<l;m++)f.set(d.subarray(m*a,(m+1)*a),m*c);let h=this.addBufferView(f);this.json.bufferViews[h].byteStride=c,u=this.addAccessor(h,{...this._getAccessorMinMax(o,s.size),...s,componentType:Io(o),count:l})}t[i]=u}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){let n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];let s=e.subarray(0,t);for(let i of s)n.min.push(i),n.max.push(i);for(let i=t;i<e.length;i+=t)for(let o=0;o<t;o++)n.min[0+o]=Math.min(n.min[0+o],e[i+o]),n.max[0+o]=Math.max(n.max[0+o],e[i+o]);return n}};var Ye=class{gltf;type;index;data;path;iterator;constructor(e,t,n,s,i){this.iterator=e,this.gltf=e.gltf,this.type=t,this.index=n,this.data=s,this.path=i}},di=class extends Ye{parent;constructor(e,t,n,s,i,o){super(e,t,n,s,i),this.parent=o}},ex=class extends Ye{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}},tx=class extends Ye{get channels(){return Eo(this.data.channels,(e,t)=>this.iterator.getOrCreateNested(e,()=>new rx(this.iterator,"animationChannel",t,e,`${this.path}.channels[${t}]`,this)))}get samplers(){return Eo(this.data.samplers,(e,t)=>this.iterator.getOrCreateNested(e,()=>new uh(this.iterator,"animationSampler",t,e,`${this.path}.samplers[${t}]`,this)))}},rx=class extends di{get sampler(){let t=this.parent.data.samplers[this.data.sampler];if(!t)throw new Error(`Invalid glTF reference at ${this.path}.sampler: animation sampler index ${this.data.sampler} is out of range`);return this.iterator.getOrCreateNested(t,()=>new uh(this.iterator,"animationSampler",this.data.sampler,t,`${this.parent.path}.samplers[${this.data.sampler}]`,this.parent))}get target(){return this.iterator.getOrCreateNested(this.data.target,()=>new nx(this.iterator,"animationChannelTarget",0,this.data.target,`${this.path}.target`,this))}},nx=class extends di{get node(){return this.data.node===void 0?void 0:this.iterator.resolveNode(this.data.node,`${this.path}.node`)}},uh=class extends di{get input(){return this.iterator.resolveAccessor(this.data.input,`${this.path}.input`)}get output(){return this.iterator.resolveAccessor(this.data.output,`${this.path}.output`)}},sx=class extends Ye{get loadedBuffer(){return this.gltf.buffers[this.index]}},ix=class extends Ye{get buffer(){return this.iterator.resolveBuffer(this.data.buffer,`${this.path}.buffer`)}get loadedBufferView(){let e=this.buffer.loadedBuffer;if(!e)return;let t=e.byteOffset+(this.data.byteOffset||0);return new Uint8Array(e.arrayBuffer,t,this.data.byteLength)}},ox=class extends Ye{},ax=class extends Ye{get file(){return this.iterator.resolveFile(this.data.file,`${this.path}.file`)}get loadedAsset(){return this.gltf.externalAssets?.[this.index]}},cx=class extends Ye{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedFile(){return this.gltf.files?.[this.index]}},ux=class extends Ye{get bufferView(){return this.data.bufferView===void 0?void 0:this.iterator.resolveBufferView(this.data.bufferView,`${this.path}.bufferView`)}get loadedImage(){return this.gltf.images?.[this.index]}},lx=class extends Ye{get baseColorTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.baseColorTexture,0,"pbrMetallicRoughness.baseColorTexture")}get metallicRoughnessTexture(){return this.getTextureInfo(this.data.pbrMetallicRoughness?.metallicRoughnessTexture,1,"pbrMetallicRoughness.metallicRoughnessTexture")}get normalTexture(){return this.getTextureInfo(this.data.normalTexture,2,"normalTexture")}get occlusionTexture(){return this.getTextureInfo(this.data.occlusionTexture,3,"occlusionTexture")}get emissiveTexture(){return this.getTextureInfo(this.data.emissiveTexture,4,"emissiveTexture")}get textures(){return[this.baseColorTexture,this.metallicRoughnessTexture,this.normalTexture,this.occlusionTexture,this.emissiveTexture].filter(t=>!!t).values()}getTextureInfo(e,t,n){return e?this.iterator.getOrCreateNested(e,()=>new fx(this.iterator,"textureInfo",t,e,`${this.path}.${n}`,this)):void 0}},fx=class extends di{get texture(){return this.iterator.resolveTexture(this.data.index,`${this.path}.index`)}},dx=class extends Ye{get primitives(){return Eo(this.data.primitives,(e,t)=>this.iterator.getOrCreateNested(e,()=>new hx(this.iterator,"primitive",t,e,`${this.path}.primitives[${t}]`,this)))}},hx=class extends di{get attributes(){return new Map(Object.entries(this.data.attributes).map(([e,t])=>[e,this.iterator.resolveAccessor(t,`${this.path}.attributes.${e}`)]))}get indices(){return this.data.indices===void 0?void 0:this.iterator.resolveAccessor(this.data.indices,`${this.path}.indices`)}get material(){return this.data.material===void 0?void 0:this.iterator.resolveMaterial(this.data.material,`${this.path}.material`)}get targets(){return(this.data.targets||[]).map((e,t)=>new Map(Object.entries(e).map(([n,s])=>[n,this.iterator.resolveAccessor(s,`${this.path}.targets[${t}].${n}`)])))}},px=class extends Ye{get camera(){return this.data.camera===void 0?void 0:this.iterator.resolveCamera(this.data.camera,`${this.path}.camera`)}get children(){return Eo(this.data.children||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.children[${t}]`))}get skin(){return this.data.skin===void 0?void 0:this.iterator.resolveSkin(this.data.skin,`${this.path}.skin`)}get mesh(){return this.data.mesh===void 0?void 0:this.iterator.resolveMesh(this.data.mesh,`${this.path}.mesh`)}get externalAsset(){return this.data.externalAsset===void 0?void 0:this.iterator.resolveExternalAsset(this.data.externalAsset,`${this.path}.externalAsset`)}},mx=class extends Ye{},bx=class extends Ye{get nodes(){return Eo(this.data.nodes||[],(e,t)=>this.iterator.resolveNode(e,`${this.path}.nodes[${t}]`))}},gx=class extends Ye{get inverseBindMatrices(){return this.data.inverseBindMatrices===void 0?void 0:this.iterator.resolveAccessor(this.data.inverseBindMatrices,`${this.path}.inverseBindMatrices`)}get skeleton(){return this.data.skeleton===void 0?void 0:this.iterator.resolveNode(this.data.skeleton,`${this.path}.skeleton`)}get joints(){return Eo(this.data.joints,(e,t)=>this.iterator.resolveNode(e,`${this.path}.joints[${t}]`))}},yx=class extends Ye{get sampler(){return this.data.sampler===void 0?void 0:this.iterator.resolveSampler(this.data.sampler,`${this.path}.sampler`)}get source(){return this.data.source===void 0?void 0:this.iterator.resolveImage(this.data.source,`${this.path}.source`)}},Xr=class{gltf;objectCache=new WeakMap;referencesCache=new WeakMap;constructor(e){this.gltf=e}get data(){return this.gltf.json}getTypedArrayForBufferView(e){return Cu(this.data,this.gltf.buffers,e)}getTypedArrayForAccessor(e){return Va(this.data,this.gltf.buffers,e)}getTypedArrayForImageData(e){return FB(this.data,this.gltf.buffers,e)}getLoadedBuffer(e){let t=this.getMetadata(e);return this.gltf.buffers[t.index]}getLoadedBufferView(e){let t=this.getReferences(e).buffer,n=this.getLoadedBuffer(t);if(!n)return;let s=n.byteOffset+(e.byteOffset||0);return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getLoadedImage(e){return this.gltf.images?.[this.getMetadata(e).index]}getLoadedFile(e){return this.gltf.files?.[this.getMetadata(e).index]}getLoadedExternalAsset(e){return this.gltf.externalAssets?.[this.getMetadata(e).index]}addBuffer(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return this.gltf.buffers.push({arrayBuffer:t,byteOffset:0,byteLength:e.byteLength}),this.data.buffers||=[],this.data.buffers.push({byteLength:e.byteLength}),this.data.buffers.length-1}addBufferView(e,t,n=0){return this.data.bufferViews||=[],this.data.bufferViews.push({buffer:e,byteOffset:n,byteLength:t}),this.data.bufferViews.length-1}addAccessor(e,t){return this.data.accessors||=[],this.data.accessors.push({bufferView:e,type:oh(t.size),componentType:t.componentType,count:t.count,min:t.min,max:t.max}),this.data.accessors.length-1}getReferences(e){let t=this.referencesCache.get(e);if(t)return t;let n=this.getObjectIterator(e),s=BU(n);return this.referencesCache.set(e,s),s}getMetadata(e){let t=this.getObjectIterator(e),n=t instanceof di?t.parent.data:void 0;return{gltf:this.gltf,type:t.type,index:t.index,parent:n,path:t.path}}get scene(){return this.data.scene===void 0?void 0:this.resolveScene(this.data.scene,"scene").data}get thumbnail(){return this.data.asset.thumbnail===void 0?void 0:this.resolveImage(this.data.asset.thumbnail,"asset.thumbnail").data}get accessors(){return this.iterateCollectionData("accessor")}get animations(){return this.iterateCollectionData("animation")}get buffers(){return this.iterateCollectionData("buffer")}get bufferViews(){return this.iterateCollectionData("bufferView")}get cameras(){return this.iterateCollectionData("camera")}get externalAssets(){return this.iterateCollectionData("externalAsset")}get files(){return this.iterateCollectionData("file")}get images(){return this.iterateCollectionData("image")}get materials(){return this.iterateCollectionData("material")}get meshes(){return this.iterateCollectionData("mesh")}get nodes(){return this.iterateCollectionData("node")}get samplers(){return this.iterateCollectionData("sampler")}get scenes(){return this.iterateCollectionData("scene")}get skins(){return this.iterateCollectionData("skin")}get textures(){return this.iterateCollectionData("texture")}hasExtension(e){return!!this.data.extensionsUsed?.includes(e)||!!this.data.extensionsRequired?.includes(e)}isExtensionRequired(e){return!!this.data.extensionsRequired?.includes(e)}getExtension(e,t){let n=typeof e=="string"?this.data:e,s=typeof e=="string"?e:t;return n.extensions?.[s]}setExtension(e,t,n){let s=typeof e=="string",i=s?this.data:e,o=s?e:t,a=s?t:n,c=s?!!n:!1;i.extensions||={},i.extensions[o]=a,this.registerUsedExtension(o),c&&this.registerRequiredExtension(o)}registerUsedExtension(e){this.data.extensionsUsed||=[],this.data.extensionsUsed.includes(e)||this.data.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.data.extensionsRequired||=[],this.data.extensionsRequired.includes(e)||this.data.extensionsRequired.push(e)}removeExtension(e,t){let n=typeof e=="string",s=n?this.data:e,i=n?e:t;s.extensions?.[i]!==void 0&&(this.recordRemovedExtension(i),delete s.extensions[i]),n&&(qB(this.data.extensionsUsed,i),qB(this.data.extensionsRequired,i))}recordRemovedExtension(e){let t=this.data;t.extensionsRemoved||=[],t.extensionsRemoved.includes(e)||t.extensionsRemoved.push(e)}resolveAccessor(e,t){return this.resolveCollectionObject("accessor",e,t)}resolveBuffer(e,t){return this.resolveCollectionObject("buffer",e,t)}resolveBufferView(e,t){return this.resolveCollectionObject("bufferView",e,t)}resolveCamera(e,t){return this.resolveCollectionObject("camera",e,t)}resolveExternalAsset(e,t){return this.resolveCollectionObject("externalAsset",e,t)}resolveFile(e,t){return this.resolveCollectionObject("file",e,t)}resolveImage(e,t){return this.resolveCollectionObject("image",e,t)}resolveMaterial(e,t){return this.resolveCollectionObject("material",e,t)}resolveMesh(e,t){return this.resolveCollectionObject("mesh",e,t)}resolveNode(e,t){return this.resolveCollectionObject("node",e,t)}resolveSampler(e,t){return this.resolveCollectionObject("sampler",e,t)}resolveScene(e,t){return this.resolveCollectionObject("scene",e,t)}resolveSkin(e,t){return this.resolveCollectionObject("skin",e,t)}resolveTexture(e,t){return this.resolveCollectionObject("texture",e,t)}getOrCreateNested(e,t){return this.getOrCreate(e,t)}iterateCollection(e){let t=this.getCollection(e);return Eo(t,(n,s)=>this.resolveCollectionObject(e,s,e))}iterateCollectionData(e){return(function*(n){for(let s of n.iterateCollection(e))yield s.data})(this)}getObjectIterator(e){let t=this.objectCache.get(e);if(!t)throw new Error("glTF object is not registered with this iterator");return t}resolveCollectionObject(e,t,n){let i=this.getCollection(e)[t];if(!i)throw new Error(`Invalid glTF reference at ${n}: ${e} index ${t} is out of range`);return this.getOrCreate(i,()=>this.createCollectionObject(e,t,i))}getCollection(e){switch(e){case"accessor":return this.data.accessors||[];case"animation":return this.data.animations||[];case"buffer":return this.data.buffers||[];case"bufferView":return this.data.bufferViews||[];case"camera":return this.data.cameras||[];case"externalAsset":return this.data.externalAssets||[];case"file":return this.data.files||[];case"image":return this.data.images||[];case"material":return this.data.materials||[];case"mesh":return this.data.meshes||[];case"node":return this.data.nodes||[];case"sampler":return this.data.samplers||[];case"scene":return this.data.scenes||[];case"skin":return this.data.skins||[];case"texture":return this.data.textures||[]}}createCollectionObject(e,t,n){let s=`${FU(e)}[${t}]`;switch(e){case"accessor":return new ex(this,e,t,n,s);case"animation":return new tx(this,e,t,n,s);case"buffer":return new sx(this,e,t,n,s);case"bufferView":return new ix(this,e,t,n,s);case"camera":return new ox(this,e,t,n,s);case"externalAsset":return new ax(this,e,t,n,s);case"file":return new cx(this,e,t,n,s);case"image":return new ux(this,e,t,n,s);case"material":return new lx(this,e,t,n,s);case"mesh":return new dx(this,e,t,n,s);case"node":return new px(this,e,t,n,s);case"sampler":return new mx(this,e,t,n,s);case"scene":return new bx(this,e,t,n,s);case"skin":return new gx(this,e,t,n,s);case"texture":return new yx(this,e,t,n,s)}}getOrCreate(e,t){let n=this.objectCache.get(e);if(n)return n;let s=t();return this.objectCache.set(e,s),s}};function BU(r){switch(r.type){case"accessor":return{get bufferView(){return r.bufferView?.data}};case"animation":return{get channels(){return So(r.channels)},get samplers(){return So(r.samplers)}};case"animationChannel":return{get sampler(){return r.sampler.data},get target(){return r.target.data}};case"animationChannelTarget":return{get node(){return r.node?.data}};case"animationSampler":return{get input(){return r.input.data},get output(){return r.output.data}};case"bufferView":return{get buffer(){return r.buffer.data}};case"externalAsset":return{get file(){return r.file.data}};case"file":case"image":return{get bufferView(){return r.bufferView?.data}};case"material":return{get baseColorTexture(){return r.baseColorTexture?.data},get metallicRoughnessTexture(){return r.metallicRoughnessTexture?.data},get normalTexture(){return r.normalTexture?.data},get occlusionTexture(){return r.occlusionTexture?.data},get emissiveTexture(){return r.emissiveTexture?.data},get textures(){return So(r.textures)}};case"textureInfo":return{get texture(){return r.texture.data}};case"mesh":return{get primitives(){return So(r.primitives)}};case"primitive":return{get attributes(){return $B(r.attributes)},get indices(){return r.indices?.data},get material(){return r.material?.data},get targets(){return r.targets.map($B)}};case"node":return{get camera(){return r.camera?.data},get children(){return So(r.children)},get skin(){return r.skin?.data},get mesh(){return r.mesh?.data},get externalAsset(){return r.externalAsset?.data}};case"scene":return{get nodes(){return So(r.nodes)}};case"skin":return{get inverseBindMatrices(){return r.inverseBindMatrices?.data},get skeleton(){return r.skeleton?.data},get joints(){return So(r.joints)}};case"texture":return{get sampler(){return r.sampler?.data},get source(){return r.source?.data}};default:return{}}}function Eo(r,e){return(function*(){for(let n=0;n<r.length;n++)yield e(r[n],n)})()}function So(r){return(function*(){for(let t of r)yield t.data})()}function $B(r){return new Map(Array.from(r,([e,t])=>[e,t.data]))}function FU(r){switch(r){case"bufferView":return"bufferViews";case"externalAsset":return"externalAssets";case"mesh":return"meshes";default:return`${r}s`}}function qB(r,e){if(r)for(let t=r.length-1;t>=0;t--)r[t]===e&&r.splice(t,1)}Xn();Be();function KB(r){return(r%1+1)%1}var HB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},OU={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},XB={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function wx(r,e){return XB[e]*HB[r]}function xx(r,e,t,n){if(t!=="UINT8"&&t!=="UINT16"&&t!=="UINT32"&&t!=="UINT64")return null;let s=r.getTypedArrayForBufferView(e),i=lh(s,"SCALAR",t,n+1);if(i instanceof BigInt64Array||i instanceof BigUint64Array){let o=new Float64Array(i.length),a=BigInt(Number.MAX_SAFE_INTEGER);for(let c=0;c<i.length;c++){let u=i[c];if(u<0n||u>a)throw new Error("EXT_structural_metadata: UINT64 offset exceeds the safe integer range");o[c]=Number(u)}return o}return i}function lh(r,e,t,n=1){let s=HB[e],i=OU[t],o=XB[t],a=n*s,c=a*o,u=r.buffer,l=r.byteOffset;return l%o!==0&&(u=new Uint8Array(u).slice(l,l+c).buffer,l=0),new i(co(u),l,a)}function fh(r,e,t){let n=`TEXCOORD_${e.texCoord||0}`,s=t.attributes[n],i=r.getTypedArrayForAccessor(s),o=r.gltf.json,a=e.index,c=o.textures?.[a]?.source;if(typeof c<"u"){let u=o.images?.[c]?.mimeType,l=r.gltf.images?.[c];if(l&&typeof l.width<"u"&&!("compressed"in l&&l.compressed)){let f=[];for(let d=0;d<i.length;d+=2){let h=MU(l,u,i,d,e.channels);f.push(h)}return f}}return[]}function JB(r,e,t,n,s){if(!t?.length)return;let i=[];for(let f of t){let d=n.findIndex(h=>h===f);d===-1&&(d=n.push(f)-1),i.push(d)}let o=new Uint32Array(i),a=r instanceof Xr?r:new Xr(r.gltf),c=a.addBuffer(o),u=a.addBufferView(c,o.byteLength),l=a.addAccessor(u,{size:1,componentType:Io(o),count:o.length});s.attributes[e]=l}function MU(r,e,t,n,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=t[n],a=t[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let u=DU(o,a,r,c),l=0;for(let f of s){let d=typeof f=="number"?Object.values(i)[f]:i[f],h=u+d.offset,m=hu(r);if(m.data.length<=h)throw new Error(`${m.data.length} <= ${h}`);let b=m.data[h];l|=b<<d.shift}return l}function DU(r,e,t,n=1){let s=t.width,i=KB(r)*(s-1),o=Math.round(i),a=t.height,c=KB(e)*(a-1),u=Math.round(c),l=t.components?t.components:n;return(u*s+o)*l}function Tx(r,e,t,n=1){let s=[];for(let i=0;i<e;i++){let o=Number(t[i]),a=Number(t[i+1])-o;if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<0||(o+a)*n>r.length)break;let c=o*n,u=a*n;s.push(r.slice(c,c+u))}return s}function _x(r,e,t,n=1){let s=[],i=t*n;for(let o=0;o<e;o++){let a=o*i;s.push(r.slice(a,a+i))}return s}function YB(r,e,t,n,s){let i=new TextDecoder("utf8");if(t){if(!n)throw new Error("stringOffsets is required for variable-length string arrays");let o=[];for(let a=0;a<r;a++){let c=t[a],u=t[a+1],l=[];for(let f=c;f<u;f++){let d=n[f],h=n[f+1],m=e.subarray(d,h);l.push(i.decode(m))}o.push(l)}return o}if(n){let o=[],a=r*(s||1);for(let c=0;c<a;c++){let u=Number(n[c]),l=Number(n[c+1]);u>=0&&l>=u&&l<=e.length&&o.push(i.decode(e.subarray(u,l)))}return s?Array.from({length:r},(c,u)=>o.slice(u*s,(u+1)*s)):o}return[]}var Ga="EXT_mesh_features",RU=Ga;async function kU(r,e){let t=new Xr(r);CU(t,e)}function NU(r,e){let t=new fi(r);return PU(t,e),t.createBinaryChunk(),t.gltf}function CU(r,e){for(let t of r.meshes)for(let n of r.getReferences(t).primitives)UU(r,n,e)}function UU(r,e,t){let s=r.getExtension(e,Ga)?.featureIds||[];if(s)for(let i of s){let o;if(typeof i.attribute<"u"){if(!t?.gltf?.loadBuffers)continue;let a=`_FEATURE_ID_${i.attribute}`,c=e.attributes[a];o=r.getTypedArrayForAccessor(c)}else if(typeof i.texture<"u"){if(!t?.gltf?.loadImages)continue;o=fh(r,i.texture,e)}else{let a=e.attributes.POSITION,c=typeof a=="number"?r.data.accessors?.[a]?.count:a?.count;if(typeof c!="number"||!Number.isInteger(c)||c<0)throw new Error("EXT_mesh_features: implicit feature IDs require a POSITION accessor");if(i.featureCount!==c)throw new Error(`EXT_mesh_features: implicit featureCount ${i.featureCount} does not match vertex count ${c}`);delete i.data,Object.defineProperty(i,"implicit",{configurable:!0,enumerable:!1,writable:!0,value:{start:0,count:c}})}o&&(i.data=o,delete i.implicit)}}function PU(r,e){let t=r.gltf.json.meshes;if(t)for(let n of t)for(let s of n.primitives)jU(r,s)}function VU(r,e,t,n){e.extensions||(e.extensions={});let s=e.extensions[Ga];s||(s={featureIds:[]},e.extensions[Ga]=s);let{featureIds:i}=s,o={featureCount:t.length,propertyTable:n,data:t};i.push(o),r.addObjectExtension(e,Ga,s)}function jU(r,e){let t=e.extensions?.[Ga];if(!t)return;let n=t.featureIds;n.forEach((s,i)=>{if(s.data){let{accessorKey:o,index:a}=GU(e.attributes),c=new Uint32Array(s.data);n[i]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a};let u=r.addBufferView(c),l=r.addAccessor(u,{size:1,componentType:Io(c),count:c.length});e.attributes[o]=l}})}function GU(r){let e="_FEATURE_ID_",t=Object.keys(r).filter(i=>i.indexOf(e)===0),n=-1;for(let i of t){let o=Number(i.substring(e.length));o>n&&(n=o)}return n++,{accessorKey:`${e}${n}`,index:n}}var Ex={};J(Ex,{createExtStructuralMetadata:()=>pP,decode:()=>$U,encode:()=>qU,name:()=>WU});function ZB(r,e,t){if(r.startsWith("data:")||r.startsWith("http:")||r.startsWith("https:"))return QB(r);let s=t?.baseUrl||zU(e?.core?.baseUrl);if(!s)throw new Error(`'baseUrl' must be provided to resolve relative url ${r}`);let i=s.endsWith("/")?`${s}${r}`:`${s}/${r}`;return QB(i)}function QB(r){try{return new URL(r).href}catch{return r}}function zU(r){if(!r)return;if(r.endsWith("/"))return r;let e=r.lastIndexOf("/");return e>=0?r.slice(0,e+1):""}var Lo="EXT_structural_metadata",WU=Lo;async function $U(r,e,t){let n=new Xr(r),s=n.getExtension(Lo);if(e.gltf?.loadBuffers&&s?.schemaUri&&!s.schema){if(!t?.fetch)throw new Error("EXT_structural_metadata: a loader context is required to load schemaUri");let i=ZB(s.schemaUri,e,t),o=await t.fetch(i);if(!o.ok)throw new Error(`EXT_structural_metadata: failed to load schemaUri ${i} (${o.status})`);s.schema=await o.json()}KU(n,e)}function qU(r,e){let t=new fi(r);return dP(t,e),t.createBinaryChunk(),t.gltf}function KU(r,e){if(!e.gltf?.loadBuffers)return;let t=r.getExtension(Lo);t&&(e.gltf?.loadImages&&HU(r,t),XU(r,t))}function HU(r,e){let t=e.propertyTextures,n=r.data;if(t&&n.meshes)for(let s of n.meshes)for(let i of s.primitives)JU(r,t,i,e)}function XU(r,e){let t=e.schema;if(!t)return;let n=t.classes,s=e.propertyTables;if(n&&s)for(let i of s)i.class&&n[i.class]&&QU(r,t,i)}function JU(r,e,t,n){if(!e)return;let i=t.extensions?.[Lo]?.propertyTextures;if(i)for(let o of i){let a=e[o];YU(r,a,t,n)}}function YU(r,e,t,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let i in e.properties){let o=`${s}_${i}`,a=e.properties?.[i];if(!a)continue;a.data||(a.data=[]);let c=a.data,u=fh(r,a,t);u!==null&&(JB(r,o,u,c,t),a.data=c,n.dataAttributeNames.push(o))}}function QU(r,e,t){let n=e.classes?.[t.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${t.class}`);let s=t.count;for(let i in n.properties){let o=n.properties[i],a=t.properties?.[i];if(a){let c={},u=ZU(r,e,o,s,a,c);a.data=u,c.value!==void 0&&Object.defineProperty(a,"rawData",{value:c.value,configurable:!0,enumerable:!1,writable:!0})}}}function ZU(r,e,t,n,s,i){let o=[],a=s.values,c=r.getTypedArrayForBufferView(a),u=tP(r,t,s,n),l=rP(r,t,s,n,u);switch(t.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{let f=nP(t,s,n,c,u);o=f.data,i&&(i.value=f.rawData);break}case"BOOLEAN":{o=eP(t,n,c,u);break}case"STRING":{o=YB(n,c,u,l,t.array?t.count:void 0);break}case"ENUM":{o=aP(e,t,n,c,u);break}default:throw new Error(`Unknown classProperty type ${t.type}`)}return o}function eP(r,e,t,n){return r.array?n?Array.from({length:e},(s,i)=>{let o=Number(n[i]),a=Number(n[i+1]);if(!Number.isInteger(o)||!Number.isInteger(a)||o<0||a<o)throw new Error("EXT_structural_metadata: invalid BOOLEAN array offsets");return vx(t,o,a-o)}):r.count===void 0?[]:Array.from({length:e},(s,i)=>vx(t,i*r.count,r.count)):vx(t,0,e)}function vx(r,e,t){if(e+t>r.byteLength*8)throw new Error("EXT_structural_metadata: BOOLEAN values exceed their buffer view");return Array.from({length:t},(n,s)=>{let i=e+s;return!!(r[Math.floor(i/8)]&1<<i%8)})}function tP(r,e,t,n){return e.array&&typeof e.count>"u"&&typeof t.arrayOffsets<"u"?xx(r,t.arrayOffsets,t.arrayOffsetType||"UINT32",n):null}function rP(r,e,t,n,s){if(typeof t.stringOffsets<"u"){let i=s?Number(s[n]):n*(e.array&&e.count||1);return xx(r,t.stringOffsets,t.stringOffsetType||"UINT32",i)}return null}function nP(r,e,t,n,s){let i=r.array,o=r.count,a={VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}[r.type]||1,c=wx(r.type,r.componentType),u=n.byteLength/c,l;r.componentType?l=lh(n,r.type,r.componentType,u):l=n;let f=l,d=e.offset??r.offset,h=e.scale??r.scale,m=r.normalized||d!==void 0||h!==void 0?sP(f,r.componentType,r.type,r.normalized,d,h):f;return i?s?{data:Tx(m,t,s,a),rawData:Tx(f,t,s,a)}:o?{data:_x(m,t,o,a),rawData:_x(f,t,o,a)}:{data:[],rawData:[]}:{data:m,rawData:f}}function sP(r,e,t,n,s,i){let o=oP(e),a=!!(n&&o!==void 0);if(!a&&s===void 0&&i===void 0)return r;let c=iP(t),u=new Float64Array(r.length);for(let l=0;l<r.length;l++){let f=Number(r[l]);a&&(f=e?.startsWith("INT")?Math.max(f/o,-1):f/o);let d=l%c,h=Array.isArray(s)?s[d]??0:s??0,m=Array.isArray(i)?i[d]??1:i??1;u[l]=f*m+h}return u}function iP(r){switch(r){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}}function oP(r){switch(r){case"INT8":return 127;case"UINT8":return 255;case"INT16":return 32767;case"UINT16":return 65535;case"INT32":return 2147483647;case"UINT32":return 4294967295;case"INT64":return 2**63-1;case"UINT64":return 2**64-1;default:return}}function aP(r,e,t,n,s){let i=e.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=r.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let a=o.valueType||"UINT16",c=wx(e.type,a),u=n.byteLength/c,l=lh(n,e.type,a,u);if(l||(l=n),e.array){if(s)return cP({valuesData:l,numberOfElements:t,arrayOffsets:s,enumEntry:o});let f=e.count;return f?uP(l,t,f,o):[]}return Sx(l,0,t,o)}function cP(r){let{valuesData:e,numberOfElements:t,arrayOffsets:n,enumEntry:s}=r,i=[];for(let o=0;o<t;o++){let a=Number(n[o]),c=Number(n[o+1])-a;if(!Number.isInteger(a)||!Number.isInteger(c)||a<0||c<0||a+c>e.length)break;let u=Sx(e,a,c,s);i.push(u)}return i}function uP(r,e,t,n){let s=[];for(let i=0;i<e;i++){let o=t*i,a=Sx(r,o,t,n);s.push(a)}return s}function Sx(r,e,t,n){let s=[];for(let i=0;i<t;i++){let o=r[e+i],a=lP(n,o);a?s.push(a.name):s.push("")}return s}function lP(r,e){for(let t of r.values)if(typeof e=="bigint"?Number.isSafeInteger(t.value)&&BigInt(t.value)===e:t.value===e)return t;return null}var fP="schemaClassId";function dP(r,e){let t=r.getExtension(Lo);if(t&&t.propertyTables)for(let n of t.propertyTables){let s=n.class,i=t.schema?.classes?.[s];n.properties&&i&&hP(n,i,r)}}function hP(r,e,t){for(let n in r.properties){let s=r.properties[n].data;if(s){let i=e.properties[n];if(i){let o=gP(s,i,t);r.properties[n]=o}}}}function pP(r,e,t=fP){let n=r.getExtension(Lo);n||(n=r.addExtension(Lo)),n.schema=mP(e,t,n.schema);let s=bP(e,t,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function mP(r,e,t){let n=t??{id:"schema_id"},s={properties:{}};for(let i of r){let o={type:i.elementType,componentType:i.componentType};s.properties[i.name]=o}return n.classes={},n.classes[e]=s,n}function bP(r,e,t){let n={class:e,count:0},s=0,i=t.classes?.[e];for(let o of r){if(s===0&&(s=o.values.length),s!==o.values.length&&o.values.length)throw new Error("Illegal values in attributes");i?.properties[o.name]&&(n.properties||(n.properties={}),n.properties[o.name]={values:0,data:o.values})}return n.count=s,n}function gP(r,e,t){let n={values:0};if(e.type==="STRING"){let{stringData:s,stringOffsets:i}=xP(r);n.stringOffsets=Ix(i,t),n.values=Ix(s,t)}else if(e.type==="SCALAR"&&e.componentType){let s=wP(r,e.componentType);n.values=Ix(s,t)}return n}var yP={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function wP(r,e){let t=[];for(let s of r)t.push(Number(s));let n=yP[e];if(!n)throw new Error("Illegal component type");return new n(t)}function xP(r){let e=new TextEncoder,t=[],n=0;for(let c of r){let u=e.encode(c);n+=u.length,t.push(u)}let s=new Uint8Array(n),i=[],o=0;for(let c of t)s.set(c,o),i.push(o),o+=c.length;i.push(o);let a=new Uint32Array(i);return{stringData:s,stringOffsets:a}}function Ix(r,e){return e.addBufferView(r)}var Lx={};J(Lx,{decode:()=>_P,encode:()=>AP,name:()=>TP});var za="KHR_materials_unlit",TP=za;async function _P(r){let e=new Xr(r);for(let t of e.materials)e.getExtension(t,za)&&(t.unlit=!0),e.removeExtension(t,za);e.removeExtension(za)}function AP(r){let e=new fi(r);for(let t of r.json.materials||[]){let n=t;n.unlit&&(delete n.unlit,e.addObjectExtension(t,za,{}),e.registerRequiredExtension(za))}for(let t of["extensionsUsed","extensionsRequired"])r.json[t]?.length===0&&delete r.json[t]}var vP=[Lx,Ex,Ax];function eF(r,e={}){for(let t of vP)r=t.encode?.(r,e)??r;return r}var rF={dataType:null,batchType:null,...Ua,version:li,options:{gltf:{}},encode:async(r,e={})=>{let t=await WB(r,e),n={...e};return n.gltf=e.gltf?{...e.gltf,draco:void 0}:void 0,tF(t,n)},encodeSync:tF};function tF(r,e={}){if(e.gltf?.draco?.enabled)throw new Error("GLTFWriter Draco compression is asynchronous; use encode() instead of encodeSync()");let{byteOffset:t=0}=e,n=eF(r);r.buffers=n.buffers,r.binary=n.binary;let s=Kw(n,null,t,e),i=new ArrayBuffer(s),o=new DataView(i);return Kw(n,o,t,e),i}async function IP(){let{GLBLoaderWithParser:r}=await Promise.resolve().then(()=>(Mw(),Ow));return r}var nF={dataType:null,batchType:null,...Pa,version:li,preload:IP,options:{glb:{strict:!1}}};var iF={...Pa,version:li,options:{glb:{}},encode:async(r,e={})=>sF(r,e),encodeSync:sF};function sF(r,e){let{byteOffset:t=0}=e??{},n=e?.glb??{},s=Nu(r,null,t,n),i=new ArrayBuffer(s),o=new DataView(i);return Nu(r,o,t,n),i}oa();var oF=typeof __VERSION__<"u"?__VERSION__:"latest";var dh={name:"Draco",id:"draco",module:"scene",encoding:"binary",format:"draco",extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"]};var aF={backend:typeof WebAssembly=="object"?"wasm":"javascript",extraAttributes:{},attributeNameEntry:void 0,shape:"arrow-table",decoderProfile:"full"};async function SP(r,e){let t=e;switch(EP(t)){case"wasm":{let{DracoWASMLoaderWithParser:n}=await Promise.resolve().then(()=>(iw(),sw));return n}case"javascript":{let{DracoJavaScriptLoaderWithParser:n}=await Promise.resolve().then(()=>(aw(),ow));return n}case"draco3d":{let{Draco3DLoaderWithParser:n}=await Promise.resolve().then(()=>(uw(),cw));return n}default:throw new Error(`DracoLoader: unsupported backend "${t?.draco?.backend}"`)}}var hh={dataType:null,batchType:null,...dh,version:oF,worker:!0,workerSourceNode:"draco/workers/draco-worker-node.ts",serializeWorkerResult:Sf,deserializeWorkerResult:Ef,options:{draco:aF},preload:SP},cF=hh;function EP(r){return r?.draco?.backend?r.draco.backend==="js"?"javascript":r.draco.backend:hh.options.draco.backend}var LP="1.5.7",BP="8786740086a9f4d83f44aa83badfbea4dce7a1b5",Pu=`https://www.gstatic.com/draco/versioned/decoders/${LP}`,uF=`https://cdn.jsdelivr.net/gh/google/draco@${BP}/javascript`,xt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",GLTF_DECODER:"draco_wasm_wrapper_gltf.js",GLTF_DECODER_WASM:"draco_decoder_gltf.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js",ENCODER_WASM:"draco_encoder.wasm"},lF={[xt.DECODER]:`${Pu}/${xt.DECODER}`,[xt.DECODER_WASM]:`${Pu}/${xt.DECODER_WASM}`,[xt.GLTF_DECODER]:`${Pu}/${xt.GLTF_DECODER}`,[xt.GLTF_DECODER_WASM]:`${Pu}/${xt.GLTF_DECODER_WASM}`,[xt.FALLBACK_DECODER]:`${Pu}/${xt.FALLBACK_DECODER}`,[xt.ENCODER]:`${uF}/${xt.ENCODER}`,[xt.ENCODER_WASM]:`${uF}/${xt.ENCODER_WASM}`};async function FP(){let{MaterialXLoaderWithParser:r}=await Promise.resolve().then(()=>(Uw(),Cw));return r}var fF={name:"MaterialX",id:"materialx",module:"scene",version:"latest",extensions:["mtlx"],mimeTypes:["application/xml"],text:!0,dataType:null,batchType:null,options:{},preload:FP};var OP=typeof __VERSION__<"u"?__VERSION__:"latest";async function MP(){let{STLLoaderWithParser:r}=await Promise.resolve().then(()=>(jw(),Vw));return r}var dF={name:"STL",id:"stl",module:"scene",version:OP,extensions:["stl"],mimeTypes:["model/stl"],binary:!0,dataType:null,batchType:null,options:{},preload:MP};return xF(DP);})();
56
56
  return __exports__;
57
57
  });