You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qrcode-decoder/index.min.js

2 lines
132 KiB
JavaScript

4 years ago
var QrcodeDecoder=function(){"use strict";var n=function(){return(n=Object.assign||function(e){for(var o,r=1,t=arguments.length;r<t;r++)for(var s in o=arguments[r])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e}).apply(this,arguments)};function a(e,n,a,d){return new(a=a||Promise)(function(r,o){function t(e){try{c(d.next(e))}catch(e){o(e)}}function s(e){try{c(d.throw(e))}catch(e){o(e)}}function c(e){var o;e.done?r(e.value):((o=e.value)instanceof a?o:new a(function(e){e(o)})).then(t,s)}c((d=d.apply(e,n||[])).next())})}function d(r,t){var s,c,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},e={next:o(0),throw:o(1),return:o(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function o(o){return function(e){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,c&&(n=2&o[0]?c.return:o[0]?c.throw||((n=c.return)&&n.call(c),0):c.next)&&!(n=n.call(c,o[1])).done)return n;switch(c=0,(o=n?[2&o[0],n.value]:o)[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,c=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=0<(n=a.trys).length&&n[n.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(r,a)}catch(e){o=[6,e],c=0}finally{s=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,e])}}}var e,o,r=(function(e){var o;o=function(){return s={},t.m=r=[function(e,o,r){Object.defineProperty(o,"__esModule",{value:!0});var t=(s.createEmpty=function(e,o){return new s(new Uint8ClampedArray(e*o),e)},s.prototype.get=function(e,o){return!(e<0||e>=this.width||o<0||o>=this.height)&&!!this.data[o*this.width+e]},s.prototype.set=function(e,o,r){this.data[o*this.width+e]=r?1:0},s.prototype.setRegion=function(e,o,r,t,s){for(var c=o;c<o+t;c++)for(var n=e;n<e+r;n++)this.set(n,c,!!s)},s);function s(e,o){this.width=o,this.height=e.length/o,this.data=e}o.BitMatrix=t},function(e,o,r){Object.defineProperty(o,"__esModule",{value:!0});var c=r(2);o.addOrSubtractGF=function(e,o){return e^o};t.prototype.multiply=function(e,o){return 0===e||0===o?0:this.expTable[(this.logTable[e]+this.logTable[o])%(this.size-1)]},t.prototype.inverse=function(e){if(0===e)throw new Error("Can't invert 0");return this.expTable[this.size-this.logTable[e]-1]},t.prototype.buildMonomial=function(e,o){if(e<0)throw new Error("Invalid monomial degree less than 0");if(0===o)return this.zero;e=new Uint8ClampedArray(e+1);return e[0]=o,new c.default(this,e)},t.prototype.log=function(e){if(0===e)throw new Error("Can't take log(0)");return this.logTable[e]},t.prototype.exp=function(e){return this.expTable[e]},r=t;function t(e,o,r){this.primitive=e,this.size=o,this.generatorBase=r,this.expTable=new Array(this.size),this.logTable=new Array(this.size);for(var t=1,s=0;s<this.size;s++)this.expTable[s]=t,(t*=2)>=this.size&&(t=(t^this.primitive)&this.size-1);for(s=0;s<this.size-1;s++)this.logTable[this.expTable[s]]=s;this.zero=new c.default(this,Uint8ClampedArray.from([0])),this.one=new c.default(this,Uint8ClampedArray.from([1]))}o.default=r},function(e,o,r){Object.defineProperty(o,"__esModule",{value:!0});var l=r(1),r=(i.prototype.degree=function(){return this.coefficients.length-1},i.prototype.isZero=function(){return 0===this.coefficients[0]},i.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},i.prototype.addOrSubtract=function(e){if(this.isZero())return e;if(e.isZero())return this;var o=this.coefficients,r=e.coefficients;o.length>r.length&&(o=(e=[r,o])[0],r=e[1]);for(var t=new Uint8ClampedArray(r.length),s=r.length-o.length,c=0;c<s;c++)t[c]=r[c];for(c=s;c<r.length;c++)t[c]=l.addOrSubtractGF(o[c-s],r[c]);return new i(this.field,t)},i.prototype.multiply=function(e){if(0===e)return this.field.zero;if(1===e)return this;for(var o=this.coefficients.length,r=new Uint8Cl