New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amc

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amc - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

build/index.js

@@ -1,1 +0,1 @@

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=30)}([,,,,,function(t,e,r){const n=r(16),i={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR",COLOR_0:"COLOR",COLOR_1:"COLOR_1",TEXCOORD:"TEXCOORD",TEXCOORD_0:"TEXCOORD",TEXCOORD_1:"TEXCOORD_1",TEXCOORD_2:"TEXCOORD_2",TANGENT:"TANGENT",JOINT:"JOINT",JOINTS_0:"JOINT",WEIGHT:"WEIGHT",WEIGHTS_0:"WEIGHT"},s=["POSITION","NORMAL","COLOR","TEXCOORD","TANGENT","JOINT","WEIGHT","OTHER","TEXCOORD_1","TEXCOORD_2","COLOR_1"],o={POSITION:0,NORMAL:1,COLOR:2,TEXCOORD:3,TANGENT:4,JOINT:5,WEIGHT:6,OTHER:7,TEXCOORD_1:8,TEXCOORD_2:9,COLOR_1:10},a={POSITION:"vertices",NORMAL:"normals",COLOR:"colors",TEXCOORD:"uvs",TEXCOORD_1:"uvs1",TEXCOORD_2:"uvs2",TANGENT:"tangents",JOINT:"skinIndices",WEIGHT:"skinWeights"},h={vertices:"POSITION",_normals:"NORMAL",colors:"COLOR",uvs:"TEXCOORD",uvs1:"TEXCOORD_1",uvs2:"TEXCOORD_2",_tangents:"TANGENT",skinIndices:"JOINT",skinWeights:"WEIGHT"},u={POSITION:3,NORMAL:3,COLOR:3,COLOR_1:3,TEXCOORD:2,TEXCOORD_1:2,TEXCOORD_2:2,TANGENT:4,JOINT:4,WEIGHT:4};class c{static get ATTR(){return i}static get ATTR_NAME_ID(){return o}static cp(t){return t}static minus(t,e){return t-e}static plus(t,e){return t+e}static pp(t,e,r,n){return n-e-r+t}static depp(t,e,r,n){return e+r-t+n}constructor(t,e=4){this.indices=t,this.mode=e,this.attrs=[],this.attrIndexMap={}}getAttrLength(){return this.attrs[0].data.length/this.attrs[0].itemCount}attrIdToName(t){return s[t]||"OTHER"}addAttr(t,e,r){i[t]?(this.attrIndexMap[t]=this.attrs.length,r||(r=u[t])):r||(r=1),this.attrs.push({name:t,itemCount:r,data:e})}getAttr(t){if(this.attrIndexMap[t])return this.attrs[this.attrIndexMap[t]];for(var e=this.attrs.length-1;e>=0;e--){var r=this.attrs[e];if(r.name===t)return r}}cal(t,e,r,...n){this.attrs.forEach((i,s)=>{for(var o=i.data,a=t.attrs[s].data,h=e*i.itemCount,u=i.itemCount-1;u>=0;u--)a[h+u]=r.apply(null,n.map(t=>o[t*i.itemCount+u]))})}quantize(t={}){this.attrs.forEach(e=>{if("JOINT"!==e.name&&0!=t[e.name]){var r=n.encode(e.data,t[e.name]||12);e.quantizationBit=r.quantizationBit,e.min=r.min,e.max=r.max,e.data=r.data}})}dequantize(){this.attrs.forEach(t=>{t.quantizationBit&&(t.data=n.decode(t.data,t.quantizationBit,t.min,t.max))})}convertTypedArray(){!this.indices||this.indices instanceof Array||(this.indices=Array.from(this.indices)),this.attrs.forEach(t=>{t.data instanceof Array||t.data instanceof Float32Array||(t.data=Array.from(t.data))})}clearEBAttrs(){delete this.clers,delete this.holes,delete this.handles}convertToTypedArray(){this.indices instanceof Array&&(this.getAttrLength()>65535?this.indices=new Uint32Array(this.indices):this.indices=new Uint16Array(this.indices)),this.attrs.forEach(t=>{t.data instanceof Array&&(t.data=new Float32Array(t.data))})}prepareToWorkerSend(){return this.clearEBAttrs(),this.convertToTypedArray(),this.getAllBuffers()}clone(){const t=new c(Array.from(this.indices),this.mode);return Object.assign(t.attrIndexMap,this.attrIndexMap),t.attrs=this.attrs.map(t=>{const e=Object.assign({},t);return e.data=Array.from(e.data),e}),t}cloneStruct(){const t=new c;return t.mode=this.mode,this.indices&&(t.indices=[]),Object.assign(t.attrIndexMap,this.attrIndexMap),t.attrs=this.attrs.map(t=>{const e=Object.assign({},t);return e.data=[],e}),t}toHilo3dGeometry(t,e){const r=e||new t.Geometry;return this.indices&&(this.indices.BYTES_PER_ELEMENT?r.indices=new t.GeometryData(this.indices,1):this.getAttrLength()>65535?r.indices=new t.GeometryData(new Uint32Array(this.indices),1):r.indices=new t.GeometryData(new Uint16Array(this.indices),1)),this.attrs.forEach(e=>{const n=a[e.name];n&&(e.data.BYTES_PER_ELEMENT?r[n]=new t.GeometryData(e.data,e.itemCount):r[n]=new t.GeometryData(new Float32Array(e.data),e.itemCount))}),r}getAllBuffers(){const t=[];return this.indices.BYTES_PER_ELEMENT&&t.push(this.indices.buffer),this.attrs.forEach(e=>{e.data&&e.data.BYTES_PER_ELEMENT&&t.push(e.data.buffer)}),t}static fromGLTFPrimitive(t){const e=new c(t.indices,t.mode),r=t.attributes;let n=0;r.POSITION&&(n=r.POSITION.length/3);for(let t in r){if(!i[t]){console.warn("Dont support attribute",t);continue}let s=u[i[t]];n&&(s=r[t].length/n),e.addAttr(i[t],r[t],s)}return e}static fromHilo3dGeometry(t){const e=new c(t.indices.data,t.mode);for(var r in h)t[r]&&e.addAttr(h[r],t[r].data,t[r].size);return e}}t.exports=c},,,,,,function(t,e){const r={C:0,R:1,L:2,S:3,E:4,M:5,F:6},n=[];for(var i in r)n[r[i]]=i;r.map=n,t.exports=r},,,,function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(34),i=4096,s="utf8";class o{constructor(t){if(this.length=0,this._encoding=s,this._writeOffset=0,this._readOffset=0,o.isSmartBufferOptions(t))if(t.encoding&&(n.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(n.isFiniteInteger(t.size)&&t.size>0))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=Buffer.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof Buffer))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=Buffer.allocUnsafe(i);else{if(void 0!==t)throw new Error(n.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(i)}}static fromSize(t,e){return new this({size:t,encoding:e})}static fromBuffer(t,e){return new this({buff:t,encoding:e})}static fromOptions(t){return new this(t)}static isSmartBufferOptions(t){const e=t;return e&&(void 0!==e.encoding||void 0!==e.size||void 0!==e.buff)}readInt8(t){return this._readNumberValue(Buffer.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(Buffer.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(Buffer.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(Buffer.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(Buffer.prototype.readInt32LE,4,t)}writeInt8(t,e){return this._writeNumberValue(Buffer.prototype.writeInt8,1,t,e),this}insertInt8(t,e){return this._insertNumberValue(Buffer.prototype.writeInt8,1,t,e),this}writeInt16BE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,t,e),this}insertInt16BE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,t,e),this}writeInt16LE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,t,e),this}insertInt16LE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,t,e),this}writeInt32BE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,t,e),this}insertInt32BE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,t,e),this}writeInt32LE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,t,e),this}insertInt32LE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,t,e),this}readUInt8(t){return this._readNumberValue(Buffer.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,t)}writeUInt8(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,t,e),this}insertUInt8(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,t,e),this}writeUInt16BE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,t,e),this}insertUInt16BE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,t,e),this}writeUInt16LE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,t,e),this}insertUInt16LE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,t,e),this}writeUInt32BE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,t,e),this}insertUInt32BE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,t,e),this}writeUInt32LE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,t,e),this}insertUInt32LE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,t,e),this}readFloatBE(t){return this._readNumberValue(Buffer.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(Buffer.prototype.readFloatLE,4,t)}writeFloatBE(t,e){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,t,e),this}insertFloatBE(t,e){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,t,e),this}writeFloatLE(t,e){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,t,e),this}insertFloatLE(t,e){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,t,e),this}readDoubleBE(t){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,t)}writeDoubleBE(t,e){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,t,e),this}insertDoubleBE(t,e){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,t,e),this}writeDoubleLE(t,e){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,t,e),this}insertDoubleLE(t,e){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,t,e),this}readString(t,e){let r;"number"==typeof t?(n.checkLengthValue(t),r=Math.min(t,this.length-this._readOffset)):(e=t,r=this.length-this._readOffset),void 0!==e&&n.checkEncoding(e);const i=this._buff.slice(this._readOffset,this._readOffset+r).toString(e||this._encoding);return this._readOffset+=r,i}insertString(t,e,r){return n.checkOffsetValue(e),this._handleString(t,!0,e,r)}writeString(t,e,r){return this._handleString(t,!1,e,r)}readStringNT(t){void 0!==t&&n.checkEncoding(t);let e=this.length;for(let t=this._readOffset;t<this.length;t++)if(0===this._buff[t]){e=t;break}const r=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,r.toString(t||this._encoding)}insertStringNT(t,e,r){n.checkOffsetValue(e),this.insertString(t,e,r),this.insertUInt8(0,e+t.length)}writeStringNT(t,e,r){this.writeString(t,e,r),this.writeUInt8(0,"number"==typeof e?e+t.length:this.writeOffset)}readBuffer(t){void 0!==t&&n.checkLengthValue(t);const e="number"==typeof t?t:this.length,r=Math.min(this.length,this._readOffset+e),i=this._buff.slice(this._readOffset,r);return this._readOffset=r,i}insertBuffer(t,e){return n.checkOffsetValue(e),this._handleBuffer(t,!0,e)}writeBuffer(t,e){return this._handleBuffer(t,!1,e)}readBufferNT(){let t=this.length;for(let e=this._readOffset;e<this.length;e++)if(0===this._buff[e]){t=e;break}const e=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,e}insertBufferNT(t,e){return n.checkOffsetValue(e),this.insertBuffer(t,e),this.insertUInt8(0,e+t.length),this}writeBufferNT(t,e){return void 0!==e&&n.checkOffsetValue(e),this.writeBuffer(t,e),this.writeUInt8(0,"number"==typeof e?e+t.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(t){n.checkOffsetValue(t),n.checkTargetOffset(t,this),this._readOffset=t}get writeOffset(){return this._writeOffset}set writeOffset(t){n.checkOffsetValue(t),n.checkTargetOffset(t,this),this._writeOffset=t}get encoding(){return this._encoding}set encoding(t){n.checkEncoding(t),this._encoding=t}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(t){const e="string"==typeof t?t:this._encoding;return n.checkEncoding(e),this._buff.toString(e,0,this.length)}destroy(){return this.clear(),this}_handleString(t,e,r,i){let s=this._writeOffset,o=this._encoding;"number"==typeof r?s=r:"string"==typeof r&&(n.checkEncoding(r),o=r),"string"==typeof i&&(n.checkEncoding(i),o=i);const a=Buffer.byteLength(t,o);return e?this.ensureInsertable(a,s):this._ensureWriteable(a,s),this._buff.write(t,s,a,o),e?this._writeOffset+=a:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,s+a):this._writeOffset+=a,this}_handleBuffer(t,e,r){const n="number"==typeof r?r:this._writeOffset;return e?this.ensureInsertable(t.length,n):this._ensureWriteable(t.length,n),t.copy(this._buff,n),e?this._writeOffset+=t.length:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,n+t.length):this._writeOffset+=t.length,this}ensureReadable(t,e){let r=this._readOffset;if(void 0!==e&&(n.checkOffsetValue(e),r=e),r<0||r+t>this.length)throw new Error(n.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(t,e){n.checkOffsetValue(e),this._ensureCapacity(this.length+t),e<this.length&&this._buff.copy(this._buff,e+t,e,this._buff.length),e+t>this.length?this.length=e+t:this.length+=t}_ensureWriteable(t,e){const r="number"==typeof e?e:this._writeOffset;this._ensureCapacity(r+t),r+t>this.length&&(this.length=r+t)}_ensureCapacity(t){const e=this._buff.length;if(t>e){let r=this._buff,n=3*e/2+1;n<t&&(n=t),this._buff=Buffer.allocUnsafe(n),r.copy(this._buff,0,0,e)}}_readNumberValue(t,e,r){this.ensureReadable(e,r);const n=t.call(this._buff,"number"==typeof r?r:this._readOffset);return void 0===r&&(this._readOffset+=e),n}_insertNumberValue(t,e,r,i){n.checkOffsetValue(i),this.ensureInsertable(e,i),t.call(this._buff,r,i),this._writeOffset+=e}_writeNumberValue(t,e,r,i){if("number"==typeof i){if(i<0)throw new Error(n.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);n.checkOffsetValue(i)}const s="number"==typeof i?i:this._writeOffset;this._ensureWriteable(e,s),t.call(this._buff,r,s),"number"==typeof i?this._writeOffset=Math.max(this._writeOffset,s+e):this._writeOffset+=e}}e.SmartBuffer=o},function(t,e){var r={};function n(t){return r[t]||(r[t]=Math.pow(2,t)-1),r[t]}t.exports={cal:function(t,e,r,i){const s=n(i),o=r-e;return Math.round((t-e)/o*s)},encode:function(t,e=8){const r=t.length,i=n(e);for(var s=1/0,o=-1/0,a=0;a<r;a++)s=Math.min(s,t[a]),o=Math.max(o,t[a]);const h=o-s||1,u=[];for(a=0;a<r;a++)u[a]=Math.round((t[a]-s)/h*i);return{min:s,max:o,quantizationBit:e,data:u}},encodeWithMinAndMax:function(t,e=[],r=0,i=1,s=8){const o=t.length,a=n(s),h=i-r||1;for(var u=0;u<o;u++)e[u]=Math.round((t[u]-r)/h*a);return e},decode:function(t,e=8,r,i){const s=t.length,o=n(e),a=i-r,h=new Float32Array(s);for(var u=0;u<s;u++)h[u]=r+a*(t[u]/o);return h},normalize:function(t,e=[],r=3){const n=t.length;for(var i=0;i<n;i+=r){for(var s=0,o=0;o<r;o++)s+=t[i+o]*t[i+o];s=Math.sqrt(s);for(o=0;o<r;o++)e[i+o]=t[i+o]/s}return e}}},function(t,e){function r(){}function n(t){this._tree=t,this._ancestors=[],this._cursor=null}r.prototype.clear=function(){this._root=null,this.size=0},r.prototype.find=function(t){for(var e=this._root;null!==e;){var r=this._comparator(t,e.data);if(0===r)return e.data;e=e.get_child(r>0)}return null},r.prototype.findIter=function(t){for(var e=this._root,r=this.iterator();null!==e;){var n=this._comparator(t,e.data);if(0===n)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(n>0)}return null},r.prototype.lowerBound=function(t){for(var e=this._root,r=this.iterator(),n=this._comparator;null!==e;){var i=n(t,e.data);if(0===i)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(i>0)}for(var s=r._ancestors.length-1;s>=0;--s)if(n(t,(e=r._ancestors[s]).data)<0)return r._cursor=e,r._ancestors.length=s,r;return r._ancestors.length=0,r},r.prototype.upperBound=function(t){for(var e=this.lowerBound(t),r=this._comparator;null!==e.data()&&0===r(e.data(),t);)e.next();return e},r.prototype.min=function(){var t=this._root;if(null===t)return null;for(;null!==t.left;)t=t.left;return t.data},r.prototype.max=function(){var t=this._root;if(null===t)return null;for(;null!==t.right;)t=t.right;return t.data},r.prototype.iterator=function(){return new n(this)},r.prototype.each=function(t){for(var e,r=this.iterator();null!==(e=r.next());)if(!1===t(e))return},r.prototype.reach=function(t){for(var e,r=this.iterator();null!==(e=r.prev());)if(!1===t(e))return},n.prototype.data=function(){return null!==this._cursor?this._cursor.data:null},n.prototype.next=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._minNode(t)}else{var e;if(null===this._cursor.right)do{if(e=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.right===e);else this._ancestors.push(this._cursor),this._minNode(this._cursor.right)}return null!==this._cursor?this._cursor.data:null},n.prototype.prev=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._maxNode(t)}else{var e;if(null===this._cursor.left)do{if(e=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.left===e);else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left)}return null!==this._cursor?this._cursor.data:null},n.prototype._minNode=function(t){for(;null!==t.left;)this._ancestors.push(t),t=t.left;this._cursor=t},n.prototype._maxNode=function(t){for(;null!==t.right;)this._ancestors.push(t),t=t.right;this._cursor=t},t.exports=r},,,,,,,,,,,,,function(t,e,r){t.exports=r(31)},function(t,e,r){t.exports=r(32)},function(t,e,r){const n=r(33),i=r(42),s=r(5);t.exports={Geometry:s,AMCompression:n,AMDecompression:i}},function(t,e,r){const n=r(15).SmartBuffer,i=r(35),s=r(41),o={EB:0},a=[i],h=[s];function u(t,e={}){const r=e.type||o.EB,n=new a[r](t,e).compress();return n.type=r,n}t.exports={Type:o,compress:u,compressToBuffer:function(t,e,r={}){t||(t=new n);const i=u(e,r);return function(t,e,r){return t.writeUInt8("A".charCodeAt(0)),t.writeUInt8("M".charCodeAt(0)),t.writeUInt8("C".charCodeAt(0)),t.writeUInt8(this.type),h[r].write(e,t),t}(t,i,i.type)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};function i(t){return"number"==typeof t&&isFinite(t)&&function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}(t)}function s(t,e){if("number"!=typeof t)throw new Error(e?n.INVALID_OFFSET_NON_NUMBER:n.INVALID_LENGTH_NON_NUMBER);if(!i(t)||t<0)throw new Error(e?n.INVALID_OFFSET:n.INVALID_LENGTH)}e.ERRORS=n,e.checkEncoding=function(t){if(!Buffer.isEncoding(t))throw new Error(n.INVALID_ENCODING)},e.isFiniteInteger=i,e.checkLengthValue=function(t){s(t,!1)},e.checkOffsetValue=function(t){s(t,!0)},e.checkTargetOffset=function(t,e){if(t<0||t>e.length)throw new Error(n.INVALID_TARGET_OFFSET)}},function(t,e,r){const n=r(5),i=r(36),s=r(37),o=r(11);t.exports=class{constructor(t,e={}){this.geometry=t,this.indices=t.indices,this.noParallelogramPrediction=!!e.noParallelogramPrediction,this.vertexCount=t.getAttrLength(),this.faceCount=this.indices.length/3,this.visitedVertexMap=new Array(this.vertexCount),this.visitedFaceMap=new Array(this.faceCount),t.quantize(e.quantization),this.faceCount>100&&this.vertexCount>this.faceCount&&s(t),this.ct=new i(this.indices,{onFaceDelete:t=>{this.visitedFaceMap[t]=1}}),this.fixNonManifold(),this.initBoundaryLoops()}fixNonManifold(){const t=this.ct,e=this.nonManifoldMap={};var r=this.indices;const n=r.length,i=[];for(var s=0;s<n;s++){var o=r[s];if(i[o]){const n=i[o];for(var a=n.length-1;a>=0;a--)if(t.isCornerCanReach(n[a],s)){r[s]=r[n[a]];break}a<0&&(e[this.vertexCount]=o,i[o].push(s),this.vertexCount>65535&&r instanceof Uint16Array&&(this.indices=new Uint32Array(r),this.geometry.indices=this.indices,r=this.indices),r[s]=this.vertexCount++)}else i[o]=[s]}}initBoundaryLoops(){const t=this.ct,e=this.indices,r=e.length,n=this.boundaryVertexMap=new Uint8Array(this.vertexCount),i=new Uint8Array(r),s=this.boundaryLoops=[];for(var o=0;o<r;o++)if(-1===t.oppositeCorner(o)&&!i[o]){i[o]=1;var a=[],h=t.prevCorner(o),u=h;do{a.push(u),n[e[u]]=1,i[t.nextCorner(u)]=1;var c=t.leftmostCorner(u);u=t.nextCorner(c)}while(u!==h);s.push(a)}}getBoundaryLoop(t){const e=this.ct,r=this.indices,n=r[t];var i;const s=e.leftmostCorner(t);if(s>=0&&s!==t)i=r[e.nextCorner(s)];else{var o=e.rightmostCorner(t);i=r[e.prevCorner(o)]}for(var a={},h=this.boundaryLoops.length-1;h>=0;h--)for(var u=this.boundaryLoops[h],c=u.length,f=c;f>=0;f--)if(r[u[f]]===n&&(a.boundaryLoop=u,a.index=f,r[u[(f+1)%c]]===i||r[u[0===f?c-1:f-1]]===i))return a;return a}isFaceVisited(t){return!!(t<0||this.visitedFaceMap[t])}isVertexVisited(t){return!!(t<0||this.visitedVertexMap[t])}isVertexOnBoundary(t){return!!this.boundaryVertexMap[t]}isCornerOnBoundary(t){return this.isVertexOnBoundary(this.indices[t])}compressFromCorner(t,e){const r=this.ct;if(this.isFaceVisited(r.cornerToFace(t)))return;const n=t,i=this.indices,s=this.visitedFaceMap,a=this.visitedVertexMap;var h=r.nextCorner(t),u=r.nextCorner(h),c=i[h],f=i[u];this.writeVertex(u),this.isVertexVisited(f)||(this.currentVertex++,a[f]=this.currentVertex+1),this.writeVertex(h),this.isVertexVisited(c)||(this.currentVertex++,a[c]=this.currentVertex+1);const l=[];for(l.length=0,l.push(t);l.length;)if(!((t=l.pop())<0||this.isFaceVisited(r.cornerToFace(t))))for(;;){this.currentFace++;var d=r.cornerToFace(t);s[d]=1;var p=3*this.currentFace,_=i[t],g=r.rightCorner(t),m=r.cornerToFace(g),v=r.leftCorner(t),w=r.cornerToFace(v);if(s[m]>1){var E=r.cornerToFace(s[m]);e.handles.push(p+1,E)}if(s[w]>1){E=r.cornerToFace(s[w]);e.handles.push(p+2,E)}const h=t===n?-1:r.oppositeCorner(t);if(this.writeVertex(t,h),a[_])if(this.isFaceVisited(m)){if(this.isFaceVisited(w)){e.clers.push(o.E),this._onCompressFace(d,this.currentFace,o.E);break}e.clers.push(o.R),this._onCompressFace(d,this.currentFace,o.R),t=v}else{if(!this.isFaceVisited(w)){s[d]=p+2,e.clers.push(o.S),this._onCompressFace(d,this.currentFace,o.S),l.push(v),l.push(g);break}e.clers.push(o.L),this._onCompressFace(d,this.currentFace,o.L),t=g}else{if(this.currentVertex++,a[_]=this.currentVertex+1,this.isVertexOnBoundary(_)){e.clers.push(o.M),this._onCompressFace(d,this.currentFace,o.M);var y=this.getBoundaryLoop(t),O=y.boundaryLoop;e.holes.push(O.length);var I=y.index,C=I;do{if(++C===O.length){if(0===I)break;C=0}var b=i[O[C]];this.currentVertex++,this.accessedMap[b]?this.handlerDuplicateVertexInOneLoop(O[C],this.currentVertex+1):(this.accessedMap[b]=1,a[b]=this.currentVertex+1)}while(C!==I-1);t=g;continue}e.clers.push(o.C),this._onCompressFace(d,this.currentFace,o.C),t=g}}e.clers[e.clers.length-1]=o.F}_onCompressFace(t,e,r){this.onCompressFace&&this.onCompressFace(t,e,r)}getNewVertexIdByCornerId(t,e){const r=this.visitedVertexMap,n=this.duplicateVertexCornerMap;return void 0===e&&(e=this.indices[t]),n[t]?n[t]-1:r[e]?r[e]-1:this.currentVertex+1}getOriginVertexId(t){const e=this.nonManifoldMap;return void 0!==e[t]?e[t]:t}writeVertex(t,e=-1){const r=this.ct,i=this.indices;this.nonManifoldMap;var s=i[t];const o=this.getNewVertexIdByCornerId(t,s);if(s=this.getOriginVertexId(s),this.writedVertexMap[o])return o;if(this.writedVertexMap[o]=1,this.noParallelogramPrediction)return this.geometry.cal(this.outputGeometry,o,n.cp,s),o;if(-1===e)void 0===this.lastWriteVertexIndex?this.geometry.cal(this.outputGeometry,o,n.cp,s):this.geometry.cal(this.outputGeometry,o,n.minus,s,this.lastWriteVertexIndex);else{var a=this.getOriginVertexId(i[e]),h=this.getOriginVertexId(i[r.prevCorner(e)]),u=this.getOriginVertexId(i[r.nextCorner(e)]);this.geometry.cal(this.outputGeometry,o,n.pp,a,h,u,s)}return this.lastWriteVertexIndex=s,o}handlerDuplicateVertexInOneLoop(t,e){const r=this.ct,n=this.duplicateVertexCornerMap;var i=t;do{n[i]=e,i=r.prevNeighborCorner(i)}while(i!==t&&i>=0);i=t;do{n[i]=e,i=r.nextNeighborCorner(i)}while(i!==t&&i>=0)}compress(){const t=this.ct;this.writedVertexMap=[];const e=this.visitedVertexMap,r=this.indices,n=r.length;var i=this.geometry.cloneStruct();delete i.indices,i.noParallelogramPrediction=this.noParallelogramPrediction,i.clers=[],i.holes=[],i.handles=[],this.currentFace=-1,this.currentVertex=-1,this.outputGeometry=i;const s=this.boundaryLoops;if(s.length)for(var o=0;o<s.length;o++){var a=s[o];if(!this.visitedFaceMap[t.cornerToFace(a[0])]){this.duplicateVertexCornerMap={},this.accessedMap={};for(var h=0;h<a.length;h++){var u=r[a[h]];this.currentVertex++,this.accessedMap[u]?this.handlerDuplicateVertexInOneLoop(a[h],this.currentVertex+1):(this.accessedMap[u]=1,e[u]=this.currentVertex+1)}this.compressFromCorner(t.nextCorner(a[0]),i),delete this.lastWriteVertexIndex}}this.duplicateVertexCornerMap={};for(o=0;o<n;o+=3)this.compressFromCorner(o,i),delete this.lastWriteVertexIndex;return i.mode="CLERS",i}}},function(t,e){t.exports=class{constructor(t,e={}){t&&(this.indices=t,this.onFaceDelete=e.onFaceDelete,this.create())}isFaceCanDelete(t){const e=this.indices,r=e[t],n=e[t+1],i=e[t+2];return r===n||r===i||n===i}markEdge(t,e,r,n,i){var s=t+"-"+e,o=e+"-"+t;if(o in n){if(-1!==i[n[o]])return;i[n[o]]=r,i[r]=n[o]}else n[s]=r}create(){const t=this.indices,e=t.length,r=this.cornerTable=new Array(e);r.fill(-1);const n={};for(var i=0;i<e;i+=3)this.isFaceCanDelete(i)?this.onFaceDelete&&this.onFaceDelete(i/3):(this.markEdge(t[i],t[i+1],i+2,n,r),this.markEdge(t[i+1],t[i+2],i,n,r),this.markEdge(t[i+2],t[i],i+1,n,r));return r}oppositeCorner(t){return this.cornerTable[t]}nextCorner(t){return t<0?-1:t+(t%3==2?-2:1)}prevCorner(t){return t<0?-1:t+(t%3?-1:2)}rightCorner(t){return this.oppositeCorner(this.nextCorner(t))}leftCorner(t){return this.oppositeCorner(this.prevCorner(t))}nextNeighborCorner(t){return this.nextCorner(this.rightCorner(t))}prevNeighborCorner(t){return this.prevCorner(this.leftCorner(t))}rightmostCorner(t){this.indices;for(var e=this.rightCorner(t),r=-1;-1!==e&&r!==t;)r=this.nextCorner(e),e=this.rightCorner(r);return r}leftmostCorner(t){this.indices;for(var e=this.leftCorner(t),r=-1;-1!==e&&r!==t;)r=this.prevCorner(e),e=this.rightCorner(e);return-1===r?t:r}cornerToFace(t){return Math.floor(t/3)}rightFace(t){return this.cornerToFace(this.rightCorner(t))}leftFace(t){return this.cornerToFace(this.leftCorner(t))}isCornerCanReach(t,e){var r=t;do{if((r=this.nextNeighborCorner(r))===e)return!0}while(r>=0&&r!==t);r=t;do{if((r=this.prevNeighborCorner(r))===e)return!0}while(r>=0&&r!==t);return!1}}},function(t,e,r){const n=r(38).RBTree;t.exports=function(t){const e=function(t){return function(e,r){for(var n=0,i=0;i<t.attrs.length;i++){var s=t.attrs[i];if("TANGENT"!==s.name)for(var o=e*s.itemCount,a=r*s.itemCount,h=0;h<s.itemCount;h++)if(n=s.data[o+h]-s.data[a+h])return n}return n}}(t),r=new n(e),i=t.getAttrLength(),s={};for(var o=0;o<i;o++){var a=r.find(o);null==a?r.insert(o):s[o]=a}const h=t.indices;for(o=h.length-1;o>=0;o--)h[o]in s&&(h[o]=s[h[o]])}},function(t,e,r){t.exports={RBTree:r(39),BinTree:r(40)}},function(t,e,r){var n=r(17);function i(t){this.data=t,this.left=null,this.right=null,this.red=!0}function s(t){this._root=null,this._comparator=t,this.size=0}function o(t){return null!==t&&t.red}function a(t,e){var r=t.get_child(!e);return t.set_child(!e,r.get_child(e)),r.set_child(e,t),t.red=!0,r.red=!1,r}function h(t,e){return t.set_child(!e,a(t.get_child(!e),!e)),a(t,e)}i.prototype.get_child=function(t){return t?this.right:this.left},i.prototype.set_child=function(t,e){t?this.right=e:this.left=e},s.prototype=new n,s.prototype.insert=function(t){var e=!1;if(null===this._root)this._root=new i(t),e=!0,this.size++;else{var r=new i(void 0),n=0,s=0,u=null,c=r,f=null,l=this._root;for(c.right=this._root;;){if(null===l?(l=new i(t),f.set_child(n,l),e=!0,this.size++):o(l.left)&&o(l.right)&&(l.red=!0,l.left.red=!1,l.right.red=!1),o(l)&&o(f)){var d=c.right===u;l===f.get_child(s)?c.set_child(d,a(u,!s)):c.set_child(d,h(u,!s))}var p=this._comparator(l.data,t);if(0===p)break;s=n,n=p<0,null!==u&&(c=u),u=f,f=l,l=l.get_child(n)}this._root=r.right}return this._root.red=!1,e},s.prototype.remove=function(t){if(null===this._root)return!1;var e=new i(void 0),r=e;r.right=this._root;for(var n=null,s=null,u=null,c=1;null!==r.get_child(c);){var f=c;s=n,n=r,r=r.get_child(c);var l=this._comparator(t,r.data);if(c=l>0,0===l&&(u=r),!o(r)&&!o(r.get_child(c)))if(o(r.get_child(!c))){var d=a(r,c);n.set_child(f,d),n=d}else if(!o(r.get_child(!c))){var p=n.get_child(!f);if(null!==p)if(o(p.get_child(!f))||o(p.get_child(f))){var _=s.right===n;o(p.get_child(f))?s.set_child(_,h(n,f)):o(p.get_child(!f))&&s.set_child(_,a(n,f));var g=s.get_child(_);g.red=!0,r.red=!0,g.left.red=!1,g.right.red=!1}else n.red=!1,p.red=!0,r.red=!0}}return null!==u&&(u.data=r.data,n.set_child(n.right===r,r.get_child(null===r.left)),this.size--),this._root=e.right,null!==this._root&&(this._root.red=!1),null!==u},t.exports=s},function(t,e,r){var n=r(17);function i(t){this.data=t,this.left=null,this.right=null}function s(t){this._root=null,this._comparator=t,this.size=0}i.prototype.get_child=function(t){return t?this.right:this.left},i.prototype.set_child=function(t,e){t?this.right=e:this.left=e},s.prototype=new n,s.prototype.insert=function(t){if(null===this._root)return this._root=new i(t),this.size++,!0;for(var e=0,r=null,n=this._root;;){if(null===n)return n=new i(t),r.set_child(e,n),ret=!0,this.size++,!0;if(0===this._comparator(n.data,t))return!1;e=this._comparator(n.data,t)<0,r=n,n=n.get_child(e)}},s.prototype.remove=function(t){if(null===this._root)return!1;var e=new i(void 0),r=e;r.right=this._root;for(var n=null,s=null,o=1;null!==r.get_child(o);){n=r,r=r.get_child(o);var a=this._comparator(t,r.data);o=a>0,0===a&&(s=r)}return null!==s&&(s.data=r.data,n.set_child(n.right===r,r.get_child(null===r.left)),this._root=e.right,this.size--,!0)},t.exports=s},function(t,e,r){const n=r(15).SmartBuffer,i=r(5);r(11);t.exports={write:function(t,e=new n){if(function(t,e){e.writeUInt8(1),e.writeUInt32LE(t.clers.length),e.writeUInt32LE(t.getAttrLength()),e.writeUInt8(t.attrs.length),e.writeUInt8(t.noParallelogramPrediction?1:0),e.writeUInt16LE(t.holes.length),e.writeUInt16LE(t.handles.length/2)}(t,e),t.holes.forEach(t=>{e.writeUInt16LE(t)}),t.handles.length)for(var r=0;r<t.handles.length;r+=2)e.writeUInt32LE(t.handles[r]),e.writeUInt32LE(t.handles[r+1]);t.clers.forEach(t=>{e.writeUInt8(t)}),t.attrs.forEach(t=>{const r=t.name?i.ATTR_NAME_ID[t.name]:7;e.writeUInt16LE(r),e.writeUInt8(t.itemCount),e.writeUInt8(t.quantizationBit||0),e.writeFloatLE(t.min||0),e.writeFloatLE(t.max||0);for(var n=t.data,s=n.length,o=0;o<s;o++)e.writeInt16LE(n[o]||0)})}}},function(t,e,r){const n=r(5),i=r(43),s=r(44),o=r(45),a=r(46),h=[i],u=[s];function c(t,e=0){return t instanceof Uint8Array&&(e=t.byteOffset,t=t.buffer),function(t){return new h[t.type](t).decompress()}(function(t,e){const r=new Uint8Array(t,e,4);if(65!==r[0]||77!==r[1]||67!==r[2])throw new Error("The file is not AMC format!");const n=u[r[3]].read(t,e+4);return n.geometry.type=r[3],n.geometry}(t,e))}var f,l=null,d=null;function p(t,e){return!l&&a()?(l=new o({wasmURL:t,memPages:e}),d=l.init()):d||Promise.resolve()}function _(t,e,r){if(l||p(e,r),!l||!l.isReady)return c(t);try{return l.decompress(t)}catch(e){return console.warn("wasm decompress error",e),c(t)}}var g=null;function m(t){return t=t||"https://g.alicdn.com/hilo/amc/0.1.26/worker.js",g||(!1===f||"undefined"==typeof Worker?Promise.reject("dont support web worker"):g=/^(?:http|blob|data:|\/\/)/.test(t)?new Promise((e,r)=>{var n=new XMLHttpRequest;n.addEventListener("load",function(){if("undefined"==typeof URL||"undefined"==typeof Blob)f=new Worker(`data:application/javascript, ${this.responseText}`);else{const t=URL.createObjectURL(new Blob([this.responseText]));f=new Worker(t)}f.onerror=t=>{console.log("web worker error",t),f=!1,r(t)},e(f)}),n.addEventListener("error",t=>r(t)),n.open("get",t,!0),n.send()}):new Promise((e,r)=>{(f=new Worker(t)).onerror=t=>{console.log("web worker init error",t),f=!1,r(t)},e(f)}))}var v=0;function w(t,e,r,i){return e=e&&a(),t=new Uint8Array(t),m(i).then(i=>new Promise((s,o)=>{const a=v++;var h=e=>{if(e.data.id===a)if(i.removeEventListener("message",h),h=null,e.data.data){const t=e.data.data;t.constructor=n,t.__proto__=n.prototype,s(t)}else s(c(t))};i.addEventListener("message",h),i.postMessage({id:a,data:t,useWASM:e,wasmURL:r},[t.buffer])})).catch(n=>e?_(t,r):c(t))}t.exports={initWASM:p,initWorker:m,decompress:function(t,e,r){const n=a();return!n||t.byteLength>1048576?w(t,n,e,r):n?Promise.resolve(_(t,e)):Promise.resolve(c(t))},decompressWithJS:c,decompressWithWASM:_,decompressWithWorker:w}},function(t,e,r){const n=r(5),i=(r(16),r(11)),o=i.map;t.exports=class{constructor(t){this.geometry=t,this.faceCount=t.clers.length,this.clers=t.clers,this.holes=t.holes,this.handles=t.handles,this.createHandleMap(this.handles),this.vertexCount=t.getAttrLength(),this.noParallelogramPrediction=!!t.noParallelogramPrediction}nextCorner(t){return t<0?-1:t+(t%3==2?-2:1)}prevCorner(t){return t<0?-1:t+(t%3?-1:2)}createHandleMap(t){const e=this.handlesMap={};if(t)for(var r=t.length-1;r>=0;r-=2)e[t[r]]=t[r-1]}mapBoundary(t){const e=this.indices,r=t.length;for(var n=this.currentVertex,i=this.currentVertex-r+1,s=r-1;s>=0;s--)e[this.nextCorner(t[s])]=n,n=i,e[this.prevCorner(t[s])]=i++;this.currentVertex-=r}mapHoleBoundary(t){const e=this.indices,r=t.length;for(var n=this.currentVertex-r+1,i=n,s=r-1;s>=0;s--)e[this.nextCorner(t[s])]=n++,e[this.prevCorner(t[s])]=s?n:i;this.currentVertex-=r}fixNegativeIndex(t){const e=t,r=this.indices;for(;r[t]<0;){if(e===-r[-r[t]]||r[t]===r[-r[t]]){console.warn("dead loop bug!!"),r[s]=0;break}r[t]=r[-r[t]]}}fixIndicesAndReadVertice(){const t=this.indices,e=this.handlesMap,r=this.clers,n=r.length;var s,o=-1;const a=[];for(var h=0,u=0;h<n;h++,u+=3)-1===o?(this.fixNegativeIndex(u+1),this.fixNegativeIndex(u+2)):(t[u+1]=t[this.prevCorner(o)],t[u+2]=t[this.nextCorner(o)]),this.fixNegativeIndex(u),-1===o?(this.readVertex(t[u+2]),this.readVertex(t[u+1]),this.readVertex(t[u])):this.readVertex(t[u],o),o=u+1,(s=r[h])!==i.S||e[h]?s===i.E||s===i.F?o=a.pop():s===i.R&&(o=u+2):a.push(u+2),s===i.F&&(o=-1,delete this.lastReadVertexIndex),this._onDecompressFace(h,s)}readVertex(t,e=-1){if(this.readedVertexMap[t])return;if(this.readedVertexMap[t]=1,this.noParallelogramPrediction)return;const r=this.indices,i=this.geometry;-1===e?void 0!==this.lastReadVertexIndex&&i.cal(i,t,n.plus,this.lastReadVertexIndex,t):i.cal(i,t,n.depp,r[e],r[this.prevCorner(e)],r[this.nextCorner(e)],t),this.lastReadVertexIndex=t}markCorner(t,e){const r=this.indices;void 0===r[this.nextCorner(t)]&&(r[this.nextCorner(t)]=-this.prevCorner(e[0])),void 0===r[this.prevCorner(t)]&&(r[this.prevCorner(t)]=-this.nextCorner(e[e.length-1]))}onFaceC(t){const e=this.indices,r=3*this.currentFace,n=this.currentVertex--;e[r]=n;var i=t.pop();return e[this.nextCorner(i)]=n,e[this.prevCorner(i)]=-this.nextCorner(t[t.length-1]),i=t.shift(),e[this.prevCorner(i)]=n,e[this.nextCorner(i)]=-this.prevCorner(t[0]),t.push(r),t}onFaceL(t){const e=3*this.currentFace;return this.markCorner(t.pop(),t),t.unshift(e+2),t.push(e),t}onFaceF(t,e){return t&&this.mapBoundary(t),this.onFaceE(null,e)}onFaceE(t,e){const r=3*this.currentFace;return t&&e.push(t),[r+2,r+1,r]}onFaceR(t){const e=3*this.currentFace;return this.markCorner(t.pop(),t),t.push(e+1,e),t}onHandleEnd(t,e,r){const n=this.indices,i=3*this.currentFace,s=this.handlesMap[this.currentFace],o=e.splice(0,t);return e.shift(),r.push(o),n[this.nextCorner(s)]=-(i+1),n[this.prevCorner(s)]=-this.nextCorner(o[o.length-1]),n[i]=-this.prevCorner(o[0]),e.push(i),e}onHandleStart(t,e){const r=this.indices,n=3*this.currentFace,i=this.handlesMap[this.currentFace];for(var s,o=e.length-1;o>=0;o--){var a=e[o].indexOf(i);if(a>=0){var h=(s=e.splice(o,1)[0]).splice(0,a);s.shift(),s.push(...h);break}}return r[this.nextCorner(i)]=-(n+1),r[this.prevCorner(i)]=-this.nextCorner(s[s.length-1]),r[n]=-this.prevCorner(t[0]),(t=s.concat(t)).push(n),t}onFaceS(t,e,r){const n=this.handlesMap,i=this.indices,s=3*this.currentFace;if(n[this.currentFace]){this.markCorner(t.pop(),t);const e=t.indexOf(n[this.currentFace]);t=e>=0?this.onHandleEnd(e,t,r):this.onHandleStart(t,r)}else{const r=t.pop();this.markCorner(r,t),i[s]=-this.nextCorner(r);const n=e.pop();this.markCorner(n.pop(),n),(t=n.concat(t)).push(s)}return t}onFaceM(t,e,r){const n=this.indices,i=3*this.currentFace,s=t.splice(0,this.holes[this.currentHole--]);this.mapHoleBoundary(s);const o=n[this.prevCorner(s[0])];n[i]=o;var a=t.pop();return n[this.prevCorner(a)]=-this.nextCorner(t[t.length-1]),n[this.nextCorner(a)]=o,a=t.shift(),n[this.prevCorner(a)]=o,n[this.nextCorner(a)]=-this.prevCorner(t[0]),t.push(i),t}decompress(){this.readedVertexMap=new Uint8Array(this.vertexCount);const t=this.faceCount,e=this.indices=new Array(3*t);this.currentFace=t-1,this.currentVertex=this.vertexCount-1,this.currentHole=this.holes.length-1;const r=this.clers,n=[],i=[];for(var s;this.currentFace>=0;){var a="onFace"+o[r[this.currentFace]];this[a]?s=this[a](s,n,i):console.warn(`has no ${a}`),this.currentFace--}return this.mapBoundary(s),this.fixIndicesAndReadVertice(this.indices),this.geometry.indices=e,this.geometry.dequantize(),this.geometry}_onDecompressFace(t,e){this.onDecompressFace&&this.onDecompressFace(t,e)}}},function(t,e,r){const n=r(5);function i(t,e,r,n){return new t(e.slice(r,r+n*t.BYTES_PER_ELEMENT))}t.exports={read:function(t,e=0){const r=new DataView(t),s=new n;var o=function(t,e){const r={};return r.version=t.getUint8(e++),r.faceCount=t.getUint32(e,!0),e+=4,r.vertexCount=t.getUint32(e,!0),e+=4,r.attrCount=t.getUint8(e++),r.noParallelogramPrediction=t.getUint8(e++),r.holesCount=t.getUint16(e,!0),e+=2,r.handlesCount=t.getUint16(e,!0),e+=2,r.headerBytes=15,r}(r,e);return e+=o.headerBytes,s.mode="CLERS",e=function(t,e,r,n){return n.holesCount?(t.holes=i(Uint16Array,e.buffer,r,n.holesCount),r+2*n.holesCount):(t.holes=[],r)}(s,r,e,o),e=function(t,e,r,n){return n.handlesCount?(t.handles=i(Uint32Array,e.buffer,r,2*n.handlesCount),r+8*n.handlesCount):(t.handles=[],r)}(s,r,e,o),e=function(t,e,r,n){return t.clers=new Uint8Array(e.buffer,r,n.faceCount),r+n.faceCount}(s,r,e,o),e=function(t,e,r,n){for(var s=0;s<n.attrCount;s++){let s={},o=e.getUint16(r,!0);r+=2,s.name=t.attrIdToName(o),s.itemCount=e.getUint8(r++),s.quantizationBit=e.getUint8(r++),s.min=e.getFloat32(r,!0),r+=4,s.max=e.getFloat32(r,!0),r+=4,s.data=i(Int16Array,e.buffer,r,s.itemCount*n.vertexCount),r+=s.itemCount*n.vertexCount*2,t.attrs.push(s)}return r}(s,r,e,o),{header:o,geometry:s,offset:e}}}},function(t,e,r){const n=r(5);t.exports=class{constructor(t={}){this.wasmURL=t.wasmURL||"https://ossgw.alicdn.com/tmall-c3/tmx/70b8d82ccf33e97a124e54c2d6a3e0c7.wasm",this.memPages=t.memPages||256,this.memPages<256&&(this.memPages=256),this.isReady=!1}initASMJS(){this.isReady=!0,this.dv=new DataView(HEAP8.buffer),this.heap8=HEAP8,this.ins={exports:{__Z7AMCinitj:Module.__Z7AMCinitj,__Z12AMDecompressv:Module.__Z12AMDecompressv}}}init(){const t=this.memory=new WebAssembly.Memory({initial:this.memPages});this.dv=new DataView(t.buffer);const e=this.heap8=new Uint8Array(t.buffer),r={global:{NaN:5,Infinity:6},env:{memoryBase:0,memory:t,_malloc:function(){return 2097152},_memset:function(t,r,n){return e.fill(r,t,t+n),t},_printf:function(t,r){for(var n=t;e[n];)n++;var i=String.fromCharCode(...e.slice(t,n)),s=0;i=i.replace(/%([duf])/g,function(t,e){return"d"===e||"u"===e?dv.getInt32(r+4*s++,!0):"f"===e?dv.getFloat32(r+4*s++,!0):void 0}),console.log(i)}}};return fetch(this.wasmURL).then(t=>t.arrayBuffer()).then(t=>WebAssembly.instantiate(t,r)).then(t=>{this.module=t,this.ins=t.instance,this.isReady=!0}).catch(t=>console.log("wasm load error, use js ver"))}getDataAddr(t){return this.ins.exports.__Z7AMCinitj(t)}decompress(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));const e=this.dv,r=this.heap8,i=this.getDataAddr(t.length);r.set(t,i);const s=this.ins.exports.__Z12AMDecompressv();if(s<=0)throw console.error("decompression error code: "+s),new Error("decompression error code: "+s);const o=e.getUint32(s,!0),a=e.getUint32(s+4,!0),h=e.getUint32(s+8,!0),u=e.getUint32(s+12,!0),c=[];for(var f=0;f<u;f++){var l=s+16+12*f;c.push([e.getUint32(l,!0),e.getUint32(l+4,!0),e.getUint32(l+8,!0)])}var d=new Uint32Array(e.buffer,a,3*o);d=h>65536?new Uint32Array(d):new Uint16Array(d);var p=new n(d);return c.forEach(t=>{const[r,n,i]=t,s=new Float32Array(e.buffer.slice(i,i+h*n*4));p.addAttr(p.attrIdToName(r),s,n)}),p}}},function(t,e){function r(){if("undefined"==typeof WebAssembly||"undefined"==typeof fetch||function(){if(!/iPad|iPhone|iPod/i.test(navigator.userAgent))return!1;if(/OS (\d+)_(\d+)_?(\d+)?/i.test(navigator.userAgent)){const t=Number(RegExp.$1),e=Number(RegExp.$2);if(11===t&&e>=3||t>11)return!1}return!0}())return!1;try{const t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)}catch(t){return console.log("err while check WebAssembly",t),!1}}var n;t.exports=function(){return void 0===n&&(n=r()),n}}]);
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=30)}([,,,,,function(t,e,r){const n=r(16),i={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR",COLOR_0:"COLOR",COLOR_1:"COLOR_1",TEXCOORD:"TEXCOORD",TEXCOORD_0:"TEXCOORD",TEXCOORD_1:"TEXCOORD_1",TEXCOORD_2:"TEXCOORD_2",TANGENT:"TANGENT",JOINT:"JOINT",JOINTS_0:"JOINT",WEIGHT:"WEIGHT",WEIGHTS_0:"WEIGHT"},s=["POSITION","NORMAL","COLOR","TEXCOORD","TANGENT","JOINT","WEIGHT","OTHER","TEXCOORD_1","TEXCOORD_2","COLOR_1"],o={POSITION:0,NORMAL:1,COLOR:2,TEXCOORD:3,TANGENT:4,JOINT:5,WEIGHT:6,OTHER:7,TEXCOORD_1:8,TEXCOORD_2:9,COLOR_1:10},a={POSITION:"vertices",NORMAL:"normals",COLOR:"colors",TEXCOORD:"uvs",TEXCOORD_1:"uvs1",TEXCOORD_2:"uvs2",TANGENT:"tangents",JOINT:"skinIndices",WEIGHT:"skinWeights"},h={vertices:"POSITION",_normals:"NORMAL",colors:"COLOR",uvs:"TEXCOORD",uvs1:"TEXCOORD_1",uvs2:"TEXCOORD_2",_tangents:"TANGENT",skinIndices:"JOINT",skinWeights:"WEIGHT"},u={POSITION:3,NORMAL:3,COLOR:3,COLOR_1:3,TEXCOORD:2,TEXCOORD_1:2,TEXCOORD_2:2,TANGENT:4,JOINT:4,WEIGHT:4};class c{static get ATTR(){return i}static get ATTR_NAME_ID(){return o}static cp(t){return t}static minus(t,e){return t-e}static plus(t,e){return t+e}static pp(t,e,r,n){return n-e-r+t}static depp(t,e,r,n){return e+r-t+n}constructor(t,e=4){this.indices=t,this.mode=e,this.attrs=[],this.attrIndexMap={}}getAttrLength(){return this.attrs[0].data.length/this.attrs[0].itemCount}attrIdToName(t){return s[t]||"OTHER"}addAttr(t,e,r){i[t]?(this.attrIndexMap[t]=this.attrs.length,r||(r=u[t])):r||(r=1),this.attrs.push({name:t,itemCount:r,data:e})}getAttr(t){if(this.attrIndexMap[t])return this.attrs[this.attrIndexMap[t]];for(var e=this.attrs.length-1;e>=0;e--){var r=this.attrs[e];if(r.name===t)return r}}cal(t,e,r,...n){this.attrs.forEach((i,s)=>{for(var o=i.data,a=t.attrs[s].data,h=e*i.itemCount,u=i.itemCount-1;u>=0;u--)a[h+u]=r.apply(null,n.map(t=>o[t*i.itemCount+u]))})}quantize(t={}){this.attrs.forEach(e=>{if("JOINT"!==e.name&&0!=t[e.name]){var r=n.encode(e.data,t[e.name]||12);e.quantizationBit=r.quantizationBit,e.min=r.min,e.max=r.max,e.data=r.data}})}dequantize(){this.attrs.forEach(t=>{t.quantizationBit&&(t.data=n.decode(t.data,t.quantizationBit,t.min,t.max))})}convertTypedArray(){!this.indices||this.indices instanceof Array||(this.indices=Array.from(this.indices)),this.attrs.forEach(t=>{t.data instanceof Array||t.data instanceof Float32Array||(t.data=Array.from(t.data))})}clearEBAttrs(){delete this.clers,delete this.holes,delete this.handles}convertToTypedArray(){this.indices instanceof Array&&(this.getAttrLength()>65535?this.indices=new Uint32Array(this.indices):this.indices=new Uint16Array(this.indices)),this.attrs.forEach(t=>{t.data instanceof Array&&(t.data=new Float32Array(t.data))})}prepareToWorkerSend(){return this.clearEBAttrs(),this.convertToTypedArray(),this.getAllBuffers()}clone(){const t=new c(Array.from(this.indices),this.mode);return Object.assign(t.attrIndexMap,this.attrIndexMap),t.attrs=this.attrs.map(t=>{const e=Object.assign({},t);return e.data=Array.from(e.data),e}),t}cloneStruct(){const t=new c;return t.mode=this.mode,this.indices&&(t.indices=[]),Object.assign(t.attrIndexMap,this.attrIndexMap),t.attrs=this.attrs.map(t=>{const e=Object.assign({},t);return e.data=[],e}),t}toHilo3dGeometry(t,e){const r=e||new t.Geometry;return this.indices&&(this.indices.BYTES_PER_ELEMENT?r.indices=new t.GeometryData(this.indices,1):this.getAttrLength()>65535?r.indices=new t.GeometryData(new Uint32Array(this.indices),1):r.indices=new t.GeometryData(new Uint16Array(this.indices),1)),this.attrs.forEach(e=>{const n=a[e.name];n&&(e.data.BYTES_PER_ELEMENT?r[n]=new t.GeometryData(e.data,e.itemCount):r[n]=new t.GeometryData(new Float32Array(e.data),e.itemCount))}),r}getAllBuffers(){const t=[];return this.indices.BYTES_PER_ELEMENT&&t.push(this.indices.buffer),this.attrs.forEach(e=>{e.data&&e.data.BYTES_PER_ELEMENT&&t.push(e.data.buffer)}),t}static fromGLTFPrimitive(t){const e=new c(t.indices,t.mode),r=t.attributes;let n=0;r.POSITION&&(n=r.POSITION.length/3);for(let t in r){if(!i[t]){console.warn("Dont support attribute",t);continue}let s=u[i[t]];n&&(s=r[t].length/n),e.addAttr(i[t],r[t],s)}return e}static fromHilo3dGeometry(t){const e=new c(t.indices.data,t.mode);for(var r in h)t[r]&&e.addAttr(h[r],t[r].data,t[r].size);return e}}t.exports=c},,,,,,function(t,e){const r={C:0,R:1,L:2,S:3,E:4,M:5,F:6},n=[];for(var i in r)n[r[i]]=i;r.map=n,t.exports=r},,,,function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(34),i=4096,s="utf8";class o{constructor(t){if(this.length=0,this._encoding=s,this._writeOffset=0,this._readOffset=0,o.isSmartBufferOptions(t))if(t.encoding&&(n.checkEncoding(t.encoding),this._encoding=t.encoding),t.size){if(!(n.isFiniteInteger(t.size)&&t.size>0))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=Buffer.allocUnsafe(t.size)}else if(t.buff){if(!(t.buff instanceof Buffer))throw new Error(n.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=t.buff,this.length=t.buff.length}else this._buff=Buffer.allocUnsafe(i);else{if(void 0!==t)throw new Error(n.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(i)}}static fromSize(t,e){return new this({size:t,encoding:e})}static fromBuffer(t,e){return new this({buff:t,encoding:e})}static fromOptions(t){return new this(t)}static isSmartBufferOptions(t){const e=t;return e&&(void 0!==e.encoding||void 0!==e.size||void 0!==e.buff)}readInt8(t){return this._readNumberValue(Buffer.prototype.readInt8,1,t)}readInt16BE(t){return this._readNumberValue(Buffer.prototype.readInt16BE,2,t)}readInt16LE(t){return this._readNumberValue(Buffer.prototype.readInt16LE,2,t)}readInt32BE(t){return this._readNumberValue(Buffer.prototype.readInt32BE,4,t)}readInt32LE(t){return this._readNumberValue(Buffer.prototype.readInt32LE,4,t)}writeInt8(t,e){return this._writeNumberValue(Buffer.prototype.writeInt8,1,t,e),this}insertInt8(t,e){return this._insertNumberValue(Buffer.prototype.writeInt8,1,t,e),this}writeInt16BE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,t,e),this}insertInt16BE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,t,e),this}writeInt16LE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,t,e),this}insertInt16LE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,t,e),this}writeInt32BE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,t,e),this}insertInt32BE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,t,e),this}writeInt32LE(t,e){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,t,e),this}insertInt32LE(t,e){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,t,e),this}readUInt8(t){return this._readNumberValue(Buffer.prototype.readUInt8,1,t)}readUInt16BE(t){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,t)}readUInt16LE(t){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,t)}readUInt32BE(t){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,t)}readUInt32LE(t){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,t)}writeUInt8(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,t,e),this}insertUInt8(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,t,e),this}writeUInt16BE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,t,e),this}insertUInt16BE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,t,e),this}writeUInt16LE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,t,e),this}insertUInt16LE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,t,e),this}writeUInt32BE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,t,e),this}insertUInt32BE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,t,e),this}writeUInt32LE(t,e){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,t,e),this}insertUInt32LE(t,e){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,t,e),this}readFloatBE(t){return this._readNumberValue(Buffer.prototype.readFloatBE,4,t)}readFloatLE(t){return this._readNumberValue(Buffer.prototype.readFloatLE,4,t)}writeFloatBE(t,e){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,t,e),this}insertFloatBE(t,e){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,t,e),this}writeFloatLE(t,e){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,t,e),this}insertFloatLE(t,e){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,t,e),this}readDoubleBE(t){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,t)}readDoubleLE(t){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,t)}writeDoubleBE(t,e){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,t,e),this}insertDoubleBE(t,e){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,t,e),this}writeDoubleLE(t,e){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,t,e),this}insertDoubleLE(t,e){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,t,e),this}readString(t,e){let r;"number"==typeof t?(n.checkLengthValue(t),r=Math.min(t,this.length-this._readOffset)):(e=t,r=this.length-this._readOffset),void 0!==e&&n.checkEncoding(e);const i=this._buff.slice(this._readOffset,this._readOffset+r).toString(e||this._encoding);return this._readOffset+=r,i}insertString(t,e,r){return n.checkOffsetValue(e),this._handleString(t,!0,e,r)}writeString(t,e,r){return this._handleString(t,!1,e,r)}readStringNT(t){void 0!==t&&n.checkEncoding(t);let e=this.length;for(let t=this._readOffset;t<this.length;t++)if(0===this._buff[t]){e=t;break}const r=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,r.toString(t||this._encoding)}insertStringNT(t,e,r){n.checkOffsetValue(e),this.insertString(t,e,r),this.insertUInt8(0,e+t.length)}writeStringNT(t,e,r){this.writeString(t,e,r),this.writeUInt8(0,"number"==typeof e?e+t.length:this.writeOffset)}readBuffer(t){void 0!==t&&n.checkLengthValue(t);const e="number"==typeof t?t:this.length,r=Math.min(this.length,this._readOffset+e),i=this._buff.slice(this._readOffset,r);return this._readOffset=r,i}insertBuffer(t,e){return n.checkOffsetValue(e),this._handleBuffer(t,!0,e)}writeBuffer(t,e){return this._handleBuffer(t,!1,e)}readBufferNT(){let t=this.length;for(let e=this._readOffset;e<this.length;e++)if(0===this._buff[e]){t=e;break}const e=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,e}insertBufferNT(t,e){return n.checkOffsetValue(e),this.insertBuffer(t,e),this.insertUInt8(0,e+t.length),this}writeBufferNT(t,e){return void 0!==e&&n.checkOffsetValue(e),this.writeBuffer(t,e),this.writeUInt8(0,"number"==typeof e?e+t.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(t){n.checkOffsetValue(t),n.checkTargetOffset(t,this),this._readOffset=t}get writeOffset(){return this._writeOffset}set writeOffset(t){n.checkOffsetValue(t),n.checkTargetOffset(t,this),this._writeOffset=t}get encoding(){return this._encoding}set encoding(t){n.checkEncoding(t),this._encoding=t}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(t){const e="string"==typeof t?t:this._encoding;return n.checkEncoding(e),this._buff.toString(e,0,this.length)}destroy(){return this.clear(),this}_handleString(t,e,r,i){let s=this._writeOffset,o=this._encoding;"number"==typeof r?s=r:"string"==typeof r&&(n.checkEncoding(r),o=r),"string"==typeof i&&(n.checkEncoding(i),o=i);const a=Buffer.byteLength(t,o);return e?this.ensureInsertable(a,s):this._ensureWriteable(a,s),this._buff.write(t,s,a,o),e?this._writeOffset+=a:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,s+a):this._writeOffset+=a,this}_handleBuffer(t,e,r){const n="number"==typeof r?r:this._writeOffset;return e?this.ensureInsertable(t.length,n):this._ensureWriteable(t.length,n),t.copy(this._buff,n),e?this._writeOffset+=t.length:"number"==typeof r?this._writeOffset=Math.max(this._writeOffset,n+t.length):this._writeOffset+=t.length,this}ensureReadable(t,e){let r=this._readOffset;if(void 0!==e&&(n.checkOffsetValue(e),r=e),r<0||r+t>this.length)throw new Error(n.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(t,e){n.checkOffsetValue(e),this._ensureCapacity(this.length+t),e<this.length&&this._buff.copy(this._buff,e+t,e,this._buff.length),e+t>this.length?this.length=e+t:this.length+=t}_ensureWriteable(t,e){const r="number"==typeof e?e:this._writeOffset;this._ensureCapacity(r+t),r+t>this.length&&(this.length=r+t)}_ensureCapacity(t){const e=this._buff.length;if(t>e){let r=this._buff,n=3*e/2+1;n<t&&(n=t),this._buff=Buffer.allocUnsafe(n),r.copy(this._buff,0,0,e)}}_readNumberValue(t,e,r){this.ensureReadable(e,r);const n=t.call(this._buff,"number"==typeof r?r:this._readOffset);return void 0===r&&(this._readOffset+=e),n}_insertNumberValue(t,e,r,i){n.checkOffsetValue(i),this.ensureInsertable(e,i),t.call(this._buff,r,i),this._writeOffset+=e}_writeNumberValue(t,e,r,i){if("number"==typeof i){if(i<0)throw new Error(n.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);n.checkOffsetValue(i)}const s="number"==typeof i?i:this._writeOffset;this._ensureWriteable(e,s),t.call(this._buff,r,s),"number"==typeof i?this._writeOffset=Math.max(this._writeOffset,s+e):this._writeOffset+=e}}e.SmartBuffer=o},function(t,e){var r={};function n(t){return r[t]||(r[t]=Math.pow(2,t)-1),r[t]}t.exports={cal:function(t,e,r,i){const s=n(i),o=r-e;return Math.round((t-e)/o*s)},encode:function(t,e=8){const r=t.length,i=n(e);for(var s=1/0,o=-1/0,a=0;a<r;a++)s=Math.min(s,t[a]),o=Math.max(o,t[a]);const h=o-s||1,u=[];for(a=0;a<r;a++)u[a]=Math.round((t[a]-s)/h*i);return{min:s,max:o,quantizationBit:e,data:u}},encodeWithMinAndMax:function(t,e=[],r=0,i=1,s=8){const o=t.length,a=n(s),h=i-r||1;for(var u=0;u<o;u++)e[u]=Math.round((t[u]-r)/h*a);return e},decode:function(t,e=8,r,i){const s=t.length,o=n(e),a=i-r,h=new Float32Array(s);for(var u=0;u<s;u++)h[u]=r+a*(t[u]/o);return h},normalize:function(t,e=[],r=3){const n=t.length;for(var i=0;i<n;i+=r){for(var s=0,o=0;o<r;o++)s+=t[i+o]*t[i+o];s=Math.sqrt(s);for(o=0;o<r;o++)e[i+o]=t[i+o]/s}return e}}},function(t,e){function r(){}function n(t){this._tree=t,this._ancestors=[],this._cursor=null}r.prototype.clear=function(){this._root=null,this.size=0},r.prototype.find=function(t){for(var e=this._root;null!==e;){var r=this._comparator(t,e.data);if(0===r)return e.data;e=e.get_child(r>0)}return null},r.prototype.findIter=function(t){for(var e=this._root,r=this.iterator();null!==e;){var n=this._comparator(t,e.data);if(0===n)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(n>0)}return null},r.prototype.lowerBound=function(t){for(var e=this._root,r=this.iterator(),n=this._comparator;null!==e;){var i=n(t,e.data);if(0===i)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(i>0)}for(var s=r._ancestors.length-1;s>=0;--s)if(n(t,(e=r._ancestors[s]).data)<0)return r._cursor=e,r._ancestors.length=s,r;return r._ancestors.length=0,r},r.prototype.upperBound=function(t){for(var e=this.lowerBound(t),r=this._comparator;null!==e.data()&&0===r(e.data(),t);)e.next();return e},r.prototype.min=function(){var t=this._root;if(null===t)return null;for(;null!==t.left;)t=t.left;return t.data},r.prototype.max=function(){var t=this._root;if(null===t)return null;for(;null!==t.right;)t=t.right;return t.data},r.prototype.iterator=function(){return new n(this)},r.prototype.each=function(t){for(var e,r=this.iterator();null!==(e=r.next());)if(!1===t(e))return},r.prototype.reach=function(t){for(var e,r=this.iterator();null!==(e=r.prev());)if(!1===t(e))return},n.prototype.data=function(){return null!==this._cursor?this._cursor.data:null},n.prototype.next=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._minNode(t)}else{var e;if(null===this._cursor.right)do{if(e=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.right===e);else this._ancestors.push(this._cursor),this._minNode(this._cursor.right)}return null!==this._cursor?this._cursor.data:null},n.prototype.prev=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._maxNode(t)}else{var e;if(null===this._cursor.left)do{if(e=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.left===e);else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left)}return null!==this._cursor?this._cursor.data:null},n.prototype._minNode=function(t){for(;null!==t.left;)this._ancestors.push(t),t=t.left;this._cursor=t},n.prototype._maxNode=function(t){for(;null!==t.right;)this._ancestors.push(t),t=t.right;this._cursor=t},t.exports=r},,,,,,,,,,,,,function(t,e,r){t.exports=r(31)},function(t,e,r){t.exports=r(32)},function(t,e,r){const n=r(33),i=r(42),s=r(5);t.exports={Geometry:s,AMCompression:n,AMDecompression:i}},function(t,e,r){const n=r(15).SmartBuffer,i=r(35),s=r(41),o={EB:0},a=[i],h=[s];function u(t,e={}){const r=e.type||o.EB,n=new a[r](t,e).compress();return n.type=r,n}t.exports={Type:o,compress:u,compressToBuffer:function(t,e,r={}){t||(t=new n);const i=u(e,r);return function(t,e,r){return t.writeUInt8("A".charCodeAt(0)),t.writeUInt8("M".charCodeAt(0)),t.writeUInt8("C".charCodeAt(0)),t.writeUInt8(this.type),h[r].write(e,t),t}(t,i,i.type)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};function i(t){return"number"==typeof t&&isFinite(t)&&function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}(t)}function s(t,e){if("number"!=typeof t)throw new Error(e?n.INVALID_OFFSET_NON_NUMBER:n.INVALID_LENGTH_NON_NUMBER);if(!i(t)||t<0)throw new Error(e?n.INVALID_OFFSET:n.INVALID_LENGTH)}e.ERRORS=n,e.checkEncoding=function(t){if(!Buffer.isEncoding(t))throw new Error(n.INVALID_ENCODING)},e.isFiniteInteger=i,e.checkLengthValue=function(t){s(t,!1)},e.checkOffsetValue=function(t){s(t,!0)},e.checkTargetOffset=function(t,e){if(t<0||t>e.length)throw new Error(n.INVALID_TARGET_OFFSET)}},function(t,e,r){const n=r(5),i=r(36),s=r(37),o=r(11);t.exports=class{constructor(t,e={}){this.geometry=t,this.indices=t.indices,this.noParallelogramPrediction=!!e.noParallelogramPrediction,this.vertexCount=t.getAttrLength(),this.faceCount=this.indices.length/3,this.visitedVertexMap=new Array(this.vertexCount),this.visitedFaceMap=new Array(this.faceCount),t.quantize(e.quantization),this.faceCount>100&&this.vertexCount>this.faceCount&&s(t),this.ct=new i(this.indices,{onFaceDelete:t=>{this.visitedFaceMap[t]=1}}),this.fixNonManifold(),this.initBoundaryLoops()}fixNonManifold(){const t=this.ct,e=this.nonManifoldMap={};var r=this.indices;const n=r.length,i=[];for(var s=0;s<n;s++){var o=r[s];if(i[o]){const n=i[o];for(var a=n.length-1;a>=0;a--)if(t.isCornerCanReach(n[a],s)){r[s]=r[n[a]];break}a<0&&(e[this.vertexCount]=o,i[o].push(s),this.vertexCount>65535&&r instanceof Uint16Array&&(this.indices=new Uint32Array(r),this.geometry.indices=this.indices,r=this.indices),r[s]=this.vertexCount++)}else i[o]=[s]}}initBoundaryLoops(){const t=this.ct,e=this.indices,r=e.length,n=this.boundaryVertexMap=new Uint8Array(this.vertexCount),i=new Uint8Array(r),s=this.boundaryLoops=[];for(var o=0;o<r;o++)if(-1===t.oppositeCorner(o)&&!i[o]){i[o]=1;var a=[],h=t.prevCorner(o),u=h;do{a.push(u),n[e[u]]=1,i[t.nextCorner(u)]=1;var c=t.leftmostCorner(u);u=t.nextCorner(c)}while(u!==h);s.push(a)}}getBoundaryLoop(t){const e=this.ct,r=this.indices,n=r[t];var i;const s=e.leftmostCorner(t);if(s>=0&&s!==t)i=r[e.nextCorner(s)];else{var o=e.rightmostCorner(t);i=r[e.prevCorner(o)]}for(var a={},h=this.boundaryLoops.length-1;h>=0;h--)for(var u=this.boundaryLoops[h],c=u.length,f=c;f>=0;f--)if(r[u[f]]===n&&(a.boundaryLoop=u,a.index=f,r[u[(f+1)%c]]===i||r[u[0===f?c-1:f-1]]===i))return a;return a}isFaceVisited(t){return!!(t<0||this.visitedFaceMap[t])}isVertexVisited(t){return!!(t<0||this.visitedVertexMap[t])}isVertexOnBoundary(t){return!!this.boundaryVertexMap[t]}isCornerOnBoundary(t){return this.isVertexOnBoundary(this.indices[t])}compressFromCorner(t,e){const r=this.ct;if(this.isFaceVisited(r.cornerToFace(t)))return;const n=t,i=this.indices,s=this.visitedFaceMap,a=this.visitedVertexMap;var h=r.nextCorner(t),u=r.nextCorner(h),c=i[h],f=i[u];this.writeVertex(u),this.isVertexVisited(f)||(this.currentVertex++,a[f]=this.currentVertex+1),this.writeVertex(h),this.isVertexVisited(c)||(this.currentVertex++,a[c]=this.currentVertex+1);const l=[];for(l.length=0,l.push(t);l.length;)if(!((t=l.pop())<0||this.isFaceVisited(r.cornerToFace(t))))for(;;){this.currentFace++;var d=r.cornerToFace(t);s[d]=1;var p=3*this.currentFace,_=i[t],g=r.rightCorner(t),m=r.cornerToFace(g),v=r.leftCorner(t),w=r.cornerToFace(v);if(s[m]>1){var E=r.cornerToFace(s[m]);e.handles.push(p+1,E)}if(s[w]>1){E=r.cornerToFace(s[w]);e.handles.push(p+2,E)}const h=t===n?-1:r.oppositeCorner(t);if(this.writeVertex(t,h),a[_])if(this.isFaceVisited(m)){if(this.isFaceVisited(w)){e.clers.push(o.E),this._onCompressFace(d,this.currentFace,o.E);break}e.clers.push(o.R),this._onCompressFace(d,this.currentFace,o.R),t=v}else{if(!this.isFaceVisited(w)){s[d]=p+2,e.clers.push(o.S),this._onCompressFace(d,this.currentFace,o.S),l.push(v),l.push(g);break}e.clers.push(o.L),this._onCompressFace(d,this.currentFace,o.L),t=g}else{if(this.currentVertex++,a[_]=this.currentVertex+1,this.isVertexOnBoundary(_)){e.clers.push(o.M),this._onCompressFace(d,this.currentFace,o.M);var y=this.getBoundaryLoop(t),O=y.boundaryLoop;e.holes.push(O.length);var I=y.index,C=I;do{if(++C===O.length){if(0===I)break;C=0}var b=i[O[C]];this.currentVertex++,this.accessedMap[b]?this.handlerDuplicateVertexInOneLoop(O[C],this.currentVertex+1):(this.accessedMap[b]=1,a[b]=this.currentVertex+1)}while(C!==I-1);t=g;continue}e.clers.push(o.C),this._onCompressFace(d,this.currentFace,o.C),t=g}}e.clers[e.clers.length-1]=o.F}_onCompressFace(t,e,r){this.onCompressFace&&this.onCompressFace(t,e,r)}getNewVertexIdByCornerId(t,e){const r=this.visitedVertexMap,n=this.duplicateVertexCornerMap;return void 0===e&&(e=this.indices[t]),n[t]?n[t]-1:r[e]?r[e]-1:this.currentVertex+1}getOriginVertexId(t){const e=this.nonManifoldMap;return void 0!==e[t]?e[t]:t}writeVertex(t,e=-1){const r=this.ct,i=this.indices;this.nonManifoldMap;var s=i[t];const o=this.getNewVertexIdByCornerId(t,s);if(s=this.getOriginVertexId(s),this.writedVertexMap[o])return o;if(this.writedVertexMap[o]=1,this.noParallelogramPrediction)return this.geometry.cal(this.outputGeometry,o,n.cp,s),o;if(-1===e)void 0===this.lastWriteVertexIndex?this.geometry.cal(this.outputGeometry,o,n.cp,s):this.geometry.cal(this.outputGeometry,o,n.minus,s,this.lastWriteVertexIndex);else{var a=this.getOriginVertexId(i[e]),h=this.getOriginVertexId(i[r.prevCorner(e)]),u=this.getOriginVertexId(i[r.nextCorner(e)]);this.geometry.cal(this.outputGeometry,o,n.pp,a,h,u,s)}return this.lastWriteVertexIndex=s,o}handlerDuplicateVertexInOneLoop(t,e){const r=this.ct,n=this.duplicateVertexCornerMap;var i=t;do{n[i]=e,i=r.prevNeighborCorner(i)}while(i!==t&&i>=0);i=t;do{n[i]=e,i=r.nextNeighborCorner(i)}while(i!==t&&i>=0)}compress(){const t=this.ct;this.writedVertexMap=[];const e=this.visitedVertexMap,r=this.indices,n=r.length;var i=this.geometry.cloneStruct();delete i.indices,i.noParallelogramPrediction=this.noParallelogramPrediction,i.clers=[],i.holes=[],i.handles=[],this.currentFace=-1,this.currentVertex=-1,this.outputGeometry=i;const s=this.boundaryLoops;if(s.length)for(var o=0;o<s.length;o++){var a=s[o];if(!this.visitedFaceMap[t.cornerToFace(a[0])]){this.duplicateVertexCornerMap={},this.accessedMap={};for(var h=0;h<a.length;h++){var u=r[a[h]];this.currentVertex++,this.accessedMap[u]?this.handlerDuplicateVertexInOneLoop(a[h],this.currentVertex+1):(this.accessedMap[u]=1,e[u]=this.currentVertex+1)}this.compressFromCorner(t.nextCorner(a[0]),i),delete this.lastWriteVertexIndex}}this.duplicateVertexCornerMap={};for(o=0;o<n;o+=3)this.compressFromCorner(o,i),delete this.lastWriteVertexIndex;if(0===i.clers.length)throw new Error("AMC Compress Failed For No Face!");return i.mode="CLERS",i}}},function(t,e){t.exports=class{constructor(t,e={}){t&&(this.indices=t,this.onFaceDelete=e.onFaceDelete,this.create())}isFaceCanDelete(t){const e=this.indices,r=e[t],n=e[t+1],i=e[t+2];return r===n||r===i||n===i}markEdge(t,e,r,n,i){var s=t+"-"+e,o=e+"-"+t;if(o in n){if(-1!==i[n[o]])return;i[n[o]]=r,i[r]=n[o]}else n[s]=r}create(){const t=this.indices,e=t.length,r=this.cornerTable=new Array(e);r.fill(-1);const n={};for(var i=0;i<e;i+=3)this.isFaceCanDelete(i)?this.onFaceDelete&&this.onFaceDelete(i/3):(this.markEdge(t[i],t[i+1],i+2,n,r),this.markEdge(t[i+1],t[i+2],i,n,r),this.markEdge(t[i+2],t[i],i+1,n,r));return r}oppositeCorner(t){return this.cornerTable[t]}nextCorner(t){return t<0?-1:t+(t%3==2?-2:1)}prevCorner(t){return t<0?-1:t+(t%3?-1:2)}rightCorner(t){return this.oppositeCorner(this.nextCorner(t))}leftCorner(t){return this.oppositeCorner(this.prevCorner(t))}nextNeighborCorner(t){return this.nextCorner(this.rightCorner(t))}prevNeighborCorner(t){return this.prevCorner(this.leftCorner(t))}rightmostCorner(t){this.indices;for(var e=this.rightCorner(t),r=-1;-1!==e&&r!==t;)r=this.nextCorner(e),e=this.rightCorner(r);return r}leftmostCorner(t){this.indices;for(var e=this.leftCorner(t),r=-1;-1!==e&&r!==t;)r=this.prevCorner(e),e=this.rightCorner(e);return-1===r?t:r}cornerToFace(t){return Math.floor(t/3)}rightFace(t){return this.cornerToFace(this.rightCorner(t))}leftFace(t){return this.cornerToFace(this.leftCorner(t))}isCornerCanReach(t,e){var r=t;do{if((r=this.nextNeighborCorner(r))===e)return!0}while(r>=0&&r!==t);r=t;do{if((r=this.prevNeighborCorner(r))===e)return!0}while(r>=0&&r!==t);return!1}}},function(t,e,r){const n=r(38).RBTree;t.exports=function(t){const e=function(t){return function(e,r){for(var n=0,i=0;i<t.attrs.length;i++){var s=t.attrs[i];if("TANGENT"!==s.name)for(var o=e*s.itemCount,a=r*s.itemCount,h=0;h<s.itemCount;h++)if(n=s.data[o+h]-s.data[a+h])return n}return n}}(t),r=new n(e),i=t.getAttrLength(),s={};for(var o=0;o<i;o++){var a=r.find(o);null==a?r.insert(o):s[o]=a}const h=t.indices;for(o=h.length-1;o>=0;o--)h[o]in s&&(h[o]=s[h[o]])}},function(t,e,r){t.exports={RBTree:r(39),BinTree:r(40)}},function(t,e,r){var n=r(17);function i(t){this.data=t,this.left=null,this.right=null,this.red=!0}function s(t){this._root=null,this._comparator=t,this.size=0}function o(t){return null!==t&&t.red}function a(t,e){var r=t.get_child(!e);return t.set_child(!e,r.get_child(e)),r.set_child(e,t),t.red=!0,r.red=!1,r}function h(t,e){return t.set_child(!e,a(t.get_child(!e),!e)),a(t,e)}i.prototype.get_child=function(t){return t?this.right:this.left},i.prototype.set_child=function(t,e){t?this.right=e:this.left=e},s.prototype=new n,s.prototype.insert=function(t){var e=!1;if(null===this._root)this._root=new i(t),e=!0,this.size++;else{var r=new i(void 0),n=0,s=0,u=null,c=r,f=null,l=this._root;for(c.right=this._root;;){if(null===l?(l=new i(t),f.set_child(n,l),e=!0,this.size++):o(l.left)&&o(l.right)&&(l.red=!0,l.left.red=!1,l.right.red=!1),o(l)&&o(f)){var d=c.right===u;l===f.get_child(s)?c.set_child(d,a(u,!s)):c.set_child(d,h(u,!s))}var p=this._comparator(l.data,t);if(0===p)break;s=n,n=p<0,null!==u&&(c=u),u=f,f=l,l=l.get_child(n)}this._root=r.right}return this._root.red=!1,e},s.prototype.remove=function(t){if(null===this._root)return!1;var e=new i(void 0),r=e;r.right=this._root;for(var n=null,s=null,u=null,c=1;null!==r.get_child(c);){var f=c;s=n,n=r,r=r.get_child(c);var l=this._comparator(t,r.data);if(c=l>0,0===l&&(u=r),!o(r)&&!o(r.get_child(c)))if(o(r.get_child(!c))){var d=a(r,c);n.set_child(f,d),n=d}else if(!o(r.get_child(!c))){var p=n.get_child(!f);if(null!==p)if(o(p.get_child(!f))||o(p.get_child(f))){var _=s.right===n;o(p.get_child(f))?s.set_child(_,h(n,f)):o(p.get_child(!f))&&s.set_child(_,a(n,f));var g=s.get_child(_);g.red=!0,r.red=!0,g.left.red=!1,g.right.red=!1}else n.red=!1,p.red=!0,r.red=!0}}return null!==u&&(u.data=r.data,n.set_child(n.right===r,r.get_child(null===r.left)),this.size--),this._root=e.right,null!==this._root&&(this._root.red=!1),null!==u},t.exports=s},function(t,e,r){var n=r(17);function i(t){this.data=t,this.left=null,this.right=null}function s(t){this._root=null,this._comparator=t,this.size=0}i.prototype.get_child=function(t){return t?this.right:this.left},i.prototype.set_child=function(t,e){t?this.right=e:this.left=e},s.prototype=new n,s.prototype.insert=function(t){if(null===this._root)return this._root=new i(t),this.size++,!0;for(var e=0,r=null,n=this._root;;){if(null===n)return n=new i(t),r.set_child(e,n),ret=!0,this.size++,!0;if(0===this._comparator(n.data,t))return!1;e=this._comparator(n.data,t)<0,r=n,n=n.get_child(e)}},s.prototype.remove=function(t){if(null===this._root)return!1;var e=new i(void 0),r=e;r.right=this._root;for(var n=null,s=null,o=1;null!==r.get_child(o);){n=r,r=r.get_child(o);var a=this._comparator(t,r.data);o=a>0,0===a&&(s=r)}return null!==s&&(s.data=r.data,n.set_child(n.right===r,r.get_child(null===r.left)),this._root=e.right,this.size--,!0)},t.exports=s},function(t,e,r){const n=r(15).SmartBuffer,i=r(5);r(11);t.exports={write:function(t,e=new n){if(function(t,e){e.writeUInt8(1),e.writeUInt32LE(t.clers.length),e.writeUInt32LE(t.getAttrLength()),e.writeUInt8(t.attrs.length),e.writeUInt8(t.noParallelogramPrediction?1:0),e.writeUInt16LE(t.holes.length),e.writeUInt16LE(t.handles.length/2)}(t,e),t.holes.forEach(t=>{e.writeUInt16LE(t)}),t.handles.length)for(var r=0;r<t.handles.length;r+=2)e.writeUInt32LE(t.handles[r]),e.writeUInt32LE(t.handles[r+1]);t.clers.forEach(t=>{e.writeUInt8(t)}),t.attrs.forEach(t=>{const r=t.name?i.ATTR_NAME_ID[t.name]:7;e.writeUInt16LE(r),e.writeUInt8(t.itemCount),e.writeUInt8(t.quantizationBit||0),e.writeFloatLE(t.min||0),e.writeFloatLE(t.max||0);for(var n=t.data,s=n.length,o=0;o<s;o++)e.writeInt16LE(n[o]||0)})}}},function(t,e,r){const n=r(5),i=r(43),s=r(44),o=r(45),a=r(46),h=[i],u=[s];function c(t,e=0){return t instanceof Uint8Array&&(e=t.byteOffset,t=t.buffer),function(t){return new h[t.type](t).decompress()}(function(t,e){const r=new Uint8Array(t,e,4);if(65!==r[0]||77!==r[1]||67!==r[2])throw new Error("The file is not AMC format!");const n=u[r[3]].read(t,e+4);return n.geometry.type=r[3],n.geometry}(t,e))}var f,l=null,d=null;function p(t,e){return!l&&a()?(l=new o({wasmURL:t,memPages:e}),d=l.init()):d||Promise.resolve()}function _(t,e,r){if(l||p(e,r),!l||!l.isReady)return c(t);try{return l.decompress(t)}catch(e){return console.warn("wasm decompress error",e),c(t)}}var g=null;function m(t){return t=t||"https://g.alicdn.com/hilo/amc/0.1.26/worker.js",g||(!1===f||"undefined"==typeof Worker?Promise.reject("dont support web worker"):g=/^(?:http|blob|data:|\/\/)/.test(t)?new Promise((e,r)=>{var n=new XMLHttpRequest;n.addEventListener("load",function(){if("undefined"==typeof URL||"undefined"==typeof Blob)f=new Worker(`data:application/javascript, ${this.responseText}`);else{const t=URL.createObjectURL(new Blob([this.responseText]));f=new Worker(t)}f.onerror=t=>{console.log("web worker error",t),f=!1,r(t)},e(f)}),n.addEventListener("error",t=>r(t)),n.open("get",t,!0),n.send()}):new Promise((e,r)=>{(f=new Worker(t)).onerror=t=>{console.log("web worker init error",t),f=!1,r(t)},e(f)}))}var v=0;function w(t,e,r,i){return e=e&&a(),t=new Uint8Array(t),m(i).then(i=>new Promise((s,o)=>{const a=v++;var h=e=>{if(e.data.id===a)if(i.removeEventListener("message",h),h=null,e.data.data){const t=e.data.data;t.constructor=n,t.__proto__=n.prototype,s(t)}else s(c(t))};i.addEventListener("message",h),i.postMessage({id:a,data:t,useWASM:e,wasmURL:r},[t.buffer])})).catch(n=>e?_(t,r):c(t))}t.exports={initWASM:p,initWorker:m,decompress:function(t,e,r){const n=a();return!n||t.byteLength>1048576?w(t,n,e,r):n?Promise.resolve(_(t,e)):Promise.resolve(c(t))},decompressWithJS:c,decompressWithWASM:_,decompressWithWorker:w}},function(t,e,r){const n=r(5),i=(r(16),r(11)),o=i.map;t.exports=class{constructor(t){this.geometry=t,this.faceCount=t.clers.length,this.clers=t.clers,this.holes=t.holes,this.handles=t.handles,this.createHandleMap(this.handles),this.vertexCount=t.getAttrLength(),this.noParallelogramPrediction=!!t.noParallelogramPrediction}nextCorner(t){return t<0?-1:t+(t%3==2?-2:1)}prevCorner(t){return t<0?-1:t+(t%3?-1:2)}createHandleMap(t){const e=this.handlesMap={};if(t)for(var r=t.length-1;r>=0;r-=2)e[t[r]]=t[r-1]}mapBoundary(t){const e=this.indices,r=t.length;for(var n=this.currentVertex,i=this.currentVertex-r+1,s=r-1;s>=0;s--)e[this.nextCorner(t[s])]=n,n=i,e[this.prevCorner(t[s])]=i++;this.currentVertex-=r}mapHoleBoundary(t){const e=this.indices,r=t.length;for(var n=this.currentVertex-r+1,i=n,s=r-1;s>=0;s--)e[this.nextCorner(t[s])]=n++,e[this.prevCorner(t[s])]=s?n:i;this.currentVertex-=r}fixNegativeIndex(t){const e=t,r=this.indices;for(;r[t]<0;){if(e===-r[-r[t]]||r[t]===r[-r[t]]){console.warn("dead loop bug!!"),r[s]=0;break}r[t]=r[-r[t]]}}fixIndicesAndReadVertice(){const t=this.indices,e=this.handlesMap,r=this.clers,n=r.length;var s,o=-1;const a=[];for(var h=0,u=0;h<n;h++,u+=3)-1===o?(this.fixNegativeIndex(u+1),this.fixNegativeIndex(u+2)):(t[u+1]=t[this.prevCorner(o)],t[u+2]=t[this.nextCorner(o)]),this.fixNegativeIndex(u),-1===o?(this.readVertex(t[u+2]),this.readVertex(t[u+1]),this.readVertex(t[u])):this.readVertex(t[u],o),o=u+1,(s=r[h])!==i.S||e[h]?s===i.E||s===i.F?o=a.pop():s===i.R&&(o=u+2):a.push(u+2),s===i.F&&(o=-1,delete this.lastReadVertexIndex),this._onDecompressFace(h,s)}readVertex(t,e=-1){if(this.readedVertexMap[t])return;if(this.readedVertexMap[t]=1,this.noParallelogramPrediction)return;const r=this.indices,i=this.geometry;-1===e?void 0!==this.lastReadVertexIndex&&i.cal(i,t,n.plus,this.lastReadVertexIndex,t):i.cal(i,t,n.depp,r[e],r[this.prevCorner(e)],r[this.nextCorner(e)],t),this.lastReadVertexIndex=t}markCorner(t,e){const r=this.indices;void 0===r[this.nextCorner(t)]&&(r[this.nextCorner(t)]=-this.prevCorner(e[0])),void 0===r[this.prevCorner(t)]&&(r[this.prevCorner(t)]=-this.nextCorner(e[e.length-1]))}onFaceC(t){const e=this.indices,r=3*this.currentFace,n=this.currentVertex--;e[r]=n;var i=t.pop();return e[this.nextCorner(i)]=n,e[this.prevCorner(i)]=-this.nextCorner(t[t.length-1]),i=t.shift(),e[this.prevCorner(i)]=n,e[this.nextCorner(i)]=-this.prevCorner(t[0]),t.push(r),t}onFaceL(t){const e=3*this.currentFace;return this.markCorner(t.pop(),t),t.unshift(e+2),t.push(e),t}onFaceF(t,e){return t&&this.mapBoundary(t),this.onFaceE(null,e)}onFaceE(t,e){const r=3*this.currentFace;return t&&e.push(t),[r+2,r+1,r]}onFaceR(t){const e=3*this.currentFace;return this.markCorner(t.pop(),t),t.push(e+1,e),t}onHandleEnd(t,e,r){const n=this.indices,i=3*this.currentFace,s=this.handlesMap[this.currentFace],o=e.splice(0,t);return e.shift(),r.push(o),n[this.nextCorner(s)]=-(i+1),n[this.prevCorner(s)]=-this.nextCorner(o[o.length-1]),n[i]=-this.prevCorner(o[0]),e.push(i),e}onHandleStart(t,e){const r=this.indices,n=3*this.currentFace,i=this.handlesMap[this.currentFace];for(var s,o=e.length-1;o>=0;o--){var a=e[o].indexOf(i);if(a>=0){var h=(s=e.splice(o,1)[0]).splice(0,a);s.shift(),s.push(...h);break}}return r[this.nextCorner(i)]=-(n+1),r[this.prevCorner(i)]=-this.nextCorner(s[s.length-1]),r[n]=-this.prevCorner(t[0]),(t=s.concat(t)).push(n),t}onFaceS(t,e,r){const n=this.handlesMap,i=this.indices,s=3*this.currentFace;if(n[this.currentFace]){this.markCorner(t.pop(),t);const e=t.indexOf(n[this.currentFace]);t=e>=0?this.onHandleEnd(e,t,r):this.onHandleStart(t,r)}else{const r=t.pop();this.markCorner(r,t),i[s]=-this.nextCorner(r);const n=e.pop();this.markCorner(n.pop(),n),(t=n.concat(t)).push(s)}return t}onFaceM(t,e,r){const n=this.indices,i=3*this.currentFace,s=t.splice(0,this.holes[this.currentHole--]);this.mapHoleBoundary(s);const o=n[this.prevCorner(s[0])];n[i]=o;var a=t.pop();return n[this.prevCorner(a)]=-this.nextCorner(t[t.length-1]),n[this.nextCorner(a)]=o,a=t.shift(),n[this.prevCorner(a)]=o,n[this.nextCorner(a)]=-this.prevCorner(t[0]),t.push(i),t}decompress(){this.readedVertexMap=new Uint8Array(this.vertexCount);const t=this.faceCount,e=this.indices=new Array(3*t);this.currentFace=t-1,this.currentVertex=this.vertexCount-1,this.currentHole=this.holes.length-1;const r=this.clers,n=[],i=[];for(var s;this.currentFace>=0;){var a="onFace"+o[r[this.currentFace]];this[a]?s=this[a](s,n,i):console.warn(`has no ${a}`),this.currentFace--}return this.mapBoundary(s),this.fixIndicesAndReadVertice(this.indices),this.geometry.indices=e,this.geometry.dequantize(),this.geometry}_onDecompressFace(t,e){this.onDecompressFace&&this.onDecompressFace(t,e)}}},function(t,e,r){const n=r(5);function i(t,e,r,n){return new t(e.slice(r,r+n*t.BYTES_PER_ELEMENT))}t.exports={read:function(t,e=0){const r=new DataView(t),s=new n;var o=function(t,e){const r={};return r.version=t.getUint8(e++),r.faceCount=t.getUint32(e,!0),e+=4,r.vertexCount=t.getUint32(e,!0),e+=4,r.attrCount=t.getUint8(e++),r.noParallelogramPrediction=t.getUint8(e++),r.holesCount=t.getUint16(e,!0),e+=2,r.handlesCount=t.getUint16(e,!0),e+=2,r.headerBytes=15,r}(r,e);return e+=o.headerBytes,s.mode="CLERS",e=function(t,e,r,n){return n.holesCount?(t.holes=i(Uint16Array,e.buffer,r,n.holesCount),r+2*n.holesCount):(t.holes=[],r)}(s,r,e,o),e=function(t,e,r,n){return n.handlesCount?(t.handles=i(Uint32Array,e.buffer,r,2*n.handlesCount),r+8*n.handlesCount):(t.handles=[],r)}(s,r,e,o),e=function(t,e,r,n){return t.clers=new Uint8Array(e.buffer,r,n.faceCount),r+n.faceCount}(s,r,e,o),e=function(t,e,r,n){for(var s=0;s<n.attrCount;s++){let s={},o=e.getUint16(r,!0);r+=2,s.name=t.attrIdToName(o),s.itemCount=e.getUint8(r++),s.quantizationBit=e.getUint8(r++),s.min=e.getFloat32(r,!0),r+=4,s.max=e.getFloat32(r,!0),r+=4,s.data=i(Int16Array,e.buffer,r,s.itemCount*n.vertexCount),r+=s.itemCount*n.vertexCount*2,t.attrs.push(s)}return r}(s,r,e,o),{header:o,geometry:s,offset:e}}}},function(t,e,r){const n=r(5);t.exports=class{constructor(t={}){this.wasmURL=t.wasmURL||"https://ossgw.alicdn.com/tmall-c3/tmx/70b8d82ccf33e97a124e54c2d6a3e0c7.wasm",this.memPages=t.memPages||256,this.memPages<256&&(this.memPages=256),this.isReady=!1}initASMJS(){this.isReady=!0,this.dv=new DataView(HEAP8.buffer),this.heap8=HEAP8,this.ins={exports:{__Z7AMCinitj:Module.__Z7AMCinitj,__Z12AMDecompressv:Module.__Z12AMDecompressv}}}init(){const t=this.memory=new WebAssembly.Memory({initial:this.memPages});this.dv=new DataView(t.buffer);const e=this.heap8=new Uint8Array(t.buffer),r={global:{NaN:5,Infinity:6},env:{memoryBase:0,memory:t,_malloc:function(){return 2097152},_memset:function(t,r,n){return e.fill(r,t,t+n),t},_printf:function(t,r){for(var n=t;e[n];)n++;var i=String.fromCharCode(...e.slice(t,n)),s=0;i=i.replace(/%([duf])/g,function(t,e){return"d"===e||"u"===e?dv.getInt32(r+4*s++,!0):"f"===e?dv.getFloat32(r+4*s++,!0):void 0}),console.log(i)}}};return fetch(this.wasmURL).then(t=>t.arrayBuffer()).then(t=>WebAssembly.instantiate(t,r)).then(t=>{this.module=t,this.ins=t.instance,this.isReady=!0}).catch(t=>console.log("wasm load error, use js ver"))}getDataAddr(t){return this.ins.exports.__Z7AMCinitj(t)}decompress(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));const e=this.dv,r=this.heap8,i=this.getDataAddr(t.length);r.set(t,i);const s=this.ins.exports.__Z12AMDecompressv();if(s<=0)throw console.error("decompression error code: "+s),new Error("decompression error code: "+s);const o=e.getUint32(s,!0),a=e.getUint32(s+4,!0),h=e.getUint32(s+8,!0),u=e.getUint32(s+12,!0),c=[];for(var f=0;f<u;f++){var l=s+16+12*f;c.push([e.getUint32(l,!0),e.getUint32(l+4,!0),e.getUint32(l+8,!0)])}var d=new Uint32Array(e.buffer,a,3*o);d=h>65536?new Uint32Array(d):new Uint16Array(d);var p=new n(d);return c.forEach(t=>{const[r,n,i]=t,s=new Float32Array(e.buffer.slice(i,i+h*n*4));p.addAttr(p.attrIdToName(r),s,n)}),p}}},function(t,e){function r(){if("undefined"==typeof WebAssembly||"undefined"==typeof fetch||function(){if(!/iPad|iPhone|iPod/i.test(navigator.userAgent))return!1;if(/OS (\d+)_(\d+)_?(\d+)?/i.test(navigator.userAgent)){const t=Number(RegExp.$1),e=Number(RegExp.$2);if(11===t&&e>=3||t>11)return!1}return!0}())return!1;try{const t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)}catch(t){return console.log("err while check WebAssembly",t),!1}}var n;t.exports=function(){return void 0===n&&(n=r()),n}}]);
{
"name": "amc",
"version": "1.0.4",
"version": "1.0.5",
"description": "Ali Mesh Compression & Ant Man Comprssion",

@@ -5,0 +5,0 @@ "main": "build/index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc