1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(e.s=7)}([function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.bytes=[];for(var r=0;r<e.length;++r)this.bytes.push(e.charCodeAt(r));this.string=e.substring(1),this.encodings=[740,644,638,176,164,100,224,220,124,608,604,572,436,244,230,484,260,254,650,628,614,764,652,902,868,836,830,892,844,842,752,734,590,304,112,94,416,128,122,672,576,570,464,422,134,496,478,142,910,678,582,768,762,774,880,862,814,896,890,818,914,602,930,328,292,200,158,68,62,424,412,232,218,76,74,554,616,978,556,146,340,212,182,508,268,266,956,940,938,758,782,974,400,310,118,512,506,960,954,502,518,886,966,668,680,692,5379]}return t.prototype.encode=function(){var t,e=this.bytes,n=e.shift()-105;return 103===n?t=this.nextA(e,1):104===n?t=this.nextB(e,1):105===n&&(t=this.nextC(e,1)),{text:this.string.replace(/[^\x20-\x7E]/g,""),data:this.getEncoding(n)+t.result+this.getEncoding((t.checksum+n)%103)+this.getEncoding(106)}},t.prototype.getEncoding=function(t){return this.encodings[t]?(this.encodings[t]+1e3).toString(2):""},t.prototype.valid=function(){return-1!==this.string.search(/^[\x00-\x7F\xC8-\xD3]+$/)},t.prototype.nextA=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;if(t[0]>=200)r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):100===r?n=this.nextB(t,e+1):98===r?(t[0]=t[0]>95?t[0]-96:t[0],n=this.nextA(t,e+1)):n=this.nextA(t,e+1);else{var i=t[0];r=32>i?i+64:i-32,t.shift(),n=this.nextA(t,e+1)}var o=this.getEncoding(r),a=r*e;return{result:o+n.result,checksum:a+n.checksum}},t.prototype.nextB=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):101===r?n=this.nextA(t,e+1):98===r?(t[0]=t[0]<32?t[0]+96:t[0],n=this.nextB(t,e+1)):n=this.nextB(t,e+1)):(r=t[0]-32,t.shift(),n=this.nextB(t,e+1));var i=this.getEncoding(r),o=r*e;return{result:i+n.result,checksum:o+n.checksum}},t.prototype.nextC=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),n=100===r?this.nextB(t,e+1):101===r?this.nextA(t,e+1):this.nextC(t,e+1)):(r=10*(t[0]-48)+t[1]-48,t.shift(),t.shift(),n=this.nextC(t,e+1));var i=this.getEncoding(r),o=r*e;return{result:i+n.result,checksum:o+n.checksum}},t}();e["default"]=r},function(t,e){"use strict";function n(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);for(n in e)e.hasOwnProperty(n)&&"undefined"!=typeof e[n]&&(r[n]=e[n]);return r}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(12);e["default"]={CODE128:r.CODE128,CODE128A:r.CODE128A,CODE128B:r.CODE128B,CODE128C:r.CODE128C}},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){var n={};for(var r in e)t.hasAttribute("jsbarcode-"+r.toLowerCase())&&(n[r]=t.getAttribute("jsbarcode-"+r.toLowerCase())),t.hasAttribute("data-"+r.toLowerCase())&&(n[r]=t.getAttribute("data-"+r.toLowerCase()));return n.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),n=(0,a["default"])(n)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(13),a=r(o);e["default"]=i},function(t,e){"use strict";function n(t){function e(t){if(Array.isArray(t))for(var r=0;r<t.length;r++)e(t[r]);else t.text=t.text||"",t.data=t.data||"",n.push(t)}var n=[];return e(t),n}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(14),o=r(i),a=n(15),u=r(a);e["default"]={canvas:o["default"],svg:u["default"]}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){b.prototype[e]=b.prototype[e.toUpperCase()]=b.prototype[e.toLowerCase()]=function(n,r){var i=(0,p["default"])(this._options,r),a=t[e],u=o(n,a,i);return this._encodings.push(u),this}}function o(t,e,n){var r=new e(t,n);if(!r.valid()){if(n.valid===O.valid)throw new Error('"'+t+'" is not a valid input for '+_);n.valid(!1)}var i=r.encode();i=(0,x["default"])(i);for(var o=0;o<i.length;o++)i[o].options=(0,p["default"])(n,i[o].options);return i}function a(){return l["default"].CODE128?"CODE128":Object.keys(l["default"])[0]}function u(t,e,n){var r=d["default"][t.renderer];e=(0,x["default"])(e);for(var i=0;i<e.length;i++)e[i].options=(0,p["default"])(n,e[i].options),(0,m["default"])(e[i].options);(0,m["default"])(n),r(t.element,e,n),t.afterRender&&t.afterRender()}function s(t){if("string"==typeof t){var e=document.querySelectorAll(t);if(0===e.length)throw new Error("No element found");for(var n=[],r=0;r<e.length;r++)n.push(s(e[r]));return n}if(Array.isArray(t)){for(var n=[],r=0;r<t.length;r++)n.push(s(t[r]));return n}if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLImageElement){var i=document.createElement("canvas");return{element:i,options:(0,C["default"])(t,O),renderer:"canvas",afterRender:function(){t.setAttribute("src",i.toDataURL())}}}if("undefined"!=typeof SVGElement&&t instanceof SVGElement)return{element:t,options:(0,C["default"])(t,O),renderer:"svg"};if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)return{element:t,options:(0,C["default"])(t,O),renderer:"canvas"};if(t.getContext)return{element:t,renderer:"canvas"};throw new Error("Not supported type to render on.")}var f=n(2),l=r(f),c=n(6),d=r(c),h=n(1),p=r(h),g=n(5),x=r(g),v=n(3),m=r(v),y=n(4),C=r(y),b=function(){},w=function(t,e,n){var r=new b;if("undefined"==typeof t)throw Error("No element to render on was provided.");return r._renderProperties=s(t),r._encodings=[],r._options=O,"undefined"!=typeof e&&(n=n||{},n.format||(n.format=a()),r.options(n),r[n.format](e,n),r.render()),r};w.getModule=function(t){return l["default"][t]};for(var _ in l["default"])l["default"].hasOwnProperty(_)&&i(l["default"],_);b.prototype.options=function(t){return this._options=(0,p["default"])(this._options,t),this},b.prototype.blank=function(t){var e="0".repeat(t);return this._encodings.push({data:e}),this},b.prototype.init=function(){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var t;for(var e in this._renderProperties){t=this._renderProperties[e];var n=(0,p["default"])(this._options,t.options);"auto"==n.format&&(n.format=a());var r=n.value,i=l["default"][n.format.toUpperCase()],s=o(r,i,n);u(t,s,n)}},b.prototype.render=function(){if(Array.isArray(this._renderProperties))for(var t in this._renderProperties)u(this._renderProperties[t],this._encodings,this._options);else u(this._renderProperties,this._encodings,this._options);return this._options.valid(!0),this},"undefined"!=typeof window&&(window.JsBarcode=w),"undefined"!=typeof jQuery&&(jQuery.fn.JsBarcode=function(t,e){var n=[];return jQuery(this).each(function(){n.push(this)}),w(n,t,e)}),t.exports=w;var O={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(t){}}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),s=r(u),f=function(t){function e(n){return i(this,e),o(this,t.call(this,String.fromCharCode(208)+n))}return a(e,t),e.prototype.valid=function(){return-1!==this.string.search(/^[\x00-\x5F\xC8-\xCF]+$/)},e}(s["default"]);e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),s=r(u),f=function(t){function e(n){return i(this,e),o(this,t.call(this,String.fromCharCode(209)+n))}return a(e,t),e.prototype.valid=function(){return-1!==this.string.search(/^[\x20-\x7F\xC8-\xCF]+$/)},e}(s["default"]);e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),s=r(u),f=function(t){function e(n){return i(this,e),o(this,t.call(this,String.fromCharCode(210)+n))}return a(e,t),e.prototype.valid=function(){return-1!==this.string.search(/^(\xCF*[0-9]{2}\xCF*)+$/)},e}(s["default"]);e["default"]=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e,n=t.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length,r=t.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length,i=t.match(/^(\xCF*[0-9]{2}\xCF*)*/)[0].length;return e=i>=2?String.fromCharCode(210)+l(t):n>r?String.fromCharCode(208)+s(t):String.fromCharCode(209)+f(t),e=e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(t,e){return String.fromCharCode(203)+e})}function s(t){var e=t.match(/^([\x00-\x5F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+l(t.substring(e[1].length));var n=t.match(/^[\x00-\x5F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(205)+f(t.substring(n[0].length))}function f(t){var e=t.match(/^([\x20-\x7F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+l(t.substring(e[1].length));var n=t.match(/^[\x20-\x7F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(206)+s(t.substring(n[0].length))}function l(t){var e=t.match(/^(\xCF*[0-9]{2}\xCF*)+/)[0],n=e.length;if(n===t.length)return t;t=t.substring(n);var r=t.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length,i=t.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length;return r>=i?e+String.fromCharCode(206)+s(t):e+String.fromCharCode(205)+f(t)}Object.defineProperty(e,"__esModule",{value:!0});var c=n(0),d=r(c),h=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));if(-1!==n.search(/^[\x00-\x7F\xC8-\xD3]+$/))var r=o(this,t.call(this,u(n)));else var r=o(this,t.call(this,n));return o(r)}return a(e,t),e}(d["default"]);e["default"]=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var i=n(11),o=r(i),a=n(8),u=r(a),s=n(9),f=r(s),l=n(10),c=r(l);e.CODE128=o["default"],e.CODE128A=u["default"],e.CODE128B=f["default"],e.CODE128C=c["default"]},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginLeft","marginBottom","marginLeft","marginRight"];for(var n in e)n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e,n){if(!t.getContext)throw new Error("The browser does not support canvas.");o(t,n,e);for(var r=0;r<e.length;r++){var i=(0,c["default"])(n,e[r].options);a(t,i,e[r]),u(t,i,e[r]),s(t,e[r])}f(t)}function o(t,e,n){var r=t.getContext("2d");r.save();for(var i=0,o=0,a=0;a<n.length;a++){var u=(0,c["default"])(u,n[a].options);r.font=u.fontOptions+" "+u.fontSize+"px "+u.font;var s=r.measureText(n[a].text).width,f=n[a].data.length*u.width;n[a].width=Math.ceil(Math.max(s,f));var l=u.height+(u.displayValue&&n[a].text.length>0?u.fontSize:0)+u.textMargin+u.marginTop+u.marginBottom,d=0;u.displayValue&&s>f&&("center"==u.textAlign?d=Math.floor((s-f)/2):"left"==u.textAlign?d=0:"right"==u.textAlign&&(d=Math.floor(s-f))),n[a].barcodePadding=d,l>o&&(o=l),i+=n[a].width}t.width=i+e.marginLeft+e.marginRight,t.height=o,r.clearRect(0,0,t.width,t.height),e.background&&(r.fillStyle=e.background,r.fillRect(0,0,t.width,t.height)),r.translate(e.marginLeft,0)}function a(t,e,n){var r,i,o=t.getContext("2d"),a=n.data;r="top"==e.textPosition?e.marginTop+e.fontSize+e.textMargin:e.marginTop,i=e.height,o.fillStyle=e.lineColor;for(var u=0;u<a.length;u++){var s=u*e.width+n.barcodePadding;"1"===a[u]?o.fillRect(s,r,e.width,e.height):a[u]&&o.fillRect(s,r,e.width,e.height*a[u])}}function u(t,e,n){var r=t.getContext("2d"),i=e.fontOptions+" "+e.fontSize+"px "+e.font;if(e.displayValue){var o,a;a="top"==e.textPosition?e.marginTop+e.fontSize-e.textMargin:e.height+e.textMargin+e.marginTop+e.fontSize,r.font=i,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.textAlign="left"):"right"==e.textAlign?(o=n.width-1,r.textAlign="right"):(o=n.width/2,r.textAlign="center"),r.fillText(n.text,o,a)}}function s(t,e){var n=t.getContext("2d");n.translate(e.width,0)}function f(t){var e=t.getContext("2d");e.restore()}Object.defineProperty(e,"__esModule",{value:!0});var l=n(1),c=r(l);e["default"]=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e,n){var r=n.marginLeft;o(t,n,e);for(var i=0;i<e.length;i++){var s=(0,h["default"])(n,e[i].options),c=f(r,s.marginTop,t);l(c,s,e[i]),a(c,s,e[i]),u(c,s,e[i]),r+=e[i].width}}function o(t,e,n){for(;t.firstChild;)t.removeChild(t.firstChild);for(var r=0,i=0,o=0;o<n.length;o++){var a=(0,h["default"])(a,n[o].options),u=s(n[o].text,t,a),f=n[o].data.length*a.width;n[o].width=Math.ceil(Math.max(u,f));var l=a.height+(a.displayValue&&n[o].text.length>0?a.fontSize:0)+a.textMargin+a.marginTop+a.marginBottom,c=0;a.displayValue&&u>f&&("center"==a.textAlign?c=Math.floor((u-f)/2):"left"==a.textAlign?c=0:"right"==a.textAlign&&(c=Math.floor(u-f))),n[o].barcodePadding=c,l>i&&(i=l),r+=n[o].width}var d=r+e.marginLeft+e.marginRight,g=i;t.setAttribute("width",d+"px"),t.setAttribute("height",g+"px"),t.setAttribute("x","0px"),t.setAttribute("y","0px"),t.setAttribute("viewBox","0 0 "+d+" "+g),t.setAttribute("xmlns",p),t.setAttribute("version","1.1"),e.background&&(t.style.background=e.background)}function a(t,e,n){var r,i,o=n.data;r="top"==e.textPosition?e.fontSize+e.textMargin:0,i=e.height;for(var a=0,u=0;u<o.length;u++){var s=u*e.width+n.barcodePadding;"1"===o[u]?a++:a>0&&(c(s-e.width*a,r,e.width*a,e.height,t),a=0)}a>0&&c(s-e.width*(a-1),r,e.width*a,e.height,t)}function u(t,e,n){var r=document.createElementNS(p,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}}function s(t,e,n){var r=document.createElement("canvas").getContext("2d");r.font=n.fontOptions+" "+n.fontSize+"px "+n.font;var i=r.measureText(t).width;return i}function f(t,e,n){var r=document.createElementNS(p,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function l(t,e,n){t.setAttribute("style","fill:"+e.lineColor+";")}function c(t,e,n,r,i){var o=document.createElementNS(p,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var d=n(1),h=r(d);e["default"]=i;var p="http://www.w3.org/2000/svg"}]); |