You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
27 KiB

1 month ago
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).msgpackr={})}(this,(function(e){"use strict";var t,r,n;try{t=new TextDecoder}catch(e){}var i,s,o,u,a,l=0,c={},f=0,h=0,g=[],p={useRecords:!1,mapsAsObjects:!0};class d{}const y=new d;y.name="MessagePack 0xC1";var w=!1,b=2;try{new Function("")}catch(e){b=1/0}class m{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.sequential&&!1!==e.trusted&&(e.trusted=!0,e.structures||0==e.useRecords||(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(r)return K((()=>(Z(),this?this.unpack(e,t):m.prototype.unpack.call(p,e,t))));e.buffer||e.constructor!==ArrayBuffer||(e="undefined"!=typeof Buffer?Buffer.from(e):new Uint8Array(e)),"object"==typeof t?(n=t.end||e.length,l=t.start||0):(l=0,n=t>-1?t:e.length),h=0,s=null,o=null,r=e;try{a=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(r=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof m){if(c=this,this.structures)return i=this.structures,S(t);(!i||i.length>0)&&(i=[])}else c=p,(!i||i.length>0)&&(i=[]);return S(t)}unpackMultiple(e,t){let r,n=0;try{w=!0;let i=e.length,s=this?this.unpack(e,i):Q.unpack(e,i);if(!t){for(r=[s];l<i;)n=l,r.push(S());return r}if(!1===t(s,n,l))return;for(;l<i;)if(n=l,!1===t(S(),n,l))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{w=!1,Z()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map((e=>e.slice(0))));for(let t=0,r=e.length;t<r;t++){let r=e[t];r&&(r.isShared=!0,t>=32&&(r.highByte=t-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],i=t[r];i&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function S(e){try{if(!c.trusted&&!w){let e=i.sharedLength||0;e<i.length&&(i.length=e)}let e;if(c.randomAccessStructure&&r[l]<64&&r[l],e=A(),o&&(l=o.postBundlePosition,o=null),w&&(i.restoreStructures=null),l==n)i&&i.restoreStructures&&U(),i=null,r=null,u&&(u=null);else{if(l>n)throw new Error("Unexpected end of MessagePack data");if(!w){let t;try{t=JSON.stringify(e,((e,t)=>"bigint"==typeof t?`${t}n`:t)).slice(0,100)}catch(e){t="(JSON view not available "+e+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw i&&i.restoreStructures&&U(),Z(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||l>n)&&(e.incomplete=!0),e}}function U(){for(let e in i.restoreStructures)i[e]=i.restoreStructures[e];i.restoreStructures=null}function A(){let e=r[l++];if(e<160){if(e<128){if(e<64)return e;{let t=i[63&e]||c.getStructures&&O()[63&e];return t?(t.read||(t.read=E(t,63&e)),t.read()):e}}if(e<144){if(e-=128,c.mapsAsObjects){let t={};for(let r=0;r<e;r++){let e=C();"__proto__"===e&&(e="__proto_"),t[e]=A()}return t}{let t=new Map;for(let r=0;r<e;r++)t.set(A(),A());return t}}{e-=144;let t=new Array(e);for(let r=0;r<e;r++)t[r]=A();return c.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(h>=l)return s.slice(l-f,(l+=t)-f);if(0==h&&n<140){let e=t<16?V(t):R(t);if(null!=e)return e}return v(t)}{let t;switch(e){case 192:return null;case 193:return o?(t=A(),t>0?o[1].slice(o.position1,o.position1+=t):o[0].slice(o.position0,o.position0-=t)):y;case 194:return!1;case 195:return!0;case 196:if(t=r[l++],void 0===t)throw new Error("Unexpected end of buffer");return N(t);case 197:return t=a.getUint16(l),l+=2,N(t);case 198:return t=a.getUint32(l),l+=4,N(t);case 199:return L(r[l++]);case 200:return t=a.getUint16(l),l+=2,L(t);case 201:return t=a.getUint32(l),l+=4,L(t);case 202:if(t=a.getFloat32(l),c.useFloat32>2){let e=
//# sourceMappingURL=index.min.js.map