Comparing version 0.5.4 to 0.6.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.msgpackr=t():e.msgpackr=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";let n=r(1),i=n.Unpackr,s=n.mult10,o=n.C1Type;const u=n.typedArrays;let l,a,c;try{l=new TextEncoder}catch(e){}const f=Symbol("record-id");t.Packr=class extends i{constructor(e){super(e),this.offset=0;let t,r,n,i,o,u,p=new d(8192),g=new DataView(p.buffer,0,8192),y=0,w=0,U=p.utf8Write?function(e,t,r){return p.utf8Write(e,t,r)}:!(!l||!l.encodeInto)&&function(e,t){return l.encodeInto(e,p.subarray(t)).written},k=this,m=32,v=e&&e.sequential;v&&(m=0,this.structures=[]);let x=[],A=0,j=0;if(this.structures&&this.structures.length>m)throw new Error("Too many shared structures");this.pack=function(e){if(y=k.offset,r=p.length-10,r-y<2048&&(p=new d(p.length),g=new DataView(p.buffer,0,p.length),r=p.length-10,y=0),t=y,u=k.structuredClone?new Map:null,n=k.structures,n){n.uninitialized&&(k.structures=n=k.getStructures());let e=n.length;if(e>m&&!v&&(e=m),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let t=0,n=e.length;t<n;t++){let n=e[t];r=i[n],r||(r=i[n]=Object.create(null)),i=r}i[f]=t+64}w=n.length}v||(n.nextId=e+64)}i&&(i=!1),o=n||[];try{if(O(e),k.offset=y,u&&u.idsToInsert){y+=6*u.idsToInsert.length,y>r&&E(y),k.offset=y;let e=function(e,t){let r,n=6*t.length,i=e.length-n;t.sort((e,t)=>e.offset>t.offset?1:-1);for(;r=t.pop();){let t=r.offset,s=r.id;e.copyWithin(t+n,t,i),n-=6;let o=t+n;e[o++]=214,e[o++]=105,e[o++]=s<<24,e[o++]=s<<16&255,e[o++]=s<<8&255,e[o++]=255&s,i=t}return e}(p.subarray(t,y),u.idsToInsert);return u=null,e}return p.subarray(t,y)}finally{if(n){if(j<10&&j++,A>5e3)n.transitions=null,j=0,A=0,x.length>0&&(x=[]);else if(x.length>0&&!v){for(let e=0,t=x.length;e<t;e++)x[e][f]=0;x=[]}if(i&&k.saveStructures){if(k.structures.length>m&&(k.structures=k.structures.slice(0,m)),!1===k.saveStructures(k.structures,w))return k.structures=k.getStructures()||[],k.pack(e);w=k.structures.length}}}};const O=e=>{y>r&&(p=E(y));var n,i=typeof e;if("string"===i){let t,i=e.length;t=i<32?1:i<256?2:i<65536?3:5;let s=3*i;if(y+s>r&&(p=E(y+s)),i<64||!U){let r,s,o,u=y+t;for(r=0;r<i;r++)s=e.charCodeAt(r),s<128?p[u++]=s:s<2048?(p[u++]=s>>6|192,p[u++]=63&s|128):55296==(64512&s)&&56320==(64512&(o=e.charCodeAt(r+1)))?(s=65536+((1023&s)<<10)+(1023&o),r++,p[u++]=s>>18|240,p[u++]=s>>12&63|128,p[u++]=s>>6&63|128,p[u++]=63&s|128):(p[u++]=s>>12|224,p[u++]=s>>6&63|128,p[u++]=63&s|128);n=u-y-t}else n=U(e,y+t,s);n<32?p[y++]=160|n:n<256?(t<2&&p.copyWithin(y+2,y+1,y+1+n),p[y++]=217,p[y++]=n):n<65536?(t<3&&p.copyWithin(y+3,y+2,y+2+n),p[y++]=218,p[y++]=n>>8,p[y++]=255&n):(t<5&&p.copyWithin(y+5,y+3,y+3+n),p[y++]=219,g.setUint32(y,n),y+=4),y+=n}else if("number"===i)if(e>>>0===e)e<64?p[y++]=e:e<256?(p[y++]=204,p[y++]=e):e<65536?(p[y++]=205,p[y++]=e>>8,p[y++]=255&e):(p[y++]=206,g.setUint32(y,e),y+=4);else if(e>>0===e)e>=-32?p[y++]=256+e:e>=-128?(p[y++]=208,p[y++]=e+256):e>=-32768?(p[y++]=209,g.setInt16(y,e),y+=2):(p[y++]=210,g.setInt32(y,e),y+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let r;if(p[y++]=202,g.setFloat32(y,e),t<4||(r=e*s[(127&p[y])<<1|p[y+1]>>7])>>0===r)return void(y+=4);y--}p[y++]=203,g.setFloat64(y,e),y+=8}else if("object"===i)if(e){if(u){let r=u.get(e);if(r){if(!r.id){let e=u.idsToInsert||(u.idsToInsert=[]);r.id=e.push(r)}return p[y++]=214,p[y++]=112,g.setUint32(y,r.id),void(y+=4)}u.set(e,{offset:y-t})}let i=e.constructor;if(i===Object)I(e,!0);else if(i===Array){(n=e.length)<16?p[y++]=144|n:n<65536?(p[y++]=220,p[y++]=n>>8,p[y++]=255&n):(p[y++]=221,g.setUint32(y,n),y+=4);for(let t=0;t<n;t++)O(e[t])}else if(i===Map){(n=e.size)<16?p[y++]=128|n:n<65536?(p[y++]=222,p[y++]=n>>8,p[y++]=255&n):(p[y++]=223,g.setUint32(y,n),y+=4);for(let[t,r]of e)O(t),O(r)}else{for(let t=0,n=a.length;t<n;t++){if(e instanceof c[t]){let n=a[t],i=n.pack.call(this,e,e=>(y+=e,y>r&&E(y),{target:p,targetView:g,position:y-e}),O);return void(i&&(y=b(i,p,y,n.type)))}}I(e,!1)}}else p[y++]=192;else if("boolean"===i)p[y++]=e?195:194;else if("bigint"===i)p[y++]=211,e<0x8000000000000000&&e>-0x8000000000000000?g.setBigInt64(y,e):g.setFloat64(y,e),y+=8;else{if("undefined"!==i)throw new Error("Unknown type "+i);p[y++]=212,p[y++]=0,p[y++]=0}},I=!1===this.useRecords?this.variableMapSize?e=>{let t,r=Object.keys(e),n=r.length;n<16?p[y++]=128|n:n<65536?(p[y++]=222,p[y++]=n>>8,p[y++]=255&n):(p[y++]=223,g.setUint32(y,n),y+=4);for(let i=0;i<n;i++)O(t=r[i]),O(e[t])}:(e,r)=>{p[y++]=222;let n=y-t;y+=2;let i=0;for(let t in e)(r||e.hasOwnProperty(t))&&(O(t),O(e[t]),i++);p[n+++t]=i>>8,p[n+t]=255&i}:e=>{let t,r,s=Object.keys(e),u=o.transitions||(o.transitions=Object.create(null));for(let e=0,n=s.length;e<n;e++){let n=s[e];t=u[n],t||(t=u[n]=Object.create(null),r=!0),u=t}let l=u[f];l?p[y++]=l:(l=o.nextId++,l||(l=64,o.nextId=65),l>=128&&(o.nextId=(l=m+64)+1),u[f]=l,o[63&l]=s,n&&n.length<=m?(p[y++]=l,i=!0):(p[y++]=212,p[y++]=114,p[y++]=l,r&&(A+=j),x.length>=64-m&&(x.shift()[f]=0),x.push(u),O(s)));for(let t=0,r=s.length;t<r;t++)O(e[s[t]])},E=e=>{let n=1+(Math.max(e-t<<2,p.length-1)>>12)<<12,i=new d(n);return g=new DataView(i.buffer,0,n),p.copy?p.copy(i,0,t,e):h(p,i,0,t,e),y-=t,t=0,r=i.length-10,p=i}}encode(e){return this.pack(e)}resetMemory(){this.offset=0}};const p="undefined"!=typeof Buffer,d=p?Buffer.allocUnsafeSlow:Uint8Array,g=p?Buffer:Uint8Array;function h(e,t,r,n,i){for(;n<i;)t[r++]=e[n++]}function y(e,t,r){let n=e.byteLength,{target:i,position:s,targetView:o}=r(7+n);i[s++]=201,o.setUint32(s,n+1),s+=4,i[s++]=116,i[s++]=t,p?Buffer.from(e).copy(i,s):h(new Uint8Array(e),i,s,0,n)}function w(e,t){let r=e.byteLength;var n,i;if(r<256){var{target:n,position:i}=t(r+2);n[i++]=196,n[i++]=r}else if(r<65536){var{target:n,position:i}=t(r+3);n[i++]=197,n[i++]=r>>8,n[i++]=255&r}else{var{target:n,position:i,targetView:s}=t(r+5);n[i++]=198,s.setUint32(i,r),i+=4}e.copy?e.copy(n,i):h(e,n,i,0,r)}function b(e,t,r,n){let i=e.length;switch(i){case 1:t[r++]=212;break;case 2:t[r++]=213;break;case 4:t[r++]=214;break;case 8:t[r++]=215;break;case 16:t[r++]=216;break;default:i<256?(t[r++]=199,t[r++]=i):i<65536?(t[r++]=200,t[r++]=i<<8,t[r++]=255&i):(t[r++]=201,t[r++]=i<<24,t[r++]=i<<16&255,t[r++]=i<<8&255,t[r++]=255&i)}return t[r++]=n,e.copy?e.copy(t,r):h(e,t,r,0,i),r+=i}c=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,o],a=[{pack(e,t){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<17179869184){let{target:n,targetView:i,position:s}=t(10);n[s++]=215,n[s++]=255,i.setUint32(s,4e6*e.getMilliseconds()+(r/1e3/4294967296>>0)),i.setUint32(s+4,r)}else{let{target:n,targetView:i,position:s}=t(15);n[s++]=199,n[s++]=12,n[s++]=255,i.setUint32(s,1e6*e.getMilliseconds()),i.setBigInt64(s+4,BigInt(Math.floor(r)))}}},{pack(e,t,r){let n=Array.from(e);if(this.structuredClone){let{target:e,position:r}=t(3);e[r++]=212,e[r++]=115,e[r++]=0}r(n)}},{pack(e,t,r){if(this.structuredClone){let{target:e,position:r}=t(3);e[r++]=212,e[r++]=101,e[r++]=0}r([e.name,e.message])}},{pack(e,t,r){if(this.structuredClone){let{target:e,position:r}=t(3);e[r++]=212,e[r++]=120,e[r++]=0}r([e.source,e.flags])}},{pack(e,t){this.structuredClone?y(e,16,t):w(p?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let r=e.constructor;r!==g&&this.structuredClone?y(e.buffer,u.indexOf(r.name),t):w(e,t)}},{pack(e,t){let{target:r,position:n}=t(1);r[n]=193}}],t.addExtension=function(e){if(e.Class){if(!e.pack)throw new Error("Extension has no pack function");c.unshift(e.Class),a.unshift(e)}n.addExtension(e)}},function(e,t,r){"use strict";(function(e){let r,n,i;try{r=new TextDecoder}catch(e){}let s=0;const o=[];let u,l,a,c=o,f=0,p={},d=0,g=0,h=[],y={useRecords:!1,mapsAsObjects:!0};class w{}const b=new w;b.name="MessagePack 0xC1";class U{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&!e.structures&&((e.structures=[]).uninitialized=!0)),Object.assign(this,e)}unpack(e,t,r){if(n)return _(()=>(n=null,this?this.unpack(e,t,r):U.prototype.unpack.call(y,e,t,r)));if(i=t>-1?t:e.length,s=0,f=0,g=0,u=null,c=o,n=e,a=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength)),this)if(p=this,this.structures){k=this.structures;try{return m()}finally{(s>=i||!r)&&(k=null,n=null,l&&(l=null))}}else(!k||k.length>0)&&(k=[]);else p=y;try{return m()}finally{n=null,l&&(l=null)}}decode(e,t){return this.unpack(e,t)}}let k;function m(){let e=n[s++];if(e<160){if(e<128){if(e<64)return e;{let t=k[63&e];if(t)return t.read||(t.read=x(t)),t.read();if(p.getStructures){let r=_(()=>(n=null,p.getStructures()));return!0===k?p.structures=k=r:k.splice.apply(k,[0,r.length].concat(r)),t=k[63&e],t?(t.read||(t.read=x(t)),t.read()):e}return e}}if(e<144){if(e-=128,p.mapsAsObjects){let t={};for(let r=0;r<e;r++)t[m()]=m();return t}{let t=new Map;for(let r=0;r<e;r++)t.set(m(),m());return t}}{e-=144;let t=new Array(e);for(let r=0;r<e;r++)t[r]=m();return t}}if(e<192){let t=e-160;if(g>=s)return u.slice(s-d,(s+=t)-d);if(0==g&&i<120&&t<16){let e=P(t);if(null!=e)return e}return A(t)}{let t;switch(e){case 192:return null;case 193:return b;case 194:return!1;case 195:return!0;case 196:return T(n[s++]);case 197:return t=a.getUint16(s),s+=2,T(t);case 198:return t=a.getUint32(s),s+=4,T(t);case 199:return B(n[s++]);case 200:return t=a.getUint16(s),s+=2,B(t);case 201:return t=a.getUint32(s),s+=4,B(t);case 202:if(t=a.getFloat32(s),p.useFloat32>2){let e=L[(127&n[s])<<1|n[s+1]>>7];return s+=4,(e*t+(t>0?.5:-.5)>>0)/e}return s+=4,t;case 203:return t=a.getFloat64(s),s+=8,t;case 204:return n[s++];case 205:return t=a.getUint16(s),s+=2,t;case 206:return t=a.getUint32(s),s+=4,t;case 207:return p.uint64AsNumber?72057594037927940*n[s++]+281474976710656*n[s++]+1099511627776*n[s++]+4294967296*n[s++]+16777216*n[s++]+(n[s++]<<16)+(n[s++]<<8)+n[s++]:(t=a.getBigUint64(s),s+=8,t);case 208:return a.getInt8(s++);case 209:return t=a.getInt16(s),s+=2,t;case 210:return t=a.getInt32(s),s+=4,t;case 211:return t=a.getBigInt64(s),s+=8,t;case 212:if(t=n[s++],114==t)return D(n[s++]);if(h[t])return h[t]([n[s++]]);throw new Error("Unknown extension "+t);case 213:return B(2);case 214:return B(4);case 215:return B(8);case 216:return B(16);case 217:return t=n[s++],g>=s?u.slice(s-d,(s+=t)-d):j(t);case 218:return t=a.getUint16(s),s+=2,O(t);case 219:return t=a.getUint32(s),s+=4,I(t);case 220:return t=a.getUint16(s),s+=2,S(t);case 221:return t=a.getUint32(s),s+=4,S(t);case 222:return t=a.getUint16(s),s+=2,M(t);case 223:return t=a.getUint32(s),s+=4,M(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}t.Unpackr=U,t.read=m,t.getPosition=()=>s;const v=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function x(e){function t(){if(t.count++>2)return this.read=new Function("r","return function(){return {"+e.map(e=>v.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"}}")(m),this.read();let r={};for(let t=0,n=e.length;t<n;t++){r[e[t]]=m()}return r}return t.count=0,t}let A=E,j=E,O=E,I=E;function E(e){let t;if(e<16&&(t=P(e)))return t;if(e>64&&r)return r.decode(n.subarray(s,s+=e));const i=s+e,o=[];for(t="";s<i;){const e=n[s++];if(0==(128&e))o.push(e);else if(192==(224&e)){const t=63&n[s++];o.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&n[s++],r=63&n[s++];o.push((31&e)<<12|t<<6|r)}else if(240==(248&e)){let t=(7&e)<<18|(63&n[s++])<<12|(63&n[s++])<<6|63&n[s++];t>65535&&(t-=65536,o.push(t>>>10&1023|55296),t=56320|1023&t),o.push(t)}else o.push(e);o.length>=4096&&(t+=C.apply(String,o),o.length=0)}return o.length>0&&(t+=C.apply(String,o)),t}function S(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=m();return t}function M(e){if(p.mapsAsObjects){let t={};for(let r=0;r<e;r++)t[m()]=m();return t}{let t=new Map;for(let r=0;r<e;r++)t.set(m(),m());return t}}t.setExtractor=e=>{function t(t){return function(r){let o=c[f++];null==o&&(c=e(s-t,i,n),f=0,o=c[f++]);let l=o.length;return l<=r?(s+=r,o):(u=o,d=s,g=s+l,s+=r,o.slice(0,r))}}A=t(1),j=t(2),O=t(3),I=t(5)};let C=String.fromCharCode;function P(e){if(e<4){if(e<2){if(0===e)return"";{let e=n[s++];return(128&e)>1?void(s-=1):C(e)}}{let t=n[s++],r=n[s++];if((128&t)>0||(128&r)>0)return void(s-=2);if(e<3)return C(t,r);let i=n[s++];return(128&i)>0?void(s-=3):C(t,r,i)}}{let t=n[s++],r=n[s++],i=n[s++],o=n[s++];if((128&t)>0||(128&r)>0||(128&i)>0||(128&o)>0)return void(s-=4);if(e<6){if(4===e)return C(t,r,i,o);{let e=n[s++];return(128&e)>0?void(s-=5):C(t,r,i,o,e)}}if(e<8){let u=n[s++],l=n[s++];if((128&u)>0||(128&l)>0)return void(s-=6);if(e<7)return C(t,r,i,o,u,l);let a=n[s++];return(128&a)>0?void(s-=7):C(t,r,i,o,u,l,a)}{let u=n[s++],l=n[s++],a=n[s++],c=n[s++];if((128&u)>0||(128&l)>0||(128&a)>0||(128&c)>0)return void(s-=8);if(e<10){if(8===e)return C(t,r,i,o,u,l,a,c);{let e=n[s++];return(128&e)>0?void(s-=9):C(t,r,i,o,u,l,a,c,e)}}if(e<12){let f=n[s++],p=n[s++];if((128&f)>0||(128&p)>0)return void(s-=10);if(e<11)return C(t,r,i,o,u,l,a,c,f,p);let d=n[s++];return(128&d)>0?void(s-=11):C(t,r,i,o,u,l,a,c,f,p,d)}{let f=n[s++],p=n[s++],d=n[s++],g=n[s++];if((128&f)>0||(128&p)>0||(128&d)>0||(128&g)>0)return void(s-=12);if(e<14){if(12===e)return C(t,r,i,o,u,l,a,c,f,p,d,g);{let e=n[s++];return(128&e)>0?void(s-=13):C(t,r,i,o,u,l,a,c,f,p,d,g,e)}}{let h=n[s++],y=n[s++];if((128&h)>0||(128&y)>0)return void(s-=14);if(e<15)return C(t,r,i,o,u,l,a,c,f,p,d,g,h,y);let w=n[s++];return(128&w)>0?void(s-=15):C(t,r,i,o,u,l,a,c,f,p,d,g,h,y,w)}}}}}function T(e){return p.copyBuffers?Uint8Array.prototype.slice.call(n,s,s+=e):n.subarray(s,s+=e)}function B(e){let t=n[s++];if(h[t])return h[t](n.subarray(s,s+=e));throw new Error("Unknown extension type "+t)}const D=e=>{let t=k[63&e]=m();return t.read=x(t),t.read()};let V="object"==typeof window?window:e;h[0]=e=>{},h[101]=()=>{let e=m();return(V[e[0]]||Error)(e[1])},h[105]=e=>{let t=a.getUint32(s-4);l||(l=new Map);let r,i=n[s];r=i>=144&&i<160||220==i||221==i?[]:{};let o={target:r};l.set(t,o);let u=m();return o.used?Object.assign(r,u):(o.target=u,u)},h[112]=e=>{let t=a.getUint32(s-4),r=l.get(t);return r.used=!0,r.target},h[115]=()=>new Set(m());const F=["Int8","Uint8\t","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");function _(e){let t=i,r=s,o=f,h=d,y=g,w=u,b=c,U=l,m=new Uint8Array(n.slice(0,i)),v=k,x=p,A=e();return i=t,s=r,f=o,d=h,g=y,u=w,c=b,l=U,n=m,k=v,p=x,a=new DataView(n.buffer,n.byteOffset,n.byteLength),A}h[116]=e=>{let t=e[0],r=F[t];if(!r)throw new Error("Could not find typed array for code "+t);return new V[r](Uint8Array.prototype.slice.call(e,1).buffer)},h[120]=()=>{let e=m();return new RegExp(e[0],e[1])},h[255]=e=>{if(4==e.length)return new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3]));if(8==e.length)return new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7]));if(12==e.length)return new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11]));throw new Error("Invalid timestamp length")},t.clearSource=function(){n=null},t.addExtension=function(e){h[e.type]=e.unpack};let L=new Array(147);for(let e=0;e<256;e++)L[e]=+("1e"+Math.floor(45.15-.30103*e));t.mult10=L,t.typedArrays=F,t.C1=b,t.C1Type=w}).call(this,r(3))},function(e,t,r){t.Packr=r(0).Packr,t.Encoder=t.Packr,t.Unpackr=r(1).Unpackr,t.Decoder=t.Unpackr,t.addExtension=r(0).addExtension;let n=new t.Packr({useRecords:!1});t.unpack=n.unpack,t.pack=n.pack,t.decode=n.unpack,t.encode=n.pack,Object.assign(t,{ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4})},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.msgpackr=t():e.msgpackr=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";let n=r(1),i=n.Unpackr,s=n.mult10,o=n.C1Type;const u=n.typedArrays;let l,a,c;try{l=new TextEncoder}catch(e){}const f="undefined"!=typeof Buffer,p=f?Buffer.allocUnsafeSlow:Uint8Array,d=f?Buffer:Uint8Array;let g,h,y,w=0;const b=Symbol("record-id");function U(e,t,r,n,i){for(;n<i;)t[r++]=e[n++]}function k(e,t,r){let n=e.byteLength,{target:i,position:s,targetView:o}=r(7+n);i[s++]=201,o.setUint32(s,n+1),s+=4,i[s++]=116,i[s++]=t,f?Buffer.from(e).copy(i,s):U(new Uint8Array(e),i,s,0,n)}function m(e,t){let r=e.byteLength;var n,i;if(r<256){var{target:n,position:i}=t(r+2);n[i++]=196,n[i++]=r}else if(r<65536){var{target:n,position:i}=t(r+3);n[i++]=197,n[i++]=r>>8,n[i++]=255&r}else{var{target:n,position:i,targetView:s}=t(r+5);n[i++]=198,s.setUint32(i,r),i+=4}e.copy?e.copy(n,i):U(e,n,i,0,r)}function v(e,t,r,n){let i=e.length;switch(i){case 1:t[r++]=212;break;case 2:t[r++]=213;break;case 4:t[r++]=214;break;case 8:t[r++]=215;break;case 16:t[r++]=216;break;default:i<256?(t[r++]=199,t[r++]=i):i<65536?(t[r++]=200,t[r++]=i<<8,t[r++]=255&i):(t[r++]=201,t[r++]=i<<24,t[r++]=i<<16&255,t[r++]=i<<8&255,t[r++]=255&i)}return t[r++]=n,e.copy?e.copy(t,r):U(e,t,r,0,i),r+=i}t.Packr=class extends i{constructor(e){let t,r,n,i,o;super(e),this.offset=0;let u=0,f=d.prototype.utf8Write?function(e,t,r){return g.utf8Write(e,t,r)}:!(!l||!l.encodeInto)&&function(e,t){return l.encodeInto(e,g.subarray(t)).written},k=this,m=32,x=e&&e.sequential;x&&(m=0,this.structures=[]);let A=[],j=0,O=0;if(this.structures&&this.structures.length>m)throw new Error("Too many shared structures");this.pack=function(e){if(g||(g=new p(8192),h=new DataView(g.buffer,0,8192),w=0),y=g.length-10,y-w<2048&&(g=new p(g.length),h=new DataView(g.buffer,0,g.length),y=g.length-10,w=0),t=w,o=k.structuredClone?new Map:null,r=k.structures,r){r.uninitialized&&(k.structures=r=k.getStructures());let e=r.length;if(e>m&&!x&&(e=m),!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||(n=i[r]=Object.create(null)),i=n}i[b]=t+64}u=r.length}x||(r.nextId=e+64)}n&&(n=!1),i=r||[];try{if(I(e),k.offset=w,o&&o.idsToInsert){w+=6*o.idsToInsert.length,w>y&&S(w),k.offset=w;let e=function(e,t){let r,n=6*t.length,i=e.length-n;t.sort((e,t)=>e.offset>t.offset?1:-1);for(;r=t.pop();){let t=r.offset,s=r.id;e.copyWithin(t+n,t,i),n-=6;let o=t+n;e[o++]=214,e[o++]=105,e[o++]=s<<24,e[o++]=s<<16&255,e[o++]=s<<8&255,e[o++]=255&s,i=t}return e}(g.subarray(t,w),o.idsToInsert);return o=null,e}return g.subarray(t,w)}finally{if(r){if(O<10&&O++,j>1e4)r.transitions=null,O=0,j=0,A.length>0&&(A=[]);else if(A.length>0&&!x){for(let e=0,t=A.length;e<t;e++)A[e][b]=0;A=[]}if(n&&k.saveStructures){if(k.structures.length>m&&(k.structures=k.structures.slice(0,m)),!1===k.saveStructures(k.structures,u))return k.structures=k.getStructures()||[],k.pack(e);u=k.structures.length}}}};const I=e=>{w>y&&(g=S(w));var r,n=typeof e;if("string"===n){let t,n=e.length;t=n<32?1:n<256?2:n<65536?3:5;let i=3*n;if(w+i>y&&(g=S(w+i)),n<64||!f){let i,s,o,u=w+t;for(i=0;i<n;i++)s=e.charCodeAt(i),s<128?g[u++]=s:s<2048?(g[u++]=s>>6|192,g[u++]=63&s|128):55296==(64512&s)&&56320==(64512&(o=e.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&o),i++,g[u++]=s>>18|240,g[u++]=s>>12&63|128,g[u++]=s>>6&63|128,g[u++]=63&s|128):(g[u++]=s>>12|224,g[u++]=s>>6&63|128,g[u++]=63&s|128);r=u-w-t}else r=f(e,w+t,i);r<32?g[w++]=160|r:r<256?(t<2&&g.copyWithin(w+2,w+1,w+1+r),g[w++]=217,g[w++]=r):r<65536?(t<3&&g.copyWithin(w+3,w+2,w+2+r),g[w++]=218,g[w++]=r>>8,g[w++]=255&r):(t<5&&g.copyWithin(w+5,w+3,w+3+r),g[w++]=219,h.setUint32(w,r),w+=4),w+=r}else if("number"===n)if(e>>>0===e)e<64?g[w++]=e:e<256?(g[w++]=204,g[w++]=e):e<65536?(g[w++]=205,g[w++]=e>>8,g[w++]=255&e):(g[w++]=206,h.setUint32(w,e),w+=4);else if(e>>0===e)e>=-32?g[w++]=256+e:e>=-128?(g[w++]=208,g[w++]=e+256):e>=-32768?(g[w++]=209,h.setInt16(w,e),w+=2):(g[w++]=210,h.setInt32(w,e),w+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let r;if(g[w++]=202,h.setFloat32(w,e),t<4||(r=e*s[(127&g[w])<<1|g[w+1]>>7])>>0===r)return void(w+=4);w--}g[w++]=203,h.setFloat64(w,e),w+=8}else if("object"===n)if(e){if(o){let r=o.get(e);if(r){if(!r.id){let e=o.idsToInsert||(o.idsToInsert=[]);r.id=e.push(r)}return g[w++]=214,g[w++]=112,h.setUint32(w,r.id),void(w+=4)}o.set(e,{offset:w-t})}let n=e.constructor;if(n===Object)E(e,!0);else if(n===Array){(r=e.length)<16?g[w++]=144|r:r<65536?(g[w++]=220,g[w++]=r>>8,g[w++]=255&r):(g[w++]=221,h.setUint32(w,r),w+=4);for(let t=0;t<r;t++)I(e[t])}else if(n===Map){(r=e.size)<16?g[w++]=128|r:r<65536?(g[w++]=222,g[w++]=r>>8,g[w++]=255&r):(g[w++]=223,h.setUint32(w,r),w+=4);for(let[t,r]of e)I(t),I(r)}else{for(let t=0,r=a.length;t<r;t++){if(e instanceof c[t]){let r,n=a[t],i=g,s=h,o=w;g=null;try{r=n.pack.call(this,e,e=>(g=i,i=null,w+=e,w>y&&S(w),{target:g,targetView:h,position:w-e}),I)}finally{i&&(g=i,h=s,w=o,y=g.length-10)}return void(r&&(w=v(r,g,w,n.type)))}}E(e,!1)}}else g[w++]=192;else if("boolean"===n)g[w++]=e?195:194;else if("bigint"===n)g[w++]=211,e<0x8000000000000000&&e>-0x8000000000000000?h.setBigInt64(w,e):h.setFloat64(w,e),w+=8;else{if("undefined"!==n)throw new Error("Unknown type "+n);g[w++]=212,g[w++]=0,g[w++]=0}},E=!1===this.useRecords?this.variableMapSize?e=>{let t,r=Object.keys(e),n=r.length;n<16?g[w++]=128|n:n<65536?(g[w++]=222,g[w++]=n>>8,g[w++]=255&n):(g[w++]=223,h.setUint32(w,n),w+=4);for(let i=0;i<n;i++)I(t=r[i]),I(e[t])}:(e,r)=>{g[w++]=222;let n=w-t;w+=2;let i=0;for(let t in e)(r||e.hasOwnProperty(t))&&(I(t),I(e[t]),i++);g[n+++t]=i>>8,g[n+t]=255&i}:e=>{let t,s=Object.keys(e),o=i.transitions||(i.transitions=Object.create(null)),u=0;for(let e=0,r=s.length;e<r;e++){let r=s[e];t=o[r],t||(t=o[r]=Object.create(null),u++),o=t}let l=o[b];l?g[w++]=l:(l=i.nextId++,l||(l=64,i.nextId=65),l>=128&&(i.nextId=(l=m+64)+1),o[b]=l,i[63&l]=s,r&&r.length<=m?(g[w++]=l,n=!0):(g[w++]=212,g[w++]=114,g[w++]=l,u&&(j+=O*u),A.length>=64-m&&(A.shift()[b]=0),A.push(o),I(s)));for(let t=0,r=s.length;t<r;t++)I(e[s[t]])},S=e=>{let r=1+(Math.max(e-t<<2,g.length-1)>>12)<<12,n=new p(r);return h=new DataView(n.buffer,0,r),g.copy?g.copy(n,0,t,e):U(g,n,0,t,e),w-=t,t=0,y=n.length-10,g=n}}encode(e){return this.pack(e)}resetMemory(){this.offset=0}},c=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,o],a=[{pack(e,t){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<17179869184){let{target:n,targetView:i,position:s}=t(10);n[s++]=215,n[s++]=255,i.setUint32(s,4e6*e.getMilliseconds()+(r/1e3/4294967296>>0)),i.setUint32(s+4,r)}else{let{target:n,targetView:i,position:s}=t(15);n[s++]=199,n[s++]=12,n[s++]=255,i.setUint32(s,1e6*e.getMilliseconds()),i.setBigInt64(s+4,BigInt(Math.floor(r)))}}},{pack(e,t,r){let n=Array.from(e);if(this.structuredClone){let{target:e,position:r}=t(3);e[r++]=212,e[r++]=115,e[r++]=0}r(n)}},{pack(e,t,r){if(this.structuredClone){let{target:e,position:r}=t(3);e[r++]=212,e[r++]=101,e[r++]=0}r([e.name,e.message])}},{pack(e,t,r){if(this.structuredClone){let{target:e,position:r}=t(3);e[r++]=212,e[r++]=120,e[r++]=0}r([e.source,e.flags])}},{pack(e,t){this.structuredClone?k(e,16,t):m(f?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let r=e.constructor;r!==d&&this.structuredClone?k(e.buffer,u.indexOf(r.name),t):m(e,t)}},{pack(e,t){let{target:r,position:n}=t(1);r[n]=193}}],t.addExtension=function(e){if(e.Class){if(!e.pack)throw new Error("Extension has no pack function");c.unshift(e.Class),a.unshift(e)}n.addExtension(e)}},function(e,t,r){"use strict";(function(e){let r,n,i;try{r=new TextDecoder}catch(e){}let s=0;const o=[];let u,l,a,c=o,f=0,p={},d=0,g=0,h=[],y={useRecords:!1,mapsAsObjects:!0};class w{}const b=new w;b.name="MessagePack 0xC1";class U{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&!e.structures&&((e.structures=[]).uninitialized=!0)),Object.assign(this,e)}unpack(e,t,r){if(n)return _(()=>(n=null,this?this.unpack(e,t,r):U.prototype.unpack.call(y,e,t,r)));if(i=t>-1?t:e.length,s=0,f=0,g=0,u=null,c=o,n=e,a=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength)),this)if(p=this,this.structures){k=this.structures;try{return m()}finally{(s>=i||!r)&&(k=null,n=null,l&&(l=null))}}else(!k||k.length>0)&&(k=[]);else p=y;(!k||k.length>0)&&(k=[]);try{return m()}finally{n=null,l&&(l=null)}}decode(e,t){return this.unpack(e,t)}}let k;function m(){let e=n[s++];if(e<160){if(e<128){if(e<64)return e;{let t=k[63&e];if(t)return t.read||(t.read=x(t)),t.read();if(p.getStructures){let r=_(()=>(n=null,p.getStructures()));return!0===k?p.structures=k=r:k.splice.apply(k,[0,r.length].concat(r)),t=k[63&e],t?(t.read||(t.read=x(t)),t.read()):e}return e}}if(e<144){if(e-=128,p.mapsAsObjects){let t={};for(let r=0;r<e;r++)t[m()]=m();return t}{let t=new Map;for(let r=0;r<e;r++)t.set(m(),m());return t}}{e-=144;let t=new Array(e);for(let r=0;r<e;r++)t[r]=m();return t}}if(e<192){let t=e-160;if(g>=s)return u.slice(s-d,(s+=t)-d);if(0==g&&i<120&&t<16){let e=P(t);if(null!=e)return e}return A(t)}{let t;switch(e){case 192:return null;case 193:return b;case 194:return!1;case 195:return!0;case 196:return T(n[s++]);case 197:return t=a.getUint16(s),s+=2,T(t);case 198:return t=a.getUint32(s),s+=4,T(t);case 199:return B(n[s++]);case 200:return t=a.getUint16(s),s+=2,B(t);case 201:return t=a.getUint32(s),s+=4,B(t);case 202:if(t=a.getFloat32(s),p.useFloat32>2){let e=L[(127&n[s])<<1|n[s+1]>>7];return s+=4,(e*t+(t>0?.5:-.5)>>0)/e}return s+=4,t;case 203:return t=a.getFloat64(s),s+=8,t;case 204:return n[s++];case 205:return t=a.getUint16(s),s+=2,t;case 206:return t=a.getUint32(s),s+=4,t;case 207:return p.uint64AsNumber?72057594037927940*n[s++]+281474976710656*n[s++]+1099511627776*n[s++]+4294967296*n[s++]+16777216*n[s++]+(n[s++]<<16)+(n[s++]<<8)+n[s++]:(t=a.getBigUint64(s),s+=8,t);case 208:return a.getInt8(s++);case 209:return t=a.getInt16(s),s+=2,t;case 210:return t=a.getInt32(s),s+=4,t;case 211:return t=a.getBigInt64(s),s+=8,t;case 212:if(t=n[s++],114==t)return D(n[s++]);if(h[t])return h[t]([n[s++]]);throw new Error("Unknown extension "+t);case 213:return B(2);case 214:return B(4);case 215:return B(8);case 216:return B(16);case 217:return t=n[s++],g>=s?u.slice(s-d,(s+=t)-d):j(t);case 218:return t=a.getUint16(s),s+=2,O(t);case 219:return t=a.getUint32(s),s+=4,I(t);case 220:return t=a.getUint16(s),s+=2,S(t);case 221:return t=a.getUint32(s),s+=4,S(t);case 222:return t=a.getUint16(s),s+=2,M(t);case 223:return t=a.getUint32(s),s+=4,M(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}t.Unpackr=U,t.read=m,t.getPosition=()=>s;const v=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function x(e){function t(){if(t.count++>2)return this.read=new Function("r","return function(){return {"+e.map(e=>v.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"}}")(m),this.read();let r={};for(let t=0,n=e.length;t<n;t++){r[e[t]]=m()}return r}return t.count=0,t}let A=E,j=E,O=E,I=E;function E(e){let t;if(e<16&&(t=P(e)))return t;if(e>64&&r)return r.decode(n.subarray(s,s+=e));const i=s+e,o=[];for(t="";s<i;){const e=n[s++];if(0==(128&e))o.push(e);else if(192==(224&e)){const t=63&n[s++];o.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&n[s++],r=63&n[s++];o.push((31&e)<<12|t<<6|r)}else if(240==(248&e)){let t=(7&e)<<18|(63&n[s++])<<12|(63&n[s++])<<6|63&n[s++];t>65535&&(t-=65536,o.push(t>>>10&1023|55296),t=56320|1023&t),o.push(t)}else o.push(e);o.length>=4096&&(t+=C.apply(String,o),o.length=0)}return o.length>0&&(t+=C.apply(String,o)),t}function S(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=m();return t}function M(e){if(p.mapsAsObjects){let t={};for(let r=0;r<e;r++)t[m()]=m();return t}{let t=new Map;for(let r=0;r<e;r++)t.set(m(),m());return t}}t.setExtractor=e=>{function t(t){return function(r){let o=c[f++];null==o&&(c=e(s-t,i,n),f=0,o=c[f++]);let l=o.length;return l<=r?(s+=r,o):(u=o,d=s,g=s+l,s+=r,o.slice(0,r))}}A=t(1),j=t(2),O=t(3),I=t(5)};let C=String.fromCharCode;function P(e){if(e<4){if(e<2){if(0===e)return"";{let e=n[s++];return(128&e)>1?void(s-=1):C(e)}}{let t=n[s++],r=n[s++];if((128&t)>0||(128&r)>0)return void(s-=2);if(e<3)return C(t,r);let i=n[s++];return(128&i)>0?void(s-=3):C(t,r,i)}}{let t=n[s++],r=n[s++],i=n[s++],o=n[s++];if((128&t)>0||(128&r)>0||(128&i)>0||(128&o)>0)return void(s-=4);if(e<6){if(4===e)return C(t,r,i,o);{let e=n[s++];return(128&e)>0?void(s-=5):C(t,r,i,o,e)}}if(e<8){let u=n[s++],l=n[s++];if((128&u)>0||(128&l)>0)return void(s-=6);if(e<7)return C(t,r,i,o,u,l);let a=n[s++];return(128&a)>0?void(s-=7):C(t,r,i,o,u,l,a)}{let u=n[s++],l=n[s++],a=n[s++],c=n[s++];if((128&u)>0||(128&l)>0||(128&a)>0||(128&c)>0)return void(s-=8);if(e<10){if(8===e)return C(t,r,i,o,u,l,a,c);{let e=n[s++];return(128&e)>0?void(s-=9):C(t,r,i,o,u,l,a,c,e)}}if(e<12){let f=n[s++],p=n[s++];if((128&f)>0||(128&p)>0)return void(s-=10);if(e<11)return C(t,r,i,o,u,l,a,c,f,p);let d=n[s++];return(128&d)>0?void(s-=11):C(t,r,i,o,u,l,a,c,f,p,d)}{let f=n[s++],p=n[s++],d=n[s++],g=n[s++];if((128&f)>0||(128&p)>0||(128&d)>0||(128&g)>0)return void(s-=12);if(e<14){if(12===e)return C(t,r,i,o,u,l,a,c,f,p,d,g);{let e=n[s++];return(128&e)>0?void(s-=13):C(t,r,i,o,u,l,a,c,f,p,d,g,e)}}{let h=n[s++],y=n[s++];if((128&h)>0||(128&y)>0)return void(s-=14);if(e<15)return C(t,r,i,o,u,l,a,c,f,p,d,g,h,y);let w=n[s++];return(128&w)>0?void(s-=15):C(t,r,i,o,u,l,a,c,f,p,d,g,h,y,w)}}}}}function T(e){return p.copyBuffers?Uint8Array.prototype.slice.call(n,s,s+=e):n.subarray(s,s+=e)}function B(e){let t=n[s++];if(h[t])return h[t](n.subarray(s,s+=e));throw new Error("Unknown extension type "+t)}const D=e=>{let t=k[63&e]=m();return t.read=x(t),t.read()};let V="object"==typeof window?window:e;h[0]=e=>{},h[101]=()=>{let e=m();return(V[e[0]]||Error)(e[1])},h[105]=e=>{let t=a.getUint32(s-4);l||(l=new Map);let r,i=n[s];r=i>=144&&i<160||220==i||221==i?[]:{};let o={target:r};l.set(t,o);let u=m();return o.used?Object.assign(r,u):(o.target=u,u)},h[112]=e=>{let t=a.getUint32(s-4),r=l.get(t);return r.used=!0,r.target},h[115]=()=>new Set(m());const F=["Int8","Uint8\t","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");function _(e){let t=i,r=s,o=f,h=d,y=g,w=u,b=c,U=l,m=new Uint8Array(n.slice(0,i)),v=k,x=p,A=e();return i=t,s=r,f=o,d=h,g=y,u=w,c=b,l=U,n=m,k=v,p=x,a=new DataView(n.buffer,n.byteOffset,n.byteLength),A}h[116]=e=>{let t=e[0],r=F[t];if(!r)throw new Error("Could not find typed array for code "+t);return new V[r](Uint8Array.prototype.slice.call(e,1).buffer)},h[120]=()=>{let e=m();return new RegExp(e[0],e[1])},h[255]=e=>{if(4==e.length)return new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3]));if(8==e.length)return new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7]));if(12==e.length)return new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11]));throw new Error("Invalid timestamp length")},t.clearSource=function(){n=null},t.addExtension=function(e){h[e.type]=e.unpack};let L=new Array(147);for(let e=0;e<256;e++)L[e]=+("1e"+Math.floor(45.15-.30103*e));t.mult10=L,t.typedArrays=F,t.C1=b,t.C1Type=w}).call(this,r(3))},function(e,t,r){t.Packr=r(0).Packr,t.Encoder=t.Packr,t.Unpackr=r(1).Unpackr,t.Decoder=t.Unpackr,t.addExtension=r(0).addExtension;let n=new t.Packr({useRecords:!1});t.unpack=n.unpack,t.pack=n.pack,t.decode=n.unpack,t.encode=n.pack,Object.assign(t,{ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4})},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r}])})); | ||
//# sourceMappingURL=index.js.map |
65
pack.js
@@ -12,2 +12,9 @@ "use strict" | ||
let extensions, extensionClasses | ||
const hasNodeBuffer = typeof Buffer !== 'undefined' | ||
const ByteArrayAllocate = hasNodeBuffer ? Buffer.allocUnsafeSlow : Uint8Array | ||
const ByteArray = hasNodeBuffer ? Buffer : Uint8Array | ||
let target | ||
let targetView | ||
let position = 0 | ||
let safeEnd | ||
const RECORD_SYMBOL = Symbol('record-id') | ||
@@ -18,8 +25,4 @@ class Packr extends Unpackr { | ||
this.offset = 0 | ||
let target = new ByteArrayAllocate(8192) // as you might expect, allocUnsafeSlow is the fastest and safest way to allocate memory | ||
let targetView = new DataView(target.buffer, 0, 8192) | ||
let typeBuffer | ||
let position = 0 | ||
let start | ||
let safeEnd | ||
let sharedStructures | ||
@@ -30,3 +33,3 @@ let hasSharedUpdate | ||
let lastSharedStructuresLength = 0 | ||
let encodeUtf8 = target.utf8Write ? function(string, position, maxBytes) { | ||
let encodeUtf8 = ByteArray.prototype.utf8Write ? function(string, position, maxBytes) { | ||
return target.utf8Write(string, position, maxBytes) | ||
@@ -53,3 +56,7 @@ } : (encoder && encoder.encodeInto) ? | ||
this.pack = function(value) { | ||
position = packr.offset | ||
if (!target) { | ||
target = new ByteArrayAllocate(8192) | ||
targetView = new DataView(target.buffer, 0, 8192) | ||
position = 0 | ||
} | ||
safeEnd = target.length - 10 | ||
@@ -115,3 +122,3 @@ if (safeEnd - position < 0x800) { | ||
serializationsSinceTransitionRebuild++ | ||
if (transitionsCount > 5000) { | ||
if (transitionsCount > 10000) { | ||
// force a rebuild occasionally after a lot of transitions so it can get cleaned up | ||
@@ -334,10 +341,28 @@ sharedStructures.transitions = null | ||
let extension = extensions[i] | ||
let result = extension.pack.call(this, value, (size) => { | ||
position += size | ||
if (position > safeEnd) | ||
makeRoom(position) | ||
return { | ||
target, targetView, position: position - size | ||
let currentTarget = target | ||
let currentTargetView = targetView | ||
let currentPosition = position | ||
target = null | ||
let result | ||
try { | ||
result = extension.pack.call(this, value, (size) => { | ||
// restore target and use it | ||
target = currentTarget | ||
currentTarget = null | ||
position += size | ||
if (position > safeEnd) | ||
makeRoom(position) | ||
return { | ||
target, targetView, position: position - size | ||
} | ||
}, pack) | ||
} finally { | ||
// restore current target information (unless already restored) | ||
if (currentTarget) { | ||
target = currentTarget | ||
targetView = currentTargetView | ||
position = currentPosition | ||
safeEnd = target.length - 10 | ||
} | ||
}, pack) | ||
} | ||
if (result) { | ||
@@ -450,3 +475,4 @@ position = writeExtensionData(result, target, position, extension.type) | ||
let keys = Object.keys(object) | ||
let nextTransition, hasNewTransition, transition = structures.transitions || (structures.transitions = Object.create(null)) | ||
let nextTransition, transition = structures.transitions || (structures.transitions = Object.create(null)) | ||
let newTransitions = 0 | ||
for (let i =0, l = keys.length; i < l; i++) { | ||
@@ -457,3 +483,3 @@ let key = keys[i] | ||
nextTransition = transition[key] = Object.create(null) | ||
hasNewTransition = true | ||
newTransitions++ | ||
} | ||
@@ -483,4 +509,4 @@ transition = nextTransition | ||
target[position++] = recordId | ||
if (hasNewTransition) | ||
transitionsCount += serializationsSinceTransitionRebuild | ||
if (newTransitions) | ||
transitionsCount += serializationsSinceTransitionRebuild * newTransitions | ||
// record the removal of the id, we can maintain our shared structure | ||
@@ -521,5 +547,2 @@ if (recordIdsToRemove.length >= 0x40 - maxSharedStructures) | ||
const hasNodeBuffer = typeof Buffer !== 'undefined' | ||
const ByteArrayAllocate = hasNodeBuffer ? Buffer.allocUnsafeSlow : Uint8Array | ||
const ByteArray = hasNodeBuffer ? Buffer : Uint8Array | ||
function copyBinary(source, target, targetOffset, offset, endOffset) { | ||
@@ -526,0 +549,0 @@ while (offset < endOffset) { |
{ | ||
"name": "msgpackr", | ||
"author": "Kris Zyp", | ||
"version": "0.5.4", | ||
"version": "0.6.0", | ||
"description": "Ultra-fast MessagePack implementation with extensions for records and structured cloning", | ||
@@ -31,3 +31,3 @@ "license": "MIT", | ||
"optionalDependencies": { | ||
"msgpackr-extract": "^0.3.5" | ||
"msgpackr-extract": "^0.3.6" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -55,4 +55,9 @@ # msgpackr | ||
## Browser Usage | ||
Msgpackr works as standalone JavaScript as well, and runs on modern browsers. It includes a bundled script for ease of direct loading. For module-based development, it is recommended that you directly import the module of interest, to minimize dependencies that get pulled into your application: | ||
Msgpackr works as standalone JavaScript as well, and runs on modern browsers. It includes a bundled script, at `dist/index.js` for ease of direct loading: | ||
``` | ||
<script src="node_modules/msgpackr/dist/index.js"></script> | ||
``` | ||
For module-based development, it is recommended that you directly import the module of interest, to minimize dependencies that get pulled into your application: | ||
``` | ||
import { unpack } from 'msgpackr/unpack' // if you only need to unpack | ||
@@ -59,0 +64,0 @@ ``` |
@@ -7,3 +7,2 @@ var data = require('./example4.json'); | ||
} catch(error) { | ||
return {} | ||
} | ||
@@ -10,0 +9,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236144
2937
261