UNPKG

shopar-plugin

Version:

Plugin for the Web that seamlessly integrates into your webpage to create embedded virtual try-on and 3D preview capabilities.

1 lines 167 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__QR={})}(this,(function(t){"use strict";function e(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var n={},r=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},i={},o={};let a;const s=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];o.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},o.getSymbolTotalCodewords=function(t){return s[t]},o.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},o.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');a=t},o.isKanjiModeEnabled=function(){return void 0!==a},o.toSJIS=function(t){return a(t)};var h={};function l(){this.buffer=[],this.length=0}!function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(t){return n}}}(h),l.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var u=l;function f(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}f.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n,r&&(this.reservedBit[i]=!0)},f.prototype.get=function(t,e){return this.data[t*this.size+e]},f.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},f.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var c=f,d={};!function(t){const e=o.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),o=[r-7];for(let t=1;t<n-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),i=r.length;for(let t=0;t<i;t++)for(let e=0;e<i;e++)0===t&&0===e||0===t&&e===i-1||t===i-1&&0===e||n.push([r[t],r[e]]);return n}}(d);var p={};const g=o.getSymbolSize;p.getPositions=function(t){const e=g(t);return[[0,0],[e-7,0],[0,e-7]]};var _={};!function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,n=3,r=40,i=10;function o(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,i=0,o=0,a=null,s=null;for(let h=0;h<n;h++){i=o=0,a=s=null;for(let l=0;l<n;l++){let n=t.get(h,l);n===a?i++:(i>=5&&(r+=e+(i-5)),a=n,i=1),n=t.get(l,h),n===s?o++:(o>=5&&(r+=e+(o-5)),s=n,o=1)}i>=5&&(r+=e+(i-5)),o>=5&&(r+=e+(o-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n<e-1;n++)for(let i=0;i<e-1;i++){const e=t.get(n,i)+t.get(n,i+1)+t.get(n+1,i)+t.get(n+1,i+1);4!==e&&0!==e||r++}return r*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,i=0,o=0;for(let r=0;r<e;r++){i=o=0;for(let a=0;a<e;a++)i=i<<1&2047|t.get(r,a),a>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|t.get(a,r),a>=10&&(1488===o||93===o)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*i},t.applyMask=function(t,e){const n=e.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.isReserved(i,r)||e.xor(i,r,o(t,i,r))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let i=0,o=1/0;for(let a=0;a<r;a++){n(a),t.applyMask(a,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(a,e),r<o&&(o=r,i=a)}return i}}(_);var w={};const m=h,b=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],y=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];w.getBlocksCount=function(t,e){switch(e){case m.L:return b[4*(t-1)+0];case m.M:return b[4*(t-1)+1];case m.Q:return b[4*(t-1)+2];case m.H:return b[4*(t-1)+3];default:return}},w.getTotalCodewordsCount=function(t,e){switch(e){case m.L:return y[4*(t-1)+0];case m.M:return y[4*(t-1)+1];case m.Q:return y[4*(t-1)+2];case m.H:return y[4*(t-1)+3];default:return}};var v={},E={};const k=new Uint8Array(512),T=new Uint8Array(256);!function(){let t=1;for(let e=0;e<255;e++)k[e]=t,T[t]=e,t<<=1,256&t&&(t^=285);for(let t=255;t<512;t++)k[t]=k[t-255]}(),E.log=function(t){if(t<1)throw new Error("log("+t+")");return T[t]},E.exp=function(t){return k[t]},E.mul=function(t,e){return 0===t||0===e?0:k[T[t]+T[e]]},function(t){const e=E;t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<n.length;o++)r[i+o]^=e.mul(t[i],n[o]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let i=0;i<n.length;i++)r[i]^=e.mul(n[i],t);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=t.mul(r,new Uint8Array([1,e.exp(i)]));return r}}(v);const R=v;function A(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}A.prototype.initialize=function(t){this.degree=t,this.genPoly=R.generateECPolynomial(this.degree)},A.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const n=R.mod(e,this.genPoly),r=this.degree-n.length;if(r>0){const t=new Uint8Array(this.degree);return t.set(n,r),t}return n};var L=A,x={},S={},C={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},I={};const O="[0-9]+";let P="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";P=P.replace(/u/g,"\\u");const M="(?:(?![A-Z0-9 $%*+\\-./:]|"+P+")(?:.|[\r\n]))+";I.KANJI=new RegExp(P,"g"),I.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),I.BYTE=new RegExp(M,"g"),I.NUMERIC=new RegExp(O,"g"),I.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const B=new RegExp("^"+P+"$"),D=new RegExp("^"+O+"$"),z=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");I.testKanji=function(t){return B.test(t)},I.testNumeric=function(t){return D.test(t)},I.testAlphanumeric=function(t){return z.test(t)},function(t){const e=C,n=I;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(t){return n}}}(S),function(t){const e=o,n=w,r=h,i=S,a=C,s=e.getBCHDigit(7973);function l(t,e){return i.getCharCountIndicator(t,e)+4}function u(t,e){let n=0;return t.forEach((function(t){const r=l(t.mode,e);n+=r+t.getBitsLength()})),n}t.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,o){if(!a.isValid(t))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const s=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(o===i.MIXED)return s;const h=s-l(o,t);switch(o){case i.NUMERIC:return Math.floor(h/10*3);case i.ALPHANUMERIC:return Math.floor(h/11*2);case i.KANJI:return Math.floor(h/13);case i.BYTE:default:return Math.floor(h/8)}},t.getBestVersionForData=function(e,n){let o;const a=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(u(e,r)<=t.getCapacity(r,n,i.MIXED))return r}(e,a);if(0===e.length)return 1;o=e[0]}else o=e;return function(e,n,r){for(let i=1;i<=40;i++)if(n<=t.getCapacity(i,r,e))return i}(o.mode,o.getLength(),a)},t.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-s>=0;)n^=7973<<e.getBCHDigit(n)-s;return t<<12|n}}(x);var N={};const U=o,F=U.getBCHDigit(1335);N.getEncodedBits=function(t,e){const n=t.bit<<3|e;let r=n<<10;for(;U.getBCHDigit(r)-F>=0;)r^=1335<<U.getBCHDigit(r)-F;return 21522^(n<<10|r)};var Y={};const j=S;function Z(t){this.mode=j.NUMERIC,this.data=t.toString()}Z.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},Z.prototype.getLength=function(){return this.data.length},Z.prototype.getBitsLength=function(){return Z.getBitsLength(this.data.length)},Z.prototype.write=function(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const i=this.data.length-e;i>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*i+1))};var H=Z;const W=S,q=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function G(t){this.mode=W.ALPHANUMERIC,this.data=t}G.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},G.prototype.getLength=function(){return this.data.length},G.prototype.getBitsLength=function(){return G.getBitsLength(this.data.length)},G.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*q.indexOf(this.data[e]);n+=q.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(q.indexOf(this.data[e]),6)};var V=G;const K=function(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var o=t.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?e.push(i):i<2048?(e.push(i>>6|192),e.push(63&i|128)):i<55296||i>=57344&&i<65536?(e.push(i>>12|224),e.push(i>>6&63|128),e.push(63&i|128)):i>=65536&&i<=1114111?(e.push(i>>18|240),e.push(i>>12&63|128),e.push(i>>6&63|128),e.push(63&i|128)):e.push(239,191,189)}return new Uint8Array(e).buffer},J=S;function X(t){this.mode=J.BYTE,"string"==typeof t&&(t=K(t)),this.data=new Uint8Array(t)}X.getBitsLength=function(t){return 8*t},X.prototype.getLength=function(){return this.data.length},X.prototype.getBitsLength=function(){return X.getBitsLength(this.data.length)},X.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};var Q=X;const $=S,tt=o;function et(t){this.mode=$.KANJI,this.data=t}et.getBitsLength=function(t){return 13*t},et.prototype.getLength=function(){return this.data.length},et.prototype.getBitsLength=function(){return et.getBitsLength(this.data.length)},et.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=tt.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}};var nt=et,rt={exports:{}};!function(t){var e={single_source_shortest_paths:function(t,n,r){var i={},o={};o[n]=0;var a,s,h,l,u,f,c,d=e.PriorityQueue.make();for(d.push(n,0);!d.empty();)for(h in s=(a=d.pop()).value,l=a.cost,u=t[s]||{})u.hasOwnProperty(h)&&(f=l+u[h],c=o[h],(void 0===o[h]||c>f)&&(o[h]=f,d.push(h,f),i[h]=s));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,n,r){var i=e.single_source_shortest_paths(t,n,r);return e.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var n,r=e.PriorityQueue,i={};for(n in t=t||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=e}(rt);var it=rt.exports;!function(t){const e=S,n=H,r=V,i=Q,a=nt,s=I,h=o,l=it;function u(t){return unescape(encodeURIComponent(t)).length}function f(t,e,n){const r=[];let i;for(;null!==(i=t.exec(n));)r.push({data:i[0],index:i.index,mode:e,length:i[0].length});return r}function c(t){const n=f(s.NUMERIC,e.NUMERIC,t),r=f(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let i,o;h.isKanjiModeEnabled()?(i=f(s.BYTE,e.BYTE,t),o=f(s.KANJI,e.KANJI,t)):(i=f(s.BYTE_KANJI,e.BYTE,t),o=[]);return n.concat(r,i,o).sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function d(t,o){switch(o){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return a.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function p(t,o){let s;const l=e.getBestModeForData(t);if(s=e.from(o,l),s!==e.BYTE&&s.bit<l.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(s)+".\n Suggested mode is: "+e.toString(l));switch(s!==e.KANJI||h.isKanjiModeEnabled()||(s=e.BYTE),s){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new a(t);case e.BYTE:return new i(t)}}t.fromArray=function(t){return t.reduce((function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t}),[])},t.fromString=function(n,r){const i=function(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:u(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:u(i.data)}])}}return n}(c(n,h.isKanjiModeEnabled())),o=function(t,n){const r={},i={start:{}};let o=["start"];for(let a=0;a<t.length;a++){const s=t[a],h=[];for(let t=0;t<s.length;t++){const l=s[t],u=""+a+t;h.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let t=0;t<o.length;t++){const a=o[t];r[a]&&r[a].node.mode===l.mode?(i[a][u]=d(r[a].lastCount+l.length,l.mode)-d(r[a].lastCount,l.mode),r[a].lastCount+=l.length):(r[a]&&(r[a].lastCount=l.length),i[a][u]=d(l.length,l.mode)+4+e.getCharCountIndicator(l.mode,n))}}o=h}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:r}}(i,r),a=l.find_path(o.map,"start","end"),s=[];for(let t=1;t<a.length-1;t++)s.push(o.table[a[t]].node);return t.fromArray(function(t){return t.reduce((function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(s))},t.rawSplit=function(e){return t.fromArray(c(e,h.isKanjiModeEnabled()))}}(Y);const ot=o,at=h,st=u,ht=c,lt=d,ut=p,ft=_,ct=w,dt=L,pt=x,gt=N,_t=S,wt=Y;function mt(t,e,n){const r=t.size,i=gt.getEncodedBits(e,n);let o,a;for(o=0;o<15;o++)a=1==(i>>o&1),o<6?t.set(o,8,a,!0):o<8?t.set(o+1,8,a,!0):t.set(r-15+o,8,a,!0),o<8?t.set(8,r-o-1,a,!0):o<9?t.set(8,15-o-1+1,a,!0):t.set(8,15-o-1,a,!0);t.set(r-8,8,1,!0)}function bt(t,e,n){const r=new st;n.forEach((function(e){r.put(e.mode.bit,4),r.put(e.getLength(),_t.getCharCountIndicator(e.mode,t)),e.write(r)}));const i=8*(ot.getSymbolTotalCodewords(t)-ct.getTotalCodewordsCount(t,e));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const o=(i-r.getLengthInBits())/8;for(let t=0;t<o;t++)r.put(t%2?17:236,8);return function(t,e,n){const r=ot.getSymbolTotalCodewords(e),i=ct.getTotalCodewordsCount(e,n),o=r-i,a=ct.getBlocksCount(e,n),s=r%a,h=a-s,l=Math.floor(r/a),u=Math.floor(o/a),f=u+1,c=l-u,d=new dt(c);let p=0;const g=new Array(a),_=new Array(a);let w=0;const m=new Uint8Array(t.buffer);for(let t=0;t<a;t++){const e=t<h?u:f;g[t]=m.slice(p,p+e),_[t]=d.encode(g[t]),p+=e,w=Math.max(w,e)}const b=new Uint8Array(r);let y,v,E=0;for(y=0;y<w;y++)for(v=0;v<a;v++)y<g[v].length&&(b[E++]=g[v][y]);for(y=0;y<c;y++)for(v=0;v<a;v++)b[E++]=_[v][y];return b}(r,t,e)}function yt(t,e,n,r){let i;if(Array.isArray(t))i=wt.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let r=e;if(!r){const e=wt.rawSplit(t);r=pt.getBestVersionForData(e,n)}i=wt.fromString(t,r||40)}}const o=pt.getBestVersionForData(i,n);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<o)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+o+".\n")}else e=o;const a=bt(e,n,i),s=ot.getSymbolSize(e),h=new ht(s);return function(t,e){const n=t.size,r=ut.getPositions(e);for(let e=0;e<r.length;e++){const i=r[e][0],o=r[e][1];for(let e=-1;e<=7;e++)if(!(i+e<=-1||n<=i+e))for(let r=-1;r<=7;r++)o+r<=-1||n<=o+r||(e>=0&&e<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===e||6===e)||e>=2&&e<=4&&r>=2&&r<=4?t.set(i+e,o+r,!0,!0):t.set(i+e,o+r,!1,!0))}}(h,e),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(h),function(t,e){const n=lt.getPositions(e);for(let e=0;e<n.length;e++){const r=n[e][0],i=n[e][1];for(let e=-2;e<=2;e++)for(let n=-2;n<=2;n++)-2===e||2===e||-2===n||2===n||0===e&&0===n?t.set(r+e,i+n,!0,!0):t.set(r+e,i+n,!1,!0)}}(h,e),mt(h,n,0),e>=7&&function(t,e){const n=t.size,r=pt.getEncodedBits(e);let i,o,a;for(let e=0;e<18;e++)i=Math.floor(e/3),o=e%3+n-8-3,a=1==(r>>e&1),t.set(i,o,a,!0),t.set(o,i,a,!0)}(h,e),function(t,e){const n=t.size;let r=-1,i=n-1,o=7,a=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!t.isReserved(i,s-n)){let r=!1;a<e.length&&(r=1==(e[a]>>>o&1)),t.set(i,s-n,r),o--,-1===o&&(a++,o=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(h,a),isNaN(r)&&(r=ft.getBestMask(h,mt.bind(null,h,n))),ft.applyMask(r,h),mt(h,n,r),{modules:h,version:e,errorCorrectionLevel:n,maskPattern:r,segments:i}}i.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let n,r,i=at.M;return void 0!==e&&(i=at.from(e.errorCorrectionLevel,at.M),n=pt.from(e.version),r=ft.from(e.maskPattern),e.toSJISFunc&&ot.setToSJISFunction(e.toSJISFunc)),yt(t,n,i,r)};var vt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Et=[],kt=[],Tt="undefined"!=typeof Uint8Array?Uint8Array:Array,Rt=!1;function At(){Rt=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Et[e]=t[e],kt[t.charCodeAt(e)]=e;kt["-".charCodeAt(0)]=62,kt["_".charCodeAt(0)]=63}function Lt(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Et[(i=r)>>18&63]+Et[i>>12&63]+Et[i>>6&63]+Et[63&i]);return o.join("")}function xt(t){var e;Rt||At();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,h=n-r;s<h;s+=a)o.push(Lt(t,s,s+a>h?h:s+a));return 1===r?(e=t[n-1],i+=Et[e>>2],i+=Et[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=Et[e>>10],i+=Et[e>>4&63],i+=Et[e<<2&63],i+="="),o.push(i),o.join("")}function St(t,e,n,r,i){var o,a,s=8*i-r-1,h=(1<<s)-1,l=h>>1,u=-7,f=n?i-1:0,c=n?-1:1,d=t[e+f];for(f+=c,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+t[e+f],f+=c,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+f],f+=c,u-=8);if(0===o)o=1-l;else{if(o===h)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)}function Ct(t,e,n,r,i,o){var a,s,h,l=8*o-i-1,u=(1<<l)-1,f=u>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+f>=1?c/h:c*Math.pow(2,1-f))*h>=2&&(a++,h/=2),a+f>=u?(s=0,a=u):a+f>=1?(s=(e*h-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[n+d]=255&a,d+=p,a/=256,l-=8);t[n+d-p]|=128*g}var It={}.toString,Ot=Array.isArray||function(t){return"[object Array]"==It.call(t)};Dt.TYPED_ARRAY_SUPPORT=void 0===vt.TYPED_ARRAY_SUPPORT||vt.TYPED_ARRAY_SUPPORT;var Pt=Mt();function Mt(){return Dt.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Bt(t,e){if(Mt()<e)throw new RangeError("Invalid typed array length");return Dt.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Dt.prototype:(null===t&&(t=new Dt(e)),t.length=e),t}function Dt(t,e,n){if(!(Dt.TYPED_ARRAY_SUPPORT||this instanceof Dt))return new Dt(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Ut(this,t)}return zt(this,t,e,n)}function zt(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);Dt.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Dt.prototype:t=Ft(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!Dt.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Zt(e,n);t=Bt(t,r);var i=t.write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(jt(e)){var n=0|Yt(e.length);return 0===(t=Bt(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?Bt(t,0):Ft(t,e);if("Buffer"===e.type&&Ot(e.data))return Ft(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function Nt(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ut(t,e){if(Nt(e),t=Bt(t,e<0?0:0|Yt(e)),!Dt.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Ft(t,e){var n=e.length<0?0:0|Yt(e.length);t=Bt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function Yt(t){if(t>=Mt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mt().toString(16)+" bytes");return 0|t}function jt(t){return!(null==t||!t._isBuffer)}function Zt(t,e){if(jt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return _e(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return we(t).length;default:if(r)return _e(t).length;e=(""+e).toLowerCase(),r=!0}}function Ht(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return oe(this,e,n);case"utf8":case"utf-8":return ee(this,e,n);case"ascii":return re(this,e,n);case"latin1":case"binary":return ie(this,e,n);case"base64":return te(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Wt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function qt(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=Dt.from(e,r)),jt(e))return 0===e.length?-1:Gt(t,e,n,r,i);if("number"==typeof e)return e&=255,Dt.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):Gt(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Gt(t,e,n,r,i){var o,a=1,s=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,h/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var u=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===h)return u*a}else-1!==u&&(o-=o-u),u=-1}else for(n+h>s&&(n=s-h),o=n;o>=0;o--){for(var f=!0,c=0;c<h;c++)if(l(t,o+c)!==l(e,c)){f=!1;break}if(f)return o}return-1}function Vt(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function Kt(t,e,n,r){return me(_e(e,t.length-n),t,n,r)}function Jt(t,e,n,r){return me(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function Xt(t,e,n,r){return Jt(t,e,n,r)}function Qt(t,e,n,r){return me(we(e),t,n,r)}function $t(t,e,n,r){return me(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(n=t.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function te(t,e,n){return 0===e&&n===t.length?xt(t):xt(t.slice(e,n))}function ee(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,h,l=t[i],u=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(u=l);break;case 2:128==(192&(o=t[i+1]))&&(h=(31&l)<<6|63&o)>127&&(u=h);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(h=(15&l)<<12|(63&o)<<6|63&a)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(h=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&h<1114112&&(u=h)}null===u?(u=65533,f=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=f}return function(t){var e=t.length;if(e<=ne)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=ne));return n}(r)}Dt.poolSize=8192,Dt._augment=function(t){return t.__proto__=Dt.prototype,t},Dt.from=function(t,e,n){return zt(null,t,e,n)},Dt.TYPED_ARRAY_SUPPORT&&(Dt.prototype.__proto__=Uint8Array.prototype,Dt.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Dt[Symbol.species]),Dt.alloc=function(t,e,n){return function(t,e,n,r){return Nt(e),e<=0?Bt(t,e):void 0!==n?"string"==typeof r?Bt(t,e).fill(n,r):Bt(t,e).fill(n):Bt(t,e)}(null,t,e,n)},Dt.allocUnsafe=function(t){return Ut(null,t)},Dt.allocUnsafeSlow=function(t){return Ut(null,t)},Dt.isBuffer=be,Dt.compare=function(t,e){if(!jt(t)||!jt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},Dt.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Dt.concat=function(t,e){if(!Ot(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Dt.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=Dt.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!jt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Dt.byteLength=Zt,Dt.prototype._isBuffer=!0,Dt.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Wt(this,e,e+1);return this},Dt.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Wt(this,e,e+3),Wt(this,e+1,e+2);return this},Dt.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Wt(this,e,e+7),Wt(this,e+1,e+6),Wt(this,e+2,e+5),Wt(this,e+3,e+4);return this},Dt.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?ee(this,0,t):Ht.apply(this,arguments)},Dt.prototype.equals=function(t){if(!jt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Dt.compare(this,t)},Dt.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Dt.prototype.compare=function(t,e,n,r,i){if(!jt(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),h=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(h[u]!==l[u]){o=h[u],a=l[u];break}return o<a?-1:a<o?1:0},Dt.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},Dt.prototype.indexOf=function(t,e,n){return qt(this,t,e,n,!0)},Dt.prototype.lastIndexOf=function(t,e,n){return qt(this,t,e,n,!1)},Dt.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Vt(this,t,e,n);case"utf8":case"utf-8":return Kt(this,t,e,n);case"ascii":return Jt(this,t,e,n);case"latin1":case"binary":return Xt(this,t,e,n);case"base64":return Qt(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Dt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;function re(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function ie(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function oe(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=ge(t[o]);return i}function ae(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function se(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function he(t,e,n,r,i,o){if(!jt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function le(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ue(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function fe(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ce(t,e,n,r,i){return i||fe(t,0,n,4),Ct(t,e,n,r,23,4),n+4}function de(t,e,n,r,i){return i||fe(t,0,n,8),Ct(t,e,n,r,52,8),n+8}Dt.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),Dt.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=Dt.prototype;else{var i=e-t;n=new Dt(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},Dt.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},Dt.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},Dt.prototype.readUInt8=function(t,e){return e||se(t,1,this.length),this[t]},Dt.prototype.readUInt16LE=function(t,e){return e||se(t,2,this.length),this[t]|this[t+1]<<8},Dt.prototype.readUInt16BE=function(t,e){return e||se(t,2,this.length),this[t]<<8|this[t+1]},Dt.prototype.readUInt32LE=function(t,e){return e||se(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Dt.prototype.readUInt32BE=function(t,e){return e||se(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Dt.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},Dt.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Dt.prototype.readInt8=function(t,e){return e||se(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Dt.prototype.readInt16LE=function(t,e){e||se(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Dt.prototype.readInt16BE=function(t,e){e||se(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Dt.prototype.readInt32LE=function(t,e){return e||se(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Dt.prototype.readInt32BE=function(t,e){return e||se(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Dt.prototype.readFloatLE=function(t,e){return e||se(t,4,this.length),St(this,t,!0,23,4)},Dt.prototype.readFloatBE=function(t,e){return e||se(t,4,this.length),St(this,t,!1,23,4)},Dt.prototype.readDoubleLE=function(t,e){return e||se(t,8,this.length),St(this,t,!0,52,8)},Dt.prototype.readDoubleBE=function(t,e){return e||se(t,8,this.length),St(this,t,!1,52,8)},Dt.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||he(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},Dt.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||he(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},Dt.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,1,255,0),Dt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Dt.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,65535,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):le(this,t,e,!0),e+2},Dt.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,65535,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):le(this,t,e,!1),e+2},Dt.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,4294967295,0),Dt.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ue(this,t,e,!0),e+4},Dt.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,4294967295,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ue(this,t,e,!1),e+4},Dt.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);he(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Dt.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);he(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Dt.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,1,127,-128),Dt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Dt.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,32767,-32768),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):le(this,t,e,!0),e+2},Dt.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,32767,-32768),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):le(this,t,e,!1),e+2},Dt.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,2147483647,-2147483648),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ue(this,t,e,!0),e+4},Dt.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ue(this,t,e,!1),e+4},Dt.prototype.writeFloatLE=function(t,e,n){return ce(this,t,e,!0,n)},Dt.prototype.writeFloatBE=function(t,e,n){return ce(this,t,e,!1,n)},Dt.prototype.writeDoubleLE=function(t,e,n){return de(this,t,e,!0,n)},Dt.prototype.writeDoubleBE=function(t,e,n){return de(this,t,e,!1,n)},Dt.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!Dt.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},Dt.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Dt.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=jt(t)?t:_e(new Dt(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var pe=/[^+\/0-9A-Za-z-_]/g;function ge(t){return t<16?"0"+t.toString(16):t.toString(16)}function _e(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function we(t){return function(t){var e,n,r,i,o,a;Rt||At();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new Tt(3*s/4-o),r=o>0?s-4:s;var h=0;for(e=0,n=0;e<r;e+=4,n+=3)i=kt[t.charCodeAt(e)]<<18|kt[t.charCodeAt(e+1)]<<12|kt[t.charCodeAt(e+2)]<<6|kt[t.charCodeAt(e+3)],a[h++]=i>>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=kt[t.charCodeAt(e)]<<2|kt[t.charCodeAt(e+1)]>>4,a[h++]=255&i):1===o&&(i=kt[t.charCodeAt(e)]<<10|kt[t.charCodeAt(e+1)]<<4|kt[t.charCodeAt(e+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(pe,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function me(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function be(t){return null!=t&&(!!t._isBuffer||ye(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ye(t.slice(0,0))}(t))}function ye(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var ve=Object.freeze({__proto__:null,Buffer:Dt,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Dt.alloc(+t)},isBuffer:be,kMaxLength:Pt}),Ee={},ke=e(Object.freeze({__proto__:null,default:{}}));function Te(){throw new Error("setTimeout has not been defined")}function Re(){throw new Error("clearTimeout has not been defined")}var Ae=Te,Le=Re;function xe(t){if(Ae===setTimeout)return setTimeout(t,0);if((Ae===Te||!Ae)&&setTimeout)return Ae=setTimeout,setTimeout(t,0);try{return Ae(t,0)}catch(e){try{return Ae.call(null,t,0)}catch(e){return Ae.call(this,t,0)}}}"function"==typeof vt.setTimeout&&(Ae=setTimeout),"function"==typeof vt.clearTimeout&&(Le=clearTimeout);var Se,Ce=[],Ie=!1,Oe=-1;function Pe(){Ie&&Se&&(Ie=!1,Se.length?Ce=Se.concat(Ce):Oe=-1,Ce.length&&Me())}function Me(){if(!Ie){var t=xe(Pe);Ie=!0;for(var e=Ce.length;e;){for(Se=Ce,Ce=[];++Oe<e;)Se&&Se[Oe].run();Oe=-1,e=Ce.length}Se=null,Ie=!1,function(t){if(Le===clearTimeout)return clearTimeout(t);if((Le===Re||!Le)&&clearTimeout)return Le=clearTimeout,clearTimeout(t);try{return Le(t)}catch(e){try{return Le.call(null,t)}catch(e){return Le.call(this,t)}}}(t)}}function Be(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Ce.push(new De(t,e)),1!==Ce.length||Ie||xe(Me)}function De(t,e){this.fun=t,this.array=e}De.prototype.run=function(){this.fun.apply(null,this.array)};function ze(){}var Ne=ze,Ue=ze,Fe=ze,Ye=ze,je=ze,Ze=ze,He=ze;var We=vt.performance||{},qe=We.now||We.mozNow||We.msNow||We.oNow||We.webkitNow||function(){return(new Date).getTime()};var Ge=new Date;var Ve={nextTick:Be,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ne,addListener:Ue,once:Fe,off:Ye,removeListener:je,removeAllListeners:Ze,emit:He,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*qe.call(We),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Ge)/1e3}},Ke={},Je="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Xe=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},Qe=/%[sdj%]/g;function $e(t){if(!_n(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(on(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(Qe,(function(t){if("%%"===t)return"%";if(n>=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),a=r[n];n<i;a=r[++n])dn(a)||!yn(a)?o+=" "+a:o+=" "+on(a);return o}function tn(t,e){if(mn(vt.process))return function(){return tn(t,e).apply(this,arguments)};if(!0===Ve.noDeprecation)return t;var n=!1;return function(){if(!n){if(Ve.throwDeprecation)throw new Error(e);Ve.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var en,nn={};function rn(t){if(mn(en)&&(en=Ve.env.NODE_DEBUG||""),t=t.toUpperCase(),!nn[t])if(new RegExp("\\b"+t+"\\b","i").test(en)){nn[t]=function(){var e=$e.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else nn[t]=function(){};return nn[t]}function on(t,e){var n={seen:[],stylize:sn};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),cn(e)?n.showHidden=e:e&&Cn(n,e),mn(n.showHidden)&&(n.showHidden=!1),mn(n.depth)&&(n.depth=2),mn(n.colors)&&(n.colors=!1),mn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=an),hn(n,t,n.depth)}function an(t,e){var n=on.styles[e];return n?"["+on.colors[n][0]+"m"+t+"["+on.colors[n][1]+"m":t}function sn(t,e){return t}function hn(t,e,n){if(t.customInspect&&e&&kn(e.inspect)&&e.inspect!==on&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return _n(r)||(r=hn(t,r,n)),r}var i=function(t,e){if(mn(e))return t.stylize("undefined","undefined");if(_n(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(gn(e))return t.stylize(""+e,"number");if(cn(e))return t.stylize(""+e,"boolean");if(dn(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),En(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ln(e);if(0===o.length){if(kn(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(bn(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(vn(e))return t.stylize(Date.prototype.toString.call(e),"date");if(En(e))return ln(e)}var h,l="",u=!1,f=["{","}"];(fn(e)&&(u=!0,f=["[","]"]),kn(e))&&(l=" [Function"+(e.name?": "+e.name:"")+"]");return bn(e)&&(l=" "+RegExp.prototype.toString.call(e)),vn(e)&&(l=" "+Date.prototype.toUTCString.call(e)),En(e)&&(l=" "+ln(e)),0!==o.length||u&&0!=e.length?n<0?bn(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),h=u?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a<s;++a)In(e,String(a))?o.push(un(t,e,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(un(t,e,n,r,i,!0))})),o}(t,e,n,a,o):o.map((function(r){return un(t,e,n,a,r,u)})),t.seen.pop(),function(t,e,n){var r=t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(h,l,f)):f[0]+l+f[1]}function ln(t){return"["+Error.prototype.toString.call(t)+"]"}function un(t,e,n,r,i,o){var a,s,h;if((h=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),In(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(h.value)<0?(s=dn(n)?hn(t,h.value,null):hn(t,h.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),mn(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function fn(t){return Array.isArray(t)}function cn(t){return"boolean"==typeof t}function dn(t){return null===t}function pn(t){return null==t}function gn(t){return"number"==typeof t}function _n(t