diff --git a/index.html b/index.html index 91b21e1..74dcde1 100644 --- a/index.html +++ b/index.html @@ -139,247 +139,7 @@ - + diff --git a/js/cbor.js b/js/cbor.js index 3e1f300..14b48fc 100644 --- a/js/cbor.js +++ b/js/cbor.js @@ -22,385 +22,386 @@ * SOFTWARE. */ -(function(global, undefined) { "use strict"; -var POW_2_24 = 5.960464477539063e-8, +(function (global, undefined) { + "use strict"; + var POW_2_24 = 5.960464477539063e-8, POW_2_32 = 4294967296, POW_2_53 = 9007199254740992; -function encode(value) { - var data = new ArrayBuffer(256); - var dataView = new DataView(data); - var lastLength; - var offset = 0; + function encode(value) { + var data = new ArrayBuffer(256); + var dataView = new DataView(data); + var lastLength; + var offset = 0; - function prepareWrite(length) { - var newByteLength = data.byteLength; - var requiredLength = offset + length; - while (newByteLength < requiredLength) - newByteLength <<= 1; - if (newByteLength !== data.byteLength) { - var oldDataView = dataView; - data = new ArrayBuffer(newByteLength); - dataView = new DataView(data); - var uint32count = (offset + 3) >> 2; - for (var i = 0; i < uint32count; ++i) - dataView.setUint32(i << 2, oldDataView.getUint32(i << 2)); - } - - lastLength = length; - return dataView; - } - function commitWrite() { - offset += lastLength; - } - function writeFloat64(value) { - commitWrite(prepareWrite(8).setFloat64(offset, value)); - } - function writeUint8(value) { - commitWrite(prepareWrite(1).setUint8(offset, value)); - } - function writeUint8Array(value) { - var dataView = prepareWrite(value.length); - for (var i = 0; i < value.length; ++i) - dataView.setUint8(offset + i, value[i]); - commitWrite(); - } - function writeUint16(value) { - commitWrite(prepareWrite(2).setUint16(offset, value)); - } - function writeUint32(value) { - commitWrite(prepareWrite(4).setUint32(offset, value)); - } - function writeUint64(value) { - var low = value % POW_2_32; - var high = (value - low) / POW_2_32; - var dataView = prepareWrite(8); - dataView.setUint32(offset, high); - dataView.setUint32(offset + 4, low); - commitWrite(); - } - function writeTypeAndLength(type, length) { - if (length < 24) { - writeUint8(type << 5 | length); - } else if (length < 0x100) { - writeUint8(type << 5 | 24); - writeUint8(length); - } else if (length < 0x10000) { - writeUint8(type << 5 | 25); - writeUint16(length); - } else if (length < 0x100000000) { - writeUint8(type << 5 | 26); - writeUint32(length); - } else { - writeUint8(type << 5 | 27); - writeUint64(length); - } - } - - function encodeItem(value) { - var i; - - if (value === false) - return writeUint8(0xf4); - if (value === true) - return writeUint8(0xf5); - if (value === null) - return writeUint8(0xf6); - if (value === undefined) - return writeUint8(0xf7); - - switch (typeof value) { - case "number": - if (Math.floor(value) === value) { - if (0 <= value && value <= POW_2_53) - return writeTypeAndLength(0, value); - if (-POW_2_53 <= value && value < 0) - return writeTypeAndLength(1, -(value + 1)); - } - writeUint8(0xfb); - return writeFloat64(value); - - case "string": - var utf8data = []; - for (i = 0; i < value.length; ++i) { - var charCode = value.charCodeAt(i); - if (charCode < 0x80) { - utf8data.push(charCode); - } else if (charCode < 0x800) { - utf8data.push(0xc0 | charCode >> 6); - utf8data.push(0x80 | charCode & 0x3f); - } else if (charCode < 0xd800) { - utf8data.push(0xe0 | charCode >> 12); - utf8data.push(0x80 | (charCode >> 6) & 0x3f); - utf8data.push(0x80 | charCode & 0x3f); - } else { - charCode = (charCode & 0x3ff) << 10; - charCode |= value.charCodeAt(++i) & 0x3ff; - charCode += 0x10000; - - utf8data.push(0xf0 | charCode >> 18); - utf8data.push(0x80 | (charCode >> 12) & 0x3f); - utf8data.push(0x80 | (charCode >> 6) & 0x3f); - utf8data.push(0x80 | charCode & 0x3f); - } - } - - writeTypeAndLength(3, utf8data.length); - return writeUint8Array(utf8data); - - default: - var length; - if (Array.isArray(value)) { - length = value.length; - writeTypeAndLength(4, length); - for (i = 0; i < length; ++i) - encodeItem(value[i]); - } else if (value instanceof Uint8Array) { - writeTypeAndLength(2, value.length); - writeUint8Array(value); - } else { - var keys = Object.keys(value); - length = keys.length; - writeTypeAndLength(5, length); - for (i = 0; i < length; ++i) { - var key = keys[i]; - encodeItem(key); - encodeItem(value[key]); - } - } - } - } - - encodeItem(value); - - if ("slice" in data) - return data.slice(0, offset); - - var ret = new ArrayBuffer(offset); - var retView = new DataView(ret); - for (var i = 0; i < offset; ++i) - retView.setUint8(i, dataView.getUint8(i)); - return ret; -} - -function decode(data, tagger, simpleValue) { - var dataView = new DataView(data); - var offset = 0; - - if (typeof tagger !== "function") - tagger = function(value) { return value; }; - if (typeof simpleValue !== "function") - simpleValue = function() { return undefined; }; - - function commitRead(length, value) { - offset += length; - return value; - } - function readArrayBuffer(length) { - return commitRead(length, new Uint8Array(data, offset, length)); - } - function readFloat16() { - var tempArrayBuffer = new ArrayBuffer(4); - var tempDataView = new DataView(tempArrayBuffer); - var value = readUint16(); - - var sign = value & 0x8000; - var exponent = value & 0x7c00; - var fraction = value & 0x03ff; - - if (exponent === 0x7c00) - exponent = 0xff << 10; - else if (exponent !== 0) - exponent += (127 - 15) << 10; - else if (fraction !== 0) - return (sign ? -1 : 1) * fraction * POW_2_24; - - tempDataView.setUint32(0, sign << 16 | exponent << 13 | fraction << 13); - return tempDataView.getFloat32(0); - } - function readFloat32() { - return commitRead(4, dataView.getFloat32(offset)); - } - function readFloat64() { - return commitRead(8, dataView.getFloat64(offset)); - } - function readUint8() { - return commitRead(1, dataView.getUint8(offset)); - } - function readUint16() { - return commitRead(2, dataView.getUint16(offset)); - } - function readUint32() { - return commitRead(4, dataView.getUint32(offset)); - } - function readUint64() { - return readUint32() * POW_2_32 + readUint32(); - } - function readBreak() { - if (dataView.getUint8(offset) !== 0xff) - return false; - offset += 1; - return true; - } - function readLength(additionalInformation) { - if (additionalInformation < 24) - return additionalInformation; - if (additionalInformation === 24) - return readUint8(); - if (additionalInformation === 25) - return readUint16(); - if (additionalInformation === 26) - return readUint32(); - if (additionalInformation === 27) - return readUint64(); - if (additionalInformation === 31) - return -1; - throw "Invalid length encoding"; - } - function readIndefiniteStringLength(majorType) { - var initialByte = readUint8(); - if (initialByte === 0xff) - return -1; - var length = readLength(initialByte & 0x1f); - if (length < 0 || (initialByte >> 5) !== majorType) - throw "Invalid indefinite length element"; - return length; - } - - function appendUtf16Data(utf16data, length) { - for (var i = 0; i < length; ++i) { - var value = readUint8(); - if (value & 0x80) { - if (value < 0xe0) { - value = (value & 0x1f) << 6 - | (readUint8() & 0x3f); - length -= 1; - } else if (value < 0xf0) { - value = (value & 0x0f) << 12 - | (readUint8() & 0x3f) << 6 - | (readUint8() & 0x3f); - length -= 2; - } else { - value = (value & 0x0f) << 18 - | (readUint8() & 0x3f) << 12 - | (readUint8() & 0x3f) << 6 - | (readUint8() & 0x3f); - length -= 3; - } + function prepareWrite(length) { + var newByteLength = data.byteLength; + var requiredLength = offset + length; + while (newByteLength < requiredLength) + newByteLength <<= 1; + if (newByteLength !== data.byteLength) { + var oldDataView = dataView; + data = new ArrayBuffer(newByteLength); + dataView = new DataView(data); + var uint32count = (offset + 3) >> 2; + for (var i = 0; i < uint32count; ++i) + dataView.setUint32(i << 2, oldDataView.getUint32(i << 2)); } - if (value < 0x10000) { - utf16data.push(value); + lastLength = length; + return dataView; + } + function commitWrite() { + offset += lastLength; + } + function writeFloat64(value) { + commitWrite(prepareWrite(8).setFloat64(offset, value)); + } + function writeUint8(value) { + commitWrite(prepareWrite(1).setUint8(offset, value)); + } + function writeUint8Array(value) { + var dataView = prepareWrite(value.length); + for (var i = 0; i < value.length; ++i) + dataView.setUint8(offset + i, value[i]); + commitWrite(); + } + function writeUint16(value) { + commitWrite(prepareWrite(2).setUint16(offset, value)); + } + function writeUint32(value) { + commitWrite(prepareWrite(4).setUint32(offset, value)); + } + function writeUint64(value) { + var low = value % POW_2_32; + var high = (value - low) / POW_2_32; + var dataView = prepareWrite(8); + dataView.setUint32(offset, high); + dataView.setUint32(offset + 4, low); + commitWrite(); + } + function writeTypeAndLength(type, length) { + if (length < 24) { + writeUint8(type << 5 | length); + } else if (length < 0x100) { + writeUint8(type << 5 | 24); + writeUint8(length); + } else if (length < 0x10000) { + writeUint8(type << 5 | 25); + writeUint16(length); + } else if (length < 0x100000000) { + writeUint8(type << 5 | 26); + writeUint32(length); } else { - value -= 0x10000; - utf16data.push(0xd800 | (value >> 10)); - utf16data.push(0xdc00 | (value & 0x3ff)); + writeUint8(type << 5 | 27); + writeUint64(length); } } + + function encodeItem(value) { + var i; + + if (value === false) + return writeUint8(0xf4); + if (value === true) + return writeUint8(0xf5); + if (value === null) + return writeUint8(0xf6); + if (value === undefined) + return writeUint8(0xf7); + + switch (typeof value) { + case "number": + if (Math.floor(value) === value) { + if (0 <= value && value <= POW_2_53) + return writeTypeAndLength(0, value); + if (-POW_2_53 <= value && value < 0) + return writeTypeAndLength(1, -(value + 1)); + } + writeUint8(0xfb); + return writeFloat64(value); + + case "string": + var utf8data = []; + for (i = 0; i < value.length; ++i) { + var charCode = value.charCodeAt(i); + if (charCode < 0x80) { + utf8data.push(charCode); + } else if (charCode < 0x800) { + utf8data.push(0xc0 | charCode >> 6); + utf8data.push(0x80 | charCode & 0x3f); + } else if (charCode < 0xd800) { + utf8data.push(0xe0 | charCode >> 12); + utf8data.push(0x80 | (charCode >> 6) & 0x3f); + utf8data.push(0x80 | charCode & 0x3f); + } else { + charCode = (charCode & 0x3ff) << 10; + charCode |= value.charCodeAt(++i) & 0x3ff; + charCode += 0x10000; + + utf8data.push(0xf0 | charCode >> 18); + utf8data.push(0x80 | (charCode >> 12) & 0x3f); + utf8data.push(0x80 | (charCode >> 6) & 0x3f); + utf8data.push(0x80 | charCode & 0x3f); + } + } + + writeTypeAndLength(3, utf8data.length); + return writeUint8Array(utf8data); + + default: + var length; + if (Array.isArray(value)) { + length = value.length; + writeTypeAndLength(4, length); + for (i = 0; i < length; ++i) + encodeItem(value[i]); + } else if (value instanceof Uint8Array) { + writeTypeAndLength(2, value.length); + writeUint8Array(value); + } else { + var keys = Object.keys(value); + length = keys.length; + writeTypeAndLength(5, length); + for (i = 0; i < length; ++i) { + var key = keys[i]; + encodeItem(key); + encodeItem(value[key]); + } + } + } + } + + encodeItem(value); + + if ("slice" in data) + return data.slice(0, offset); + + var ret = new ArrayBuffer(offset); + var retView = new DataView(ret); + for (var i = 0; i < offset; ++i) + retView.setUint8(i, dataView.getUint8(i)); + return ret; } - function decodeItem() { - var initialByte = readUint8(); - var majorType = initialByte >> 5; - var additionalInformation = initialByte & 0x1f; - var i; - var length; + function decode(data, tagger, simpleValue) { + var dataView = new DataView(data); + var offset = 0; - if (majorType === 7) { - switch (additionalInformation) { - case 25: - return readFloat16(); - case 26: - return readFloat32(); - case 27: - return readFloat64(); - } + if (typeof tagger !== "function") + tagger = function (value) { return value; }; + if (typeof simpleValue !== "function") + simpleValue = function () { return undefined; }; + + function commitRead(length, value) { + offset += length; + return value; + } + function readArrayBuffer(length) { + return commitRead(length, new Uint8Array(data, offset, length)); + } + function readFloat16() { + var tempArrayBuffer = new ArrayBuffer(4); + var tempDataView = new DataView(tempArrayBuffer); + var value = readUint16(); + + var sign = value & 0x8000; + var exponent = value & 0x7c00; + var fraction = value & 0x03ff; + + if (exponent === 0x7c00) + exponent = 0xff << 10; + else if (exponent !== 0) + exponent += (127 - 15) << 10; + else if (fraction !== 0) + return (sign ? -1 : 1) * fraction * POW_2_24; + + tempDataView.setUint32(0, sign << 16 | exponent << 13 | fraction << 13); + return tempDataView.getFloat32(0); + } + function readFloat32() { + return commitRead(4, dataView.getFloat32(offset)); + } + function readFloat64() { + return commitRead(8, dataView.getFloat64(offset)); + } + function readUint8() { + return commitRead(1, dataView.getUint8(offset)); + } + function readUint16() { + return commitRead(2, dataView.getUint16(offset)); + } + function readUint32() { + return commitRead(4, dataView.getUint32(offset)); + } + function readUint64() { + return readUint32() * POW_2_32 + readUint32(); + } + function readBreak() { + if (dataView.getUint8(offset) !== 0xff) + return false; + offset += 1; + return true; + } + function readLength(additionalInformation) { + if (additionalInformation < 24) + return additionalInformation; + if (additionalInformation === 24) + return readUint8(); + if (additionalInformation === 25) + return readUint16(); + if (additionalInformation === 26) + return readUint32(); + if (additionalInformation === 27) + return readUint64(); + if (additionalInformation === 31) + return -1; + throw "Invalid length encoding"; + } + function readIndefiniteStringLength(majorType) { + var initialByte = readUint8(); + if (initialByte === 0xff) + return -1; + var length = readLength(initialByte & 0x1f); + if (length < 0 || (initialByte >> 5) !== majorType) + throw "Invalid indefinite length element"; + return length; } - length = readLength(additionalInformation); - if (length < 0 && (majorType < 2 || 6 < majorType)) - throw "Invalid length"; - - switch (majorType) { - case 0: - return length; - case 1: - return -1 - length; - case 2: - if (length < 0) { - var elements = []; - var fullArrayLength = 0; - while ((length = readIndefiniteStringLength(majorType)) >= 0) { - fullArrayLength += length; - elements.push(readArrayBuffer(length)); + function appendUtf16Data(utf16data, length) { + for (var i = 0; i < length; ++i) { + var value = readUint8(); + if (value & 0x80) { + if (value < 0xe0) { + value = (value & 0x1f) << 6 + | (readUint8() & 0x3f); + length -= 1; + } else if (value < 0xf0) { + value = (value & 0x0f) << 12 + | (readUint8() & 0x3f) << 6 + | (readUint8() & 0x3f); + length -= 2; + } else { + value = (value & 0x0f) << 18 + | (readUint8() & 0x3f) << 12 + | (readUint8() & 0x3f) << 6 + | (readUint8() & 0x3f); + length -= 3; } - var fullArray = new Uint8Array(fullArrayLength); - var fullArrayOffset = 0; - for (i = 0; i < elements.length; ++i) { - fullArray.set(elements[i], fullArrayOffset); - fullArrayOffset += elements[i].length; - } - return fullArray; } - return readArrayBuffer(length); - case 3: - var utf16data = []; - if (length < 0) { - while ((length = readIndefiniteStringLength(majorType)) >= 0) - appendUtf16Data(utf16data, length); - } else - appendUtf16Data(utf16data, length); - return String.fromCharCode.apply(null, utf16data); - case 4: - var retArray; - if (length < 0) { - retArray = []; - while (!readBreak()) - retArray.push(decodeItem()); + + if (value < 0x10000) { + utf16data.push(value); } else { - retArray = new Array(length); - for (i = 0; i < length; ++i) - retArray[i] = decodeItem(); - } - return retArray; - case 5: - var retObject = {}; - for (i = 0; i < length || length < 0 && !readBreak(); ++i) { - var key = decodeItem(); - retObject[key] = decodeItem(); - } - return retObject; - case 6: - return tagger(decodeItem(), length); - case 7: - switch (length) { - case 20: - return false; - case 21: - return true; - case 22: - return null; - case 23: - return undefined; - default: - return simpleValue(length); + value -= 0x10000; + utf16data.push(0xd800 | (value >> 10)); + utf16data.push(0xdc00 | (value & 0x3ff)); } + } } + + function decodeItem() { + var initialByte = readUint8(); + var majorType = initialByte >> 5; + var additionalInformation = initialByte & 0x1f; + var i; + var length; + + if (majorType === 7) { + switch (additionalInformation) { + case 25: + return readFloat16(); + case 26: + return readFloat32(); + case 27: + return readFloat64(); + } + } + + length = readLength(additionalInformation); + if (length < 0 && (majorType < 2 || 6 < majorType)) + throw "Invalid length"; + + switch (majorType) { + case 0: + return length; + case 1: + return -1 - length; + case 2: + if (length < 0) { + var elements = []; + var fullArrayLength = 0; + while ((length = readIndefiniteStringLength(majorType)) >= 0) { + fullArrayLength += length; + elements.push(readArrayBuffer(length)); + } + var fullArray = new Uint8Array(fullArrayLength); + var fullArrayOffset = 0; + for (i = 0; i < elements.length; ++i) { + fullArray.set(elements[i], fullArrayOffset); + fullArrayOffset += elements[i].length; + } + return fullArray; + } + return readArrayBuffer(length); + case 3: + var utf16data = []; + if (length < 0) { + while ((length = readIndefiniteStringLength(majorType)) >= 0) + appendUtf16Data(utf16data, length); + } else + appendUtf16Data(utf16data, length); + return String.fromCharCode.apply(null, utf16data); + case 4: + var retArray; + if (length < 0) { + retArray = []; + while (!readBreak()) + retArray.push(decodeItem()); + } else { + retArray = new Array(length); + for (i = 0; i < length; ++i) + retArray[i] = decodeItem(); + } + return retArray; + case 5: + var retObject = {}; + for (i = 0; i < length || length < 0 && !readBreak(); ++i) { + var key = decodeItem(); + retObject[key] = decodeItem(); + } + return retObject; + case 6: + return tagger(decodeItem(), length); + case 7: + switch (length) { + case 20: + return false; + case 21: + return true; + case 22: + return null; + case 23: + return undefined; + default: + return simpleValue(length); + } + } + } + + var ret = decodeItem(); + if (offset !== data.byteLength) + throw "Remaining bytes"; + return ret; } - var ret = decodeItem(); - if (offset !== data.byteLength) - throw "Remaining bytes"; - return ret; -} + var obj = { encode: encode, decode: decode }; -var obj = { encode: encode, decode: decode }; - -if (typeof define === "function" && define.amd) - define("cbor/cbor", obj); -else if (typeof module !== "undefined" && module.exports) - module.exports = obj; -else if (!global.CBOR) - global.CBOR = obj; + if (typeof define === "function" && define.amd) + define("cbor/cbor", obj); + else if (typeof module !== "undefined" && module.exports) + module.exports = obj; + else if (!global.CBOR) + global.CBOR = obj; })(this); diff --git a/js/disease-agent-targeted.js b/js/disease-agent-targeted.js index f2ebca4..1cc4135 100644 --- a/js/disease-agent-targeted.js +++ b/js/disease-agent-targeted.js @@ -1,4 +1,4 @@ -diseases={ +diseases = { "valueSetId": "disease-agent-targeted", "valueSetDate": "2021-04-27", "valueSetValues": { diff --git a/js/llqrcode.js b/js/llqrcode.js index 253ccc1..b6b6a84 100644 --- a/js/llqrcode.js +++ b/js/llqrcode.js @@ -1 +1 @@ -_aa={};_aa._ab=function(f,e){var d=qrcode.width;var b=qrcode.height;var c=true;for(var g=0;gd||h<-1||h>b){throw"Error._ab "}c=false;if(a==-1){e[g]=0;c=true}else{if(a==d){e[g]=d-1;c=true}}if(h==-1){e[g+1]=0;c=true}else{if(h==b){e[g+1]=b-1;c=true}}}c=true;for(var g=e.length-2;g>=0&&c;g-=2){var a=Math.floor(e[g]);var h=Math.floor(e[g+1]);if(a<-1||a>d||h<-1||h>b){throw"Error._ab "}c=false;if(a==-1){e[g]=0;c=true}else{if(a==d){e[g]=d-1;c=true}}if(h==-1){e[g+1]=0;c=true}else{if(h==b){e[g+1]=b-1;c=true}}}};_aa._af=function(b,d,a){var l=new _ac(d);var k=new Array(d<<1);for(var g=0;g>1)+0.5;k[i+1]=j}a._ad(k);_aa._ab(b,k);try{for(var i=0;i>1,g)}}}catch(c){throw"Error._ab"}}return l};_aa._ah=function(h,o,l,k,r,q,b,a,f,e,n,m,t,s,d,c,j,i){var g=_ae._ag(l,k,r,q,b,a,f,e,n,m,t,s,d,c,j,i);return _aa._af(h,o,g)};function _a1(b,a){this.count=b;this._fc=a;this.__defineGetter__("Count",function(){return this.count});this.__defineGetter__("_dm",function(){return this._fc})}function _a2(a,c,b){this._bm=a;if(b){this._do=new Array(c,b)}else{this._do=new Array(c)}this.__defineGetter__("_bo",function(){return this._bm});this.__defineGetter__("_dn",function(){return this._bm*this._fo});this.__defineGetter__("_fo",function(){var e=0;for(var d=0;d6){o._bq(r-11,0,3,6);o._bq(0,r-11,6,3)}return o};this._bu=function(i){return this._do[i.ordinal()]}}_a3._bv=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017);_a3.VERSIONS=_ay();_a3._av=function(a){if(a<1||a>40){throw"bad arguments"}return _a3.VERSIONS[a-1]};_a3._at=function(b){if(b%4!=1){throw"Error _at"}try{return _a3._av((b-17)>>2)}catch(a){throw"Error _av"}};_a3._aw=function(d){var b=4294967295;var f=0;for(var c=0;c<_a3._bv.length;c++){var a=_a3._bv[c];if(a==d){return this._av(c+7)}var e=_ax._gj(d,a);if(eMath.abs(c-m);if(d){var s=m;m=l;l=s;s=c;c=b;b=s}var j=Math.abs(c-m);var i=Math.abs(b-l);var q=-j>>1;var v=l0){if(g==b){break}g+=v;q-=j}}var k=c-m;var r=b-l;return Math.sqrt((k*k+r*r))};this._bh=function(i,g,h,f){var b=this._bi(i,g,h,f);var e=1;var d=i-(h-i);if(d<0){e=i/(i-d);d=0}else{if(d>=qrcode.width){e=(qrcode.width-1-i)/(d-i);d=qrcode.width-1}}var c=Math.floor(g-(f-g)*e);e=1;if(c<0){e=g/(g-c);c=0}else{if(c>=qrcode.height){e=(qrcode.height-1-g)/(c-g);c=qrcode.height-1}}d=Math.floor(i+(d-i)*e);b+=this._bi(i,g,d,c);return b-1};this._bj=function(c,d){var b=this._bh(Math.floor(c.X),Math.floor(c.Y),Math.floor(d.X),Math.floor(d.Y));var e=this._bh(Math.floor(d.X),Math.floor(d.Y),Math.floor(c.X),Math.floor(c.Y));if(isNaN(b)){return e/7}if(isNaN(e)){return b/7}return(b+e)/14};this._bk=function(d,c,b){return(this._bj(d,c)+this._bj(d,b))/2};this.distance=function(c,b){xDiff=c.X-b.X;yDiff=c.Y-b.Y;return Math.sqrt((xDiff*xDiff+yDiff*yDiff))};this._bx=function(g,f,d,e){var b=Math.round(this.distance(g,f)/e);var c=Math.round(this.distance(g,d)/e);var h=((b+c)>>1)+7;switch(h&3){case 0:h++;break;case 2:h--;break;case 3:throw"Error"}return h};this._bl=function(g,f,d,j){var k=Math.floor(j*g);var h=Math.max(0,f-k);var i=Math.min(qrcode.width-1,f+k);if(i-h0){var f=h.X-j.X+n.X;var e=h.Y-j.Y+n.Y;var c=1-3/k;var u=Math.floor(j.X+c*(f-j.X));var t=Math.floor(j.Y+c*(e-j.Y));for(var q=4;q<=16;q<<=1){l=this._bl(d,u,t,q);break}}var g=this.createTransform(j,h,n,l,s);var m=this._bz(this.image,g,s);var o;if(l==null){o=new Array(n,j,h)}else{o=new Array(n,j,h,l)}return new _bg(m,o)};this.detect=function(){var b=new _cc()._ce(this.image);return this._cd(b)}}var _ca=21522;var _cb=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31));var _ch=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);function _ax(a){this._cf=_cg.forBits((a>>3)&3);this._fe=(a&7);this.__defineGetter__("_cg",function(){return this._cf});this.__defineGetter__("_dx",function(){return this._fe});this.GetHashCode=function(){return(this._cf.ordinal()<<3)|_fe};this.Equals=function(c){var b=c;return this._cf==b._cf&&this._fe==b._fe}}_ax._gj=function(d,c){d^=c;return _ch[d&15]+_ch[(_ew(d,4)&15)]+_ch[(_ew(d,8)&15)]+_ch[(_ew(d,12)&15)]+_ch[(_ew(d,16)&15)]+_ch[(_ew(d,20)&15)]+_ch[(_ew(d,24)&15)]+_ch[(_ew(d,28)&15)]};_ax._ci=function(a){var b=_ax._cj(a);if(b!=null){return b}return _ax._cj(a^_ca)};_ax._cj=function(d){var b=4294967295;var a=0;for(var c=0;c<_cb.length;c++){var g=_cb[c];var f=g[0];if(f==d){return new _ax(g[1])}var e=this._gj(d,f);if(e=FOR_BITS.length){throw"bad arguments"}return FOR_BITS[a]};var L=new _cg(0,1,"L");var M=new _cg(1,0,"M");var Q=new _cg(2,3,"Q");var H=new _cg(3,2,"H");var FOR_BITS=new Array(M,L,H,Q);function _ac(d,a){if(!a){a=d}if(d<1||a<1){throw"Both dimensions must be greater than 0"}this.width=d;this.height=a;var c=d>>5;if((d&31)!=0){c++}this.rowSize=c;this.bits=new Array(c*a);for(var b=0;b>5);return((_ew(this.bits[f],(e&31)))&1)!=0};this._dq=function(e,g){var f=g*this.rowSize+(e>>5);this.bits[f]|=1<<(e&31)};this.flip=function(e,g){var f=g*this.rowSize+(e>>5);this.bits[f]^=1<<(e&31)};this.clear=function(){var e=this.bits.length;for(var f=0;fthis.height||l>this.width){throw"The region must fit inside the matrix"}for(var i=j;i>5)]|=1<<(k&31)}}}}function _dl(a,b){this._dv=a;this._dw=b;this.__defineGetter__("_du",function(){return this._dv});this.__defineGetter__("Codewords",function(){return this._dw})}_dl._gn=function(c,h,s){if(c.length!=h._dp){throw"bad arguments"}var k=h._bu(s);var e=0;var d=k._fb();for(var r=0;r=0){var w=l[b]._dw.length;if(w==u){break}b--}b++;var g=u-k._bo;var a=0;for(var r=0;r=0;c--){g=this._dk(8,c,g)}this._co=_ax._ci(g);if(this._co!=null){return this._co}var f=this._au.Dimension;g=0;var d=f-8;for(var e=f-1;e>=d;e--){g=this._dk(e,8,g)}for(var c=f-7;c>2;if(f<=6){return _a3._av(f)}var g=0;var e=h-11;for(var c=5;c>=0;c--){for(var d=h-9;d>=e;d--){g=this._dk(d,c,g)}}this._cp=_a3._aw(g);if(this._cp!=null&&this._cp._cr==h){return this._cp}g=0;for(var d=5;d>=0;d--){for(var c=h-9;c>=e;c--){g=this._dk(d,c,g)}}this._cp=_a3._aw(g);if(this._cp!=null&&this._cp._cr==h){return this._cp}throw"Error _cq"};this._gk=function(){var r=this._cm();var o=this._cq();var c=_dx._gl(r._dx);var f=this._au.Dimension;c._dj(this._au,f);var k=o._aq();var n=true;var s=new Array(o._dp);var m=0;var q=0;var h=0;for(var e=f-1;e>0;e-=2){if(e==6){e--}for(var l=0;l7){throw"bad arguments"}return _dx._dy[a]};function _fg(){this._dj=function(c,d){for(var b=0;b=Math.floor(R/2)){var rLastLast=rLast;var _ga=sLast;var _gb=tLast;rLast=r;sLast=s;tLast=t;if(rLast.Zero){throw"r_{i-1} was zero"}r=rLastLast;var q=this._fa.Zero;var _df=rLast._ex(rLast._ec);var _fy=this._fa.inverse(_df);while(r._ec>=rLast._ec&&!r.Zero){var _fx=r._ec-rLast._ec;var scale=this._fa.multiply(r._ex(r._ec),_fy);q=q._bd(this._fa._ba(_fx,scale));r=r._bd(rLast._dc(_fx,scale))}s=q.multiply1(sLast)._bd(_ga);t=q.multiply1(tLast)._bd(_gb)}var _de=t._ex(0);if(_de==0){throw"ReedSolomonException sigmaTilde(0) was zero"}var inverse=this._fa.inverse(_de);var sigma=t.multiply2(inverse);var omega=r.multiply2(inverse);return new Array(sigma,omega)};this._ey=function(_ez){var _fz=_ez._ec;if(_fz==1){return new Array(_ez._ex(1))}var result=new Array(_fz);var e=0;for(var i=1;i<256&&e<_fz;i++){if(_ez.evaluateAt(i)==0){result[e]=this._fa.inverse(i);e++}}if(e!=_fz){throw"Error locator degree does not match number of roots"}return result};this._di=function(_fs,_dz,_fq){var s=_dz.length;var result=new Array(s);for(var i=0;i1&&e[0]==0){var d=1;while(dn.length){var j=o;o=n;n=j}var h=new Array(n.length);var k=n.length-o.length;for(var m=0;m=l._ec&&!o.Zero){var m=o._ec-l._ec;var h=this._fa.multiply(o._ex(o._ec),n);var i=l._dc(m,h);var k=this._fa._ba(m,h);j=j._bd(k);o=o._bd(i)}return new Array(j,o)}}function _az(b){this._gh=new Array(256);this._gi=new Array(256);var a=1;for(var e=0;e<256;e++){this._gh[e]=a;a<<=1;if(a>=256){a^=b}}for(var e=0;e<255;e++){this._gi[this._gh[e]]=e}var d=new Array(1);d[0]=0;this.zero=new _bp(this,new Array(d));var c=new Array(1);c[0]=1;this.one=new _bp(this,new Array(c));this.__defineGetter__("Zero",function(){return this.zero});this.__defineGetter__("One",function(){return this.one});this._ba=function(j,f){if(j<0){throw"bad arguments"}if(f==0){return zero}var h=new Array(j+1);for(var g=0;gqrcode.maxImgSize){var k=c.width/c.height;f=Math.sqrt(qrcode.maxImgSize/k);l=k*f}i.width=l;i.height=f;h.drawImage(c,0,0,i.width,i.height);qrcode.width=i.width;qrcode.height=i.height;try{qrcode.imagedata=h.getImageData(0,0,i.width,i.height)}catch(m){qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!";if(qrcode.callback!=null){qrcode.callback(qrcode.result)}return}try{qrcode.result=qrcode.process(h)}catch(m){console.log(m);qrcode.result="error decoding QR Code"}if(qrcode.callback!=null){qrcode.callback(qrcode.result)}};c.src=d}};qrcode.isUrl=function(a){var b=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return b.test(a)};qrcode.decode_url=function(b){var d="";try{d=escape(b)}catch(c){console.log(c);d=b}var a="";try{a=decodeURIComponent(d)}catch(c){console.log(c);a=d}return a};qrcode.decode_utf8=function(a){if(qrcode.isUrl(a)){return qrcode.decode_url(a)}else{return a}};qrcode.process=function(r){var a=new Date().getTime();var c=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var m=0;mf[a][o][1]){f[a][o][1]=h}}}}}var m=new Array(c);for(var b=0;b=0){return a>>b}else{return(a>>b)+(2<<~b)}}Array.prototype.remove=function(c,b){var a=this.slice((b||c)+1||this.length);this.length=c<0?this.length+c:c;return this.push.apply(this,a)};var _gf=3;var _eh=57;var _el=8;var _eg=2;qrcode._er=function(c){function b(l,k){xDiff=l.X-k.X;yDiff=l.Y-k.Y;return Math.sqrt((xDiff*xDiff+yDiff*yDiff))}function d(k,o,n){var m=o.x;var l=o.y;return((n.x-m)*(k.y-l))-((n.y-l)*(k.x-m))}var i=b(c[0],c[1]);var f=b(c[1],c[2]);var e=b(c[0],c[2]);var a,j,h;if(f>=i&&f>=e){j=c[0];a=c[1];h=c[2]}else{if(e>=f&&e>=i){j=c[1];a=c[0];h=c[2]}else{j=c[2];a=c[0];h=c[1]}}if(d(a,j,h)<0){var g=a;a=h;h=g}c[0]=a;c[1]=j;c[2]=h};function _cz(c,a,b){this.x=c;this.y=a;this.count=1;this._aj=b;this.__defineGetter__("_ei",function(){return this._aj});this.__defineGetter__("Count",function(){return this.count});this.__defineGetter__("X",function(){return this.x});this.__defineGetter__("Y",function(){return this.y});this._ek=function(){this.count++};this._ev=function(f,e,d){if(Math.abs(e-this.y)<=f&&Math.abs(d-this.x)<=f){var g=Math.abs(f-this._aj);return g<=1||g/this._aj<=1}return false}}function _es(a){this._go=a[0];this._gu=a[1];this._gr=a[2];this.__defineGetter__("_gp",function(){return this._go});this.__defineGetter__("_gq",function(){return this._gu});this.__defineGetter__("_gs",function(){return this._gr})}function _cc(){this.image=null;this._cv=[];this._ge=false;this._al=new Array(0,0,0,0,0);this._am=null;this.__defineGetter__("_da",function(){this._al[0]=0;this._al[1]=0;this._al[2]=0;this._al[3]=0;this._al[4]=0;return this._al});this._ao=function(f){var b=0;for(var d=0;d<5;d++){var e=f[d];if(e==0){return false}b+=e}if(b<7){return false}var c=Math.floor((b<<_el)/7);var a=Math.floor(c/2);return Math.abs(c-(f[0]<<_el))=0&&c[j+f*qrcode.width]){b[2]++;f--}if(f<0){return NaN}while(f>=0&&!c[j+f*qrcode.width]&&b[1]<=d){b[1]++;f--}if(f<0||b[1]>d){return NaN}while(f>=0&&c[j+f*qrcode.width]&&b[0]<=d){b[0]++;f--}if(b[0]>d){return NaN}f=a+1;while(f=d){return NaN}while(f=d){return NaN}var e=b[0]+b[1]+b[2]+b[3]+b[4];if(5*Math.abs(e-g)>=2*g){return NaN}return this._ao(b)?this._an(b,f):NaN};this._ej=function(b,a,e,h){var d=this.image;var i=qrcode.width;var c=this._da;var g=b;while(g>=0&&d[g+a*qrcode.width]){c[2]++;g--}if(g<0){return NaN}while(g>=0&&!d[g+a*qrcode.width]&&c[1]<=e){c[1]++;g--}if(g<0||c[1]>e){return NaN}while(g>=0&&d[g+a*qrcode.width]&&c[0]<=e){c[0]++;g--}if(c[0]>e){return NaN}g=b+1;while(g=e){return NaN}while(g=e){return NaN}var f=c[0]+c[1]+c[2]+c[3]+c[4];if(5*Math.abs(f-h)>=h){return NaN}return this._ao(c)?this._an(c,g):NaN};this._cu=function(c,f,e){var d=c[0]+c[1]+c[2]+c[3]+c[4];var n=this._an(c,e);var b=this._ap(f,Math.floor(n),c[2],d);if(!isNaN(b)){n=this._ej(Math.floor(n),Math.floor(b),c[2],d);if(!isNaN(n)){var l=d/7;var m=false;var h=this._cv.length;for(var g=0;g3){var b=0;var j=0;for(var d=0;d3;d++){var f=this._cv[d];if(Math.abs(f._ei-a)>c){this._cv.remove(d);d--}}}if(this._cv.length>3){this._cv.sort(function(k,i){if(k.count>i.count){return -1}if(k.count=_eg){if(c==null){c=a}else{this._ge=true;return Math.floor((Math.abs(c.X-a.X)-Math.abs(c.Y-a.Y))/2)}}}return 0};this._cx=function(){var g=0;var c=0;var a=this._cv.length;for(var d=0;d=_eg){g++;c+=f._ei}}if(g<3){return false}var e=c/a;var b=0;for(var d=0;dd[2]){h+=m-d[2]-a;f=k-1}}}else{do{f++}while(f=h){return false}}return true};this._ap=function(h,r,l,o){var k=this.image;var q=qrcode.height;var j=this._al;j[0]=0;j[1]=0;j[2]=0;var n=h;while(n>=0&&k[r+n*qrcode.width]&&j[1]<=l){j[1]++;n--}if(n<0||j[1]>l){return NaN}while(n>=0&&!k[r+n*qrcode.width]&&j[0]<=l){j[0]++;n--}if(j[0]>l){return NaN}n=h+1;while(nl){return NaN}while(nl){return NaN}var m=j[0]+j[1]+j[2];if(5*Math.abs(m-o)>=2*o){return NaN}return this._ao(j)?this._an(j,n):NaN};this._cu=function(l,o,n){var m=l[0]+l[1]+l[2];var u=this._an(l,n);var k=this._ap(o,Math.floor(u),2*l[1],m);if(!isNaN(k)){var t=(l[0]+l[1]+l[2])/3;var r=this._cv.length;for(var q=0;q>1);var m=new Array(0,0,0);for(var k=0;k>1):-((k+1)>>1));m[0]=0;m[1]=0;m[2]=0;var n=q;while(n=10&&a<=26){this.dataLengthMode=1}else{if(a>=27&&a<=40){this.dataLengthMode=2}}}this._gd=function(f){var k=0;if(f>(this._cw-f+1);this._cw-=f;return k}else{if(f>(8-(f-(this._cw+1))));this._cw=this._cw-f%8;if(this._cw<0){this._cw=8+this._cw}return k}else{if(f>(8-(f-(this._cw+1+8)));k=g+d+l;this._cw=this._cw-(f-8)%8;if(this._cw<0){this._cw=8+this._cw}return k}else{return 0}}}};this.NextMode=function(){if((this._ed>this.blocks.length-this._en-2)){return 0}else{return this._gd(4)}};this.getDataLength=function(d){var e=0;while(true){if((d>>e)==1){break}e++}return this._gd(qrcode._eo[this.dataLengthMode][e])};this.getRomanAndFigureString=function(h){var f=h;var g=0;var j="";var d=new Array("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"," ","$","%","*","+","-",".","/",":");do{if(f>1){g=this._gd(11);var i=Math.floor(g/45);var e=g%45;j+=d[i];j+=d[e];f-=2}else{if(f==1){g=this._gd(6);j+=d[g];f-=1}}}while(f>0);return j};this.getFigureString=function(f){var d=f;var e=0;var g="";do{if(d>=3){e=this._gd(10);if(e<100){g+="0"}if(e<10){g+="0"}d-=3}else{if(d==2){e=this._gd(7);if(e<10){g+="0"}d-=2}else{if(d==1){e=this._gd(4);d-=1}}}g+=e}while(d>0);return g};this.get8bitByteArray=function(g){var e=g;var f=0;var d=new Array();do{f=this._gd(8);d.push(f);e--}while(e>0);return d};this.getKanjiString=function(j){var g=j;var i=0;var h="";do{i=_gd(13);var e=i%192;var f=i/192;var k=(f<<8)+e;var d=0;if(k+33088<=40956){d=k+33088}else{d=k+49472}h+=String.fromCharCode(d);g--}while(g>0);return h};this.__defineGetter__("DataByte",function(){var g=new Array();var e=1;var f=2;var d=4;var n=8;do{var k=this.NextMode();if(k==0){if(g.length>0){break}else{throw"Empty data block"}}if(k!=e&&k!=f&&k!=d&&k!=n){throw"Invalid mode: "+k+" in (block:"+this._ed+" bit:"+this._cw+")"}dataLength=this.getDataLength(k);if(dataLength<1){throw"Invalid data length: "+dataLength}switch(k){case e:var l=this.getFigureString(dataLength);var i=new Array(l.length);for(var h=0;h d || h < -1 || h > b) { throw "Error._ab " } c = false; if (a == -1) { e[g] = 0; c = true } else { if (a == d) { e[g] = d - 1; c = true } } if (h == -1) { e[g + 1] = 0; c = true } else { if (h == b) { e[g + 1] = b - 1; c = true } } } c = true; for (var g = e.length - 2; g >= 0 && c; g -= 2) { var a = Math.floor(e[g]); var h = Math.floor(e[g + 1]); if (a < -1 || a > d || h < -1 || h > b) { throw "Error._ab " } c = false; if (a == -1) { e[g] = 0; c = true } else { if (a == d) { e[g] = d - 1; c = true } } if (h == -1) { e[g + 1] = 0; c = true } else { if (h == b) { e[g + 1] = b - 1; c = true } } } }; _aa._af = function (b, d, a) { var l = new _ac(d); var k = new Array(d << 1); for (var g = 0; g < d; g++) { var h = k.length; var j = g + 0.5; for (var i = 0; i < h; i += 2) { k[i] = (i >> 1) + 0.5; k[i + 1] = j } a._ad(k); _aa._ab(b, k); try { for (var i = 0; i < h; i += 2) { var e = (Math.floor(k[i]) * 4) + (Math.floor(k[i + 1]) * qrcode.width * 4); var f = b[Math.floor(k[i]) + qrcode.width * Math.floor(k[i + 1])]; qrcode.imagedata.data[e] = f ? 255 : 0; qrcode.imagedata.data[e + 1] = f ? 255 : 0; qrcode.imagedata.data[e + 2] = 0; qrcode.imagedata.data[e + 3] = 255; if (f) { l._dq(i >> 1, g) } } } catch (c) { throw "Error._ab" } } return l }; _aa._ah = function (h, o, l, k, r, q, b, a, f, e, n, m, t, s, d, c, j, i) { var g = _ae._ag(l, k, r, q, b, a, f, e, n, m, t, s, d, c, j, i); return _aa._af(h, o, g) }; function _a1(b, a) { this.count = b; this._fc = a; this.__defineGetter__("Count", function () { return this.count }); this.__defineGetter__("_dm", function () { return this._fc }) } function _a2(a, c, b) { this._bm = a; if (b) { this._do = new Array(c, b) } else { this._do = new Array(c) } this.__defineGetter__("_bo", function () { return this._bm }); this.__defineGetter__("_dn", function () { return this._bm * this._fo }); this.__defineGetter__("_fo", function () { var e = 0; for (var d = 0; d < this._do.length; d++) { e += this._do[d].length } return e }); this._fb = function () { return this._do } } function _a3(k, l, h, g, f, e) { this._bs = k; this._ar = l; this._do = new Array(h, g, f, e); var j = 0; var b = h._bo; var a = h._fb(); for (var d = 0; d < a.length; d++) { var c = a[d]; j += c.Count * (c._dm + b) } this._br = j; this.__defineGetter__("_fd", function () { return this._bs }); this.__defineGetter__("_as", function () { return this._ar }); this.__defineGetter__("_dp", function () { return this._br }); this.__defineGetter__("_cr", function () { return 17 + 4 * this._bs }); this._aq = function () { var r = this._cr; var o = new _ac(r); o._bq(0, 0, 9, 9); o._bq(r - 8, 0, 8, 9); o._bq(0, r - 8, 9, 8); var n = this._ar.length; for (var m = 0; m < n; m++) { var q = this._ar[m] - 2; for (var s = 0; s < n; s++) { if ((m == 0 && (s == 0 || s == n - 1)) || (m == n - 1 && s == 0)) { continue } o._bq(this._ar[s] - 2, q, 5, 5) } } o._bq(6, 9, 1, r - 17); o._bq(9, 6, r - 17, 1); if (this._bs > 6) { o._bq(r - 11, 0, 3, 6); o._bq(0, r - 11, 6, 3) } return o }; this._bu = function (i) { return this._do[i.ordinal()] } } _a3._bv = new Array(31892, 34236, 39577, 42195, 48118, 51042, 55367, 58893, 63784, 68472, 70749, 76311, 79154, 84390, 87683, 92361, 96236, 102084, 102881, 110507, 110734, 117786, 119615, 126325, 127568, 133589, 136944, 141498, 145311, 150283, 152622, 158308, 161089, 167017); _a3.VERSIONS = _ay(); _a3._av = function (a) { if (a < 1 || a > 40) { throw "bad arguments" } return _a3.VERSIONS[a - 1] }; _a3._at = function (b) { if (b % 4 != 1) { throw "Error _at" } try { return _a3._av((b - 17) >> 2) } catch (a) { throw "Error _av" } }; _a3._aw = function (d) { var b = 4294967295; var f = 0; for (var c = 0; c < _a3._bv.length; c++) { var a = _a3._bv[c]; if (a == d) { return this._av(c + 7) } var e = _ax._gj(d, a); if (e < b) { f = c + 7; b = e } } if (b <= 3) { return this._av(f) } return null }; function _ay() { return new Array(new _a3(1, new Array(), new _a2(7, new _a1(1, 19)), new _a2(10, new _a1(1, 16)), new _a2(13, new _a1(1, 13)), new _a2(17, new _a1(1, 9))), new _a3(2, new Array(6, 18), new _a2(10, new _a1(1, 34)), new _a2(16, new _a1(1, 28)), new _a2(22, new _a1(1, 22)), new _a2(28, new _a1(1, 16))), new _a3(3, new Array(6, 22), new _a2(15, new _a1(1, 55)), new _a2(26, new _a1(1, 44)), new _a2(18, new _a1(2, 17)), new _a2(22, new _a1(2, 13))), new _a3(4, new Array(6, 26), new _a2(20, new _a1(1, 80)), new _a2(18, new _a1(2, 32)), new _a2(26, new _a1(2, 24)), new _a2(16, new _a1(4, 9))), new _a3(5, new Array(6, 30), new _a2(26, new _a1(1, 108)), new _a2(24, new _a1(2, 43)), new _a2(18, new _a1(2, 15), new _a1(2, 16)), new _a2(22, new _a1(2, 11), new _a1(2, 12))), new _a3(6, new Array(6, 34), new _a2(18, new _a1(2, 68)), new _a2(16, new _a1(4, 27)), new _a2(24, new _a1(4, 19)), new _a2(28, new _a1(4, 15))), new _a3(7, new Array(6, 22, 38), new _a2(20, new _a1(2, 78)), new _a2(18, new _a1(4, 31)), new _a2(18, new _a1(2, 14), new _a1(4, 15)), new _a2(26, new _a1(4, 13), new _a1(1, 14))), new _a3(8, new Array(6, 24, 42), new _a2(24, new _a1(2, 97)), new _a2(22, new _a1(2, 38), new _a1(2, 39)), new _a2(22, new _a1(4, 18), new _a1(2, 19)), new _a2(26, new _a1(4, 14), new _a1(2, 15))), new _a3(9, new Array(6, 26, 46), new _a2(30, new _a1(2, 116)), new _a2(22, new _a1(3, 36), new _a1(2, 37)), new _a2(20, new _a1(4, 16), new _a1(4, 17)), new _a2(24, new _a1(4, 12), new _a1(4, 13))), new _a3(10, new Array(6, 28, 50), new _a2(18, new _a1(2, 68), new _a1(2, 69)), new _a2(26, new _a1(4, 43), new _a1(1, 44)), new _a2(24, new _a1(6, 19), new _a1(2, 20)), new _a2(28, new _a1(6, 15), new _a1(2, 16))), new _a3(11, new Array(6, 30, 54), new _a2(20, new _a1(4, 81)), new _a2(30, new _a1(1, 50), new _a1(4, 51)), new _a2(28, new _a1(4, 22), new _a1(4, 23)), new _a2(24, new _a1(3, 12), new _a1(8, 13))), new _a3(12, new Array(6, 32, 58), new _a2(24, new _a1(2, 92), new _a1(2, 93)), new _a2(22, new _a1(6, 36), new _a1(2, 37)), new _a2(26, new _a1(4, 20), new _a1(6, 21)), new _a2(28, new _a1(7, 14), new _a1(4, 15))), new _a3(13, new Array(6, 34, 62), new _a2(26, new _a1(4, 107)), new _a2(22, new _a1(8, 37), new _a1(1, 38)), new _a2(24, new _a1(8, 20), new _a1(4, 21)), new _a2(22, new _a1(12, 11), new _a1(4, 12))), new _a3(14, new Array(6, 26, 46, 66), new _a2(30, new _a1(3, 115), new _a1(1, 116)), new _a2(24, new _a1(4, 40), new _a1(5, 41)), new _a2(20, new _a1(11, 16), new _a1(5, 17)), new _a2(24, new _a1(11, 12), new _a1(5, 13))), new _a3(15, new Array(6, 26, 48, 70), new _a2(22, new _a1(5, 87), new _a1(1, 88)), new _a2(24, new _a1(5, 41), new _a1(5, 42)), new _a2(30, new _a1(5, 24), new _a1(7, 25)), new _a2(24, new _a1(11, 12), new _a1(7, 13))), new _a3(16, new Array(6, 26, 50, 74), new _a2(24, new _a1(5, 98), new _a1(1, 99)), new _a2(28, new _a1(7, 45), new _a1(3, 46)), new _a2(24, new _a1(15, 19), new _a1(2, 20)), new _a2(30, new _a1(3, 15), new _a1(13, 16))), new _a3(17, new Array(6, 30, 54, 78), new _a2(28, new _a1(1, 107), new _a1(5, 108)), new _a2(28, new _a1(10, 46), new _a1(1, 47)), new _a2(28, new _a1(1, 22), new _a1(15, 23)), new _a2(28, new _a1(2, 14), new _a1(17, 15))), new _a3(18, new Array(6, 30, 56, 82), new _a2(30, new _a1(5, 120), new _a1(1, 121)), new _a2(26, new _a1(9, 43), new _a1(4, 44)), new _a2(28, new _a1(17, 22), new _a1(1, 23)), new _a2(28, new _a1(2, 14), new _a1(19, 15))), new _a3(19, new Array(6, 30, 58, 86), new _a2(28, new _a1(3, 113), new _a1(4, 114)), new _a2(26, new _a1(3, 44), new _a1(11, 45)), new _a2(26, new _a1(17, 21), new _a1(4, 22)), new _a2(26, new _a1(9, 13), new _a1(16, 14))), new _a3(20, new Array(6, 34, 62, 90), new _a2(28, new _a1(3, 107), new _a1(5, 108)), new _a2(26, new _a1(3, 41), new _a1(13, 42)), new _a2(30, new _a1(15, 24), new _a1(5, 25)), new _a2(28, new _a1(15, 15), new _a1(10, 16))), new _a3(21, new Array(6, 28, 50, 72, 94), new _a2(28, new _a1(4, 116), new _a1(4, 117)), new _a2(26, new _a1(17, 42)), new _a2(28, new _a1(17, 22), new _a1(6, 23)), new _a2(30, new _a1(19, 16), new _a1(6, 17))), new _a3(22, new Array(6, 26, 50, 74, 98), new _a2(28, new _a1(2, 111), new _a1(7, 112)), new _a2(28, new _a1(17, 46)), new _a2(30, new _a1(7, 24), new _a1(16, 25)), new _a2(24, new _a1(34, 13))), new _a3(23, new Array(6, 30, 54, 74, 102), new _a2(30, new _a1(4, 121), new _a1(5, 122)), new _a2(28, new _a1(4, 47), new _a1(14, 48)), new _a2(30, new _a1(11, 24), new _a1(14, 25)), new _a2(30, new _a1(16, 15), new _a1(14, 16))), new _a3(24, new Array(6, 28, 54, 80, 106), new _a2(30, new _a1(6, 117), new _a1(4, 118)), new _a2(28, new _a1(6, 45), new _a1(14, 46)), new _a2(30, new _a1(11, 24), new _a1(16, 25)), new _a2(30, new _a1(30, 16), new _a1(2, 17))), new _a3(25, new Array(6, 32, 58, 84, 110), new _a2(26, new _a1(8, 106), new _a1(4, 107)), new _a2(28, new _a1(8, 47), new _a1(13, 48)), new _a2(30, new _a1(7, 24), new _a1(22, 25)), new _a2(30, new _a1(22, 15), new _a1(13, 16))), new _a3(26, new Array(6, 30, 58, 86, 114), new _a2(28, new _a1(10, 114), new _a1(2, 115)), new _a2(28, new _a1(19, 46), new _a1(4, 47)), new _a2(28, new _a1(28, 22), new _a1(6, 23)), new _a2(30, new _a1(33, 16), new _a1(4, 17))), new _a3(27, new Array(6, 34, 62, 90, 118), new _a2(30, new _a1(8, 122), new _a1(4, 123)), new _a2(28, new _a1(22, 45), new _a1(3, 46)), new _a2(30, new _a1(8, 23), new _a1(26, 24)), new _a2(30, new _a1(12, 15), new _a1(28, 16))), new _a3(28, new Array(6, 26, 50, 74, 98, 122), new _a2(30, new _a1(3, 117), new _a1(10, 118)), new _a2(28, new _a1(3, 45), new _a1(23, 46)), new _a2(30, new _a1(4, 24), new _a1(31, 25)), new _a2(30, new _a1(11, 15), new _a1(31, 16))), new _a3(29, new Array(6, 30, 54, 78, 102, 126), new _a2(30, new _a1(7, 116), new _a1(7, 117)), new _a2(28, new _a1(21, 45), new _a1(7, 46)), new _a2(30, new _a1(1, 23), new _a1(37, 24)), new _a2(30, new _a1(19, 15), new _a1(26, 16))), new _a3(30, new Array(6, 26, 52, 78, 104, 130), new _a2(30, new _a1(5, 115), new _a1(10, 116)), new _a2(28, new _a1(19, 47), new _a1(10, 48)), new _a2(30, new _a1(15, 24), new _a1(25, 25)), new _a2(30, new _a1(23, 15), new _a1(25, 16))), new _a3(31, new Array(6, 30, 56, 82, 108, 134), new _a2(30, new _a1(13, 115), new _a1(3, 116)), new _a2(28, new _a1(2, 46), new _a1(29, 47)), new _a2(30, new _a1(42, 24), new _a1(1, 25)), new _a2(30, new _a1(23, 15), new _a1(28, 16))), new _a3(32, new Array(6, 34, 60, 86, 112, 138), new _a2(30, new _a1(17, 115)), new _a2(28, new _a1(10, 46), new _a1(23, 47)), new _a2(30, new _a1(10, 24), new _a1(35, 25)), new _a2(30, new _a1(19, 15), new _a1(35, 16))), new _a3(33, new Array(6, 30, 58, 86, 114, 142), new _a2(30, new _a1(17, 115), new _a1(1, 116)), new _a2(28, new _a1(14, 46), new _a1(21, 47)), new _a2(30, new _a1(29, 24), new _a1(19, 25)), new _a2(30, new _a1(11, 15), new _a1(46, 16))), new _a3(34, new Array(6, 34, 62, 90, 118, 146), new _a2(30, new _a1(13, 115), new _a1(6, 116)), new _a2(28, new _a1(14, 46), new _a1(23, 47)), new _a2(30, new _a1(44, 24), new _a1(7, 25)), new _a2(30, new _a1(59, 16), new _a1(1, 17))), new _a3(35, new Array(6, 30, 54, 78, 102, 126, 150), new _a2(30, new _a1(12, 121), new _a1(7, 122)), new _a2(28, new _a1(12, 47), new _a1(26, 48)), new _a2(30, new _a1(39, 24), new _a1(14, 25)), new _a2(30, new _a1(22, 15), new _a1(41, 16))), new _a3(36, new Array(6, 24, 50, 76, 102, 128, 154), new _a2(30, new _a1(6, 121), new _a1(14, 122)), new _a2(28, new _a1(6, 47), new _a1(34, 48)), new _a2(30, new _a1(46, 24), new _a1(10, 25)), new _a2(30, new _a1(2, 15), new _a1(64, 16))), new _a3(37, new Array(6, 28, 54, 80, 106, 132, 158), new _a2(30, new _a1(17, 122), new _a1(4, 123)), new _a2(28, new _a1(29, 46), new _a1(14, 47)), new _a2(30, new _a1(49, 24), new _a1(10, 25)), new _a2(30, new _a1(24, 15), new _a1(46, 16))), new _a3(38, new Array(6, 32, 58, 84, 110, 136, 162), new _a2(30, new _a1(4, 122), new _a1(18, 123)), new _a2(28, new _a1(13, 46), new _a1(32, 47)), new _a2(30, new _a1(48, 24), new _a1(14, 25)), new _a2(30, new _a1(42, 15), new _a1(32, 16))), new _a3(39, new Array(6, 26, 54, 82, 110, 138, 166), new _a2(30, new _a1(20, 117), new _a1(4, 118)), new _a2(28, new _a1(40, 47), new _a1(7, 48)), new _a2(30, new _a1(43, 24), new _a1(22, 25)), new _a2(30, new _a1(10, 15), new _a1(67, 16))), new _a3(40, new Array(6, 30, 58, 86, 114, 142, 170), new _a2(30, new _a1(19, 118), new _a1(6, 119)), new _a2(28, new _a1(18, 47), new _a1(31, 48)), new _a2(30, new _a1(34, 24), new _a1(34, 25)), new _a2(30, new _a1(20, 15), new _a1(61, 16)))) } function _ae(i, f, c, h, e, b, g, d, a) { this.a11 = i; this.a12 = h; this.a13 = g; this.a21 = f; this.a22 = e; this.a23 = d; this.a31 = c; this.a32 = b; this.a33 = a; this._ad = function (w) { var t = w.length; var A = this.a11; var z = this.a12; var v = this.a13; var r = this.a21; var q = this.a22; var o = this.a23; var m = this.a31; var k = this.a32; var j = this.a33; for (var n = 0; n < t; n += 2) { var u = w[n]; var s = w[n + 1]; var l = v * u + o * s + j; w[n] = (A * u + r * s + m) / l; w[n + 1] = (z * u + q * s + k) / l } }; this._fp = function (m, k) { var r = m.length; for (var l = 0; l < r; l++) { var j = m[l]; var q = k[l]; var o = this.a13 * j + this.a23 * q + this.a33; m[l] = (this.a11 * j + this.a21 * q + this.a31) / o; k[l] = (this.a12 * j + this.a22 * q + this.a32) / o } }; this._fr = function () { return new _ae(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21) }; this.times = function (j) { return new _ae(this.a11 * j.a11 + this.a21 * j.a12 + this.a31 * j.a13, this.a11 * j.a21 + this.a21 * j.a22 + this.a31 * j.a23, this.a11 * j.a31 + this.a21 * j.a32 + this.a31 * j.a33, this.a12 * j.a11 + this.a22 * j.a12 + this.a32 * j.a13, this.a12 * j.a21 + this.a22 * j.a22 + this.a32 * j.a23, this.a12 * j.a31 + this.a22 * j.a32 + this.a32 * j.a33, this.a13 * j.a11 + this.a23 * j.a12 + this.a33 * j.a13, this.a13 * j.a21 + this.a23 * j.a22 + this.a33 * j.a23, this.a13 * j.a31 + this.a23 * j.a32 + this.a33 * j.a33) } } _ae._ag = function (q, e, o, d, n, c, m, b, h, r, l, f, a, j, i, s) { var g = this._be(q, e, o, d, n, c, m, b); var k = this._bf(h, r, l, f, a, j, i, s); return k.times(g) }; _ae._bf = function (f, h, d, g, b, e, a, c) { dy2 = c - e; dy3 = h - g + e - c; if (dy2 == 0 && dy3 == 0) { return new _ae(d - f, b - d, f, g - h, e - g, h, 0, 0, 1) } else { dx1 = d - b; dx2 = a - b; dx3 = f - d + b - a; dy1 = g - e; _dr = dx1 * dy2 - dx2 * dy1; a13 = (dx3 * dy2 - dx2 * dy3) / _dr; a23 = (dx1 * dy3 - dx3 * dy1) / _dr; return new _ae(d - f + a13 * d, a - f + a23 * a, f, g - h + a13 * g, c - h + a23 * c, h, a13, a23, 1) } }; _ae._be = function (f, h, d, g, b, e, a, c) { return this._bf(f, h, d, g, b, e, a, c)._fr() }; function _bg(b, a) { this.bits = b; this.points = a } function Detector(a) { this.image = a; this._am = null; this._bi = function (m, l, c, b) { var d = Math.abs(b - l) > Math.abs(c - m); if (d) { var s = m; m = l; l = s; s = c; c = b; b = s } var j = Math.abs(c - m); var i = Math.abs(b - l); var q = -j >> 1; var v = l < b ? 1 : -1; var f = m < c ? 1 : -1; var e = 0; for (var h = m, g = l; h != c; h += f) { var u = d ? g : h; var t = d ? h : g; if (e == 1) { if (this.image[u + t * qrcode.width]) { e++ } } else { if (!this.image[u + t * qrcode.width]) { e++ } } if (e == 3) { var o = h - m; var n = g - l; return Math.sqrt((o * o + n * n)) } q += i; if (q > 0) { if (g == b) { break } g += v; q -= j } } var k = c - m; var r = b - l; return Math.sqrt((k * k + r * r)) }; this._bh = function (i, g, h, f) { var b = this._bi(i, g, h, f); var e = 1; var d = i - (h - i); if (d < 0) { e = i / (i - d); d = 0 } else { if (d >= qrcode.width) { e = (qrcode.width - 1 - i) / (d - i); d = qrcode.width - 1 } } var c = Math.floor(g - (f - g) * e); e = 1; if (c < 0) { e = g / (g - c); c = 0 } else { if (c >= qrcode.height) { e = (qrcode.height - 1 - g) / (c - g); c = qrcode.height - 1 } } d = Math.floor(i + (d - i) * e); b += this._bi(i, g, d, c); return b - 1 }; this._bj = function (c, d) { var b = this._bh(Math.floor(c.X), Math.floor(c.Y), Math.floor(d.X), Math.floor(d.Y)); var e = this._bh(Math.floor(d.X), Math.floor(d.Y), Math.floor(c.X), Math.floor(c.Y)); if (isNaN(b)) { return e / 7 } if (isNaN(e)) { return b / 7 } return (b + e) / 14 }; this._bk = function (d, c, b) { return (this._bj(d, c) + this._bj(d, b)) / 2 }; this.distance = function (c, b) { xDiff = c.X - b.X; yDiff = c.Y - b.Y; return Math.sqrt((xDiff * xDiff + yDiff * yDiff)) }; this._bx = function (g, f, d, e) { var b = Math.round(this.distance(g, f) / e); var c = Math.round(this.distance(g, d) / e); var h = ((b + c) >> 1) + 7; switch (h & 3) { case 0: h++; break; case 2: h--; break; case 3: throw "Error" }return h }; this._bl = function (g, f, d, j) { var k = Math.floor(j * g); var h = Math.max(0, f - k); var i = Math.min(qrcode.width - 1, f + k); if (i - h < g * 3) { throw "Error" } var b = Math.max(0, d - k); var c = Math.min(qrcode.height - 1, d + k); var e = new _ak(this.image, h, b, i - h, c - b, g, this._am); return e.find() }; this.createTransform = function (l, h, k, b, g) { var j = g - 3.5; var i; var f; var e; var c; if (b != null) { i = b.X; f = b.Y; e = c = j - 3 } else { i = (h.X - l.X) + k.X; f = (h.Y - l.Y) + k.Y; e = c = j } var d = _ae._ag(3.5, 3.5, j, 3.5, e, c, 3.5, j, l.X, l.Y, h.X, h.Y, i, f, k.X, k.Y); return d }; this._bz = function (e, b, d) { var c = _aa; return c._af(e, d, b) }; this._cd = function (r) { var j = r._gq; var h = r._gs; var n = r._gp; var d = this._bk(j, h, n); if (d < 1) { throw "Error" } var s = this._bx(j, h, n, d); var b = _a3._at(s); var k = b._cr - 7; var l = null; if (b._as.length > 0) { var f = h.X - j.X + n.X; var e = h.Y - j.Y + n.Y; var c = 1 - 3 / k; var u = Math.floor(j.X + c * (f - j.X)); var t = Math.floor(j.Y + c * (e - j.Y)); for (var q = 4; q <= 16; q <<= 1) { l = this._bl(d, u, t, q); break } } var g = this.createTransform(j, h, n, l, s); var m = this._bz(this.image, g, s); var o; if (l == null) { o = new Array(n, j, h) } else { o = new Array(n, j, h, l) } return new _bg(m, o) }; this.detect = function () { var b = new _cc()._ce(this.image); return this._cd(b) } } var _ca = 21522; var _cb = new Array(new Array(21522, 0), new Array(20773, 1), new Array(24188, 2), new Array(23371, 3), new Array(17913, 4), new Array(16590, 5), new Array(20375, 6), new Array(19104, 7), new Array(30660, 8), new Array(29427, 9), new Array(32170, 10), new Array(30877, 11), new Array(26159, 12), new Array(25368, 13), new Array(27713, 14), new Array(26998, 15), new Array(5769, 16), new Array(5054, 17), new Array(7399, 18), new Array(6608, 19), new Array(1890, 20), new Array(597, 21), new Array(3340, 22), new Array(2107, 23), new Array(13663, 24), new Array(12392, 25), new Array(16177, 26), new Array(14854, 27), new Array(9396, 28), new Array(8579, 29), new Array(11994, 30), new Array(11245, 31)); var _ch = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4); function _ax(a) { this._cf = _cg.forBits((a >> 3) & 3); this._fe = (a & 7); this.__defineGetter__("_cg", function () { return this._cf }); this.__defineGetter__("_dx", function () { return this._fe }); this.GetHashCode = function () { return (this._cf.ordinal() << 3) | _fe }; this.Equals = function (c) { var b = c; return this._cf == b._cf && this._fe == b._fe } } _ax._gj = function (d, c) { d ^= c; return _ch[d & 15] + _ch[(_ew(d, 4) & 15)] + _ch[(_ew(d, 8) & 15)] + _ch[(_ew(d, 12) & 15)] + _ch[(_ew(d, 16) & 15)] + _ch[(_ew(d, 20) & 15)] + _ch[(_ew(d, 24) & 15)] + _ch[(_ew(d, 28) & 15)] }; _ax._ci = function (a) { var b = _ax._cj(a); if (b != null) { return b } return _ax._cj(a ^ _ca) }; _ax._cj = function (d) { var b = 4294967295; var a = 0; for (var c = 0; c < _cb.length; c++) { var g = _cb[c]; var f = g[0]; if (f == d) { return new _ax(g[1]) } var e = this._gj(d, f); if (e < b) { a = g[1]; b = e } } if (b <= 3) { return new _ax(a) } return null }; function _cg(a, c, b) { this._ff = a; this.bits = c; this.name = b; this.__defineGetter__("Bits", function () { return this.bits }); this.__defineGetter__("Name", function () { return this.name }); this.ordinal = function () { return this._ff } } _cg.forBits = function (a) { if (a < 0 || a >= FOR_BITS.length) { throw "bad arguments" } return FOR_BITS[a] }; var L = new _cg(0, 1, "L"); var M = new _cg(1, 0, "M"); var Q = new _cg(2, 3, "Q"); var H = new _cg(3, 2, "H"); var FOR_BITS = new Array(M, L, H, Q); function _ac(d, a) { if (!a) { a = d } if (d < 1 || a < 1) { throw "Both dimensions must be greater than 0" } this.width = d; this.height = a; var c = d >> 5; if ((d & 31) != 0) { c++ } this.rowSize = c; this.bits = new Array(c * a); for (var b = 0; b < this.bits.length; b++) { this.bits[b] = 0 } this.__defineGetter__("Width", function () { return this.width }); this.__defineGetter__("Height", function () { return this.height }); this.__defineGetter__("Dimension", function () { if (this.width != this.height) { throw "Can't call getDimension() on a non-square matrix" } return this.width }); this._ds = function (e, g) { var f = g * this.rowSize + (e >> 5); return ((_ew(this.bits[f], (e & 31))) & 1) != 0 }; this._dq = function (e, g) { var f = g * this.rowSize + (e >> 5); this.bits[f] |= 1 << (e & 31) }; this.flip = function (e, g) { var f = g * this.rowSize + (e >> 5); this.bits[f] ^= 1 << (e & 31) }; this.clear = function () { var e = this.bits.length; for (var f = 0; f < e; f++) { this.bits[f] = 0 } }; this._bq = function (g, j, f, m) { if (j < 0 || g < 0) { throw "Left and top must be nonnegative" } if (m < 1 || f < 1) { throw "Height and width must be at least 1" } var l = g + f; var e = j + m; if (e > this.height || l > this.width) { throw "The region must fit inside the matrix" } for (var i = j; i < e; i++) { var h = i * this.rowSize; for (var k = g; k < l; k++) { this.bits[h + (k >> 5)] |= 1 << (k & 31) } } } } function _dl(a, b) { this._dv = a; this._dw = b; this.__defineGetter__("_du", function () { return this._dv }); this.__defineGetter__("Codewords", function () { return this._dw }) } _dl._gn = function (c, h, s) { if (c.length != h._dp) { throw "bad arguments" } var k = h._bu(s); var e = 0; var d = k._fb(); for (var r = 0; r < d.length; r++) { e += d[r].Count } var l = new Array(e); var n = 0; for (var o = 0; o < d.length; o++) { var f = d[o]; for (var r = 0; r < f.Count; r++) { var m = f._dm; var t = k._bo + m; l[n++] = new _dl(m, new Array(t)) } } var u = l[0]._dw.length; var b = l.length - 1; while (b >= 0) { var w = l[b]._dw.length; if (w == u) { break } b-- } b++; var g = u - k._bo; var a = 0; for (var r = 0; r < g; r++) { for (var o = 0; o < n; o++) { l[o]._dw[r] = c[a++] } } for (var o = b; o < n; o++) { l[o]._dw[g] = c[a++] } var q = l[0]._dw.length; for (var r = g; r < q; r++) { for (var o = 0; o < n; o++) { var v = o < b ? r : r + 1; l[o]._dw[v] = c[a++] } } return l }; function _cl(a) { var b = a.Dimension; if (b < 21 || (b & 3) != 1) { throw "Error _cl" } this._au = a; this._cp = null; this._co = null; this._dk = function (d, c, e) { return this._au._ds(d, c) ? (e << 1) | 1 : e << 1 }; this._cm = function () { if (this._co != null) { return this._co } var g = 0; for (var e = 0; e < 6; e++) { g = this._dk(e, 8, g) } g = this._dk(7, 8, g); g = this._dk(8, 8, g); g = this._dk(8, 7, g); for (var c = 5; c >= 0; c--) { g = this._dk(8, c, g) } this._co = _ax._ci(g); if (this._co != null) { return this._co } var f = this._au.Dimension; g = 0; var d = f - 8; for (var e = f - 1; e >= d; e--) { g = this._dk(e, 8, g) } for (var c = f - 7; c < f; c++) { g = this._dk(8, c, g) } this._co = _ax._ci(g); if (this._co != null) { return this._co } throw "Error _cm" }; this._cq = function () { if (this._cp != null) { return this._cp } var h = this._au.Dimension; var f = (h - 17) >> 2; if (f <= 6) { return _a3._av(f) } var g = 0; var e = h - 11; for (var c = 5; c >= 0; c--) { for (var d = h - 9; d >= e; d--) { g = this._dk(d, c, g) } } this._cp = _a3._aw(g); if (this._cp != null && this._cp._cr == h) { return this._cp } g = 0; for (var d = 5; d >= 0; d--) { for (var c = h - 9; c >= e; c--) { g = this._dk(d, c, g) } } this._cp = _a3._aw(g); if (this._cp != null && this._cp._cr == h) { return this._cp } throw "Error _cq" }; this._gk = function () { var r = this._cm(); var o = this._cq(); var c = _dx._gl(r._dx); var f = this._au.Dimension; c._dj(this._au, f); var k = o._aq(); var n = true; var s = new Array(o._dp); var m = 0; var q = 0; var h = 0; for (var e = f - 1; e > 0; e -= 2) { if (e == 6) { e-- } for (var l = 0; l < f; l++) { var g = n ? f - 1 - l : l; for (var d = 0; d < 2; d++) { if (!k._ds(e - d, g)) { h++; q <<= 1; if (this._au._ds(e - d, g)) { q |= 1 } if (h == 8) { s[m++] = q; h = 0; q = 0 } } } } n ^= true } if (m != o._dp) { throw "Error _gk" } return s } } _dx = {}; _dx._gl = function (a) { if (a < 0 || a > 7) { throw "bad arguments" } return _dx._dy[a] }; function _fg() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (b, a) { return ((b + a) & 1) == 0 } } function _fh() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (b, a) { return (b & 1) == 0 } } function _fi() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (b, a) { return a % 3 == 0 } } function _fj() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (b, a) { return (b + a) % 3 == 0 } } function _fk() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (b, a) { return (((_ew(b, 1)) + (a / 3)) & 1) == 0 } } function _fl() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (c, b) { var a = c * b; return (a & 1) + (a % 3) == 0 } } function _fm() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (c, b) { var a = c * b; return (((a & 1) + (a % 3)) & 1) == 0 } } function _fn() { this._dj = function (c, d) { for (var b = 0; b < d; b++) { for (var a = 0; a < d; a++) { if (this._fw(b, a)) { c.flip(a, b) } } } }; this._fw = function (b, a) { return ((((b + a) & 1) + ((b * a) % 3)) & 1) == 0 } } _dx._dy = new Array(new _fg(), new _fh(), new _fi(), new _fj(), new _fk(), new _fl(), new _fm(), new _fn()); function _db(_fa) { this._fa = _fa; this.decode = function (received, _fv) { var poly = new _bp(this._fa, received); var _dh = new Array(_fv); for (var i = 0; i < _dh.length; i++) { _dh[i] = 0 } var _fq = false; var noError = true; for (var i = 0; i < _fv; i++) { var eval = poly.evaluateAt(this._fa.exp(_fq ? i + 1 : i)); _dh[_dh.length - 1 - i] = eval; if (eval != 0) { noError = false } } if (noError) { return } var _fu = new _bp(this._fa, _dh); var _dg = this._eb(this._fa._ba(_fv, 1), _fu, _fv); var sigma = _dg[0]; var omega = _dg[1]; var _dz = this._ey(sigma); var _ea = this._di(omega, _dz, _fq); for (var i = 0; i < _dz.length; i++) { var position = received.length - 1 - this._fa.log(_dz[i]); if (position < 0) { throw "ReedSolomonException Bad error location" } received[position] = _az._bd(received[position], _ea[i]) } }; this._eb = function (a, b, R) { if (a._ec < b._ec) { var temp = a; a = b; b = temp } var rLast = a; var r = b; var sLast = this._fa.One; var s = this._fa.Zero; var tLast = this._fa.Zero; var t = this._fa.One; while (r._ec >= Math.floor(R / 2)) { var rLastLast = rLast; var _ga = sLast; var _gb = tLast; rLast = r; sLast = s; tLast = t; if (rLast.Zero) { throw "r_{i-1} was zero" } r = rLastLast; var q = this._fa.Zero; var _df = rLast._ex(rLast._ec); var _fy = this._fa.inverse(_df); while (r._ec >= rLast._ec && !r.Zero) { var _fx = r._ec - rLast._ec; var scale = this._fa.multiply(r._ex(r._ec), _fy); q = q._bd(this._fa._ba(_fx, scale)); r = r._bd(rLast._dc(_fx, scale)) } s = q.multiply1(sLast)._bd(_ga); t = q.multiply1(tLast)._bd(_gb) } var _de = t._ex(0); if (_de == 0) { throw "ReedSolomonException sigmaTilde(0) was zero" } var inverse = this._fa.inverse(_de); var sigma = t.multiply2(inverse); var omega = r.multiply2(inverse); return new Array(sigma, omega) }; this._ey = function (_ez) { var _fz = _ez._ec; if (_fz == 1) { return new Array(_ez._ex(1)) } var result = new Array(_fz); var e = 0; for (var i = 1; i < 256 && e < _fz; i++) { if (_ez.evaluateAt(i) == 0) { result[e] = this._fa.inverse(i); e++ } } if (e != _fz) { throw "Error locator degree does not match number of roots" } return result }; this._di = function (_fs, _dz, _fq) { var s = _dz.length; var result = new Array(s); for (var i = 0; i < s; i++) { var _gc = this._fa.inverse(_dz[i]); var _dr = 1; for (var j = 0; j < s; j++) { if (i != j) { _dr = this._fa.multiply(_dr, _az._bd(1, this._fa.multiply(_dz[j], _gc))) } } result[i] = this._fa.multiply(_fs.evaluateAt(_gc), this._fa.inverse(_dr)); if (_fq) { result[i] = this._fa.multiply(result[i], _gc) } } return result } } function _bp(f, e) { if (e == null || e.length == 0) { throw "bad arguments" } this._fa = f; var c = e.length; if (c > 1 && e[0] == 0) { var d = 1; while (d < c && e[d] == 0) { d++ } if (d == c) { this._dd = f.Zero._dd } else { this._dd = new Array(c - d); for (var b = 0; b < this._dd.length; b++) { this._dd[b] = 0 } for (var a = 0; a < this._dd.length; a++) { this._dd[a] = e[d + a] } } } else { this._dd = e } this.__defineGetter__("Zero", function () { return this._dd[0] == 0 }); this.__defineGetter__("_ec", function () { return this._dd.length - 1 }); this.__defineGetter__("Coefficients", function () { return this._dd }); this._ex = function (g) { return this._dd[this._dd.length - 1 - g] }; this.evaluateAt = function (h) { if (h == 0) { return this._ex(0) } var l = this._dd.length; if (h == 1) { var g = 0; for (var k = 0; k < l; k++) { g = _az._bd(g, this._dd[k]) } return g } var j = this._dd[0]; for (var k = 1; k < l; k++) { j = _az._bd(this._fa.multiply(h, j), this._dd[k]) } return j }; this._bd = function (g) { if (this._fa != g._fa) { throw "GF256Polys do not have same _az _fa" } if (this.Zero) { return g } if (g.Zero) { return this } var o = this._dd; var n = g._dd; if (o.length > n.length) { var j = o; o = n; n = j } var h = new Array(n.length); var k = n.length - o.length; for (var m = 0; m < k; m++) { h[m] = n[m] } for (var l = k; l < n.length; l++) { h[l] = _az._bd(o[l - k], n[l]) } return new _bp(f, h) }; this.multiply1 = function (o) { if (this._fa != o._fa) { throw "GF256Polys do not have same _az _fa" } if (this.Zero || o.Zero) { return this._fa.Zero } var r = this._dd; var g = r.length; var l = o._dd; var n = l.length; var q = new Array(g + n - 1); for (var m = 0; m < g; m++) { var h = r[m]; for (var k = 0; k < n; k++) { q[m + k] = _az._bd(q[m + k], this._fa.multiply(h, l[k])) } } return new _bp(this._fa, q) }; this.multiply2 = function (g) { if (g == 0) { return this._fa.Zero } if (g == 1) { return this } var j = this._dd.length; var k = new Array(j); for (var h = 0; h < j; h++) { k[h] = this._fa.multiply(this._dd[h], g) } return new _bp(this._fa, k) }; this._dc = function (l, g) { if (l < 0) { throw "bad arguments" } if (g == 0) { return this._fa.Zero } var j = this._dd.length; var k = new Array(j + l); for (var h = 0; h < k.length; h++) { k[h] = 0 } for (var h = 0; h < j; h++) { k[h] = this._fa.multiply(this._dd[h], g) } return new _bp(this._fa, k) }; this.divide = function (l) { if (this._fa != l._fa) { throw "GF256Polys do not have same _az _fa" } if (l.Zero) { throw "Divide by 0" } var j = this._fa.Zero; var o = this; var g = l._ex(l._ec); var n = this._fa.inverse(g); while (o._ec >= l._ec && !o.Zero) { var m = o._ec - l._ec; var h = this._fa.multiply(o._ex(o._ec), n); var i = l._dc(m, h); var k = this._fa._ba(m, h); j = j._bd(k); o = o._bd(i) } return new Array(j, o) } } function _az(b) { this._gh = new Array(256); this._gi = new Array(256); var a = 1; for (var e = 0; e < 256; e++) { this._gh[e] = a; a <<= 1; if (a >= 256) { a ^= b } } for (var e = 0; e < 255; e++) { this._gi[this._gh[e]] = e } var d = new Array(1); d[0] = 0; this.zero = new _bp(this, new Array(d)); var c = new Array(1); c[0] = 1; this.one = new _bp(this, new Array(c)); this.__defineGetter__("Zero", function () { return this.zero }); this.__defineGetter__("One", function () { return this.one }); this._ba = function (j, f) { if (j < 0) { throw "bad arguments" } if (f == 0) { return zero } var h = new Array(j + 1); for (var g = 0; g < h.length; g++) { h[g] = 0 } h[0] = f; return new _bp(this, h) }; this.exp = function (f) { return this._gh[f] }; this.log = function (f) { if (f == 0) { throw "bad arguments" } return this._gi[f] }; this.inverse = function (f) { if (f == 0) { throw "System.ArithmeticException" } return this._gh[255 - this._gi[f]] }; this.multiply = function (g, f) { if (g == 0 || f == 0) { return 0 } if (g == 1) { return f } if (f == 1) { return g } return this._gh[(this._gi[g] + this._gi[f]) % 255] } } _az._bb = new _az(285); _az._bc = new _az(301); _az._bd = function (d, c) { return d ^ c }; Decoder = {}; Decoder.rsDecoder = new _db(_az._bb); Decoder.correctErrors = function (g, b) { var d = g.length; var f = new Array(d); for (var e = 0; e < d; e++) { f[e] = g[e] & 255 } var a = g.length - b; try { Decoder.rsDecoder.decode(f, a) } catch (c) { throw c } for (var e = 0; e < b; e++) { g[e] = f[e] } }; Decoder.decode = function (r) { var b = new _cl(r); var o = b._cq(); var c = b._cm()._cg; var q = b._gk(); var a = _dl._gn(q, o, c); var f = 0; for (var k = 0; k < a.length; k++) { f += a[k]._du } var e = new Array(f); var n = 0; for (var h = 0; h < a.length; h++) { var m = a[h]; var d = m.Codewords; var g = m._du; Decoder.correctErrors(d, g); for (var k = 0; k < g; k++) { e[n++] = d[k] } } var l = new QRCodeDataBlockReader(e, o._fd, c.Bits); return l }; qrcode = {}; qrcode.imagedata = null; qrcode.width = 0; qrcode.height = 0; qrcode.qrCodeSymbol = null; qrcode.debug = false; qrcode.maxImgSize = 1024 * 1024; qrcode._eo = [[10, 9, 8, 8], [12, 11, 16, 10], [14, 13, 16, 12]]; qrcode.callback = null; qrcode.decode = function (d) { if (arguments.length == 0) { var b = document.getElementById("qr-canvas"); var a = b.getContext("2d"); qrcode.width = b.width; qrcode.height = b.height; qrcode.imagedata = a.getImageData(0, 0, qrcode.width, qrcode.height); qrcode.result = qrcode.process(a); if (qrcode.callback != null) { qrcode.callback(qrcode.result) } return qrcode.result } else { var c = new Image(); c.onload = function () { var g = document.getElementById("out-canvas"); if (g != null) { var j = g.getContext("2d"); j.clearRect(0, 0, 320, 240); j.drawImage(c, 0, 0, 320, 240) } var i = document.createElement("canvas"); var h = i.getContext("2d"); var f = c.height; var l = c.width; if (c.width * c.height > qrcode.maxImgSize) { var k = c.width / c.height; f = Math.sqrt(qrcode.maxImgSize / k); l = k * f } i.width = l; i.height = f; h.drawImage(c, 0, 0, i.width, i.height); qrcode.width = i.width; qrcode.height = i.height; try { qrcode.imagedata = h.getImageData(0, 0, i.width, i.height) } catch (m) { qrcode.result = "Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!"; if (qrcode.callback != null) { qrcode.callback(qrcode.result) } return } try { qrcode.result = qrcode.process(h) } catch (m) { console.log(m); qrcode.result = "error decoding QR Code" } if (qrcode.callback != null) { qrcode.callback(qrcode.result) } }; c.src = d } }; qrcode.isUrl = function (a) { var b = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; return b.test(a) }; qrcode.decode_url = function (b) { var d = ""; try { d = escape(b) } catch (c) { console.log(c); d = b } var a = ""; try { a = decodeURIComponent(d) } catch (c) { console.log(c); a = d } return a }; qrcode.decode_utf8 = function (a) { if (qrcode.isUrl(a)) { return qrcode.decode_url(a) } else { return a } }; qrcode.process = function (r) { var a = new Date().getTime(); var c = qrcode.grayScaleToBitmap(qrcode.grayscale()); if (qrcode.debug) { for (var m = 0; m < qrcode.height; m++) { for (var n = 0; n < qrcode.width; n++) { var o = (n * 4) + (m * qrcode.width * 4); qrcode.imagedata.data[o] = c[n + m * qrcode.width] ? 0 : 0; qrcode.imagedata.data[o + 1] = c[n + m * qrcode.width] ? 0 : 0; qrcode.imagedata.data[o + 2] = c[n + m * qrcode.width] ? 255 : 0 } } r.putImageData(qrcode.imagedata, 0, 0) } var h = new Detector(c); var q = h.detect(); if (qrcode.debug) { r.putImageData(qrcode.imagedata, 0, 0) } var k = Decoder.decode(q.bits); var g = k.DataByte; var l = ""; for (var f = 0; f < g.length; f++) { for (var e = 0; e < g[f].length; e++) { l += String.fromCharCode(g[f][e]) } } var d = new Date().getTime(); var b = d - a; console.log(b); return qrcode.decode_utf8(l) }; qrcode.getPixel = function (a, b) { if (qrcode.width < a) { throw "point error" } if (qrcode.height < b) { throw "point error" } point = (a * 4) + (b * qrcode.width * 4); p = (qrcode.imagedata.data[point] * 33 + qrcode.imagedata.data[point + 1] * 34 + qrcode.imagedata.data[point + 2] * 33) / 100; return p }; qrcode.binarize = function (d) { var c = new Array(qrcode.width * qrcode.height); for (var e = 0; e < qrcode.height; e++) { for (var b = 0; b < qrcode.width; b++) { var a = qrcode.getPixel(b, e); c[b + e * qrcode.width] = a <= d ? true : false } } return c }; qrcode._em = function (d) { var c = 4; var k = Math.floor(qrcode.width / c); var j = Math.floor(qrcode.height / c); var f = new Array(c); for (var g = 0; g < c; g++) { f[g] = new Array(c); for (var e = 0; e < c; e++) { f[g][e] = new Array(0, 0) } } for (var o = 0; o < c; o++) { for (var a = 0; a < c; a++) { f[a][o][0] = 255; for (var l = 0; l < j; l++) { for (var n = 0; n < k; n++) { var h = d[k * a + n + (j * o + l) * qrcode.width]; if (h < f[a][o][0]) { f[a][o][0] = h } if (h > f[a][o][1]) { f[a][o][1] = h } } } } } var m = new Array(c); for (var b = 0; b < c; b++) { m[b] = new Array(c) } for (var o = 0; o < c; o++) { for (var a = 0; a < c; a++) { m[a][o] = Math.floor((f[a][o][0] + f[a][o][1]) / 2) } } return m }; qrcode.grayScaleToBitmap = function (f) { var j = qrcode._em(f); var b = j.length; var e = Math.floor(qrcode.width / b); var d = Math.floor(qrcode.height / b); var c = new Array(qrcode.height * qrcode.width); for (var i = 0; i < b; i++) { for (var a = 0; a < b; a++) { for (var g = 0; g < d; g++) { for (var h = 0; h < e; h++) { c[e * a + h + (d * i + g) * qrcode.width] = (f[e * a + h + (d * i + g) * qrcode.width] < j[a][i]) ? true : false } } } } return c }; qrcode.grayscale = function () { var c = new Array(qrcode.width * qrcode.height); for (var d = 0; d < qrcode.height; d++) { for (var b = 0; b < qrcode.width; b++) { var a = qrcode.getPixel(b, d); c[b + d * qrcode.width] = a } } return c }; function _ew(a, b) { if (a >= 0) { return a >> b } else { return (a >> b) + (2 << ~b) } } Array.prototype.remove = function (c, b) { var a = this.slice((b || c) + 1 || this.length); this.length = c < 0 ? this.length + c : c; return this.push.apply(this, a) }; var _gf = 3; var _eh = 57; var _el = 8; var _eg = 2; qrcode._er = function (c) { function b(l, k) { xDiff = l.X - k.X; yDiff = l.Y - k.Y; return Math.sqrt((xDiff * xDiff + yDiff * yDiff)) } function d(k, o, n) { var m = o.x; var l = o.y; return ((n.x - m) * (k.y - l)) - ((n.y - l) * (k.x - m)) } var i = b(c[0], c[1]); var f = b(c[1], c[2]); var e = b(c[0], c[2]); var a, j, h; if (f >= i && f >= e) { j = c[0]; a = c[1]; h = c[2] } else { if (e >= f && e >= i) { j = c[1]; a = c[0]; h = c[2] } else { j = c[2]; a = c[0]; h = c[1] } } if (d(a, j, h) < 0) { var g = a; a = h; h = g } c[0] = a; c[1] = j; c[2] = h }; function _cz(c, a, b) { this.x = c; this.y = a; this.count = 1; this._aj = b; this.__defineGetter__("_ei", function () { return this._aj }); this.__defineGetter__("Count", function () { return this.count }); this.__defineGetter__("X", function () { return this.x }); this.__defineGetter__("Y", function () { return this.y }); this._ek = function () { this.count++ }; this._ev = function (f, e, d) { if (Math.abs(e - this.y) <= f && Math.abs(d - this.x) <= f) { var g = Math.abs(f - this._aj); return g <= 1 || g / this._aj <= 1 } return false } } function _es(a) { this._go = a[0]; this._gu = a[1]; this._gr = a[2]; this.__defineGetter__("_gp", function () { return this._go }); this.__defineGetter__("_gq", function () { return this._gu }); this.__defineGetter__("_gs", function () { return this._gr }) } function _cc() { this.image = null; this._cv = []; this._ge = false; this._al = new Array(0, 0, 0, 0, 0); this._am = null; this.__defineGetter__("_da", function () { this._al[0] = 0; this._al[1] = 0; this._al[2] = 0; this._al[3] = 0; this._al[4] = 0; return this._al }); this._ao = function (f) { var b = 0; for (var d = 0; d < 5; d++) { var e = f[d]; if (e == 0) { return false } b += e } if (b < 7) { return false } var c = Math.floor((b << _el) / 7); var a = Math.floor(c / 2); return Math.abs(c - (f[0] << _el)) < a && Math.abs(c - (f[1] << _el)) < a && Math.abs(3 * c - (f[2] << _el)) < 3 * a && Math.abs(c - (f[3] << _el)) < a && Math.abs(c - (f[4] << _el)) < a }; this._an = function (b, a) { return (a - b[4] - b[3]) - b[2] / 2 }; this._ap = function (a, j, d, g) { var c = this.image; var h = qrcode.height; var b = this._da; var f = a; while (f >= 0 && c[j + f * qrcode.width]) { b[2]++; f-- } if (f < 0) { return NaN } while (f >= 0 && !c[j + f * qrcode.width] && b[1] <= d) { b[1]++; f-- } if (f < 0 || b[1] > d) { return NaN } while (f >= 0 && c[j + f * qrcode.width] && b[0] <= d) { b[0]++; f-- } if (b[0] > d) { return NaN } f = a + 1; while (f < h && c[j + f * qrcode.width]) { b[2]++; f++ } if (f == h) { return NaN } while (f < h && !c[j + f * qrcode.width] && b[3] < d) { b[3]++; f++ } if (f == h || b[3] >= d) { return NaN } while (f < h && c[j + f * qrcode.width] && b[4] < d) { b[4]++; f++ } if (b[4] >= d) { return NaN } var e = b[0] + b[1] + b[2] + b[3] + b[4]; if (5 * Math.abs(e - g) >= 2 * g) { return NaN } return this._ao(b) ? this._an(b, f) : NaN }; this._ej = function (b, a, e, h) { var d = this.image; var i = qrcode.width; var c = this._da; var g = b; while (g >= 0 && d[g + a * qrcode.width]) { c[2]++; g-- } if (g < 0) { return NaN } while (g >= 0 && !d[g + a * qrcode.width] && c[1] <= e) { c[1]++; g-- } if (g < 0 || c[1] > e) { return NaN } while (g >= 0 && d[g + a * qrcode.width] && c[0] <= e) { c[0]++; g-- } if (c[0] > e) { return NaN } g = b + 1; while (g < i && d[g + a * qrcode.width]) { c[2]++; g++ } if (g == i) { return NaN } while (g < i && !d[g + a * qrcode.width] && c[3] < e) { c[3]++; g++ } if (g == i || c[3] >= e) { return NaN } while (g < i && d[g + a * qrcode.width] && c[4] < e) { c[4]++; g++ } if (c[4] >= e) { return NaN } var f = c[0] + c[1] + c[2] + c[3] + c[4]; if (5 * Math.abs(f - h) >= h) { return NaN } return this._ao(c) ? this._an(c, g) : NaN }; this._cu = function (c, f, e) { var d = c[0] + c[1] + c[2] + c[3] + c[4]; var n = this._an(c, e); var b = this._ap(f, Math.floor(n), c[2], d); if (!isNaN(b)) { n = this._ej(Math.floor(n), Math.floor(b), c[2], d); if (!isNaN(n)) { var l = d / 7; var m = false; var h = this._cv.length; for (var g = 0; g < h; g++) { var a = this._cv[g]; if (a._ev(l, b, n)) { a._ek(); m = true; break } } if (!m) { var k = new _cz(n, b, l); this._cv.push(k); if (this._am != null) { this._am._ep(k) } } return true } } return false }; this._ee = function () { var h = this._cv.length; if (h < 3) { throw "Couldn't find enough finder patterns" } if (h > 3) { var b = 0; var j = 0; for (var d = 0; d < h; d++) { var g = this._cv[d]._ei; b += g; j += (g * g) } var a = b / h; this._cv.sort(function (m, l) { var k = Math.abs(l._ei - a); var i = Math.abs(m._ei - a); if (k < i) { return (-1) } else { if (k == i) { return 0 } else { return 1 } } }); var e = Math.sqrt(j / h - a * a); var c = Math.max(0.2 * a, e); for (var d = 0; d < this._cv.length && this._cv.length > 3; d++) { var f = this._cv[d]; if (Math.abs(f._ei - a) > c) { this._cv.remove(d); d-- } } } if (this._cv.length > 3) { this._cv.sort(function (k, i) { if (k.count > i.count) { return -1 } if (k.count < i.count) { return 1 } return 0 }) } return new Array(this._cv[0], this._cv[1], this._cv[2]) }; this._eq = function () { var b = this._cv.length; if (b <= 1) { return 0 } var c = null; for (var d = 0; d < b; d++) { var a = this._cv[d]; if (a.Count >= _eg) { if (c == null) { c = a } else { this._ge = true; return Math.floor((Math.abs(c.X - a.X) - Math.abs(c.Y - a.Y)) / 2) } } } return 0 }; this._cx = function () { var g = 0; var c = 0; var a = this._cv.length; for (var d = 0; d < a; d++) { var f = this._cv[d]; if (f.Count >= _eg) { g++; c += f._ei } } if (g < 3) { return false } var e = c / a; var b = 0; for (var d = 0; d < a; d++) { f = this._cv[d]; b += Math.abs(f._ei - e) } return b <= 0.05 * c }; this._ce = function (e) { var o = false; this.image = e; var n = qrcode.height; var k = qrcode.width; var a = Math.floor((3 * n) / (4 * _eh)); if (a < _gf || o) { a = _gf } var g = false; var d = new Array(5); for (var h = a - 1; h < n && !g; h += a) { d[0] = 0; d[1] = 0; d[2] = 0; d[3] = 0; d[4] = 0; var b = 0; for (var f = 0; f < k; f++) { if (e[f + h * qrcode.width]) { if ((b & 1) == 1) { b++ } d[b]++ } else { if ((b & 1) == 0) { if (b == 4) { if (this._ao(d)) { var c = this._cu(d, h, f); if (c) { a = 2; if (this._ge) { g = this._cx() } else { var m = this._eq(); if (m > d[2]) { h += m - d[2] - a; f = k - 1 } } } else { do { f++ } while (f < k && !e[f + h * qrcode.width]); f-- } b = 0; d[0] = 0; d[1] = 0; d[2] = 0; d[3] = 0; d[4] = 0 } else { d[0] = d[2]; d[1] = d[3]; d[2] = d[4]; d[3] = 1; d[4] = 0; b = 3 } } else { d[++b]++ } } else { d[b]++ } } } if (this._ao(d)) { var c = this._cu(d, h, k); if (c) { a = d[0]; if (this._ge) { g = _cx() } } } } var l = this._ee(); qrcode._er(l); return new _es(l) } } function _ai(c, a, b) { this.x = c; this.y = a; this.count = 1; this._aj = b; this.__defineGetter__("_ei", function () { return this._aj }); this.__defineGetter__("Count", function () { return this.count }); this.__defineGetter__("X", function () { return Math.floor(this.x) }); this.__defineGetter__("Y", function () { return Math.floor(this.y) }); this._ek = function () { this.count++ }; this._ev = function (f, e, d) { if (Math.abs(e - this.y) <= f && Math.abs(d - this.x) <= f) { var g = Math.abs(f - this._aj); return g <= 1 || g / this._aj <= 1 } return false } } function _ak(g, c, b, f, a, e, d) { this.image = g; this._cv = new Array(); this.startX = c; this.startY = b; this.width = f; this.height = a; this._ef = e; this._al = new Array(0, 0, 0); this._am = d; this._an = function (i, h) { return (h - i[2]) - i[1] / 2 }; this._ao = function (l) { var k = this._ef; var h = k / 2; for (var j = 0; j < 3; j++) { if (Math.abs(k - l[j]) >= h) { return false } } return true }; this._ap = function (h, r, l, o) { var k = this.image; var q = qrcode.height; var j = this._al; j[0] = 0; j[1] = 0; j[2] = 0; var n = h; while (n >= 0 && k[r + n * qrcode.width] && j[1] <= l) { j[1]++; n-- } if (n < 0 || j[1] > l) { return NaN } while (n >= 0 && !k[r + n * qrcode.width] && j[0] <= l) { j[0]++; n-- } if (j[0] > l) { return NaN } n = h + 1; while (n < q && k[r + n * qrcode.width] && j[1] <= l) { j[1]++; n++ } if (n == q || j[1] > l) { return NaN } while (n < q && !k[r + n * qrcode.width] && j[2] <= l) { j[2]++; n++ } if (j[2] > l) { return NaN } var m = j[0] + j[1] + j[2]; if (5 * Math.abs(m - o) >= 2 * o) { return NaN } return this._ao(j) ? this._an(j, n) : NaN }; this._cu = function (l, o, n) { var m = l[0] + l[1] + l[2]; var u = this._an(l, n); var k = this._ap(o, Math.floor(u), 2 * l[1], m); if (!isNaN(k)) { var t = (l[0] + l[1] + l[2]) / 3; var r = this._cv.length; for (var q = 0; q < r; q++) { var h = this._cv[q]; if (h._ev(t, k, u)) { return new _ai(u, k, t) } } var s = new _ai(u, k, t); this._cv.push(s); if (this._am != null) { this._am._ep(s) } } return null }; this.find = function () { var q = this.startX; var t = this.height; var r = q + f; var s = b + (t >> 1); var m = new Array(0, 0, 0); for (var k = 0; k < t; k++) { var o = s + ((k & 1) == 0 ? ((k + 1) >> 1) : -((k + 1) >> 1)); m[0] = 0; m[1] = 0; m[2] = 0; var n = q; while (n < r && !g[n + qrcode.width * o]) { n++ } var h = 0; while (n < r) { if (g[n + o * qrcode.width]) { if (h == 1) { m[h]++ } else { if (h == 2) { if (this._ao(m)) { var l = this._cu(m, o, n); if (l != null) { return l } } m[0] = m[2]; m[1] = 1; m[2] = 0; h = 1 } else { m[++h]++ } } } else { if (h == 1) { h++ } m[h]++ } n++ } if (this._ao(m)) { var l = this._cu(m, o, r); if (l != null) { return l } } } if (!(this._cv.length == 0)) { return this._cv[0] } throw "Couldn't find enough alignment patterns" } } function QRCodeDataBlockReader(c, a, b) { this._ed = 0; this._cw = 7; this.dataLength = 0; this.blocks = c; this._en = b; if (a <= 9) { this.dataLengthMode = 0 } else { if (a >= 10 && a <= 26) { this.dataLengthMode = 1 } else { if (a >= 27 && a <= 40) { this.dataLengthMode = 2 } } } this._gd = function (f) { var k = 0; if (f < this._cw + 1) { var m = 0; for (var e = 0; e < f; e++) { m += (1 << e) } m <<= (this._cw - f + 1); k = (this.blocks[this._ed] & m) >> (this._cw - f + 1); this._cw -= f; return k } else { if (f < this._cw + 1 + 8) { var j = 0; for (var e = 0; e < this._cw + 1; e++) { j += (1 << e) } k = (this.blocks[this._ed] & j) << (f - (this._cw + 1)); this._ed++; k += ((this.blocks[this._ed]) >> (8 - (f - (this._cw + 1)))); this._cw = this._cw - f % 8; if (this._cw < 0) { this._cw = 8 + this._cw } return k } else { if (f < this._cw + 1 + 16) { var j = 0; var h = 0; for (var e = 0; e < this._cw + 1; e++) { j += (1 << e) } var g = (this.blocks[this._ed] & j) << (f - (this._cw + 1)); this._ed++; var d = this.blocks[this._ed] << (f - (this._cw + 1 + 8)); this._ed++; for (var e = 0; e < f - (this._cw + 1 + 8); e++) { h += (1 << e) } h <<= 8 - (f - (this._cw + 1 + 8)); var l = (this.blocks[this._ed] & h) >> (8 - (f - (this._cw + 1 + 8))); k = g + d + l; this._cw = this._cw - (f - 8) % 8; if (this._cw < 0) { this._cw = 8 + this._cw } return k } else { return 0 } } } }; this.NextMode = function () { if ((this._ed > this.blocks.length - this._en - 2)) { return 0 } else { return this._gd(4) } }; this.getDataLength = function (d) { var e = 0; while (true) { if ((d >> e) == 1) { break } e++ } return this._gd(qrcode._eo[this.dataLengthMode][e]) }; this.getRomanAndFigureString = function (h) { var f = h; var g = 0; var j = ""; var d = new Array("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", " ", "$", "%", "*", "+", "-", ".", "/", ":"); do { if (f > 1) { g = this._gd(11); var i = Math.floor(g / 45); var e = g % 45; j += d[i]; j += d[e]; f -= 2 } else { if (f == 1) { g = this._gd(6); j += d[g]; f -= 1 } } } while (f > 0); return j }; this.getFigureString = function (f) { var d = f; var e = 0; var g = ""; do { if (d >= 3) { e = this._gd(10); if (e < 100) { g += "0" } if (e < 10) { g += "0" } d -= 3 } else { if (d == 2) { e = this._gd(7); if (e < 10) { g += "0" } d -= 2 } else { if (d == 1) { e = this._gd(4); d -= 1 } } } g += e } while (d > 0); return g }; this.get8bitByteArray = function (g) { var e = g; var f = 0; var d = new Array(); do { f = this._gd(8); d.push(f); e-- } while (e > 0); return d }; this.getKanjiString = function (j) { var g = j; var i = 0; var h = ""; do { i = _gd(13); var e = i % 192; var f = i / 192; var k = (f << 8) + e; var d = 0; if (k + 33088 <= 40956) { d = k + 33088 } else { d = k + 49472 } h += String.fromCharCode(d); g-- } while (g > 0); return h }; this.__defineGetter__("DataByte", function () { var g = new Array(); var e = 1; var f = 2; var d = 4; var n = 8; do { var k = this.NextMode(); if (k == 0) { if (g.length > 0) { break } else { throw "Empty data block" } } if (k != e && k != f && k != d && k != n) { throw "Invalid mode: " + k + " in (block:" + this._ed + " bit:" + this._cw + ")" } dataLength = this.getDataLength(k); if (dataLength < 1) { throw "Invalid data length: " + dataLength } switch (k) { case e: var l = this.getFigureString(dataLength); var i = new Array(l.length); for (var h = 0; h < l.length; h++) { i[h] = l.charCodeAt(h) } g.push(i); break; case f: var l = this.getRomanAndFigureString(dataLength); var i = new Array(l.length); for (var h = 0; h < l.length; h++) { i[h] = l.charCodeAt(h) } g.push(i); break; case d: var m = this.get8bitByteArray(dataLength); g.push(m); break; case n: var l = this.getKanjiString(dataLength); g.push(l); break } } while (true); return g }) }; diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..084dddc --- /dev/null +++ b/js/main.js @@ -0,0 +1,237 @@ + +function newr() { + document.getElementById("main").style.display = "block"; + document.getElementById("res").style.display = "none"; +} +function check() { + document.getElementById("res").style.display = "block"; + document.getElementById("main").style.display = "none"; + list = Object.values(manufacturer)[2]; // Extract actual list from file + manufacturersValues = Object.values(list); // extract values + manufacturersKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: manufacturersValues[manufacturersKeys.indexOf()].display + + list = Object.values(product)[2]; // Extract actual list from file + productsValues = Object.values(list); // extract values + productsKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: productsValues[productsKeys.indexOf()].display + + list = Object.values(prophylaxis)[2]; // Extract actual list from file + prophylaxisValues = Object.values(list); // extract values + prophylaxisKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: prophylaxisValues[prophylaxisKeys.indexOf()].display + + list = Object.values(diseases)[2]; // Extract actual list from file + diseasesValues = Object.values(list); // extract values + diseasesKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: diseasesValues[diseasesKeys.indexOf()].display + + list = Object.values(testManufObj)[2]; // Extract actual list from file + testDeviceValues = Object.values(list); // extract values + testDeviceKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: testDeviceValues[testDeviceKeys.indexOf()].display + + list = Object.values(testTypeObj)[2]; // Extract actual list from file + testTypeValues = Object.values(list); // extract values + testTypeKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: testTypeValues[testTypeKeys.indexOf()].display + + list = Object.values(testResultObj)[2]; // Extract actual list from file + testResultValues = Object.values(list); // extract values + testResultKeys = Object.keys(list); // extract keys + // To find the name of the manufacturer: testResultValues[testResultKeys.indexOf()].display + + + + // Process: + // QR Image --> HC1 string --> BASE45 string --> ZIP array --> COSE array --> CBOR array --> json object + + BASE45 = window["raw"].replace("HC1:", ""); + //console.log("BASE45=",BASE45); + + // Decode BASE45: + COMPRESSED = decode(BASE45).raw; + + // Unzip the COMPRESSED: + COSEbin = pako.inflate(COMPRESSED); + //console.log("UNZ:",COSEbin); + + COSE = buf2hex(COSEbin); + console.log("UNZ:", COSE); + + //console.log("Input:", raw.innerHTML.length); + //console.log("Test:", testData.COSE.length); + var typedArray = new Uint8Array(COSE.match(/[\da-f]{2}/gi).map(function (h) { + return parseInt(h, 16) + })) // https://stackoverflow.com/questions/43131242/how-to-convert-a-hexadecimal-string-of-data-to-an-arraybuffer-in-javascript + var unzipped = typedArray.buffer; + //console.log("unzipped=",unzipped) ; + + [headers1, headers2, cbor_data, signature] = CBOR.decode(unzipped); + //console.log("cbor_data=",cbor_data) ; + + //cbor_dataStr = buf2hex(cbor_data); + //console.log("decodedStr=",decodedStr); + //cbor_dataArr=hexStringToArrayBuffer(cbor_dataStr); + cbor_dataArr = typedArrayToBuffer(cbor_data); + //console.log("cbor_dataArr=",cbor_dataArr); + + greenpassData = CBOR.decode(cbor_dataArr); + qrdays = ((greenpassData[4] * 1000 - greenpassData[6] * 1000) / 86400000).toFixed(0); + qrmonths = ((greenpassData[4] * 1000 - greenpassData[6] * 1000) / 2592000000).toFixed(0); + qrCreation = new Date(greenpassData[6] * 1000).toLocaleString(); + qrExpiration = new Date(greenpassData[4] * 1000).toLocaleString(); + console.log("greenpassData =", greenpassData); + + //rawjson.innerHTML = JSON.stringify(greenpassData, null, "\t");; + + firstname.innerHTML = "-"; + surname.innerHTML = "-"; + birth.innerHTML = "-"; + + covidend.innerHTML = "-"; + tested.innerHTML = "-"; + vaccin.innerHTML = "-"; + + /// VACCINATO + targetV.innerHTML = "-"; + proph.innerHTML = "-"; + vaccid.innerHTML = "-"; + manuf.innerHTML = "-"; + receivedDoses.innerHTML = "-"; + neededDoses.innerHTML = "-"; + vaccinDate.innerHTML = "-"; + nation.innerHTML = "-"; + issuerV.innerHTML = "-"; + idV.innerHTML = "-"; + + /// TESTATO + testDate.innerHTML = "-"; //sc + testDevice.innerHTML = "-"; //ma + testType.innerHTML = "-"; //tt + testName.innerHTML = "-"; //nm + testCountryTestato.innerHTML = "-"; //co + testCenter.innerHTML = "-"; //tc + testCertId.innerHTML = "-"; //ci + issuerT.innerHTML = "-"; //is + testDisease.innerHTML = "-"; //tg + testResult.innerHTML = "-"; //tr + + /// GUARITO + covidend.innerHTML = "-"; + targetR.innerHTML = "-"; + firstPositive.innerHTML = "-"; + testCountryGuarito.innerHTML = "-"; + issuerR.innerHTML = "-"; + validFromR.innerHTML = "-"; + validToR.innerHTML = "-"; + validForDaysR.innerHTML = "-"; + certIdR.innerHTML = "-"; + + + validFromR.innerHTML = "-"; + validToR.innerHTML = "-"; + validForDaysR.innerHTML = "-"; + + try { + console.log("First name:", greenpassData[-260][1].nam.gn); + firstname.innerHTML = greenpassData[-260][1].nam.gn; + + console.log("Surname:", greenpassData[-260][1].nam.fn); + surname.innerHTML = greenpassData[-260][1].nam.fn; + + console.log("Born:", greenpassData[-260][1].dob); + birth.innerHTML = greenpassData[-260][1].dob; + + ////////////// VACCINATO + if (greenpassData[-260][1].v != null) { + console.log("Vaccinato"); + vaccin.innerHTML = "Yes"; + targetV.innerHTML = diseasesValues[diseasesKeys.indexOf(greenpassData[-260][1].v[0].tg)].display; + proph.innerHTML = prophylaxisValues[prophylaxisKeys.indexOf(greenpassData[-260][1].v[0].vp)].display; + vaccid.innerHTML = productsValues[productsKeys.indexOf(greenpassData[-260][1].v[0].mp)].display; + manuf.innerHTML = manufacturersValues[manufacturersKeys.indexOf(greenpassData[-260][1].v[0].ma)].display; + + console.log("Vaccine doses:", greenpassData[-260][1].v[0].dn); + receivedDoses.innerHTML = greenpassData[-260][1].v[0].dn; + + console.log("Vaccine doses needed:", greenpassData[-260][1].v[0].sd); + neededDoses.innerHTML = greenpassData[-260][1].v[0].sd; + + console.log("Vaccin date:", greenpassData[-260][1].v[0].dt); + vaccinDate.innerHTML = greenpassData[-260][1].v[0].dt; + + nation.innerHTML = greenpassData[-260][1].v[0].co; + + issuerV.innerHTML = greenpassData[-260][1].v[0].is; + idV.innerHTML = greenpassData[-260][1].v[0].ci; + + } else { + vaccin.innerHTML = "No"; + } + + ////////// TESTATO + if (greenpassData[-260][1].t != null) { + console.log("Testato"); + tested.innerHTML = "Yes"; + testDisease.innerHTML = diseasesValues[diseasesKeys.indexOf(greenpassData[-260][1].t[0].tg)].display; + testType.innerHTML = testTypeValues[testTypeKeys.indexOf(greenpassData[-260][1].t[0].tt)].display; + testName.innerHTML = greenpassData[-260][1].t[0].nm; + testDevice.innerHTML = testDeviceValues[testDeviceKeys.indexOf(greenpassData[-260][1].t[0].ma)].display;; + testDate.innerHTML = greenpassData[-260][1].t[0].sc; + testResult.innerHTML = greenpassData[-260][1].t[0].tr; + testCenter.innerHTML = greenpassData[-260][1].t[0].tc; + //dr.innerHTML = greenpassData[-260][1].t[0].dr; ??? + testCountryTestato.innerHTML = greenpassData[-260][1].t[0].co; + issuerT.innerHTML = greenpassData[-260][1].t[0].is; + testCertId.innerHTML = greenpassData[-260][1].t[0].ci; + } else { + tested.innerHTML = "No"; + } + + + ///////// GUARITO + if (greenpassData[-260][1].r != null) { + console.log("Guarito"); + covidend.innerHTML = "Yes"; + targetR.innerHTML = diseasesValues[diseasesKeys.indexOf(greenpassData[-260][1].r[0].tg)].display;; + console.log("1"); + firstPositive.innerHTML = greenpassData[-260][1].r[0].fr; + testCountryGuarito.innerHTML = greenpassData[-260][1].r[0].co; + console.log("2"); + issuerR.innerHTML = greenpassData[-260][1].r[0].is; + validFromR.innerHTML = greenpassData[-260][1].r[0].df; + validToR.innerHTML = greenpassData[-260][1].r[0].du; + + fromDate = new Date(greenpassData[-260][1].r[0].df); + toDate = new Date(greenpassData[-260][1].r[0].du); + diffDays = (toDate.getTime() - fromDate.getTime()) / 86400000; + validForDaysR.innerHTML = diffDays.toFixed(0); + certIdR.innerHTML = greenpassData[-260][1].r[0].ci; + + } else { + covidend.innerHTML = "No"; + } + + + } catch (e) { + console.log("ops"); + } + console.log("QR code creation date:", qrCreation); + console.log("QR code expiration date:", qrExpiration); + console.log("QR code duration (days):", qrdays); + console.log("QR code duration (months):", qrmonths); + + qrdate1.innerHTML = qrCreation; + qrdate2.innerHTML = qrExpiration; + days.innerHTML = qrdays; + months.innerHTML = qrmonths; + + today = new Date(); + todayDays = today.getDate(); + + diff = (new Date(greenpassData[4] * 1000).getTime() - (new Date()).getTime()) / 86400000; + daysleft.innerHTML = diff.toFixed(0); + monthsleft.innerHTML = (diff / 30).toFixed(2); + +} diff --git a/js/my_base45_2.js b/js/my_base45_2.js index f3e8855..cf44478 100644 --- a/js/my_base45_2.js +++ b/js/my_base45_2.js @@ -1,61 +1,61 @@ function encode(uint8array) { - var output = []; + var output = []; - for (var i = 0, length = uint8array.length; i < length; i+=2) { - if (uint8array.length -i > 1) { - var x = (uint8array[i]<<8)+ uint8array[i+1] - var [ e, x ] = divmod(x, 45*45) - var [ d, c ] = divmod(x, 45) - output.push(fromCharCode(c) + fromCharCode(d) + fromCharCode(e)) - } else { - var x = uint8array[i] - var [ d, c ] = divmod(x, 45) - output.push(fromCharCode(c) + fromCharCode(d)) - } + for (var i = 0, length = uint8array.length; i < length; i += 2) { + if (uint8array.length - i > 1) { + var x = (uint8array[i] << 8) + uint8array[i + 1] + var [e, x] = divmod(x, 45 * 45) + var [d, c] = divmod(x, 45) + output.push(fromCharCode(c) + fromCharCode(d) + fromCharCode(e)) + } else { + var x = uint8array[i] + var [d, c] = divmod(x, 45) + output.push(fromCharCode(c) + fromCharCode(d)) } - return output.join('') - }; - - var divmod = function divmod(a,b) { - var remainder = a - var quotient = 0 - if (a >= b) { - remainder = a % b - quotient = (a - remainder) / b - } - return [ quotient, remainder ] } + return output.join('') +}; - const BASE45_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:" - var fromCharCode = function fromCharCode(c) { - return BASE45_CHARSET.charAt(c); - }; +var divmod = function divmod(a, b) { + var remainder = a + var quotient = 0 + if (a >= b) { + remainder = a % b + quotient = (a - remainder) / b + } + return [quotient, remainder] +} + +const BASE45_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:" +var fromCharCode = function fromCharCode(c) { + return BASE45_CHARSET.charAt(c); +}; function decode(str) { - var output = [] - var buf = [] + var output = [] + var buf = [] - for(var i = 0, length=str.length; i < length; i++) { -//console.log(i); - var j = BASE45_CHARSET.indexOf(str[i]) - if (j < 0) - console.log('Base45 decode: unknown character n.', i, j); - //throw new Error('Base45 decode: unknown character'); - buf.push(j) - } + for (var i = 0, length = str.length; i < length; i++) { + //console.log(i); + var j = BASE45_CHARSET.indexOf(str[i]) + if (j < 0) + console.log('Base45 decode: unknown character n.', i, j); + //throw new Error('Base45 decode: unknown character'); + buf.push(j) + } - for(var i = 0, length=buf.length; i < length; i+=3) { - var x = buf[i] + buf[i + 1] * 45 - if (length - i >= 3) { - var [d, c] = divmod(x + buf[i + 2] * 45 * 45,256) - output.push(d) - output.push(c) - } else { - output.push(x) - } + for (var i = 0, length = buf.length; i < length; i += 3) { + var x = buf[i] + buf[i + 1] * 45 + if (length - i >= 3) { + var [d, c] = divmod(x + buf[i + 2] * 45 * 45, 256) + output.push(d) + output.push(c) + } else { + output.push(x) } -console.log("output",output); - var enc = new TextEncoder(); - return {"enc" : enc.encode(output), "raw" : output}; - //return Buffer.from(output); - }; \ No newline at end of file + } + console.log("output", output); + var enc = new TextEncoder(); + return { "enc": enc.encode(output), "raw": output }; + //return Buffer.from(output); +}; \ No newline at end of file diff --git a/js/pako.min.js b/js/pako.min.js index 5f0fee1..6550e8c 100644 --- a/js/pako.min.js +++ b/js/pako.min.js @@ -1,2 +1,2 @@ /*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */ -!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).pako={})}(this,(function(t){"use strict";function e(t){let e=t.length;for(;--e>=0;)t[e]=0}const a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),l=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),o=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);const _=new Array(60);e(_);const f=new Array(512);e(f);const c=new Array(256);e(c);const u=new Array(29);e(u);const w=new Array(n);function b(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}let g,p,m;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(w);const v=t=>t<256?f[t]:f[256+(t>>>7)],y=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},x=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<{x(t,a[2*e],a[2*e+1])},A=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},E=(t,e,a)=>{const i=new Array(16);let n,r,l=0;for(n=1;n<=s;n++)i[n]=l=l+a[n-1]<<1;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=A(i[e]++,e))}},R=t=>{let e;for(e=0;e{t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},U=(t,e,a,i)=>{const n=2*e,s=2*a;return t[n]{const i=t.heap[a];let n=a<<1;for(;n<=t.heap_len&&(n{let n,s,o,h,d=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*d]<<8|t.pending_buf[t.d_buf+2*d+1],s=t.pending_buf[t.l_buf+d],d++,0===n?z(t,s,e):(o=c[s],z(t,o+a+1,e),h=r[o],0!==h&&(s-=u[o],x(t,s,h)),n--,o=v(n),z(t,o,i),h=l[o],0!==h&&(n-=w[o],x(t,n,h)))}while(d{const a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;let l,o,h,d=-1;for(t.heap_len=0,t.heap_max=573,l=0;l>1;l>=1;l--)S(t,a,l);h=r;do{l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),o=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=o,a[2*h]=a[2*l]+a[2*o],t.depth[h]=(t.depth[l]>=t.depth[o]?t.depth[l]:t.depth[o])+1,a[2*l+1]=a[2*o+1]=h,t.heap[1]=h++,S(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,h=e.stat_desc.max_length;let d,_,f,c,u,w,b=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,b++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=o&&(u=l[_-o]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==b){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,b-=2}while(b>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--)}})(t,e),E(a,d,t.bl_count)},O=(t,e,a)=>{let i,n,s=-1,r=e[1],l=0,o=7,h=4;for(0===r&&(o=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++l{let i,n,s=-1,r=e[1],l=0,o=7,h=4;for(0===r&&(o=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++l{x(t,0+(i?1:0),3),((t,e,a,i)=>{Z(t),i&&(y(t,a),y(t,~a)),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a})(t,e,a,!0)};var N={_tr_init:t=>{F||((()=>{let t,e,a,h,k;const v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<>=7;h{let s,r,l=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),((t,e,a,i)=>{let n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{x(t,2,3),z(t,256,d),(t=>{16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var B=(t,e,a,i)=>{let n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0}while(--r);n%=65521,s%=65521}return n|s<<16|0};const C=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var M=(t,e,a,i)=>{const n=C,s=i+a;t^=-1;for(let a=i;a>>8^n[255&(t^e[a])];return-1^t},H={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},j={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:K,_tr_stored_block:P,_tr_flush_block:Y,_tr_tally:G,_tr_align:X}=N,{Z_NO_FLUSH:W,Z_PARTIAL_FLUSH:q,Z_FULL_FLUSH:J,Z_FINISH:Q,Z_BLOCK:V,Z_OK:$,Z_STREAM_END:tt,Z_STREAM_ERROR:et,Z_DATA_ERROR:at,Z_BUF_ERROR:it,Z_DEFAULT_COMPRESSION:nt,Z_FILTERED:st,Z_HUFFMAN_ONLY:rt,Z_RLE:lt,Z_FIXED:ot,Z_DEFAULT_STRATEGY:ht,Z_UNKNOWN:dt,Z_DEFLATED:_t}=j,ft=258,ct=262,ut=103,wt=113,bt=666,gt=(t,e)=>(t.msg=H[e],e),pt=t=>(t<<1)-(t>4?9:0),mt=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let kt=(t,e,a)=>(e<{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},yt=(t,e)=>{Y(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,vt(t.strm)},xt=(t,e)=>{t.pending_buf[t.pending++]=e},zt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},At=(t,e,a,i)=>{let n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=B(t.adler,e,n,a):2===t.state.wrap&&(t.adler=M(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n)},Et=(t,e)=>{let a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,l=t.nice_match;const o=t.strstart>t.w_size-ct?t.strstart-(t.w_size-ct):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ft;let c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),l>t.lookahead&&(l=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&sr){if(t.match_start=e,r=i,i>=l)break;c=h[s+r-1],u=h[s+r]}}}while((e=_[e&d])>o&&0!=--n);return r<=t.lookahead?r:t.lookahead},Rt=t=>{const e=t.w_size;let a,i,n,s,r;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ct)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,a=i;do{n=t.head[--a],t.head[a]=n>=e?n-e:0}while(--i);i=e,a=i;do{n=t.prev[--a],t.prev[a]=n>=e?n-e:0}while(--i);s+=e}if(0===t.strm.avail_in)break;if(i=At(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=kt(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=kt(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let a,i;for(;;){if(t.lookahead=3&&(t.ins_h=kt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ct&&(t.match_length=Et(t,a)),t.match_length>=3)if(i=G(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=kt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=kt(t,t.ins_h,t.window[t.strstart+1]);else i=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===Q?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2},Ut=(t,e)=>{let a,i,n;for(;;){if(t.lookahead=3&&(t.ins_h=kt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=G(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=kt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(yt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=G(t,0,t.window[t.strstart-1]),i&&yt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=G(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===Q?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2};function St(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n}const Dt=[new St(0,0,0,0,((t,e)=>{let a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Rt(t),0===t.lookahead&&e===W)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;const i=t.block_start+a;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,yt(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-ct&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(yt(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(yt(t,!1),t.strm.avail_out),1)})),new St(4,4,8,4,Zt),new St(4,5,16,8,Zt),new St(4,6,32,32,Zt),new St(4,4,16,16,Ut),new St(8,16,32,32,Ut),new St(8,16,128,128,Ut),new St(8,32,128,256,Ut),new St(32,128,258,1024,Ut),new St(32,258,258,4096,Ut)];function Tt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_t,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),mt(this.dyn_ltree),mt(this.dyn_dtree),mt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),mt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),mt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ot=t=>{if(!t||!t.state)return gt(t,et);t.total_in=t.total_out=0,t.data_type=dt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:wt,t.adler=2===e.wrap?0:1,e.last_flush=W,K(e),$},It=t=>{const e=Ot(t);var a;return e===$&&((a=t.state).window_size=2*a.w_size,mt(a.head),a.max_lazy_match=Dt[a.level].max_lazy,a.good_match=Dt[a.level].good_length,a.nice_match=Dt[a.level].nice_length,a.max_chain_length=Dt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e},Ft=(t,e,a,i,n,s)=>{if(!t)return et;let r=1;if(e===nt&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==_t||i<8||i>15||e<0||e>9||s<0||s>ot)return gt(t,et);8===i&&(i=9);const l=new Tt;return t.state=l,l.strm=t,l.wrap=r,l.gzhead=null,l.w_bits=i,l.w_size=1<Ft(t,e,_t,15,8,ht),deflateInit2:Ft,deflateReset:It,deflateResetKeep:Ot,deflateSetHeader:(t,e)=>t&&t.state?2!==t.state.wrap?et:(t.state.gzhead=e,$):et,deflate:(t,e)=>{let a,i;if(!t||!t.state||e>V||e<0)return t?gt(t,et):et;const n=t.state;if(!t.output||!t.input&&0!==t.avail_in||n.status===bt&&e!==Q)return gt(t,0===t.avail_out?it:et);n.strm=t;const s=n.last_flush;if(n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,xt(n,31),xt(n,139),xt(n,8),n.gzhead?(xt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),xt(n,255&n.gzhead.time),xt(n,n.gzhead.time>>8&255),xt(n,n.gzhead.time>>16&255),xt(n,n.gzhead.time>>24&255),xt(n,9===n.level?2:n.strategy>=rt||n.level<2?4:0),xt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(xt(n,255&n.gzhead.extra.length),xt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=M(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(xt(n,0),xt(n,0),xt(n,0),xt(n,0),xt(n,0),xt(n,9===n.level?2:n.strategy>=rt||n.level<2?4:0),xt(n,3),n.status=wt);else{let e=_t+(n.w_bits-8<<4)<<8,a=-1;a=n.strategy>=rt||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=a<<6,0!==n.strstart&&(e|=32),e+=31-e%31,n.status=wt,zt(n,e),0!==n.strstart&&(zt(n,t.adler>>>16),zt(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(a=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>a&&(t.adler=M(t.adler,n.pending_buf,n.pending-a,a)),vt(t),a=n.pending,n.pending!==n.pending_buf_size));)xt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>a&&(t.adler=M(t.adler,n.pending_buf,n.pending-a,a)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=M(t.adler,n.pending_buf,n.pending-a,a)),vt(t),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindexa&&(t.adler=M(t.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=M(t.adler,n.pending_buf,n.pending-a,a)),vt(t),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindexa&&(t.adler=M(t.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.status=ut)}else n.status=ut;if(n.status===ut&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&vt(t),n.pending+2<=n.pending_buf_size&&(xt(n,255&t.adler),xt(n,t.adler>>8&255),t.adler=0,n.status=wt)):n.status=wt),0!==n.pending){if(vt(t),0===t.avail_out)return n.last_flush=-1,$}else if(0===t.avail_in&&pt(e)<=pt(s)&&e!==Q)return gt(t,it);if(n.status===bt&&0!==t.avail_in)return gt(t,it);if(0!==t.avail_in||0!==n.lookahead||e!==W&&n.status!==bt){let a=n.strategy===rt?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(Rt(t),0===t.lookahead)){if(e===W)return 1;break}if(t.match_length=0,a=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===lt?((t,e)=>{let a,i,n,s;const r=t.window;for(;;){if(t.lookahead<=ft){if(Rt(t),t.lookahead<=ft&&e===W)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ft;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=G(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2})(n,e):Dt[n.level].func(n,e);if(3!==a&&4!==a||(n.status=bt),1===a||3===a)return 0===t.avail_out&&(n.last_flush=-1),$;if(2===a&&(e===q?X(n):e!==V&&(P(n,0,0,!1),e===J&&(mt(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),vt(t),0===t.avail_out))return n.last_flush=-1,$}return e!==Q?$:n.wrap<=0?tt:(2===n.wrap?(xt(n,255&t.adler),xt(n,t.adler>>8&255),xt(n,t.adler>>16&255),xt(n,t.adler>>24&255),xt(n,255&t.total_in),xt(n,t.total_in>>8&255),xt(n,t.total_in>>16&255),xt(n,t.total_in>>24&255)):(zt(n,t.adler>>>16),zt(n,65535&t.adler)),vt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?$:tt)},deflateEnd:t=>{if(!t||!t.state)return et;const e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==ut&&e!==wt&&e!==bt?gt(t,et):(t.state=null,e===wt?gt(t,at):$)},deflateSetDictionary:(t,e)=>{let a=e.length;if(!t||!t.state)return et;const i=t.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return et;if(1===n&&(t.adler=B(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(mt(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(a-i.w_size,a),0),e=t,a=i.w_size}const s=t.avail_in,r=t.next_in,l=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Rt(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=kt(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Rt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=l,t.avail_in=s,i.wrap=n,$},deflateInfo:"pako deflate (from Nodeca project)"};const Nt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Bt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const e in a)Nt(a,e)&&(t[e]=a[e])}}return t},Ct=t=>{let e=0;for(let a=0,i=t.length;a=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Ht[254]=Ht[254]=1;var jt=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,i,n,s,r=t.length,l=0;for(n=0;n>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e},Kt=(t,e)=>{const a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,n;const s=new Array(2*a);for(n=0,i=0;i4)s[n++]=65533,i+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&i1?s[n++]=65533:e<65536?s[n++]=e:(e-=65536,s[n++]=55296|e>>10&1023,s[n++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Mt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a="";for(let i=0;i{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Ht[t[a]]>e?a:e};var Yt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Gt=Object.prototype.toString,{Z_NO_FLUSH:Xt,Z_SYNC_FLUSH:Wt,Z_FULL_FLUSH:qt,Z_FINISH:Jt,Z_OK:Qt,Z_STREAM_END:Vt,Z_DEFAULT_COMPRESSION:$t,Z_DEFAULT_STRATEGY:te,Z_DEFLATED:ee}=j;function ae(t){this.options=Bt({level:$t,method:ee,chunkSize:16384,windowBits:15,memLevel:8,strategy:te},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Yt,this.strm.avail_out=0;let a=Lt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Qt)throw new Error(H[a]);if(e.header&&Lt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?jt(e.dictionary):"[object ArrayBuffer]"===Gt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Lt.deflateSetDictionary(this.strm,t),a!==Qt)throw new Error(H[a]);this._dict_set=!0}}function ie(t,e){const a=new ae(e);if(a.push(t,!0),a.err)throw a.msg||H[a.err];return a.result}ae.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize;let n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?Jt:Xt,"string"==typeof t?a.input=jt(t):"[object ArrayBuffer]"===Gt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Wt||s===qt)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Lt.deflate(a,s),n===Vt)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Lt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Qt;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},ae.prototype.onData=function(t){this.chunks.push(t)},ae.prototype.onEnd=function(t){t===Qt&&(this.result=Ct(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var ne={Deflate:ae,deflate:ie,deflateRaw:function(t,e){return(e=e||{}).raw=!0,ie(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,ie(t,e)},constants:j};var se=function(t,e){let a,i,n,s,r,l,o,h,d,_,f,c,u,w,b,g,p,m,k,v,y,x,z,A;const E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),l=E.dmax,o=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,b=(1<>>24,f>>>=m,c-=m,m=p>>>16&255,0===m)A[n++]=65535&p;else{if(!(16&m)){if(0==(64&m)){p=u[(65535&p)+(f&(1<>>=m,c-=m),c<15&&(f+=z[a++]<>>24,f>>>=m,c-=m,m=p>>>16&255,!(16&m)){if(0==(64&m)){p=w[(65535&p)+(f&(1<l){t.msg="invalid distance too far back",E.mode=30;break t}if(f>>>=m,c-=m,m=n-s,v>m){if(m=v-m,m>h&&E.sane){t.msg="invalid distance too far back",E.mode=30;break t}if(y=0,x=_,0===d){if(y+=o-m,m2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]))}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]))}break}}break}}while(a>3,a-=k,c-=k<<3,f&=(1<{const o=l.bits;let h,d,_,f,c,u,w=0,b=0,g=0,p=0,m=0,k=0,v=0,y=0,x=0,z=0,A=null,E=0;const R=new Uint16Array(16),Z=new Uint16Array(16);let U,S,D,T=null,O=0;for(w=0;w<=re;w++)R[w]=0;for(b=0;b=1&&0===R[p];p--);if(m>p&&(m=p),0===p)return n[s++]=20971520,n[s++]=20971520,l.bits=1,0;for(g=1;g0&&(0===t||1!==p))return-1;for(Z[1]=0,w=1;w852||2===t&&x>592)return 1;for(;;){U=w-v,r[b]u?(S=T[O+r[b]],D=A[E+r[b]]):(S=96,D=0),h=1<>v)+d]=U<<24|S<<16|D|0}while(0!==d);for(h=1<>=1;if(0!==h?(z&=h-1,z+=h):z=0,b++,0==--R[w]){if(w===p)break;w=e[a+r[b]]}if(w>m&&(z&f)!==_){for(0===v&&(v=m),c+=g,k=w-v,y=1<852||2===t&&x>592)return 1;_=z&f,n[_]=m<<24|k<<16|c-s|0}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),l.bits=m,0};const{Z_FINISH:fe,Z_BLOCK:ce,Z_TREES:ue,Z_OK:we,Z_STREAM_END:be,Z_NEED_DICT:ge,Z_STREAM_ERROR:pe,Z_DATA_ERROR:me,Z_MEM_ERROR:ke,Z_BUF_ERROR:ve,Z_DEFLATED:ye}=j,xe=12,ze=30,Ae=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Ee(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Re=t=>{if(!t||!t.state)return pe;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,we},Ze=t=>{if(!t||!t.state)return pe;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Re(t)},Ue=(t,e)=>{let a;if(!t||!t.state)return pe;const i=t.state;return e<0?(a=0,e=-e):(a=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?pe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,Ze(t))},Se=(t,e)=>{if(!t)return pe;const a=new Ee;t.state=a,a.window=null;const i=Ue(t,e);return i!==we&&(t.state=null),i};let De,Te,Oe=!0;const Ie=t=>{if(Oe){De=new Int32Array(512),Te=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(_e(1,t.lens,0,288,De,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;_e(2,t.lens,0,32,Te,0,t.work,{bits:5}),Oe=!1}t.lencode=De,t.lenbits=9,t.distcode=Te,t.distbits=5},Fe=(t,e,a,i)=>{let n;const s=t.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whaveSe(t,15),inflateInit2:Se,inflate:(t,e)=>{let a,i,n,s,r,l,o,h,d,_,f,c,u,w,b,g,p,m,k,v,y,x,z=0;const A=new Uint8Array(4);let E,R;const Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return pe;a=t.state,a.mode===xe&&(a.mode=13),r=t.next_out,n=t.output,o=t.avail_out,s=t.next_in,i=t.input,l=t.avail_in,h=a.hold,d=a.bits,_=l,f=o,x=we;t:for(;;)switch(a.mode){case 1:if(0===a.wrap){a.mode=13;break}for(;d<16;){if(0===l)break t;l--,h+=i[s++]<>>8&255,a.check=M(a.check,A,2,0),h=0,d=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=ze;break}if((15&h)!==ye){t.msg="unknown compression method",a.mode=ze;break}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits)a.wbits=y;else if(y>a.wbits){t.msg="invalid window size",a.mode=ze;break}a.dmax=1<>8&1),512&a.flags&&(A[0]=255&h,A[1]=h>>>8&255,a.check=M(a.check,A,2,0)),h=0,d=0,a.mode=3;case 3:for(;d<32;){if(0===l)break t;l--,h+=i[s++]<>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=M(a.check,A,4,0)),h=0,d=0,a.mode=4;case 4:for(;d<16;){if(0===l)break t;l--,h+=i[s++]<>8),512&a.flags&&(A[0]=255&h,A[1]=h>>>8&255,a.check=M(a.check,A,2,0)),h=0,d=0,a.mode=5;case 5:if(1024&a.flags){for(;d<16;){if(0===l)break t;l--,h+=i[s++]<>>8&255,a.check=M(a.check,A,2,0)),h=0,d=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(c=a.length,c>l&&(c=l),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&(a.check=M(a.check,i,c,s)),l-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===l)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y))}while(y&&c>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=xe;break;case 10:for(;d<32;){if(0===l)break t;l--,h+=i[s++]<>>=7&d,d-=7&d,a.mode=27;break}for(;d<3;){if(0===l)break t;l--,h+=i[s++]<>>=1,d-=1,3&h){case 0:a.mode=14;break;case 1:if(Ie(a),a.mode=20,e===ue){h>>>=2,d-=2;break t}break;case 2:a.mode=17;break;case 3:t.msg="invalid block type",a.mode=ze}h>>>=2,d-=2;break;case 14:for(h>>>=7&d,d-=7&d;d<32;){if(0===l)break t;l--,h+=i[s++]<>>16^65535)){t.msg="invalid stored block lengths",a.mode=ze;break}if(a.length=65535&h,h=0,d=0,a.mode=15,e===ue)break t;case 15:a.mode=16;case 16:if(c=a.length,c){if(c>l&&(c=l),c>o&&(c=o),0===c)break t;n.set(i.subarray(s,s+c),r),l-=c,s+=c,o-=c,r+=c,a.length-=c;break}a.mode=xe;break;case 17:for(;d<14;){if(0===l)break t;l--,h+=i[s++]<>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=ze;break}a.have=0,a.mode=18;case 18:for(;a.have>>=3,d-=3}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=_e(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=ze;break}a.have=0,a.mode=19;case 19:for(;a.have>>24,g=z>>>16&255,p=65535&z,!(b<=d);){if(0===l)break t;l--,h+=i[s++]<>>=b,d-=b,a.lens[a.have++]=p;else{if(16===p){for(R=b+2;d>>=b,d-=b,0===a.have){t.msg="invalid bit length repeat",a.mode=ze;break}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2}else if(17===p){for(R=b+3;d>>=b,d-=b,y=0,c=3+(7&h),h>>>=3,d-=3}else{for(R=b+7;d>>=b,d-=b,y=0,c=11+(127&h),h>>>=7,d-=7}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=ze;break}for(;c--;)a.lens[a.have++]=y}}if(a.mode===ze)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=ze;break}if(a.lenbits=9,E={bits:a.lenbits},x=_e(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=ze;break}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=_e(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=ze;break}if(a.mode=20,e===ue)break t;case 20:a.mode=21;case 21:if(l>=6&&o>=258){t.next_out=r,t.avail_out=o,t.next_in=s,t.avail_in=l,a.hold=h,a.bits=d,se(t,f),r=t.next_out,n=t.output,o=t.avail_out,s=t.next_in,i=t.input,l=t.avail_in,h=a.hold,d=a.bits,a.mode===xe&&(a.back=-1);break}for(a.back=0;z=a.lencode[h&(1<>>24,g=z>>>16&255,p=65535&z,!(b<=d);){if(0===l)break t;l--,h+=i[s++]<>m)],b=z>>>24,g=z>>>16&255,p=65535&z,!(m+b<=d);){if(0===l)break t;l--,h+=i[s++]<>>=m,d-=m,a.back+=m}if(h>>>=b,d-=b,a.back+=b,a.length=p,0===g){a.mode=26;break}if(32&g){a.back=-1,a.mode=xe;break}if(64&g){t.msg="invalid literal/length code",a.mode=ze;break}a.extra=15&g,a.mode=22;case 22:if(a.extra){for(R=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;z=a.distcode[h&(1<>>24,g=z>>>16&255,p=65535&z,!(b<=d);){if(0===l)break t;l--,h+=i[s++]<>m)],b=z>>>24,g=z>>>16&255,p=65535&z,!(m+b<=d);){if(0===l)break t;l--,h+=i[s++]<>>=m,d-=m,a.back+=m}if(h>>>=b,d-=b,a.back+=b,64&g){t.msg="invalid distance code",a.mode=ze;break}a.offset=p,a.extra=15&g,a.mode=24;case 24:if(a.extra){for(R=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=ze;break}a.mode=25;case 25:if(0===o)break t;if(c=f-o,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=ze;break}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window}else w=n,u=r-a.offset,c=a.length;c>o&&(c=o),o-=c,a.length-=c;do{n[r++]=w[u++]}while(--c);0===a.length&&(a.mode=21);break;case 26:if(0===o)break t;n[r++]=a.length,o--,a.mode=21;break;case 27:if(a.wrap){for(;d<32;){if(0===l)break t;l--,h|=i[s++]<{if(!t||!t.state)return pe;let e=t.state;return e.window&&(e.window=null),t.state=null,we},inflateGetHeader:(t,e)=>{if(!t||!t.state)return pe;const a=t.state;return 0==(2&a.wrap)?pe:(a.head=e,e.done=!1,we)},inflateSetDictionary:(t,e)=>{const a=e.length;let i,n,s;return t&&t.state?(i=t.state,0!==i.wrap&&11!==i.mode?pe:11===i.mode&&(n=1,n=B(n,e,a,0),n!==i.check)?me:(s=Fe(t,e,a,a),s?(i.mode=31,ke):(i.havedict=1,we))):pe},inflateInfo:"pako inflate (from Nodeca project)"};var Ne=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Be=Object.prototype.toString,{Z_NO_FLUSH:Ce,Z_FINISH:Me,Z_OK:He,Z_STREAM_END:je,Z_NEED_DICT:Ke,Z_STREAM_ERROR:Pe,Z_DATA_ERROR:Ye,Z_MEM_ERROR:Ge}=j;function Xe(t){this.options=Bt({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Yt,this.strm.avail_out=0;let a=Le.inflateInit2(this.strm,e.windowBits);if(a!==He)throw new Error(H[a]);if(this.header=new Ne,Le.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=jt(e.dictionary):"[object ArrayBuffer]"===Be.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=Le.inflateSetDictionary(this.strm,e.dictionary),a!==He)))throw new Error(H[a])}function We(t,e){const a=new Xe(e);if(a.push(t),a.err)throw a.msg||H[a.err];return a.result}Xe.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let s,r,l;if(this.ended)return!1;for(r=e===~~e?e:!0===e?Me:Ce,"[object ArrayBuffer]"===Be.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=Le.inflate(a,r),s===Ke&&n&&(s=Le.inflateSetDictionary(a,n),s===He?s=Le.inflate(a,r):s===Ye&&(s=Ke));a.avail_in>0&&s===je&&a.state.wrap>0&&0!==t[a.next_in];)Le.inflateReset(a),s=Le.inflate(a,r);switch(s){case Pe:case Ye:case Ke:case Ge:return this.onEnd(s),this.ended=!0,!1}if(l=a.avail_out,a.next_out&&(0===a.avail_out||s===je))if("string"===this.options.to){let t=Pt(a.output,a.next_out),e=a.next_out-t,n=Kt(a.output,t);a.next_out=e,a.avail_out=i-e,e&&a.output.set(a.output.subarray(t,t+e),0),this.onData(n)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==He||0!==l){if(s===je)return s=Le.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},Xe.prototype.onData=function(t){this.chunks.push(t)},Xe.prototype.onEnd=function(t){t===He&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ct(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var qe={Inflate:Xe,inflate:We,inflateRaw:function(t,e){return(e=e||{}).raw=!0,We(t,e)},ungzip:We,constants:j};const{Deflate:Je,deflate:Qe,deflateRaw:Ve,gzip:$e}=ne,{Inflate:ta,inflate:ea,inflateRaw:aa,ungzip:ia}=qe;var na=Je,sa=Qe,ra=Ve,la=$e,oa=ta,ha=ea,da=aa,_a=ia,fa=j,ca={Deflate:na,deflate:sa,deflateRaw:ra,gzip:la,Inflate:oa,inflate:ha,inflateRaw:da,ungzip:_a,constants:fa};t.Deflate=na,t.Inflate=oa,t.constants=fa,t.default=ca,t.deflate=sa,t.deflateRaw=ra,t.gzip=la,t.inflate=ha,t.inflateRaw=da,t.ungzip=_a,Object.defineProperty(t,"__esModule",{value:!0})})); +!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).pako = {}) }(this, (function (t) { "use strict"; function e(t) { let e = t.length; for (; --e >= 0;)t[e] = 0 } const a = 256, i = 286, n = 30, s = 15, r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]), l = new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]), o = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]), h = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), d = new Array(576); e(d); const _ = new Array(60); e(_); const f = new Array(512); e(f); const c = new Array(256); e(c); const u = new Array(29); e(u); const w = new Array(n); function b(t, e, a, i, n) { this.static_tree = t, this.extra_bits = e, this.extra_base = a, this.elems = i, this.max_length = n, this.has_stree = t && t.length } let g, p, m; function k(t, e) { this.dyn_tree = t, this.max_code = 0, this.stat_desc = e } e(w); const v = t => t < 256 ? f[t] : f[256 + (t >>> 7)], y = (t, e) => { t.pending_buf[t.pending++] = 255 & e, t.pending_buf[t.pending++] = e >>> 8 & 255 }, x = (t, e, a) => { t.bi_valid > 16 - a ? (t.bi_buf |= e << t.bi_valid & 65535, y(t, t.bi_buf), t.bi_buf = e >> 16 - t.bi_valid, t.bi_valid += a - 16) : (t.bi_buf |= e << t.bi_valid & 65535, t.bi_valid += a) }, z = (t, e, a) => { x(t, a[2 * e], a[2 * e + 1]) }, A = (t, e) => { let a = 0; do { a |= 1 & t, t >>>= 1, a <<= 1 } while (--e > 0); return a >>> 1 }, E = (t, e, a) => { const i = new Array(16); let n, r, l = 0; for (n = 1; n <= s; n++)i[n] = l = l + a[n - 1] << 1; for (r = 0; r <= e; r++) { let e = t[2 * r + 1]; 0 !== e && (t[2 * r] = A(i[e]++, e)) } }, R = t => { let e; for (e = 0; e < i; e++)t.dyn_ltree[2 * e] = 0; for (e = 0; e < n; e++)t.dyn_dtree[2 * e] = 0; for (e = 0; e < 19; e++)t.bl_tree[2 * e] = 0; t.dyn_ltree[512] = 1, t.opt_len = t.static_len = 0, t.last_lit = t.matches = 0 }, Z = t => { t.bi_valid > 8 ? y(t, t.bi_buf) : t.bi_valid > 0 && (t.pending_buf[t.pending++] = t.bi_buf), t.bi_buf = 0, t.bi_valid = 0 }, U = (t, e, a, i) => { const n = 2 * e, s = 2 * a; return t[n] < t[s] || t[n] === t[s] && i[e] <= i[a] }, S = (t, e, a) => { const i = t.heap[a]; let n = a << 1; for (; n <= t.heap_len && (n < t.heap_len && U(e, t.heap[n + 1], t.heap[n], t.depth) && n++, !U(e, i, t.heap[n], t.depth));)t.heap[a] = t.heap[n], a = n, n <<= 1; t.heap[a] = i }, D = (t, e, i) => { let n, s, o, h, d = 0; if (0 !== t.last_lit) do { n = t.pending_buf[t.d_buf + 2 * d] << 8 | t.pending_buf[t.d_buf + 2 * d + 1], s = t.pending_buf[t.l_buf + d], d++, 0 === n ? z(t, s, e) : (o = c[s], z(t, o + a + 1, e), h = r[o], 0 !== h && (s -= u[o], x(t, s, h)), n--, o = v(n), z(t, o, i), h = l[o], 0 !== h && (n -= w[o], x(t, n, h))) } while (d < t.last_lit); z(t, 256, e) }, T = (t, e) => { const a = e.dyn_tree, i = e.stat_desc.static_tree, n = e.stat_desc.has_stree, r = e.stat_desc.elems; let l, o, h, d = -1; for (t.heap_len = 0, t.heap_max = 573, l = 0; l < r; l++)0 !== a[2 * l] ? (t.heap[++t.heap_len] = d = l, t.depth[l] = 0) : a[2 * l + 1] = 0; for (; t.heap_len < 2;)h = t.heap[++t.heap_len] = d < 2 ? ++d : 0, a[2 * h] = 1, t.depth[h] = 0, t.opt_len--, n && (t.static_len -= i[2 * h + 1]); for (e.max_code = d, l = t.heap_len >> 1; l >= 1; l--)S(t, a, l); h = r; do { l = t.heap[1], t.heap[1] = t.heap[t.heap_len--], S(t, a, 1), o = t.heap[1], t.heap[--t.heap_max] = l, t.heap[--t.heap_max] = o, a[2 * h] = a[2 * l] + a[2 * o], t.depth[h] = (t.depth[l] >= t.depth[o] ? t.depth[l] : t.depth[o]) + 1, a[2 * l + 1] = a[2 * o + 1] = h, t.heap[1] = h++, S(t, a, 1) } while (t.heap_len >= 2); t.heap[--t.heap_max] = t.heap[1], ((t, e) => { const a = e.dyn_tree, i = e.max_code, n = e.stat_desc.static_tree, r = e.stat_desc.has_stree, l = e.stat_desc.extra_bits, o = e.stat_desc.extra_base, h = e.stat_desc.max_length; let d, _, f, c, u, w, b = 0; for (c = 0; c <= s; c++)t.bl_count[c] = 0; for (a[2 * t.heap[t.heap_max] + 1] = 0, d = t.heap_max + 1; d < 573; d++)_ = t.heap[d], c = a[2 * a[2 * _ + 1] + 1] + 1, c > h && (c = h, b++), a[2 * _ + 1] = c, _ > i || (t.bl_count[c]++, u = 0, _ >= o && (u = l[_ - o]), w = a[2 * _], t.opt_len += w * (c + u), r && (t.static_len += w * (n[2 * _ + 1] + u))); if (0 !== b) { do { for (c = h - 1; 0 === t.bl_count[c];)c--; t.bl_count[c]--, t.bl_count[c + 1] += 2, t.bl_count[h]--, b -= 2 } while (b > 0); for (c = h; 0 !== c; c--)for (_ = t.bl_count[c]; 0 !== _;)f = t.heap[--d], f > i || (a[2 * f + 1] !== c && (t.opt_len += (c - a[2 * f + 1]) * a[2 * f], a[2 * f + 1] = c), _--) } })(t, e), E(a, d, t.bl_count) }, O = (t, e, a) => { let i, n, s = -1, r = e[1], l = 0, o = 7, h = 4; for (0 === r && (o = 138, h = 3), e[2 * (a + 1) + 1] = 65535, i = 0; i <= a; i++)n = r, r = e[2 * (i + 1) + 1], ++l < o && n === r || (l < h ? t.bl_tree[2 * n] += l : 0 !== n ? (n !== s && t.bl_tree[2 * n]++, t.bl_tree[32]++) : l <= 10 ? t.bl_tree[34]++ : t.bl_tree[36]++, l = 0, s = n, 0 === r ? (o = 138, h = 3) : n === r ? (o = 6, h = 3) : (o = 7, h = 4)) }, I = (t, e, a) => { let i, n, s = -1, r = e[1], l = 0, o = 7, h = 4; for (0 === r && (o = 138, h = 3), i = 0; i <= a; i++)if (n = r, r = e[2 * (i + 1) + 1], !(++l < o && n === r)) { if (l < h) do { z(t, n, t.bl_tree) } while (0 != --l); else 0 !== n ? (n !== s && (z(t, n, t.bl_tree), l--), z(t, 16, t.bl_tree), x(t, l - 3, 2)) : l <= 10 ? (z(t, 17, t.bl_tree), x(t, l - 3, 3)) : (z(t, 18, t.bl_tree), x(t, l - 11, 7)); l = 0, s = n, 0 === r ? (o = 138, h = 3) : n === r ? (o = 6, h = 3) : (o = 7, h = 4) } }; let F = !1; const L = (t, e, a, i) => { x(t, 0 + (i ? 1 : 0), 3), ((t, e, a, i) => { Z(t), i && (y(t, a), y(t, ~a)), t.pending_buf.set(t.window.subarray(e, e + a), t.pending), t.pending += a })(t, e, a, !0) }; var N = { _tr_init: t => { F || ((() => { let t, e, a, h, k; const v = new Array(16); for (a = 0, h = 0; h < 28; h++)for (u[h] = a, t = 0; t < 1 << r[h]; t++)c[a++] = h; for (c[a - 1] = h, k = 0, h = 0; h < 16; h++)for (w[h] = k, t = 0; t < 1 << l[h]; t++)f[k++] = h; for (k >>= 7; h < n; h++)for (w[h] = k << 7, t = 0; t < 1 << l[h] - 7; t++)f[256 + k++] = h; for (e = 0; e <= s; e++)v[e] = 0; for (t = 0; t <= 143;)d[2 * t + 1] = 8, t++, v[8]++; for (; t <= 255;)d[2 * t + 1] = 9, t++, v[9]++; for (; t <= 279;)d[2 * t + 1] = 7, t++, v[7]++; for (; t <= 287;)d[2 * t + 1] = 8, t++, v[8]++; for (E(d, 287, v), t = 0; t < n; t++)_[2 * t + 1] = 5, _[2 * t] = A(t, 5); g = new b(d, r, 257, i, s), p = new b(_, l, 0, n, s), m = new b(new Array(0), o, 0, 19, 7) })(), F = !0), t.l_desc = new k(t.dyn_ltree, g), t.d_desc = new k(t.dyn_dtree, p), t.bl_desc = new k(t.bl_tree, m), t.bi_buf = 0, t.bi_valid = 0, R(t) }, _tr_stored_block: L, _tr_flush_block: (t, e, i, n) => { let s, r, l = 0; t.level > 0 ? (2 === t.strm.data_type && (t.strm.data_type = (t => { let e, i = 4093624447; for (e = 0; e <= 31; e++, i >>>= 1)if (1 & i && 0 !== t.dyn_ltree[2 * e]) return 0; if (0 !== t.dyn_ltree[18] || 0 !== t.dyn_ltree[20] || 0 !== t.dyn_ltree[26]) return 1; for (e = 32; e < a; e++)if (0 !== t.dyn_ltree[2 * e]) return 1; return 0 })(t)), T(t, t.l_desc), T(t, t.d_desc), l = (t => { let e; for (O(t, t.dyn_ltree, t.l_desc.max_code), O(t, t.dyn_dtree, t.d_desc.max_code), T(t, t.bl_desc), e = 18; e >= 3 && 0 === t.bl_tree[2 * h[e] + 1]; e--); return t.opt_len += 3 * (e + 1) + 5 + 5 + 4, e })(t), s = t.opt_len + 3 + 7 >>> 3, r = t.static_len + 3 + 7 >>> 3, r <= s && (s = r)) : s = r = i + 5, i + 4 <= s && -1 !== e ? L(t, e, i, n) : 4 === t.strategy || r === s ? (x(t, 2 + (n ? 1 : 0), 3), D(t, d, _)) : (x(t, 4 + (n ? 1 : 0), 3), ((t, e, a, i) => { let n; for (x(t, e - 257, 5), x(t, a - 1, 5), x(t, i - 4, 4), n = 0; n < i; n++)x(t, t.bl_tree[2 * h[n] + 1], 3); I(t, t.dyn_ltree, e - 1), I(t, t.dyn_dtree, a - 1) })(t, t.l_desc.max_code + 1, t.d_desc.max_code + 1, l + 1), D(t, t.dyn_ltree, t.dyn_dtree)), R(t), n && Z(t) }, _tr_tally: (t, e, i) => (t.pending_buf[t.d_buf + 2 * t.last_lit] = e >>> 8 & 255, t.pending_buf[t.d_buf + 2 * t.last_lit + 1] = 255 & e, t.pending_buf[t.l_buf + t.last_lit] = 255 & i, t.last_lit++, 0 === e ? t.dyn_ltree[2 * i]++ : (t.matches++, e--, t.dyn_ltree[2 * (c[i] + a + 1)]++, t.dyn_dtree[2 * v(e)]++), t.last_lit === t.lit_bufsize - 1), _tr_align: t => { x(t, 2, 3), z(t, 256, d), (t => { 16 === t.bi_valid ? (y(t, t.bi_buf), t.bi_buf = 0, t.bi_valid = 0) : t.bi_valid >= 8 && (t.pending_buf[t.pending++] = 255 & t.bi_buf, t.bi_buf >>= 8, t.bi_valid -= 8) })(t) } }; var B = (t, e, a, i) => { let n = 65535 & t | 0, s = t >>> 16 & 65535 | 0, r = 0; for (; 0 !== a;) { r = a > 2e3 ? 2e3 : a, a -= r; do { n = n + e[i++] | 0, s = s + n | 0 } while (--r); n %= 65521, s %= 65521 } return n | s << 16 | 0 }; const C = new Uint32Array((() => { let t, e = []; for (var a = 0; a < 256; a++) { t = a; for (var i = 0; i < 8; i++)t = 1 & t ? 3988292384 ^ t >>> 1 : t >>> 1; e[a] = t } return e })()); var M = (t, e, a, i) => { const n = C, s = i + a; t ^= -1; for (let a = i; a < s; a++)t = t >>> 8 ^ n[255 & (t ^ e[a])]; return -1 ^ t }, H = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }, j = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; const { _tr_init: K, _tr_stored_block: P, _tr_flush_block: Y, _tr_tally: G, _tr_align: X } = N, { Z_NO_FLUSH: W, Z_PARTIAL_FLUSH: q, Z_FULL_FLUSH: J, Z_FINISH: Q, Z_BLOCK: V, Z_OK: $, Z_STREAM_END: tt, Z_STREAM_ERROR: et, Z_DATA_ERROR: at, Z_BUF_ERROR: it, Z_DEFAULT_COMPRESSION: nt, Z_FILTERED: st, Z_HUFFMAN_ONLY: rt, Z_RLE: lt, Z_FIXED: ot, Z_DEFAULT_STRATEGY: ht, Z_UNKNOWN: dt, Z_DEFLATED: _t } = j, ft = 258, ct = 262, ut = 103, wt = 113, bt = 666, gt = (t, e) => (t.msg = H[e], e), pt = t => (t << 1) - (t > 4 ? 9 : 0), mt = t => { let e = t.length; for (; --e >= 0;)t[e] = 0 }; let kt = (t, e, a) => (e << t.hash_shift ^ a) & t.hash_mask; const vt = t => { const e = t.state; let a = e.pending; a > t.avail_out && (a = t.avail_out), 0 !== a && (t.output.set(e.pending_buf.subarray(e.pending_out, e.pending_out + a), t.next_out), t.next_out += a, e.pending_out += a, t.total_out += a, t.avail_out -= a, e.pending -= a, 0 === e.pending && (e.pending_out = 0)) }, yt = (t, e) => { Y(t, t.block_start >= 0 ? t.block_start : -1, t.strstart - t.block_start, e), t.block_start = t.strstart, vt(t.strm) }, xt = (t, e) => { t.pending_buf[t.pending++] = e }, zt = (t, e) => { t.pending_buf[t.pending++] = e >>> 8 & 255, t.pending_buf[t.pending++] = 255 & e }, At = (t, e, a, i) => { let n = t.avail_in; return n > i && (n = i), 0 === n ? 0 : (t.avail_in -= n, e.set(t.input.subarray(t.next_in, t.next_in + n), a), 1 === t.state.wrap ? t.adler = B(t.adler, e, n, a) : 2 === t.state.wrap && (t.adler = M(t.adler, e, n, a)), t.next_in += n, t.total_in += n, n) }, Et = (t, e) => { let a, i, n = t.max_chain_length, s = t.strstart, r = t.prev_length, l = t.nice_match; const o = t.strstart > t.w_size - ct ? t.strstart - (t.w_size - ct) : 0, h = t.window, d = t.w_mask, _ = t.prev, f = t.strstart + ft; let c = h[s + r - 1], u = h[s + r]; t.prev_length >= t.good_match && (n >>= 2), l > t.lookahead && (l = t.lookahead); do { if (a = e, h[a + r] === u && h[a + r - 1] === c && h[a] === h[s] && h[++a] === h[s + 1]) { s += 2, a++; do { } while (h[++s] === h[++a] && h[++s] === h[++a] && h[++s] === h[++a] && h[++s] === h[++a] && h[++s] === h[++a] && h[++s] === h[++a] && h[++s] === h[++a] && h[++s] === h[++a] && s < f); if (i = ft - (f - s), s = f - ft, i > r) { if (t.match_start = e, r = i, i >= l) break; c = h[s + r - 1], u = h[s + r] } } } while ((e = _[e & d]) > o && 0 != --n); return r <= t.lookahead ? r : t.lookahead }, Rt = t => { const e = t.w_size; let a, i, n, s, r; do { if (s = t.window_size - t.lookahead - t.strstart, t.strstart >= e + (e - ct)) { t.window.set(t.window.subarray(e, e + e), 0), t.match_start -= e, t.strstart -= e, t.block_start -= e, i = t.hash_size, a = i; do { n = t.head[--a], t.head[a] = n >= e ? n - e : 0 } while (--i); i = e, a = i; do { n = t.prev[--a], t.prev[a] = n >= e ? n - e : 0 } while (--i); s += e } if (0 === t.strm.avail_in) break; if (i = At(t.strm, t.window, t.strstart + t.lookahead, s), t.lookahead += i, t.lookahead + t.insert >= 3) for (r = t.strstart - t.insert, t.ins_h = t.window[r], t.ins_h = kt(t, t.ins_h, t.window[r + 1]); t.insert && (t.ins_h = kt(t, t.ins_h, t.window[r + 3 - 1]), t.prev[r & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = r, r++, t.insert--, !(t.lookahead + t.insert < 3));); } while (t.lookahead < ct && 0 !== t.strm.avail_in) }, Zt = (t, e) => { let a, i; for (; ;) { if (t.lookahead < ct) { if (Rt(t), t.lookahead < ct && e === W) return 1; if (0 === t.lookahead) break } if (a = 0, t.lookahead >= 3 && (t.ins_h = kt(t, t.ins_h, t.window[t.strstart + 3 - 1]), a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), 0 !== a && t.strstart - a <= t.w_size - ct && (t.match_length = Et(t, a)), t.match_length >= 3) if (i = G(t, t.strstart - t.match_start, t.match_length - 3), t.lookahead -= t.match_length, t.match_length <= t.max_lazy_match && t.lookahead >= 3) { t.match_length--; do { t.strstart++, t.ins_h = kt(t, t.ins_h, t.window[t.strstart + 3 - 1]), a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart } while (0 != --t.match_length); t.strstart++ } else t.strstart += t.match_length, t.match_length = 0, t.ins_h = t.window[t.strstart], t.ins_h = kt(t, t.ins_h, t.window[t.strstart + 1]); else i = G(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++; if (i && (yt(t, !1), 0 === t.strm.avail_out)) return 1 } return t.insert = t.strstart < 2 ? t.strstart : 2, e === Q ? (yt(t, !0), 0 === t.strm.avail_out ? 3 : 4) : t.last_lit && (yt(t, !1), 0 === t.strm.avail_out) ? 1 : 2 }, Ut = (t, e) => { let a, i, n; for (; ;) { if (t.lookahead < ct) { if (Rt(t), t.lookahead < ct && e === W) return 1; if (0 === t.lookahead) break } if (a = 0, t.lookahead >= 3 && (t.ins_h = kt(t, t.ins_h, t.window[t.strstart + 3 - 1]), a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), t.prev_length = t.match_length, t.prev_match = t.match_start, t.match_length = 2, 0 !== a && t.prev_length < t.max_lazy_match && t.strstart - a <= t.w_size - ct && (t.match_length = Et(t, a), t.match_length <= 5 && (t.strategy === st || 3 === t.match_length && t.strstart - t.match_start > 4096) && (t.match_length = 2)), t.prev_length >= 3 && t.match_length <= t.prev_length) { n = t.strstart + t.lookahead - 3, i = G(t, t.strstart - 1 - t.prev_match, t.prev_length - 3), t.lookahead -= t.prev_length - 1, t.prev_length -= 2; do { ++t.strstart <= n && (t.ins_h = kt(t, t.ins_h, t.window[t.strstart + 3 - 1]), a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart) } while (0 != --t.prev_length); if (t.match_available = 0, t.match_length = 2, t.strstart++, i && (yt(t, !1), 0 === t.strm.avail_out)) return 1 } else if (t.match_available) { if (i = G(t, 0, t.window[t.strstart - 1]), i && yt(t, !1), t.strstart++, t.lookahead--, 0 === t.strm.avail_out) return 1 } else t.match_available = 1, t.strstart++, t.lookahead-- } return t.match_available && (i = G(t, 0, t.window[t.strstart - 1]), t.match_available = 0), t.insert = t.strstart < 2 ? t.strstart : 2, e === Q ? (yt(t, !0), 0 === t.strm.avail_out ? 3 : 4) : t.last_lit && (yt(t, !1), 0 === t.strm.avail_out) ? 1 : 2 }; function St(t, e, a, i, n) { this.good_length = t, this.max_lazy = e, this.nice_length = a, this.max_chain = i, this.func = n } const Dt = [new St(0, 0, 0, 0, ((t, e) => { let a = 65535; for (a > t.pending_buf_size - 5 && (a = t.pending_buf_size - 5); ;) { if (t.lookahead <= 1) { if (Rt(t), 0 === t.lookahead && e === W) return 1; if (0 === t.lookahead) break } t.strstart += t.lookahead, t.lookahead = 0; const i = t.block_start + a; if ((0 === t.strstart || t.strstart >= i) && (t.lookahead = t.strstart - i, t.strstart = i, yt(t, !1), 0 === t.strm.avail_out)) return 1; if (t.strstart - t.block_start >= t.w_size - ct && (yt(t, !1), 0 === t.strm.avail_out)) return 1 } return t.insert = 0, e === Q ? (yt(t, !0), 0 === t.strm.avail_out ? 3 : 4) : (t.strstart > t.block_start && (yt(t, !1), t.strm.avail_out), 1) })), new St(4, 4, 8, 4, Zt), new St(4, 5, 16, 8, Zt), new St(4, 6, 32, 32, Zt), new St(4, 4, 16, 16, Ut), new St(8, 16, 32, 32, Ut), new St(8, 16, 128, 128, Ut), new St(8, 32, 128, 256, Ut), new St(32, 128, 258, 1024, Ut), new St(32, 258, 258, 4096, Ut)]; function Tt() { this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = _t, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(1146), this.dyn_dtree = new Uint16Array(122), this.bl_tree = new Uint16Array(78), mt(this.dyn_ltree), mt(this.dyn_dtree), mt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(16), this.heap = new Uint16Array(573), mt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(573), mt(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0 } const Ot = t => { if (!t || !t.state) return gt(t, et); t.total_in = t.total_out = 0, t.data_type = dt; const e = t.state; return e.pending = 0, e.pending_out = 0, e.wrap < 0 && (e.wrap = -e.wrap), e.status = e.wrap ? 42 : wt, t.adler = 2 === e.wrap ? 0 : 1, e.last_flush = W, K(e), $ }, It = t => { const e = Ot(t); var a; return e === $ && ((a = t.state).window_size = 2 * a.w_size, mt(a.head), a.max_lazy_match = Dt[a.level].max_lazy, a.good_match = Dt[a.level].good_length, a.nice_match = Dt[a.level].nice_length, a.max_chain_length = Dt[a.level].max_chain, a.strstart = 0, a.block_start = 0, a.lookahead = 0, a.insert = 0, a.match_length = a.prev_length = 2, a.match_available = 0, a.ins_h = 0), e }, Ft = (t, e, a, i, n, s) => { if (!t) return et; let r = 1; if (e === nt && (e = 6), i < 0 ? (r = 0, i = -i) : i > 15 && (r = 2, i -= 16), n < 1 || n > 9 || a !== _t || i < 8 || i > 15 || e < 0 || e > 9 || s < 0 || s > ot) return gt(t, et); 8 === i && (i = 9); const l = new Tt; return t.state = l, l.strm = t, l.wrap = r, l.gzhead = null, l.w_bits = i, l.w_size = 1 << l.w_bits, l.w_mask = l.w_size - 1, l.hash_bits = n + 7, l.hash_size = 1 << l.hash_bits, l.hash_mask = l.hash_size - 1, l.hash_shift = ~~((l.hash_bits + 3 - 1) / 3), l.window = new Uint8Array(2 * l.w_size), l.head = new Uint16Array(l.hash_size), l.prev = new Uint16Array(l.w_size), l.lit_bufsize = 1 << n + 6, l.pending_buf_size = 4 * l.lit_bufsize, l.pending_buf = new Uint8Array(l.pending_buf_size), l.d_buf = 1 * l.lit_bufsize, l.l_buf = 3 * l.lit_bufsize, l.level = e, l.strategy = s, l.method = a, It(t) }; var Lt = { deflateInit: (t, e) => Ft(t, e, _t, 15, 8, ht), deflateInit2: Ft, deflateReset: It, deflateResetKeep: Ot, deflateSetHeader: (t, e) => t && t.state ? 2 !== t.state.wrap ? et : (t.state.gzhead = e, $) : et, deflate: (t, e) => { let a, i; if (!t || !t.state || e > V || e < 0) return t ? gt(t, et) : et; const n = t.state; if (!t.output || !t.input && 0 !== t.avail_in || n.status === bt && e !== Q) return gt(t, 0 === t.avail_out ? it : et); n.strm = t; const s = n.last_flush; if (n.last_flush = e, 42 === n.status) if (2 === n.wrap) t.adler = 0, xt(n, 31), xt(n, 139), xt(n, 8), n.gzhead ? (xt(n, (n.gzhead.text ? 1 : 0) + (n.gzhead.hcrc ? 2 : 0) + (n.gzhead.extra ? 4 : 0) + (n.gzhead.name ? 8 : 0) + (n.gzhead.comment ? 16 : 0)), xt(n, 255 & n.gzhead.time), xt(n, n.gzhead.time >> 8 & 255), xt(n, n.gzhead.time >> 16 & 255), xt(n, n.gzhead.time >> 24 & 255), xt(n, 9 === n.level ? 2 : n.strategy >= rt || n.level < 2 ? 4 : 0), xt(n, 255 & n.gzhead.os), n.gzhead.extra && n.gzhead.extra.length && (xt(n, 255 & n.gzhead.extra.length), xt(n, n.gzhead.extra.length >> 8 & 255)), n.gzhead.hcrc && (t.adler = M(t.adler, n.pending_buf, n.pending, 0)), n.gzindex = 0, n.status = 69) : (xt(n, 0), xt(n, 0), xt(n, 0), xt(n, 0), xt(n, 0), xt(n, 9 === n.level ? 2 : n.strategy >= rt || n.level < 2 ? 4 : 0), xt(n, 3), n.status = wt); else { let e = _t + (n.w_bits - 8 << 4) << 8, a = -1; a = n.strategy >= rt || n.level < 2 ? 0 : n.level < 6 ? 1 : 6 === n.level ? 2 : 3, e |= a << 6, 0 !== n.strstart && (e |= 32), e += 31 - e % 31, n.status = wt, zt(n, e), 0 !== n.strstart && (zt(n, t.adler >>> 16), zt(n, 65535 & t.adler)), t.adler = 1 } if (69 === n.status) if (n.gzhead.extra) { for (a = n.pending; n.gzindex < (65535 & n.gzhead.extra.length) && (n.pending !== n.pending_buf_size || (n.gzhead.hcrc && n.pending > a && (t.adler = M(t.adler, n.pending_buf, n.pending - a, a)), vt(t), a = n.pending, n.pending !== n.pending_buf_size));)xt(n, 255 & n.gzhead.extra[n.gzindex]), n.gzindex++; n.gzhead.hcrc && n.pending > a && (t.adler = M(t.adler, n.pending_buf, n.pending - a, a)), n.gzindex === n.gzhead.extra.length && (n.gzindex = 0, n.status = 73) } else n.status = 73; if (73 === n.status) if (n.gzhead.name) { a = n.pending; do { if (n.pending === n.pending_buf_size && (n.gzhead.hcrc && n.pending > a && (t.adler = M(t.adler, n.pending_buf, n.pending - a, a)), vt(t), a = n.pending, n.pending === n.pending_buf_size)) { i = 1; break } i = n.gzindex < n.gzhead.name.length ? 255 & n.gzhead.name.charCodeAt(n.gzindex++) : 0, xt(n, i) } while (0 !== i); n.gzhead.hcrc && n.pending > a && (t.adler = M(t.adler, n.pending_buf, n.pending - a, a)), 0 === i && (n.gzindex = 0, n.status = 91) } else n.status = 91; if (91 === n.status) if (n.gzhead.comment) { a = n.pending; do { if (n.pending === n.pending_buf_size && (n.gzhead.hcrc && n.pending > a && (t.adler = M(t.adler, n.pending_buf, n.pending - a, a)), vt(t), a = n.pending, n.pending === n.pending_buf_size)) { i = 1; break } i = n.gzindex < n.gzhead.comment.length ? 255 & n.gzhead.comment.charCodeAt(n.gzindex++) : 0, xt(n, i) } while (0 !== i); n.gzhead.hcrc && n.pending > a && (t.adler = M(t.adler, n.pending_buf, n.pending - a, a)), 0 === i && (n.status = ut) } else n.status = ut; if (n.status === ut && (n.gzhead.hcrc ? (n.pending + 2 > n.pending_buf_size && vt(t), n.pending + 2 <= n.pending_buf_size && (xt(n, 255 & t.adler), xt(n, t.adler >> 8 & 255), t.adler = 0, n.status = wt)) : n.status = wt), 0 !== n.pending) { if (vt(t), 0 === t.avail_out) return n.last_flush = -1, $ } else if (0 === t.avail_in && pt(e) <= pt(s) && e !== Q) return gt(t, it); if (n.status === bt && 0 !== t.avail_in) return gt(t, it); if (0 !== t.avail_in || 0 !== n.lookahead || e !== W && n.status !== bt) { let a = n.strategy === rt ? ((t, e) => { let a; for (; ;) { if (0 === t.lookahead && (Rt(t), 0 === t.lookahead)) { if (e === W) return 1; break } if (t.match_length = 0, a = G(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++, a && (yt(t, !1), 0 === t.strm.avail_out)) return 1 } return t.insert = 0, e === Q ? (yt(t, !0), 0 === t.strm.avail_out ? 3 : 4) : t.last_lit && (yt(t, !1), 0 === t.strm.avail_out) ? 1 : 2 })(n, e) : n.strategy === lt ? ((t, e) => { let a, i, n, s; const r = t.window; for (; ;) { if (t.lookahead <= ft) { if (Rt(t), t.lookahead <= ft && e === W) return 1; if (0 === t.lookahead) break } if (t.match_length = 0, t.lookahead >= 3 && t.strstart > 0 && (n = t.strstart - 1, i = r[n], i === r[++n] && i === r[++n] && i === r[++n])) { s = t.strstart + ft; do { } while (i === r[++n] && i === r[++n] && i === r[++n] && i === r[++n] && i === r[++n] && i === r[++n] && i === r[++n] && i === r[++n] && n < s); t.match_length = ft - (s - n), t.match_length > t.lookahead && (t.match_length = t.lookahead) } if (t.match_length >= 3 ? (a = G(t, 1, t.match_length - 3), t.lookahead -= t.match_length, t.strstart += t.match_length, t.match_length = 0) : (a = G(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++), a && (yt(t, !1), 0 === t.strm.avail_out)) return 1 } return t.insert = 0, e === Q ? (yt(t, !0), 0 === t.strm.avail_out ? 3 : 4) : t.last_lit && (yt(t, !1), 0 === t.strm.avail_out) ? 1 : 2 })(n, e) : Dt[n.level].func(n, e); if (3 !== a && 4 !== a || (n.status = bt), 1 === a || 3 === a) return 0 === t.avail_out && (n.last_flush = -1), $; if (2 === a && (e === q ? X(n) : e !== V && (P(n, 0, 0, !1), e === J && (mt(n.head), 0 === n.lookahead && (n.strstart = 0, n.block_start = 0, n.insert = 0))), vt(t), 0 === t.avail_out)) return n.last_flush = -1, $ } return e !== Q ? $ : n.wrap <= 0 ? tt : (2 === n.wrap ? (xt(n, 255 & t.adler), xt(n, t.adler >> 8 & 255), xt(n, t.adler >> 16 & 255), xt(n, t.adler >> 24 & 255), xt(n, 255 & t.total_in), xt(n, t.total_in >> 8 & 255), xt(n, t.total_in >> 16 & 255), xt(n, t.total_in >> 24 & 255)) : (zt(n, t.adler >>> 16), zt(n, 65535 & t.adler)), vt(t), n.wrap > 0 && (n.wrap = -n.wrap), 0 !== n.pending ? $ : tt) }, deflateEnd: t => { if (!t || !t.state) return et; const e = t.state.status; return 42 !== e && 69 !== e && 73 !== e && 91 !== e && e !== ut && e !== wt && e !== bt ? gt(t, et) : (t.state = null, e === wt ? gt(t, at) : $) }, deflateSetDictionary: (t, e) => { let a = e.length; if (!t || !t.state) return et; const i = t.state, n = i.wrap; if (2 === n || 1 === n && 42 !== i.status || i.lookahead) return et; if (1 === n && (t.adler = B(t.adler, e, a, 0)), i.wrap = 0, a >= i.w_size) { 0 === n && (mt(i.head), i.strstart = 0, i.block_start = 0, i.insert = 0); let t = new Uint8Array(i.w_size); t.set(e.subarray(a - i.w_size, a), 0), e = t, a = i.w_size } const s = t.avail_in, r = t.next_in, l = t.input; for (t.avail_in = a, t.next_in = 0, t.input = e, Rt(i); i.lookahead >= 3;) { let t = i.strstart, e = i.lookahead - 2; do { i.ins_h = kt(i, i.ins_h, i.window[t + 3 - 1]), i.prev[t & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = t, t++ } while (--e); i.strstart = t, i.lookahead = 2, Rt(i) } return i.strstart += i.lookahead, i.block_start = i.strstart, i.insert = i.lookahead, i.lookahead = 0, i.match_length = i.prev_length = 2, i.match_available = 0, t.next_in = r, t.input = l, t.avail_in = s, i.wrap = n, $ }, deflateInfo: "pako deflate (from Nodeca project)" }; const Nt = (t, e) => Object.prototype.hasOwnProperty.call(t, e); var Bt = function (t) { const e = Array.prototype.slice.call(arguments, 1); for (; e.length;) { const a = e.shift(); if (a) { if ("object" != typeof a) throw new TypeError(a + "must be non-object"); for (const e in a) Nt(a, e) && (t[e] = a[e]) } } return t }, Ct = t => { let e = 0; for (let a = 0, i = t.length; a < i; a++)e += t[a].length; const a = new Uint8Array(e); for (let e = 0, i = 0, n = t.length; e < n; e++) { let n = t[e]; a.set(n, i), i += n.length } return a }; let Mt = !0; try { String.fromCharCode.apply(null, new Uint8Array(1)) } catch (t) { Mt = !1 } const Ht = new Uint8Array(256); for (let t = 0; t < 256; t++)Ht[t] = t >= 252 ? 6 : t >= 248 ? 5 : t >= 240 ? 4 : t >= 224 ? 3 : t >= 192 ? 2 : 1; Ht[254] = Ht[254] = 1; var jt = t => { if ("function" == typeof TextEncoder && TextEncoder.prototype.encode) return (new TextEncoder).encode(t); let e, a, i, n, s, r = t.length, l = 0; for (n = 0; n < r; n++)a = t.charCodeAt(n), 55296 == (64512 & a) && n + 1 < r && (i = t.charCodeAt(n + 1), 56320 == (64512 & i) && (a = 65536 + (a - 55296 << 10) + (i - 56320), n++)), l += a < 128 ? 1 : a < 2048 ? 2 : a < 65536 ? 3 : 4; for (e = new Uint8Array(l), s = 0, n = 0; s < l; n++)a = t.charCodeAt(n), 55296 == (64512 & a) && n + 1 < r && (i = t.charCodeAt(n + 1), 56320 == (64512 & i) && (a = 65536 + (a - 55296 << 10) + (i - 56320), n++)), a < 128 ? e[s++] = a : a < 2048 ? (e[s++] = 192 | a >>> 6, e[s++] = 128 | 63 & a) : a < 65536 ? (e[s++] = 224 | a >>> 12, e[s++] = 128 | a >>> 6 & 63, e[s++] = 128 | 63 & a) : (e[s++] = 240 | a >>> 18, e[s++] = 128 | a >>> 12 & 63, e[s++] = 128 | a >>> 6 & 63, e[s++] = 128 | 63 & a); return e }, Kt = (t, e) => { const a = e || t.length; if ("function" == typeof TextDecoder && TextDecoder.prototype.decode) return (new TextDecoder).decode(t.subarray(0, e)); let i, n; const s = new Array(2 * a); for (n = 0, i = 0; i < a;) { let e = t[i++]; if (e < 128) { s[n++] = e; continue } let r = Ht[e]; if (r > 4) s[n++] = 65533, i += r - 1; else { for (e &= 2 === r ? 31 : 3 === r ? 15 : 7; r > 1 && i < a;)e = e << 6 | 63 & t[i++], r--; r > 1 ? s[n++] = 65533 : e < 65536 ? s[n++] = e : (e -= 65536, s[n++] = 55296 | e >> 10 & 1023, s[n++] = 56320 | 1023 & e) } } return ((t, e) => { if (e < 65534 && t.subarray && Mt) return String.fromCharCode.apply(null, t.length === e ? t : t.subarray(0, e)); let a = ""; for (let i = 0; i < e; i++)a += String.fromCharCode(t[i]); return a })(s, n) }, Pt = (t, e) => { (e = e || t.length) > t.length && (e = t.length); let a = e - 1; for (; a >= 0 && 128 == (192 & t[a]);)a--; return a < 0 || 0 === a ? e : a + Ht[t[a]] > e ? a : e }; var Yt = function () { this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0 }; const Gt = Object.prototype.toString, { Z_NO_FLUSH: Xt, Z_SYNC_FLUSH: Wt, Z_FULL_FLUSH: qt, Z_FINISH: Jt, Z_OK: Qt, Z_STREAM_END: Vt, Z_DEFAULT_COMPRESSION: $t, Z_DEFAULT_STRATEGY: te, Z_DEFLATED: ee } = j; function ae(t) { this.options = Bt({ level: $t, method: ee, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: te }, t || {}); let e = this.options; e.raw && e.windowBits > 0 ? e.windowBits = -e.windowBits : e.gzip && e.windowBits > 0 && e.windowBits < 16 && (e.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Yt, this.strm.avail_out = 0; let a = Lt.deflateInit2(this.strm, e.level, e.method, e.windowBits, e.memLevel, e.strategy); if (a !== Qt) throw new Error(H[a]); if (e.header && Lt.deflateSetHeader(this.strm, e.header), e.dictionary) { let t; if (t = "string" == typeof e.dictionary ? jt(e.dictionary) : "[object ArrayBuffer]" === Gt.call(e.dictionary) ? new Uint8Array(e.dictionary) : e.dictionary, a = Lt.deflateSetDictionary(this.strm, t), a !== Qt) throw new Error(H[a]); this._dict_set = !0 } } function ie(t, e) { const a = new ae(e); if (a.push(t, !0), a.err) throw a.msg || H[a.err]; return a.result } ae.prototype.push = function (t, e) { const a = this.strm, i = this.options.chunkSize; let n, s; if (this.ended) return !1; for (s = e === ~~e ? e : !0 === e ? Jt : Xt, "string" == typeof t ? a.input = jt(t) : "[object ArrayBuffer]" === Gt.call(t) ? a.input = new Uint8Array(t) : a.input = t, a.next_in = 0, a.avail_in = a.input.length; ;)if (0 === a.avail_out && (a.output = new Uint8Array(i), a.next_out = 0, a.avail_out = i), (s === Wt || s === qt) && a.avail_out <= 6) this.onData(a.output.subarray(0, a.next_out)), a.avail_out = 0; else { if (n = Lt.deflate(a, s), n === Vt) return a.next_out > 0 && this.onData(a.output.subarray(0, a.next_out)), n = Lt.deflateEnd(this.strm), this.onEnd(n), this.ended = !0, n === Qt; if (0 !== a.avail_out) { if (s > 0 && a.next_out > 0) this.onData(a.output.subarray(0, a.next_out)), a.avail_out = 0; else if (0 === a.avail_in) break } else this.onData(a.output) } return !0 }, ae.prototype.onData = function (t) { this.chunks.push(t) }, ae.prototype.onEnd = function (t) { t === Qt && (this.result = Ct(this.chunks)), this.chunks = [], this.err = t, this.msg = this.strm.msg }; var ne = { Deflate: ae, deflate: ie, deflateRaw: function (t, e) { return (e = e || {}).raw = !0, ie(t, e) }, gzip: function (t, e) { return (e = e || {}).gzip = !0, ie(t, e) }, constants: j }; var se = function (t, e) { let a, i, n, s, r, l, o, h, d, _, f, c, u, w, b, g, p, m, k, v, y, x, z, A; const E = t.state; a = t.next_in, z = t.input, i = a + (t.avail_in - 5), n = t.next_out, A = t.output, s = n - (e - t.avail_out), r = n + (t.avail_out - 257), l = E.dmax, o = E.wsize, h = E.whave, d = E.wnext, _ = E.window, f = E.hold, c = E.bits, u = E.lencode, w = E.distcode, b = (1 << E.lenbits) - 1, g = (1 << E.distbits) - 1; t: do { c < 15 && (f += z[a++] << c, c += 8, f += z[a++] << c, c += 8), p = u[f & b]; e: for (; ;) { if (m = p >>> 24, f >>>= m, c -= m, m = p >>> 16 & 255, 0 === m) A[n++] = 65535 & p; else { if (!(16 & m)) { if (0 == (64 & m)) { p = u[(65535 & p) + (f & (1 << m) - 1)]; continue e } if (32 & m) { E.mode = 12; break t } t.msg = "invalid literal/length code", E.mode = 30; break t } k = 65535 & p, m &= 15, m && (c < m && (f += z[a++] << c, c += 8), k += f & (1 << m) - 1, f >>>= m, c -= m), c < 15 && (f += z[a++] << c, c += 8, f += z[a++] << c, c += 8), p = w[f & g]; a: for (; ;) { if (m = p >>> 24, f >>>= m, c -= m, m = p >>> 16 & 255, !(16 & m)) { if (0 == (64 & m)) { p = w[(65535 & p) + (f & (1 << m) - 1)]; continue a } t.msg = "invalid distance code", E.mode = 30; break t } if (v = 65535 & p, m &= 15, c < m && (f += z[a++] << c, c += 8, c < m && (f += z[a++] << c, c += 8)), v += f & (1 << m) - 1, v > l) { t.msg = "invalid distance too far back", E.mode = 30; break t } if (f >>>= m, c -= m, m = n - s, v > m) { if (m = v - m, m > h && E.sane) { t.msg = "invalid distance too far back", E.mode = 30; break t } if (y = 0, x = _, 0 === d) { if (y += o - m, m < k) { k -= m; do { A[n++] = _[y++] } while (--m); y = n - v, x = A } } else if (d < m) { if (y += o + d - m, m -= d, m < k) { k -= m; do { A[n++] = _[y++] } while (--m); if (y = 0, d < k) { m = d, k -= m; do { A[n++] = _[y++] } while (--m); y = n - v, x = A } } } else if (y += d - m, m < k) { k -= m; do { A[n++] = _[y++] } while (--m); y = n - v, x = A } for (; k > 2;)A[n++] = x[y++], A[n++] = x[y++], A[n++] = x[y++], k -= 3; k && (A[n++] = x[y++], k > 1 && (A[n++] = x[y++])) } else { y = n - v; do { A[n++] = A[y++], A[n++] = A[y++], A[n++] = A[y++], k -= 3 } while (k > 2); k && (A[n++] = A[y++], k > 1 && (A[n++] = A[y++])) } break } } break } } while (a < i && n < r); k = c >> 3, a -= k, c -= k << 3, f &= (1 << c) - 1, t.next_in = a, t.next_out = n, t.avail_in = a < i ? i - a + 5 : 5 - (a - i), t.avail_out = n < r ? r - n + 257 : 257 - (n - r), E.hold = f, E.bits = c }; const re = 15, le = new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0]), oe = new Uint8Array([16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78]), he = new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0]), de = new Uint8Array([16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]); var _e = (t, e, a, i, n, s, r, l) => { const o = l.bits; let h, d, _, f, c, u, w = 0, b = 0, g = 0, p = 0, m = 0, k = 0, v = 0, y = 0, x = 0, z = 0, A = null, E = 0; const R = new Uint16Array(16), Z = new Uint16Array(16); let U, S, D, T = null, O = 0; for (w = 0; w <= re; w++)R[w] = 0; for (b = 0; b < i; b++)R[e[a + b]]++; for (m = o, p = re; p >= 1 && 0 === R[p]; p--); if (m > p && (m = p), 0 === p) return n[s++] = 20971520, n[s++] = 20971520, l.bits = 1, 0; for (g = 1; g < p && 0 === R[g]; g++); for (m < g && (m = g), y = 1, w = 1; w <= re; w++)if (y <<= 1, y -= R[w], y < 0) return -1; if (y > 0 && (0 === t || 1 !== p)) return -1; for (Z[1] = 0, w = 1; w < re; w++)Z[w + 1] = Z[w] + R[w]; for (b = 0; b < i; b++)0 !== e[a + b] && (r[Z[e[a + b]]++] = b); if (0 === t ? (A = T = r, u = 19) : 1 === t ? (A = le, E -= 257, T = oe, O -= 257, u = 256) : (A = he, T = de, u = -1), z = 0, b = 0, w = g, c = s, k = m, v = 0, _ = -1, x = 1 << m, f = x - 1, 1 === t && x > 852 || 2 === t && x > 592) return 1; for (; ;) { U = w - v, r[b] < u ? (S = 0, D = r[b]) : r[b] > u ? (S = T[O + r[b]], D = A[E + r[b]]) : (S = 96, D = 0), h = 1 << w - v, d = 1 << k, g = d; do { d -= h, n[c + (z >> v) + d] = U << 24 | S << 16 | D | 0 } while (0 !== d); for (h = 1 << w - 1; z & h;)h >>= 1; if (0 !== h ? (z &= h - 1, z += h) : z = 0, b++, 0 == --R[w]) { if (w === p) break; w = e[a + r[b]] } if (w > m && (z & f) !== _) { for (0 === v && (v = m), c += g, k = w - v, y = 1 << k; k + v < p && (y -= R[k + v], !(y <= 0));)k++, y <<= 1; if (x += 1 << k, 1 === t && x > 852 || 2 === t && x > 592) return 1; _ = z & f, n[_] = m << 24 | k << 16 | c - s | 0 } } return 0 !== z && (n[c + z] = w - v << 24 | 64 << 16 | 0), l.bits = m, 0 }; const { Z_FINISH: fe, Z_BLOCK: ce, Z_TREES: ue, Z_OK: we, Z_STREAM_END: be, Z_NEED_DICT: ge, Z_STREAM_ERROR: pe, Z_DATA_ERROR: me, Z_MEM_ERROR: ke, Z_BUF_ERROR: ve, Z_DEFLATED: ye } = j, xe = 12, ze = 30, Ae = t => (t >>> 24 & 255) + (t >>> 8 & 65280) + ((65280 & t) << 8) + ((255 & t) << 24); function Ee() { this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0 } const Re = t => { if (!t || !t.state) return pe; const e = t.state; return t.total_in = t.total_out = e.total = 0, t.msg = "", e.wrap && (t.adler = 1 & e.wrap), e.mode = 1, e.last = 0, e.havedict = 0, e.dmax = 32768, e.head = null, e.hold = 0, e.bits = 0, e.lencode = e.lendyn = new Int32Array(852), e.distcode = e.distdyn = new Int32Array(592), e.sane = 1, e.back = -1, we }, Ze = t => { if (!t || !t.state) return pe; const e = t.state; return e.wsize = 0, e.whave = 0, e.wnext = 0, Re(t) }, Ue = (t, e) => { let a; if (!t || !t.state) return pe; const i = t.state; return e < 0 ? (a = 0, e = -e) : (a = 1 + (e >> 4), e < 48 && (e &= 15)), e && (e < 8 || e > 15) ? pe : (null !== i.window && i.wbits !== e && (i.window = null), i.wrap = a, i.wbits = e, Ze(t)) }, Se = (t, e) => { if (!t) return pe; const a = new Ee; t.state = a, a.window = null; const i = Ue(t, e); return i !== we && (t.state = null), i }; let De, Te, Oe = !0; const Ie = t => { if (Oe) { De = new Int32Array(512), Te = new Int32Array(32); let e = 0; for (; e < 144;)t.lens[e++] = 8; for (; e < 256;)t.lens[e++] = 9; for (; e < 280;)t.lens[e++] = 7; for (; e < 288;)t.lens[e++] = 8; for (_e(1, t.lens, 0, 288, De, 0, t.work, { bits: 9 }), e = 0; e < 32;)t.lens[e++] = 5; _e(2, t.lens, 0, 32, Te, 0, t.work, { bits: 5 }), Oe = !1 } t.lencode = De, t.lenbits = 9, t.distcode = Te, t.distbits = 5 }, Fe = (t, e, a, i) => { let n; const s = t.state; return null === s.window && (s.wsize = 1 << s.wbits, s.wnext = 0, s.whave = 0, s.window = new Uint8Array(s.wsize)), i >= s.wsize ? (s.window.set(e.subarray(a - s.wsize, a), 0), s.wnext = 0, s.whave = s.wsize) : (n = s.wsize - s.wnext, n > i && (n = i), s.window.set(e.subarray(a - i, a - i + n), s.wnext), (i -= n) ? (s.window.set(e.subarray(a - i, a), 0), s.wnext = i, s.whave = s.wsize) : (s.wnext += n, s.wnext === s.wsize && (s.wnext = 0), s.whave < s.wsize && (s.whave += n))), 0 }; var Le = { inflateReset: Ze, inflateReset2: Ue, inflateResetKeep: Re, inflateInit: t => Se(t, 15), inflateInit2: Se, inflate: (t, e) => { let a, i, n, s, r, l, o, h, d, _, f, c, u, w, b, g, p, m, k, v, y, x, z = 0; const A = new Uint8Array(4); let E, R; const Z = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); if (!t || !t.state || !t.output || !t.input && 0 !== t.avail_in) return pe; a = t.state, a.mode === xe && (a.mode = 13), r = t.next_out, n = t.output, o = t.avail_out, s = t.next_in, i = t.input, l = t.avail_in, h = a.hold, d = a.bits, _ = l, f = o, x = we; t: for (; ;)switch (a.mode) { case 1: if (0 === a.wrap) { a.mode = 13; break } for (; d < 16;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (2 & a.wrap && 35615 === h) { a.check = 0, A[0] = 255 & h, A[1] = h >>> 8 & 255, a.check = M(a.check, A, 2, 0), h = 0, d = 0, a.mode = 2; break } if (a.flags = 0, a.head && (a.head.done = !1), !(1 & a.wrap) || (((255 & h) << 8) + (h >> 8)) % 31) { t.msg = "incorrect header check", a.mode = ze; break } if ((15 & h) !== ye) { t.msg = "unknown compression method", a.mode = ze; break } if (h >>>= 4, d -= 4, y = 8 + (15 & h), 0 === a.wbits) a.wbits = y; else if (y > a.wbits) { t.msg = "invalid window size", a.mode = ze; break } a.dmax = 1 << a.wbits, t.adler = a.check = 1, a.mode = 512 & h ? 10 : xe, h = 0, d = 0; break; case 2: for (; d < 16;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (a.flags = h, (255 & a.flags) !== ye) { t.msg = "unknown compression method", a.mode = ze; break } if (57344 & a.flags) { t.msg = "unknown header flags set", a.mode = ze; break } a.head && (a.head.text = h >> 8 & 1), 512 & a.flags && (A[0] = 255 & h, A[1] = h >>> 8 & 255, a.check = M(a.check, A, 2, 0)), h = 0, d = 0, a.mode = 3; case 3: for (; d < 32;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } a.head && (a.head.time = h), 512 & a.flags && (A[0] = 255 & h, A[1] = h >>> 8 & 255, A[2] = h >>> 16 & 255, A[3] = h >>> 24 & 255, a.check = M(a.check, A, 4, 0)), h = 0, d = 0, a.mode = 4; case 4: for (; d < 16;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } a.head && (a.head.xflags = 255 & h, a.head.os = h >> 8), 512 & a.flags && (A[0] = 255 & h, A[1] = h >>> 8 & 255, a.check = M(a.check, A, 2, 0)), h = 0, d = 0, a.mode = 5; case 5: if (1024 & a.flags) { for (; d < 16;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } a.length = h, a.head && (a.head.extra_len = h), 512 & a.flags && (A[0] = 255 & h, A[1] = h >>> 8 & 255, a.check = M(a.check, A, 2, 0)), h = 0, d = 0 } else a.head && (a.head.extra = null); a.mode = 6; case 6: if (1024 & a.flags && (c = a.length, c > l && (c = l), c && (a.head && (y = a.head.extra_len - a.length, a.head.extra || (a.head.extra = new Uint8Array(a.head.extra_len)), a.head.extra.set(i.subarray(s, s + c), y)), 512 & a.flags && (a.check = M(a.check, i, c, s)), l -= c, s += c, a.length -= c), a.length)) break t; a.length = 0, a.mode = 7; case 7: if (2048 & a.flags) { if (0 === l) break t; c = 0; do { y = i[s + c++], a.head && y && a.length < 65536 && (a.head.name += String.fromCharCode(y)) } while (y && c < l); if (512 & a.flags && (a.check = M(a.check, i, c, s)), l -= c, s += c, y) break t } else a.head && (a.head.name = null); a.length = 0, a.mode = 8; case 8: if (4096 & a.flags) { if (0 === l) break t; c = 0; do { y = i[s + c++], a.head && y && a.length < 65536 && (a.head.comment += String.fromCharCode(y)) } while (y && c < l); if (512 & a.flags && (a.check = M(a.check, i, c, s)), l -= c, s += c, y) break t } else a.head && (a.head.comment = null); a.mode = 9; case 9: if (512 & a.flags) { for (; d < 16;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (h !== (65535 & a.check)) { t.msg = "header crc mismatch", a.mode = ze; break } h = 0, d = 0 } a.head && (a.head.hcrc = a.flags >> 9 & 1, a.head.done = !0), t.adler = a.check = 0, a.mode = xe; break; case 10: for (; d < 32;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } t.adler = a.check = Ae(h), h = 0, d = 0, a.mode = 11; case 11: if (0 === a.havedict) return t.next_out = r, t.avail_out = o, t.next_in = s, t.avail_in = l, a.hold = h, a.bits = d, ge; t.adler = a.check = 1, a.mode = xe; case xe: if (e === ce || e === ue) break t; case 13: if (a.last) { h >>>= 7 & d, d -= 7 & d, a.mode = 27; break } for (; d < 3;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } switch (a.last = 1 & h, h >>>= 1, d -= 1, 3 & h) { case 0: a.mode = 14; break; case 1: if (Ie(a), a.mode = 20, e === ue) { h >>>= 2, d -= 2; break t } break; case 2: a.mode = 17; break; case 3: t.msg = "invalid block type", a.mode = ze }h >>>= 2, d -= 2; break; case 14: for (h >>>= 7 & d, d -= 7 & d; d < 32;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if ((65535 & h) != (h >>> 16 ^ 65535)) { t.msg = "invalid stored block lengths", a.mode = ze; break } if (a.length = 65535 & h, h = 0, d = 0, a.mode = 15, e === ue) break t; case 15: a.mode = 16; case 16: if (c = a.length, c) { if (c > l && (c = l), c > o && (c = o), 0 === c) break t; n.set(i.subarray(s, s + c), r), l -= c, s += c, o -= c, r += c, a.length -= c; break } a.mode = xe; break; case 17: for (; d < 14;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (a.nlen = 257 + (31 & h), h >>>= 5, d -= 5, a.ndist = 1 + (31 & h), h >>>= 5, d -= 5, a.ncode = 4 + (15 & h), h >>>= 4, d -= 4, a.nlen > 286 || a.ndist > 30) { t.msg = "too many length or distance symbols", a.mode = ze; break } a.have = 0, a.mode = 18; case 18: for (; a.have < a.ncode;) { for (; d < 3;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } a.lens[Z[a.have++]] = 7 & h, h >>>= 3, d -= 3 } for (; a.have < 19;)a.lens[Z[a.have++]] = 0; if (a.lencode = a.lendyn, a.lenbits = 7, E = { bits: a.lenbits }, x = _e(0, a.lens, 0, 19, a.lencode, 0, a.work, E), a.lenbits = E.bits, x) { t.msg = "invalid code lengths set", a.mode = ze; break } a.have = 0, a.mode = 19; case 19: for (; a.have < a.nlen + a.ndist;) { for (; z = a.lencode[h & (1 << a.lenbits) - 1], b = z >>> 24, g = z >>> 16 & 255, p = 65535 & z, !(b <= d);) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (p < 16) h >>>= b, d -= b, a.lens[a.have++] = p; else { if (16 === p) { for (R = b + 2; d < R;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (h >>>= b, d -= b, 0 === a.have) { t.msg = "invalid bit length repeat", a.mode = ze; break } y = a.lens[a.have - 1], c = 3 + (3 & h), h >>>= 2, d -= 2 } else if (17 === p) { for (R = b + 3; d < R;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } h >>>= b, d -= b, y = 0, c = 3 + (7 & h), h >>>= 3, d -= 3 } else { for (R = b + 7; d < R;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } h >>>= b, d -= b, y = 0, c = 11 + (127 & h), h >>>= 7, d -= 7 } if (a.have + c > a.nlen + a.ndist) { t.msg = "invalid bit length repeat", a.mode = ze; break } for (; c--;)a.lens[a.have++] = y } } if (a.mode === ze) break; if (0 === a.lens[256]) { t.msg = "invalid code -- missing end-of-block", a.mode = ze; break } if (a.lenbits = 9, E = { bits: a.lenbits }, x = _e(1, a.lens, 0, a.nlen, a.lencode, 0, a.work, E), a.lenbits = E.bits, x) { t.msg = "invalid literal/lengths set", a.mode = ze; break } if (a.distbits = 6, a.distcode = a.distdyn, E = { bits: a.distbits }, x = _e(2, a.lens, a.nlen, a.ndist, a.distcode, 0, a.work, E), a.distbits = E.bits, x) { t.msg = "invalid distances set", a.mode = ze; break } if (a.mode = 20, e === ue) break t; case 20: a.mode = 21; case 21: if (l >= 6 && o >= 258) { t.next_out = r, t.avail_out = o, t.next_in = s, t.avail_in = l, a.hold = h, a.bits = d, se(t, f), r = t.next_out, n = t.output, o = t.avail_out, s = t.next_in, i = t.input, l = t.avail_in, h = a.hold, d = a.bits, a.mode === xe && (a.back = -1); break } for (a.back = 0; z = a.lencode[h & (1 << a.lenbits) - 1], b = z >>> 24, g = z >>> 16 & 255, p = 65535 & z, !(b <= d);) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (g && 0 == (240 & g)) { for (m = b, k = g, v = p; z = a.lencode[v + ((h & (1 << m + k) - 1) >> m)], b = z >>> 24, g = z >>> 16 & 255, p = 65535 & z, !(m + b <= d);) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } h >>>= m, d -= m, a.back += m } if (h >>>= b, d -= b, a.back += b, a.length = p, 0 === g) { a.mode = 26; break } if (32 & g) { a.back = -1, a.mode = xe; break } if (64 & g) { t.msg = "invalid literal/length code", a.mode = ze; break } a.extra = 15 & g, a.mode = 22; case 22: if (a.extra) { for (R = a.extra; d < R;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } a.length += h & (1 << a.extra) - 1, h >>>= a.extra, d -= a.extra, a.back += a.extra } a.was = a.length, a.mode = 23; case 23: for (; z = a.distcode[h & (1 << a.distbits) - 1], b = z >>> 24, g = z >>> 16 & 255, p = 65535 & z, !(b <= d);) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (0 == (240 & g)) { for (m = b, k = g, v = p; z = a.distcode[v + ((h & (1 << m + k) - 1) >> m)], b = z >>> 24, g = z >>> 16 & 255, p = 65535 & z, !(m + b <= d);) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } h >>>= m, d -= m, a.back += m } if (h >>>= b, d -= b, a.back += b, 64 & g) { t.msg = "invalid distance code", a.mode = ze; break } a.offset = p, a.extra = 15 & g, a.mode = 24; case 24: if (a.extra) { for (R = a.extra; d < R;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } a.offset += h & (1 << a.extra) - 1, h >>>= a.extra, d -= a.extra, a.back += a.extra } if (a.offset > a.dmax) { t.msg = "invalid distance too far back", a.mode = ze; break } a.mode = 25; case 25: if (0 === o) break t; if (c = f - o, a.offset > c) { if (c = a.offset - c, c > a.whave && a.sane) { t.msg = "invalid distance too far back", a.mode = ze; break } c > a.wnext ? (c -= a.wnext, u = a.wsize - c) : u = a.wnext - c, c > a.length && (c = a.length), w = a.window } else w = n, u = r - a.offset, c = a.length; c > o && (c = o), o -= c, a.length -= c; do { n[r++] = w[u++] } while (--c); 0 === a.length && (a.mode = 21); break; case 26: if (0 === o) break t; n[r++] = a.length, o--, a.mode = 21; break; case 27: if (a.wrap) { for (; d < 32;) { if (0 === l) break t; l--, h |= i[s++] << d, d += 8 } if (f -= o, t.total_out += f, a.total += f, f && (t.adler = a.check = a.flags ? M(a.check, n, f, r - f) : B(a.check, n, f, r - f)), f = o, (a.flags ? h : Ae(h)) !== a.check) { t.msg = "incorrect data check", a.mode = ze; break } h = 0, d = 0 } a.mode = 28; case 28: if (a.wrap && a.flags) { for (; d < 32;) { if (0 === l) break t; l--, h += i[s++] << d, d += 8 } if (h !== (4294967295 & a.total)) { t.msg = "incorrect length check", a.mode = ze; break } h = 0, d = 0 } a.mode = 29; case 29: x = be; break t; case ze: x = me; break t; case 31: return ke; case 32: default: return pe }return t.next_out = r, t.avail_out = o, t.next_in = s, t.avail_in = l, a.hold = h, a.bits = d, (a.wsize || f !== t.avail_out && a.mode < ze && (a.mode < 27 || e !== fe)) && Fe(t, t.output, t.next_out, f - t.avail_out), _ -= t.avail_in, f -= t.avail_out, t.total_in += _, t.total_out += f, a.total += f, a.wrap && f && (t.adler = a.check = a.flags ? M(a.check, n, f, t.next_out - f) : B(a.check, n, f, t.next_out - f)), t.data_type = a.bits + (a.last ? 64 : 0) + (a.mode === xe ? 128 : 0) + (20 === a.mode || 15 === a.mode ? 256 : 0), (0 === _ && 0 === f || e === fe) && x === we && (x = ve), x }, inflateEnd: t => { if (!t || !t.state) return pe; let e = t.state; return e.window && (e.window = null), t.state = null, we }, inflateGetHeader: (t, e) => { if (!t || !t.state) return pe; const a = t.state; return 0 == (2 & a.wrap) ? pe : (a.head = e, e.done = !1, we) }, inflateSetDictionary: (t, e) => { const a = e.length; let i, n, s; return t && t.state ? (i = t.state, 0 !== i.wrap && 11 !== i.mode ? pe : 11 === i.mode && (n = 1, n = B(n, e, a, 0), n !== i.check) ? me : (s = Fe(t, e, a, a), s ? (i.mode = 31, ke) : (i.havedict = 1, we))) : pe }, inflateInfo: "pako inflate (from Nodeca project)" }; var Ne = function () { this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1 }; const Be = Object.prototype.toString, { Z_NO_FLUSH: Ce, Z_FINISH: Me, Z_OK: He, Z_STREAM_END: je, Z_NEED_DICT: Ke, Z_STREAM_ERROR: Pe, Z_DATA_ERROR: Ye, Z_MEM_ERROR: Ge } = j; function Xe(t) { this.options = Bt({ chunkSize: 65536, windowBits: 15, to: "" }, t || {}); const e = this.options; e.raw && e.windowBits >= 0 && e.windowBits < 16 && (e.windowBits = -e.windowBits, 0 === e.windowBits && (e.windowBits = -15)), !(e.windowBits >= 0 && e.windowBits < 16) || t && t.windowBits || (e.windowBits += 32), e.windowBits > 15 && e.windowBits < 48 && 0 == (15 & e.windowBits) && (e.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Yt, this.strm.avail_out = 0; let a = Le.inflateInit2(this.strm, e.windowBits); if (a !== He) throw new Error(H[a]); if (this.header = new Ne, Le.inflateGetHeader(this.strm, this.header), e.dictionary && ("string" == typeof e.dictionary ? e.dictionary = jt(e.dictionary) : "[object ArrayBuffer]" === Be.call(e.dictionary) && (e.dictionary = new Uint8Array(e.dictionary)), e.raw && (a = Le.inflateSetDictionary(this.strm, e.dictionary), a !== He))) throw new Error(H[a]) } function We(t, e) { const a = new Xe(e); if (a.push(t), a.err) throw a.msg || H[a.err]; return a.result } Xe.prototype.push = function (t, e) { const a = this.strm, i = this.options.chunkSize, n = this.options.dictionary; let s, r, l; if (this.ended) return !1; for (r = e === ~~e ? e : !0 === e ? Me : Ce, "[object ArrayBuffer]" === Be.call(t) ? a.input = new Uint8Array(t) : a.input = t, a.next_in = 0, a.avail_in = a.input.length; ;) { for (0 === a.avail_out && (a.output = new Uint8Array(i), a.next_out = 0, a.avail_out = i), s = Le.inflate(a, r), s === Ke && n && (s = Le.inflateSetDictionary(a, n), s === He ? s = Le.inflate(a, r) : s === Ye && (s = Ke)); a.avail_in > 0 && s === je && a.state.wrap > 0 && 0 !== t[a.next_in];)Le.inflateReset(a), s = Le.inflate(a, r); switch (s) { case Pe: case Ye: case Ke: case Ge: return this.onEnd(s), this.ended = !0, !1 }if (l = a.avail_out, a.next_out && (0 === a.avail_out || s === je)) if ("string" === this.options.to) { let t = Pt(a.output, a.next_out), e = a.next_out - t, n = Kt(a.output, t); a.next_out = e, a.avail_out = i - e, e && a.output.set(a.output.subarray(t, t + e), 0), this.onData(n) } else this.onData(a.output.length === a.next_out ? a.output : a.output.subarray(0, a.next_out)); if (s !== He || 0 !== l) { if (s === je) return s = Le.inflateEnd(this.strm), this.onEnd(s), this.ended = !0, !0; if (0 === a.avail_in) break } } return !0 }, Xe.prototype.onData = function (t) { this.chunks.push(t) }, Xe.prototype.onEnd = function (t) { t === He && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = Ct(this.chunks)), this.chunks = [], this.err = t, this.msg = this.strm.msg }; var qe = { Inflate: Xe, inflate: We, inflateRaw: function (t, e) { return (e = e || {}).raw = !0, We(t, e) }, ungzip: We, constants: j }; const { Deflate: Je, deflate: Qe, deflateRaw: Ve, gzip: $e } = ne, { Inflate: ta, inflate: ea, inflateRaw: aa, ungzip: ia } = qe; var na = Je, sa = Qe, ra = Ve, la = $e, oa = ta, ha = ea, da = aa, _a = ia, fa = j, ca = { Deflate: na, deflate: sa, deflateRaw: ra, gzip: la, Inflate: oa, inflate: ha, inflateRaw: da, ungzip: _a, constants: fa }; t.Deflate = na, t.Inflate = oa, t.constants = fa, t.default = ca, t.deflate = sa, t.deflateRaw = ra, t.gzip = la, t.inflate = ha, t.inflateRaw = da, t.ungzip = _a, Object.defineProperty(t, "__esModule", { value: !0 }) })); diff --git a/js/qrcode.js b/js/qrcode.js index 1980d68..ef02b4d 100644 --- a/js/qrcode.js +++ b/js/qrcode.js @@ -84,95 +84,181 @@ var QRCode; this.dataList = []; } - QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);} - return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);} - if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);} - this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}} - return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;} - for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}} - for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}} - this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);} - var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;} - this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}} - row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error("code length overflow. (" - +buffer.getLengthInBits() - +">" - +totalDataCount*8 - +")");} - if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);} - while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);} - while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;} - buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;} - buffer.put(QRCodeModel.PAD1,8);} - return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}} - var totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));} - return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));} - return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;} - return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}} - for(var row=0;row=256){n-=255;} - return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);} - if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));} - this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]; - + QRCodeModel.prototype = { + addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) { + if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); } + return this.modules[row][col]; + }, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) { + this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } } + this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); } + if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); } + this.mapData(this.dataCache, maskPattern); + }, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () { + var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } } + return pattern; + }, createMovieClip: function (target_mc, instance_name, depth) { + var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } } + return qr_mc; + }, setupTimingPattern: function () { + for (var r = 8; r < this.moduleCount - 8; r++) { + if (this.modules[r][6] != null) { continue; } + this.modules[r][6] = (r % 2 == 0); + } + for (var c = 8; c < this.moduleCount - 8; c++) { + if (this.modules[6][c] != null) { continue; } + this.modules[6][c] = (c % 2 == 0); + } + }, setupPositionAdjustPattern: function () { + var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) { + for (var j = 0; j < pos.length; j++) { + var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; } + for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } + } + } + }, setupTypeNumber: function (test) { + var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; } + for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; } + }, setupTypeInfo: function (test, maskPattern) { + var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } } + for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } } + this.modules[this.moduleCount - 8][8] = (!test); + }, mapData: function (data, maskPattern) { + var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) { + if (col == 6) col--; while (true) { + for (var c = 0; c < 2; c++) { + if (this.modules[row][col - c] == null) { + var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); } + var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; } + this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; } + } + } + row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; } + } + } + } + }; QRCodeModel.PAD0 = 0xEC; QRCodeModel.PAD1 = 0x11; QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) { + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); } + var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; } + if (buffer.getLengthInBits() > totalDataCount * 8) { + throw new Error("code length overflow. (" + + buffer.getLengthInBits() + + ">" + + totalDataCount * 8 + + ")"); + } + if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); } + while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); } + while (true) { + if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } + buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } + buffer.put(QRCodeModel.PAD1, 8); + } + return QRCodeModel.createBytes(buffer, rsBlocks); + }; QRCodeModel.createBytes = function (buffer, rsBlocks) { + var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) { + var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; } + offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; } + } + var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; } + var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } } + for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } } + return data; + }; var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 }; var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 }; var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }; var QRUtil = { + PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) { + var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); } + return ((data << 10) | d) ^ QRUtil.G15_MASK; + }, getBCHTypeNumber: function (data) { + var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); } + return (data << 12) | d; + }, getBCHDigit: function (data) { + var digit = 0; while (data != 0) { digit++; data >>>= 1; } + return digit; + }, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) { + var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); } + return a; + }, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) { + var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) { + for (var col = 0; col < moduleCount; col++) { + var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) { + if (row + r < 0 || moduleCount <= row + r) { continue; } + for (var c = -1; c <= 1; c++) { + if (col + c < 0 || moduleCount <= col + c) { continue; } + if (r == 0 && c == 0) { continue; } + if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; } + } + } + if (sameCount > 5) { lostPoint += (3 + sameCount - 5); } + } + } + for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } } + for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } } + for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } } + var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } } + var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint; + } + }; var QRMath = { + glog: function (n) { + if (n < 1) { throw new Error("glog(" + n + ")"); } + return QRMath.LOG_TABLE[n]; + }, gexp: function (n) { + while (n < 0) { n += 255; } + while (n >= 256) { n -= 255; } + return QRMath.EXP_TABLE[n]; + }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256) + }; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; } + for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; } + for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; } + function QRPolynomial(num, shift) { + if (num.length == undefined) { throw new Error(num.length + "/" + shift); } + var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; } + this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; } + } + QRPolynomial.prototype = { + get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) { + var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } } + return new QRPolynomial(num, 0); + }, mod: function (e) { + if (this.getLength() - e.getLength() < 0) { return this; } + var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); } + for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); } + return new QRPolynomial(num, 0).mod(e); + } + }; function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; } + QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]]; QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) { + var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); } + var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } } + return list; + }; QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } }; function QRBitBuffer() { this.buffer = []; this.length = 0; } + QRBitBuffer.prototype = { + get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) { + var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); } + if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); } + this.length++; + } + }; var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]]; + function _isSupportCanvas() { return typeof CanvasRenderingContext2D != "undefined"; } - + // android 2.x doesn't support Data-URI spec function _getAndroid() { var android = false; var sAgent = navigator.userAgent; - + if (/android/i.test(sAgent)) { // android android = true; var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); - + if (aMat && aMat[1]) { android = parseFloat(aMat[1]); } } - + return android; } - - var svgDrawer = (function() { + + var svgDrawer = (function () { var Drawing = function (el, htOption) { this._el = el; @@ -195,17 +281,17 @@ var QRCode; return el; } - var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight}); + var svg = makeSVG("svg", { 'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight }); svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); _el.appendChild(svg); - svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"})); - svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"})); + svg.appendChild(makeSVG("rect", { "fill": _htOption.colorLight, "width": "100%", "height": "100%" })); + svg.appendChild(makeSVG("rect", { "fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template" })); for (var row = 0; row < nCount; row++) { for (var col = 0; col < nCount; col++) { if (oQRCode.isDark(row, col)) { - var child = makeSVG("use", {"x": String(row), "y": String(col)}); + var child = makeSVG("use", { "x": String(row), "y": String(col) }); child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template") svg.appendChild(child); } @@ -227,79 +313,79 @@ var QRCode; this._el = el; this._htOption = htOption; }; - + /** * Draw the QRCode * * @param {QRCode} oQRCode */ Drawing.prototype.draw = function (oQRCode) { - var _htOption = this._htOption; - var _el = this._el; + var _htOption = this._htOption; + var _el = this._el; var nCount = oQRCode.getModuleCount(); var nWidth = Math.floor(_htOption.width / nCount); var nHeight = Math.floor(_htOption.height / nCount); var aHTML = ['']; - + for (var row = 0; row < nCount; row++) { aHTML.push(''); - + for (var col = 0; col < nCount; col++) { aHTML.push(''); } - + aHTML.push(''); } - + aHTML.push('
'); _el.innerHTML = aHTML.join(''); - + // Fix the margin values as real size. var elTable = _el.childNodes[0]; var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; - + if (nLeftMarginTable > 0 && nTopMarginTable > 0) { - elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; + elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; } }; - + /** * Clear the QRCode */ Drawing.prototype.clear = function () { this._el.innerHTML = ''; }; - + return Drawing; })() : (function () { // Drawing in Canvas function _onMakeImage() { this._elImage.src = this._elCanvas.toDataURL("image/png"); this._elImage.style.display = "block"; - this._elCanvas.style.display = "none"; + this._elCanvas.style.display = "none"; } - + // Android 2.1 bug workaround // http://code.google.com/p/android/issues/detail?id=5141 if (this._android && this._android <= 2.1) { - var factor = 1 / window.devicePixelRatio; - var drawImage = CanvasRenderingContext2D.prototype.drawImage; - CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { - if (("nodeName" in image) && /img/i.test(image.nodeName)) { - for (var i = arguments.length - 1; i >= 1; i--) { - arguments[i] = arguments[i] * factor; - } - } else if (typeof dw == "undefined") { - arguments[1] *= factor; - arguments[2] *= factor; - arguments[3] *= factor; - arguments[4] *= factor; - } - - drawImage.apply(this, arguments); - }; + var factor = 1 / window.devicePixelRatio; + var drawImage = CanvasRenderingContext2D.prototype.drawImage; + CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (("nodeName" in image) && /img/i.test(image.nodeName)) { + for (var i = arguments.length - 1; i >= 1; i--) { + arguments[i] = arguments[i] * factor; + } + } else if (typeof dw == "undefined") { + arguments[1] *= factor; + arguments[2] *= factor; + arguments[3] *= factor; + arguments[4] *= factor; + } + + drawImage.apply(this, arguments); + }; } - + /** * Check whether the user's browser supports Data URI or not * @@ -308,40 +394,40 @@ var QRCode; * @param {Function} fFail Occurs if it doesn't support Data URI */ function _safeSetDataURI(fSuccess, fFail) { - var self = this; - self._fFail = fFail; - self._fSuccess = fSuccess; + var self = this; + self._fFail = fFail; + self._fSuccess = fSuccess; - // Check it just once - if (self._bSupportDataURI === null) { - var el = document.createElement("img"); - var fOnError = function() { - self._bSupportDataURI = false; + // Check it just once + if (self._bSupportDataURI === null) { + var el = document.createElement("img"); + var fOnError = function () { + self._bSupportDataURI = false; - if (self._fFail) { - self._fFail.call(self); - } - }; - var fOnSuccess = function() { - self._bSupportDataURI = true; + if (self._fFail) { + self._fFail.call(self); + } + }; + var fOnSuccess = function () { + self._bSupportDataURI = true; - if (self._fSuccess) { - self._fSuccess.call(self); - } - }; + if (self._fSuccess) { + self._fSuccess.call(self); + } + }; - el.onabort = fOnError; - el.onerror = fOnError; - el.onload = fOnSuccess; - el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. - return; - } else if (self._bSupportDataURI === true && self._fSuccess) { - self._fSuccess.call(self); - } else if (self._bSupportDataURI === false && self._fFail) { - self._fFail.call(self); - } + el.onabort = fOnError; + el.onerror = fOnError; + el.onload = fOnSuccess; + el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. + return; + } else if (self._bSupportDataURI === true && self._fSuccess) { + self._fSuccess.call(self); + } else if (self._bSupportDataURI === false && self._fFail) { + self._fFail.call(self); + } }; - + /** * Drawing QRCode by using canvas * @@ -350,9 +436,9 @@ var QRCode; * @param {Object} htOption QRCode Options */ var Drawing = function (el, htOption) { - this._bIsPainted = false; - this._android = _getAndroid(); - + this._bIsPainted = false; + this._android = _getAndroid(); + this._htOption = htOption; this._elCanvas = document.createElement("canvas"); this._elCanvas.width = htOption.width; @@ -367,17 +453,17 @@ var QRCode; this._el.appendChild(this._elImage); this._bSupportDataURI = null; }; - + /** * Draw the QRCode * * @param {QRCode} oQRCode */ Drawing.prototype.draw = function (oQRCode) { - var _elImage = this._elImage; - var _oContext = this._oContext; - var _htOption = this._htOption; - + var _elImage = this._elImage; + var _oContext = this._oContext; + var _htOption = this._htOption; + var nCount = oQRCode.getModuleCount(); var nWidth = _htOption.width / nCount; var nHeight = _htOption.height / nCount; @@ -386,7 +472,7 @@ var QRCode; _elImage.style.display = "none"; this.clear(); - + for (var row = 0; row < nCount; row++) { for (var col = 0; col < nCount; col++) { var bIsDark = oQRCode.isDark(row, col); @@ -394,9 +480,9 @@ var QRCode; var nTop = row * nHeight; _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; _oContext.lineWidth = 1; - _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; _oContext.fillRect(nLeft, nTop, nWidth, nHeight); - + // 안티 앨리어싱 방지 처리 _oContext.strokeRect( Math.floor(nLeft) + 0.5, @@ -404,7 +490,7 @@ var QRCode; nRoundedWidth, nRoundedHeight ); - + _oContext.strokeRect( Math.ceil(nLeft) - 0.5, Math.ceil(nTop) - 0.5, @@ -413,10 +499,10 @@ var QRCode; ); } } - + this._bIsPainted = true; }; - + /** * Make the image from Canvas if the browser supports Data URI. */ @@ -425,7 +511,7 @@ var QRCode; _safeSetDataURI.call(this, _onMakeImage); } }; - + /** * Return whether the QRCode is painted or not * @@ -434,7 +520,7 @@ var QRCode; Drawing.prototype.isPainted = function () { return this._bIsPainted; }; - + /** * Clear the QRCode */ @@ -442,7 +528,7 @@ var QRCode; this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); this._bIsPainted = false; }; - + /** * @private * @param {Number} nNumber @@ -451,13 +537,13 @@ var QRCode; if (!nNumber) { return nNumber; } - + return Math.floor(nNumber * 1000) / 1000; }; - + return Drawing; })(); - + /** * Get the type by string length * @@ -466,39 +552,39 @@ var QRCode; * @param {Number} nCorrectLevel * @return {Number} type */ - function _getTypeNumber(sText, nCorrectLevel) { + function _getTypeNumber(sText, nCorrectLevel) { var nType = 1; var length = _getUTF8Length(sText); - + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { var nLimit = 0; - + switch (nCorrectLevel) { - case QRErrorCorrectLevel.L : + case QRErrorCorrectLevel.L: nLimit = QRCodeLimitLength[i][0]; break; - case QRErrorCorrectLevel.M : + case QRErrorCorrectLevel.M: nLimit = QRCodeLimitLength[i][1]; break; - case QRErrorCorrectLevel.Q : + case QRErrorCorrectLevel.Q: nLimit = QRCodeLimitLength[i][2]; break; - case QRErrorCorrectLevel.H : + case QRErrorCorrectLevel.H: nLimit = QRCodeLimitLength[i][3]; break; } - + if (length <= nLimit) { break; } else { nType++; } } - + if (nType > QRCodeLimitLength.length) { throw new Error("Too long data"); } - + return nType; } @@ -506,7 +592,7 @@ var QRCode; var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); return replacedText.length + (replacedText.length != sText ? 3 : 0); } - + /** * @class QRCode * @constructor @@ -534,27 +620,27 @@ var QRCode; */ QRCode = function (el, vOption) { this._htOption = { - width : 256, - height : 256, - typeNumber : 4, - colorDark : "#000000", - colorLight : "#ffffff", - correctLevel : QRErrorCorrectLevel.H + width: 256, + height: 256, + typeNumber: 4, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRErrorCorrectLevel.H }; - + if (typeof vOption === 'string') { - vOption = { - text : vOption + vOption = { + text: vOption }; } - + // Overwrites options if (vOption) { for (var i in vOption) { this._htOption[i] = vOption[i]; } } - + if (typeof el == "string") { el = document.getElementById(el); } @@ -562,17 +648,17 @@ var QRCode; if (this._htOption.useSVG) { Drawing = svgDrawer; } - + this._android = _getAndroid(); this._el = el; this._oQRCode = null; this._oDrawing = new Drawing(this._el, this._htOption); - + if (this._htOption.text) { - this.makeCode(this._htOption.text); + this.makeCode(this._htOption.text); } }; - + /** * Make the QRCode * @@ -583,10 +669,10 @@ var QRCode; this._oQRCode.addData(sText); this._oQRCode.make(); this._el.title = sText; - this._oDrawing.draw(this._oQRCode); + this._oDrawing.draw(this._oQRCode); this.makeImage(); }; - + /** * Make the Image from Canvas element * - It occurs automatically @@ -599,14 +685,14 @@ var QRCode; this._oDrawing.makeImage(); } }; - + /** * Clear the QRCode */ QRCode.prototype.clear = function () { this._oDrawing.clear(); }; - + /** * @name QRCode.CorrectLevel */ diff --git a/js/qrcode.min.js b/js/qrcode.min.js index 993e88f..b7d4639 100644 --- a/js/qrcode.min.js +++ b/js/qrcode.min.js @@ -1 +1 @@ -var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j=0?p.get(q):0}}for(var r=0,m=0;mm;m++)for(var j=0;jm;m++)for(var j=0;j=0;)b^=f.G15<=0;)b^=f.G18<>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;cf;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=[''],h=0;d>h;h++){g.push("");for(var i=0;d>i;i++)g.push('');g.push("")}g.push("
"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}(); \ No newline at end of file +var QRCode; !function () { function a(a) { this.mode = c.MODE_8BIT_BYTE, this.data = a, this.parsedData = []; for (var b = [], d = 0, e = this.data.length; e > d; d++) { var f = this.data.charCodeAt(d); f > 65536 ? (b[0] = 240 | (1835008 & f) >>> 18, b[1] = 128 | (258048 & f) >>> 12, b[2] = 128 | (4032 & f) >>> 6, b[3] = 128 | 63 & f) : f > 2048 ? (b[0] = 224 | (61440 & f) >>> 12, b[1] = 128 | (4032 & f) >>> 6, b[2] = 128 | 63 & f) : f > 128 ? (b[0] = 192 | (1984 & f) >>> 6, b[1] = 128 | 63 & f) : b[0] = f, this.parsedData = this.parsedData.concat(b) } this.parsedData.length != this.data.length && (this.parsedData.unshift(191), this.parsedData.unshift(187), this.parsedData.unshift(239)) } function b(a, b) { this.typeNumber = a, this.errorCorrectLevel = b, this.modules = null, this.moduleCount = 0, this.dataCache = null, this.dataList = [] } function i(a, b) { if (void 0 == a.length) throw new Error(a.length + "/" + b); for (var c = 0; c < a.length && 0 == a[c];)c++; this.num = new Array(a.length - c + b); for (var d = 0; d < a.length - c; d++)this.num[d] = a[d + c] } function j(a, b) { this.totalCount = a, this.dataCount = b } function k() { this.buffer = [], this.length = 0 } function m() { return "undefined" != typeof CanvasRenderingContext2D } function n() { var a = !1, b = navigator.userAgent; return /android/i.test(b) && (a = !0, aMat = b.toString().match(/android ([0-9]\.[0-9])/i), aMat && aMat[1] && (a = parseFloat(aMat[1]))), a } function r(a, b) { for (var c = 1, e = s(a), f = 0, g = l.length; g >= f; f++) { var h = 0; switch (b) { case d.L: h = l[f][0]; break; case d.M: h = l[f][1]; break; case d.Q: h = l[f][2]; break; case d.H: h = l[f][3] }if (h >= e) break; c++ } if (c > l.length) throw new Error("Too long data"); return c } function s(a) { var b = encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g, "a"); return b.length + (b.length != a ? 3 : 0) } a.prototype = { getLength: function () { return this.parsedData.length }, write: function (a) { for (var b = 0, c = this.parsedData.length; c > b; b++)a.put(this.parsedData[b], 8) } }, b.prototype = { addData: function (b) { var c = new a(b); this.dataList.push(c), this.dataCache = null }, isDark: function (a, b) { if (0 > a || this.moduleCount <= a || 0 > b || this.moduleCount <= b) throw new Error(a + "," + b); return this.modules[a][b] }, getModuleCount: function () { return this.moduleCount }, make: function () { this.makeImpl(!1, this.getBestMaskPattern()) }, makeImpl: function (a, c) { this.moduleCount = 4 * this.typeNumber + 17, this.modules = new Array(this.moduleCount); for (var d = 0; d < this.moduleCount; d++) { this.modules[d] = new Array(this.moduleCount); for (var e = 0; e < this.moduleCount; e++)this.modules[d][e] = null } this.setupPositionProbePattern(0, 0), this.setupPositionProbePattern(this.moduleCount - 7, 0), this.setupPositionProbePattern(0, this.moduleCount - 7), this.setupPositionAdjustPattern(), this.setupTimingPattern(), this.setupTypeInfo(a, c), this.typeNumber >= 7 && this.setupTypeNumber(a), null == this.dataCache && (this.dataCache = b.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)), this.mapData(this.dataCache, c) }, setupPositionProbePattern: function (a, b) { for (var c = -1; 7 >= c; c++)if (!(-1 >= a + c || this.moduleCount <= a + c)) for (var d = -1; 7 >= d; d++)-1 >= b + d || this.moduleCount <= b + d || (this.modules[a + c][b + d] = c >= 0 && 6 >= c && (0 == d || 6 == d) || d >= 0 && 6 >= d && (0 == c || 6 == c) || c >= 2 && 4 >= c && d >= 2 && 4 >= d ? !0 : !1) }, getBestMaskPattern: function () { for (var a = 0, b = 0, c = 0; 8 > c; c++) { this.makeImpl(!0, c); var d = f.getLostPoint(this); (0 == c || a > d) && (a = d, b = c) } return b }, createMovieClip: function (a, b, c) { var d = a.createEmptyMovieClip(b, c), e = 1; this.make(); for (var f = 0; f < this.modules.length; f++)for (var g = f * e, h = 0; h < this.modules[f].length; h++) { var i = h * e, j = this.modules[f][h]; j && (d.beginFill(0, 100), d.moveTo(i, g), d.lineTo(i + e, g), d.lineTo(i + e, g + e), d.lineTo(i, g + e), d.endFill()) } return d }, setupTimingPattern: function () { for (var a = 8; a < this.moduleCount - 8; a++)null == this.modules[a][6] && (this.modules[a][6] = 0 == a % 2); for (var b = 8; b < this.moduleCount - 8; b++)null == this.modules[6][b] && (this.modules[6][b] = 0 == b % 2) }, setupPositionAdjustPattern: function () { for (var a = f.getPatternPosition(this.typeNumber), b = 0; b < a.length; b++)for (var c = 0; c < a.length; c++) { var d = a[b], e = a[c]; if (null == this.modules[d][e]) for (var g = -2; 2 >= g; g++)for (var h = -2; 2 >= h; h++)this.modules[d + g][e + h] = -2 == g || 2 == g || -2 == h || 2 == h || 0 == g && 0 == h ? !0 : !1 } }, setupTypeNumber: function (a) { for (var b = f.getBCHTypeNumber(this.typeNumber), c = 0; 18 > c; c++) { var d = !a && 1 == (1 & b >> c); this.modules[Math.floor(c / 3)][c % 3 + this.moduleCount - 8 - 3] = d } for (var c = 0; 18 > c; c++) { var d = !a && 1 == (1 & b >> c); this.modules[c % 3 + this.moduleCount - 8 - 3][Math.floor(c / 3)] = d } }, setupTypeInfo: function (a, b) { for (var c = this.errorCorrectLevel << 3 | b, d = f.getBCHTypeInfo(c), e = 0; 15 > e; e++) { var g = !a && 1 == (1 & d >> e); 6 > e ? this.modules[e][8] = g : 8 > e ? this.modules[e + 1][8] = g : this.modules[this.moduleCount - 15 + e][8] = g } for (var e = 0; 15 > e; e++) { var g = !a && 1 == (1 & d >> e); 8 > e ? this.modules[8][this.moduleCount - e - 1] = g : 9 > e ? this.modules[8][15 - e - 1 + 1] = g : this.modules[8][15 - e - 1] = g } this.modules[this.moduleCount - 8][8] = !a }, mapData: function (a, b) { for (var c = -1, d = this.moduleCount - 1, e = 7, g = 0, h = this.moduleCount - 1; h > 0; h -= 2)for (6 == h && h--; ;) { for (var i = 0; 2 > i; i++)if (null == this.modules[d][h - i]) { var j = !1; g < a.length && (j = 1 == (1 & a[g] >>> e)); var k = f.getMask(b, d, h - i); k && (j = !j), this.modules[d][h - i] = j, e--, -1 == e && (g++, e = 7) } if (d += c, 0 > d || this.moduleCount <= d) { d -= c, c = -c; break } } } }, b.PAD0 = 236, b.PAD1 = 17, b.createData = function (a, c, d) { for (var e = j.getRSBlocks(a, c), g = new k, h = 0; h < d.length; h++) { var i = d[h]; g.put(i.mode, 4), g.put(i.getLength(), f.getLengthInBits(i.mode, a)), i.write(g) } for (var l = 0, h = 0; h < e.length; h++)l += e[h].dataCount; if (g.getLengthInBits() > 8 * l) throw new Error("code length overflow. (" + g.getLengthInBits() + ">" + 8 * l + ")"); for (g.getLengthInBits() + 4 <= 8 * l && g.put(0, 4); 0 != g.getLengthInBits() % 8;)g.putBit(!1); for (; ;) { if (g.getLengthInBits() >= 8 * l) break; if (g.put(b.PAD0, 8), g.getLengthInBits() >= 8 * l) break; g.put(b.PAD1, 8) } return b.createBytes(g, e) }, b.createBytes = function (a, b) { for (var c = 0, d = 0, e = 0, g = new Array(b.length), h = new Array(b.length), j = 0; j < b.length; j++) { var k = b[j].dataCount, l = b[j].totalCount - k; d = Math.max(d, k), e = Math.max(e, l), g[j] = new Array(k); for (var m = 0; m < g[j].length; m++)g[j][m] = 255 & a.buffer[m + c]; c += k; var n = f.getErrorCorrectPolynomial(l), o = new i(g[j], n.getLength() - 1), p = o.mod(n); h[j] = new Array(n.getLength() - 1); for (var m = 0; m < h[j].length; m++) { var q = m + p.getLength() - h[j].length; h[j][m] = q >= 0 ? p.get(q) : 0 } } for (var r = 0, m = 0; m < b.length; m++)r += b[m].totalCount; for (var s = new Array(r), t = 0, m = 0; d > m; m++)for (var j = 0; j < b.length; j++)m < g[j].length && (s[t++] = g[j][m]); for (var m = 0; e > m; m++)for (var j = 0; j < b.length; j++)m < h[j].length && (s[t++] = h[j][m]); return s }; for (var c = { MODE_NUMBER: 1, MODE_ALPHA_NUM: 2, MODE_8BIT_BYTE: 4, MODE_KANJI: 8 }, d = { L: 1, M: 0, Q: 3, H: 2 }, e = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }, f = { PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: 1335, G18: 7973, G15_MASK: 21522, getBCHTypeInfo: function (a) { for (var b = a << 10; f.getBCHDigit(b) - f.getBCHDigit(f.G15) >= 0;)b ^= f.G15 << f.getBCHDigit(b) - f.getBCHDigit(f.G15); return (a << 10 | b) ^ f.G15_MASK }, getBCHTypeNumber: function (a) { for (var b = a << 12; f.getBCHDigit(b) - f.getBCHDigit(f.G18) >= 0;)b ^= f.G18 << f.getBCHDigit(b) - f.getBCHDigit(f.G18); return a << 12 | b }, getBCHDigit: function (a) { for (var b = 0; 0 != a;)b++, a >>>= 1; return b }, getPatternPosition: function (a) { return f.PATTERN_POSITION_TABLE[a - 1] }, getMask: function (a, b, c) { switch (a) { case e.PATTERN000: return 0 == (b + c) % 2; case e.PATTERN001: return 0 == b % 2; case e.PATTERN010: return 0 == c % 3; case e.PATTERN011: return 0 == (b + c) % 3; case e.PATTERN100: return 0 == (Math.floor(b / 2) + Math.floor(c / 3)) % 2; case e.PATTERN101: return 0 == b * c % 2 + b * c % 3; case e.PATTERN110: return 0 == (b * c % 2 + b * c % 3) % 2; case e.PATTERN111: return 0 == (b * c % 3 + (b + c) % 2) % 2; default: throw new Error("bad maskPattern:" + a) } }, getErrorCorrectPolynomial: function (a) { for (var b = new i([1], 0), c = 0; a > c; c++)b = b.multiply(new i([1, g.gexp(c)], 0)); return b }, getLengthInBits: function (a, b) { if (b >= 1 && 10 > b) switch (a) { case c.MODE_NUMBER: return 10; case c.MODE_ALPHA_NUM: return 9; case c.MODE_8BIT_BYTE: return 8; case c.MODE_KANJI: return 8; default: throw new Error("mode:" + a) } else if (27 > b) switch (a) { case c.MODE_NUMBER: return 12; case c.MODE_ALPHA_NUM: return 11; case c.MODE_8BIT_BYTE: return 16; case c.MODE_KANJI: return 10; default: throw new Error("mode:" + a) } else { if (!(41 > b)) throw new Error("type:" + b); switch (a) { case c.MODE_NUMBER: return 14; case c.MODE_ALPHA_NUM: return 13; case c.MODE_8BIT_BYTE: return 16; case c.MODE_KANJI: return 12; default: throw new Error("mode:" + a) } } }, getLostPoint: function (a) { for (var b = a.getModuleCount(), c = 0, d = 0; b > d; d++)for (var e = 0; b > e; e++) { for (var f = 0, g = a.isDark(d, e), h = -1; 1 >= h; h++)if (!(0 > d + h || d + h >= b)) for (var i = -1; 1 >= i; i++)0 > e + i || e + i >= b || (0 != h || 0 != i) && g == a.isDark(d + h, e + i) && f++; f > 5 && (c += 3 + f - 5) } for (var d = 0; b - 1 > d; d++)for (var e = 0; b - 1 > e; e++) { var j = 0; a.isDark(d, e) && j++, a.isDark(d + 1, e) && j++, a.isDark(d, e + 1) && j++, a.isDark(d + 1, e + 1) && j++, (0 == j || 4 == j) && (c += 3) } for (var d = 0; b > d; d++)for (var e = 0; b - 6 > e; e++)a.isDark(d, e) && !a.isDark(d, e + 1) && a.isDark(d, e + 2) && a.isDark(d, e + 3) && a.isDark(d, e + 4) && !a.isDark(d, e + 5) && a.isDark(d, e + 6) && (c += 40); for (var e = 0; b > e; e++)for (var d = 0; b - 6 > d; d++)a.isDark(d, e) && !a.isDark(d + 1, e) && a.isDark(d + 2, e) && a.isDark(d + 3, e) && a.isDark(d + 4, e) && !a.isDark(d + 5, e) && a.isDark(d + 6, e) && (c += 40); for (var k = 0, e = 0; b > e; e++)for (var d = 0; b > d; d++)a.isDark(d, e) && k++; var l = Math.abs(100 * k / b / b - 50) / 5; return c += 10 * l } }, g = { glog: function (a) { if (1 > a) throw new Error("glog(" + a + ")"); return g.LOG_TABLE[a] }, gexp: function (a) { for (; 0 > a;)a += 255; for (; a >= 256;)a -= 255; return g.EXP_TABLE[a] }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256) }, h = 0; 8 > h; h++)g.EXP_TABLE[h] = 1 << h; for (var h = 8; 256 > h; h++)g.EXP_TABLE[h] = g.EXP_TABLE[h - 4] ^ g.EXP_TABLE[h - 5] ^ g.EXP_TABLE[h - 6] ^ g.EXP_TABLE[h - 8]; for (var h = 0; 255 > h; h++)g.LOG_TABLE[g.EXP_TABLE[h]] = h; i.prototype = { get: function (a) { return this.num[a] }, getLength: function () { return this.num.length }, multiply: function (a) { for (var b = new Array(this.getLength() + a.getLength() - 1), c = 0; c < this.getLength(); c++)for (var d = 0; d < a.getLength(); d++)b[c + d] ^= g.gexp(g.glog(this.get(c)) + g.glog(a.get(d))); return new i(b, 0) }, mod: function (a) { if (this.getLength() - a.getLength() < 0) return this; for (var b = g.glog(this.get(0)) - g.glog(a.get(0)), c = new Array(this.getLength()), d = 0; d < this.getLength(); d++)c[d] = this.get(d); for (var d = 0; d < a.getLength(); d++)c[d] ^= g.gexp(g.glog(a.get(d)) + b); return new i(c, 0).mod(a) } }, j.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], j.getRSBlocks = function (a, b) { var c = j.getRsBlockTable(a, b); if (void 0 == c) throw new Error("bad rs block @ typeNumber:" + a + "/errorCorrectLevel:" + b); for (var d = c.length / 3, e = [], f = 0; d > f; f++)for (var g = c[3 * f + 0], h = c[3 * f + 1], i = c[3 * f + 2], k = 0; g > k; k++)e.push(new j(h, i)); return e }, j.getRsBlockTable = function (a, b) { switch (b) { case d.L: return j.RS_BLOCK_TABLE[4 * (a - 1) + 0]; case d.M: return j.RS_BLOCK_TABLE[4 * (a - 1) + 1]; case d.Q: return j.RS_BLOCK_TABLE[4 * (a - 1) + 2]; case d.H: return j.RS_BLOCK_TABLE[4 * (a - 1) + 3]; default: return void 0 } }, k.prototype = { get: function (a) { var b = Math.floor(a / 8); return 1 == (1 & this.buffer[b] >>> 7 - a % 8) }, put: function (a, b) { for (var c = 0; b > c; c++)this.putBit(1 == (1 & a >>> b - c - 1)) }, getLengthInBits: function () { return this.length }, putBit: function (a) { var b = Math.floor(this.length / 8); this.buffer.length <= b && this.buffer.push(0), a && (this.buffer[b] |= 128 >>> this.length % 8), this.length++ } }; var l = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]], o = function () { var a = function (a, b) { this._el = a, this._htOption = b }; return a.prototype.draw = function (a) { function g(a, b) { var c = document.createElementNS("http://www.w3.org/2000/svg", a); for (var d in b) b.hasOwnProperty(d) && c.setAttribute(d, b[d]); return c } var b = this._htOption, c = this._el, d = a.getModuleCount(); Math.floor(b.width / d), Math.floor(b.height / d), this.clear(); var h = g("svg", { viewBox: "0 0 " + String(d) + " " + String(d), width: "100%", height: "100%", fill: b.colorLight }); h.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"), c.appendChild(h), h.appendChild(g("rect", { fill: b.colorDark, width: "1", height: "1", id: "template" })); for (var i = 0; d > i; i++)for (var j = 0; d > j; j++)if (a.isDark(i, j)) { var k = g("use", { x: String(i), y: String(j) }); k.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template"), h.appendChild(k) } }, a.prototype.clear = function () { for (; this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild) }, a }(), p = "svg" === document.documentElement.tagName.toLowerCase(), q = p ? o : m() ? function () { function a() { this._elImage.src = this._elCanvas.toDataURL("image/png"), this._elImage.style.display = "block", this._elCanvas.style.display = "none" } function d(a, b) { var c = this; if (c._fFail = b, c._fSuccess = a, null === c._bSupportDataURI) { var d = document.createElement("img"), e = function () { c._bSupportDataURI = !1, c._fFail && _fFail.call(c) }, f = function () { c._bSupportDataURI = !0, c._fSuccess && c._fSuccess.call(c) }; return d.onabort = e, d.onerror = e, d.onload = f, d.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", void 0 } c._bSupportDataURI === !0 && c._fSuccess ? c._fSuccess.call(c) : c._bSupportDataURI === !1 && c._fFail && c._fFail.call(c) } if (this._android && this._android <= 2.1) { var b = 1 / window.devicePixelRatio, c = CanvasRenderingContext2D.prototype.drawImage; CanvasRenderingContext2D.prototype.drawImage = function (a, d, e, f, g, h, i, j) { if ("nodeName" in a && /img/i.test(a.nodeName)) for (var l = arguments.length - 1; l >= 1; l--)arguments[l] = arguments[l] * b; else "undefined" == typeof j && (arguments[1] *= b, arguments[2] *= b, arguments[3] *= b, arguments[4] *= b); c.apply(this, arguments) } } var e = function (a, b) { this._bIsPainted = !1, this._android = n(), this._htOption = b, this._elCanvas = document.createElement("canvas"), this._elCanvas.width = b.width, this._elCanvas.height = b.height, a.appendChild(this._elCanvas), this._el = a, this._oContext = this._elCanvas.getContext("2d"), this._bIsPainted = !1, this._elImage = document.createElement("img"), this._elImage.style.display = "none", this._el.appendChild(this._elImage), this._bSupportDataURI = null }; return e.prototype.draw = function (a) { var b = this._elImage, c = this._oContext, d = this._htOption, e = a.getModuleCount(), f = d.width / e, g = d.height / e, h = Math.round(f), i = Math.round(g); b.style.display = "none", this.clear(); for (var j = 0; e > j; j++)for (var k = 0; e > k; k++) { var l = a.isDark(j, k), m = k * f, n = j * g; c.strokeStyle = l ? d.colorDark : d.colorLight, c.lineWidth = 1, c.fillStyle = l ? d.colorDark : d.colorLight, c.fillRect(m, n, f, g), c.strokeRect(Math.floor(m) + .5, Math.floor(n) + .5, h, i), c.strokeRect(Math.ceil(m) - .5, Math.ceil(n) - .5, h, i) } this._bIsPainted = !0 }, e.prototype.makeImage = function () { this._bIsPainted && d.call(this, a) }, e.prototype.isPainted = function () { return this._bIsPainted }, e.prototype.clear = function () { this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height), this._bIsPainted = !1 }, e.prototype.round = function (a) { return a ? Math.floor(1e3 * a) / 1e3 : a }, e }() : function () { var a = function (a, b) { this._el = a, this._htOption = b }; return a.prototype.draw = function (a) { for (var b = this._htOption, c = this._el, d = a.getModuleCount(), e = Math.floor(b.width / d), f = Math.floor(b.height / d), g = [''], h = 0; d > h; h++) { g.push(""); for (var i = 0; d > i; i++)g.push(''); g.push("") } g.push("
"), c.innerHTML = g.join(""); var j = c.childNodes[0], k = (b.width - j.offsetWidth) / 2, l = (b.height - j.offsetHeight) / 2; k > 0 && l > 0 && (j.style.margin = l + "px " + k + "px") }, a.prototype.clear = function () { this._el.innerHTML = "" }, a }(); QRCode = function (a, b) { if (this._htOption = { width: 256, height: 256, typeNumber: 4, colorDark: "#000000", colorLight: "#ffffff", correctLevel: d.H }, "string" == typeof b && (b = { text: b }), b) for (var c in b) this._htOption[c] = b[c]; "string" == typeof a && (a = document.getElementById(a)), this._android = n(), this._el = a, this._oQRCode = null, this._oDrawing = new q(this._el, this._htOption), this._htOption.text && this.makeCode(this._htOption.text) }, QRCode.prototype.makeCode = function (a) { this._oQRCode = new b(r(a, this._htOption.correctLevel), this._htOption.correctLevel), this._oQRCode.addData(a), this._oQRCode.make(), this._el.title = a, this._oDrawing.draw(this._oQRCode), this.makeImage() }, QRCode.prototype.makeImage = function () { "function" == typeof this._oDrawing.makeImage && (!this._android || this._android >= 3) && this._oDrawing.makeImage() }, QRCode.prototype.clear = function () { this._oDrawing.clear() }, QRCode.CorrectLevel = d }(); \ No newline at end of file diff --git a/js/test-manf.js b/js/test-manf.js index 790a8a8..d9dc431 100644 --- a/js/test-manf.js +++ b/js/test-manf.js @@ -1,4 +1,4 @@ -testManufObj={ +testManufObj = { "valueSetId": "covid-19-lab-test-manufacturer-and-name", "valueSetDate": "2021-05-27", "valueSetValues": { diff --git a/js/test-result.js b/js/test-result.js index afbcfcd..4e21315 100644 --- a/js/test-result.js +++ b/js/test-result.js @@ -1,4 +1,4 @@ -testResultObj={ +testResultObj = { "valueSetId": "covid-19-lab-result", "valueSetDate": "2021-04-27", "valueSetValues": { diff --git a/js/test-type.js b/js/test-type.js index 8b7cac9..bc20c43 100644 --- a/js/test-type.js +++ b/js/test-type.js @@ -1,4 +1,4 @@ -testTypeObj={ +testTypeObj = { "valueSetId": "covid-19-lab-test-type", "valueSetDate": "2021-04-27", "valueSetValues": { diff --git a/js/vaccine-mah-manf.js b/js/vaccine-mah-manf.js index ec8d101..a66458d 100644 --- a/js/vaccine-mah-manf.js +++ b/js/vaccine-mah-manf.js @@ -1,4 +1,4 @@ -manufacturer={ +manufacturer = { "valueSetId": "vaccines-covid-19-auth-holders", "valueSetDate": "2021-04-27", "valueSetValues": { diff --git a/js/vaccine-medicinal-product.js b/js/vaccine-medicinal-product.js index eeab8ad..dcfb0d4 100644 --- a/js/vaccine-medicinal-product.js +++ b/js/vaccine-medicinal-product.js @@ -1,4 +1,4 @@ -product={ +product = { "valueSetId": "vaccines-covid-19-names", "valueSetDate": "2021-04-27", "valueSetValues": { diff --git a/js/vaccine-prophylaxis.js b/js/vaccine-prophylaxis.js index e986845..96e6ac3 100644 --- a/js/vaccine-prophylaxis.js +++ b/js/vaccine-prophylaxis.js @@ -1,4 +1,4 @@ -prophylaxis={ +prophylaxis = { "valueSetId": "sct-vaccines-covid-19", "valueSetDate": "2021-04-27", "valueSetValues": {