UNPKG

@runfoodapp/template-based-document-generator

Version:

Sitio diseñado para trabajar dentro de un `iframe` que recibe plantillas y datos, las procesa y las convierte a imagen o comandos POS

1 lines 58.3 kB
!function(e){function t(t){for(var n,f,_=t[0],E=t[1],C=t[2],s=0,m=[];s<_.length;s++)f=_[s],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&m.push(o[f][0]),o[f]=0;for(n in E)Object.prototype.hasOwnProperty.call(E,n)&&(e[n]=E[n]);for(a&&a(t);m.length;)m.shift()();return i.push.apply(i,C||[]),r()}function r(){for(var e,t=0;t<i.length;t++){for(var r=i[t],n=!0,_=1;_<r.length;_++){var E=r[_];0!==o[E]&&(n=!1)}n&&(i.splice(t--,1),e=f(f.s=r[0]))}return e}var n={},o={0:0},i=[];function f(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=e,f.c=n,f.d=function(e,t,r){f.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,t){if(1&t&&(e=f(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(f.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)f.d(r,n,function(t){return e[t]}.bind(null,n));return r},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,"a",t),t},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.p="";var _=window.webpackJsonp=window.webpackJsonp||[],E=_.push.bind(_);_.push=t,_=_.slice();for(var C=0;C<_.length;C++)t(_[C]);var a=E;i.push([17,1]),r()}([,,,function(e,t,r){"use strict";e.exports=class{constructor(){this.config={}}beep(e=1,t=1){return console.error(new Error("'beep' not implemented yet")),null}printImageBuffer(e,t,r){return console.error(new Error("'printImageBuffer' not implemented yet")),null}}},,,,,function(e,t,r){"use strict";var n=r(5),o=r.n(n),i=r(6),f=r.n(i)()(o.a);f.push([e.i,":root{\n --document-font-size: 16px;\n --document-width: 600px;\n --html-print-scale: 1;\n}\nhtml,body{\n margin: 0px;\n padding: 0px;\n width: var(--document-width);\n height: auto;\n overflow: hidden;\n}\n\nhtml{\n font-size: var(--document-font-size);\n}\n\n#template_target{\n max-width: var(--document-width);\n min-width: var(--document-width);\n width: var(--document-width);\n}\n\n@media print {\n html,body{\n max-width: var(--document-width);\n min-width: var(--document-width);\n width: var(--document-width);\n overflow: hidden;\n }\n @page{\n margin:0px;\n }\n body{\n transform:scale( var(--html-print-scale) );\n }\n}\n","",{version:3,sources:["webpack://./src/index.css"],names:[],mappings:"AAAA;IACI,0BAA0B;IAC1B,uBAAuB;IACvB,qBAAqB;AACzB;AACA;IACI,WAAW;IACX,YAAY;IACZ,4BAA4B;IAC5B,YAAY;IACZ,gBAAgB;AACpB;;AAEA;IACI,oCAAoC;AACxC;;AAEA;IACI,gCAAgC;IAChC,gCAAgC;IAChC,4BAA4B;AAChC;;AAEA;IACI;QACI,gCAAgC;QAChC,gCAAgC;QAChC,4BAA4B;QAC5B,gBAAgB;IACpB;IACA;QACI,UAAU;IACd;IACA;QACI,0CAA0C;IAC9C;AACJ",sourcesContent:[":root{\n --document-font-size: 16px;\n --document-width: 600px;\n --html-print-scale: 1;\n}\nhtml,body{\n margin: 0px;\n padding: 0px;\n width: var(--document-width);\n height: auto;\n overflow: hidden;\n}\n\nhtml{\n font-size: var(--document-font-size);\n}\n\n#template_target{\n max-width: var(--document-width);\n min-width: var(--document-width);\n width: var(--document-width);\n}\n\n@media print {\n html,body{\n max-width: var(--document-width);\n min-width: var(--document-width);\n width: var(--document-width);\n overflow: hidden;\n }\n @page{\n margin:0px;\n }\n body{\n transform:scale( var(--html-print-scale) );\n }\n}\n"],sourceRoot:""}]),t.a=f},function(e,t,r){"use strict";var n=r(5),o=r.n(n),i=r(6),f=r.n(i)()(o.a);f.push([e.i,'*{\n font-family: Raleway Arial, Helvetica, sans-serif;\n margin: 0px;\n padding: 0px;\n}\n\ntable {\n width: 100%;\n border-width:0px;\n border:0px;\n}\n\nhr {\n margin-top: calc( var(--document-font-size) / 2);\n margin-top: 0.5em;\n margin-bottom: calc( var(--document-font-size) / 2);\n margin-bottom: 0.5em;\n}\n\nol,ul {\n padding-left: var(--document-font-size);\n padding-left: 1.7em;\n}\n\ntd,\nth {\n vertical-align: baseline;\n}\n\n\n\n/** HELPERS **/\n.right {\n text-align: right;\n}\n.left {\n text-align: left;\n}\n.center { \n text-align: center;\n}\n.uppercase{\n text-transform: uppercase;\n}\n\n\n\n\n\n/** componentes UI predefinidos **/\ntable.table-bordered { \n border-collapse: collapse;\n}\n \ntable.table-bordered td, \ntable.table-bordered th {\n border: 1px solid black;\n}\n\ntable.table-striped {\n width: 100%;\n border-collapse: collapse;\n }\n \ntable.table-striped th, \ntable.table-striped td {\n border: 1px solid black;\n padding: 8px;\n text-align: left;\n}\n\ntable.table-striped tbody tr:nth-child(even) {\n background-color: #f2f2f2;\n}\n\n\n\n.barcode-128{\n position: relative; \n font-size:2em;\n display:block;\n}\n.barcode-128::before {\n content: attr(data-text);\n font-family: "Libre Barcode 128", system-ui;\n font-weight: 400;\n font-style: normal;\n transform: scale(1.3);\n font-size:inherit;\n white-space: nowrap;\n}\n.barcode-128.legend::after {\n content: attr(data-text);\n display: block; /* Hacemos que el contenido generado sea un bloque */\n font-size: 0.4em; /* Tamaño de fuente más pequeño para simular un elemento <small> */\n color: gray; /* Color de texto opcional para diferenciarlo */\n text-align: center;\n position: absolute;\n top: calc(2.1em + 10px);\n width:100%;\n}\n\n',"",{version:3,sources:["webpack://./src/component-styles.css"],names:[],mappings:"AAAA;IACI,iDAAiD;IACjD,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,WAAW;IACX,gBAAgB;IAChB,UAAU;AACd;;AAEA;IACI,gDAAgD;IAChD,iBAAiB;IACjB,mDAAmD;IACnD,oBAAoB;AACxB;;AAEA;IACI,uCAAuC;IACvC,mBAAmB;AACvB;;AAEA;;EAEE,wBAAwB;AAC1B;;;;AAIA,cAAc;AACd;IACI,iBAAiB;AACrB;AACA;IACI,gBAAgB;AACpB;AACA;IACI,kBAAkB;AACtB;AACA;IACI,yBAAyB;AAC7B;;;;;;AAMA,kCAAkC;AAClC;IACI,yBAAyB;AAC7B;;AAEA;;IAEI,uBAAuB;AAC3B;;AAEA;IACI,WAAW;IACX,yBAAyB;EAC3B;;AAEF;;EAEE,uBAAuB;EACvB,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,yBAAyB;AAC3B;;;;AAIA;IACI,kBAAkB;IAClB,aAAa;IACb,aAAa;AACjB;AACA;IACI,wBAAwB;IACxB,2CAA2C;IAC3C,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,iBAAiB;IACjB,mBAAmB;AACvB;AACA;EACE,wBAAwB;EACxB,cAAc,EAAE,oDAAoD;EACpE,gBAAgB,EAAE,kEAAkE;EACpF,WAAW,EAAE,+CAA+C;EAC5D,kBAAkB;EAClB,kBAAkB;EAClB,uBAAuB;EACvB,UAAU;AACZ",sourcesContent:['*{\n font-family: Raleway Arial, Helvetica, sans-serif;\n margin: 0px;\n padding: 0px;\n}\n\ntable {\n width: 100%;\n border-width:0px;\n border:0px;\n}\n\nhr {\n margin-top: calc( var(--document-font-size) / 2);\n margin-top: 0.5em;\n margin-bottom: calc( var(--document-font-size) / 2);\n margin-bottom: 0.5em;\n}\n\nol,ul {\n padding-left: var(--document-font-size);\n padding-left: 1.7em;\n}\n\ntd,\nth {\n vertical-align: baseline;\n}\n\n\n\n/** HELPERS **/\n.right {\n text-align: right;\n}\n.left {\n text-align: left;\n}\n.center { \n text-align: center;\n}\n.uppercase{\n text-transform: uppercase;\n}\n\n\n\n\n\n/** componentes UI predefinidos **/\ntable.table-bordered { \n border-collapse: collapse;\n}\n \ntable.table-bordered td, \ntable.table-bordered th {\n border: 1px solid black;\n}\n\ntable.table-striped {\n width: 100%;\n border-collapse: collapse;\n }\n \ntable.table-striped th, \ntable.table-striped td {\n border: 1px solid black;\n padding: 8px;\n text-align: left;\n}\n\ntable.table-striped tbody tr:nth-child(even) {\n background-color: #f2f2f2;\n}\n\n\n\n.barcode-128{\n position: relative; \n font-size:2em;\n display:block;\n}\n.barcode-128::before {\n content: attr(data-text);\n font-family: "Libre Barcode 128", system-ui;\n font-weight: 400;\n font-style: normal;\n transform: scale(1.3);\n font-size:inherit;\n white-space: nowrap;\n}\n.barcode-128.legend::after {\n content: attr(data-text);\n display: block; /* Hacemos que el contenido generado sea un bloque */\n font-size: 0.4em; /* Tamaño de fuente más pequeño para simular un elemento <small> */\n color: gray; /* Color de texto opcional para diferenciarlo */\n text-align: center;\n position: absolute;\n top: calc(2.1em + 10px);\n width:100%;\n}\n\n'],sourceRoot:""}]),t.a=f},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function f(e){try{E(n.next(e))}catch(e){i(e)}}function _(e){try{E(n.throw(e))}catch(e){i(e)}}function E(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(f,_)}E((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentToImage=function(e,t){return n(this,void 0,void 0,(function*(){const r=document.getElementById(window.TEMPLATE_TARGET_ID);if(!r)throw new Error("No se encontró el elemento para renderizar el documento");if(!r.dataset.renderedAt)throw new Error("Primero ejecute la acción `RENDER antes de ejecutar esta nueva acción");const n=yield html2canvas(r,{backgroundColor:"#fff",scale:e.imageScale||1});if(!["base64","buffer"].includes(t))throw new RangeError(`Export image type '${t}' is not allowed`);if(e.grayscale){const e=n.getContext("2d"),t=e.getImageData(0,0,n.width,n.height),r=t.data;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}e.putImageData(t,0,0)}if("base64"===t)return n.toDataURL("image/png");if("buffer"===t){return n.getContext("2d").getImageData(0,0,n.width,n.height).data.buffer}}))},t.DocumentToChunkImages=function(e){return n(this,arguments,void 0,(function*(e,t=900){const r=document.getElementById(window.TEMPLATE_TARGET_ID);if(!r)throw new Error("No se encontró el elemento para renderizar el documento");if(!r.dataset.renderedAt)throw new Error("Primero ejecute la acción `RENDER antes de ejecutar esta nueva acción");const n=new URLSearchParams(location.search);return html2canvas(r,{backgroundColor:"#fff",scale:e.imageScale||1,allowTaint:"1"==n.get("html2canvas.allowTaint"),useCORS:"0"!=n.get("html2canvas.useCORS")}).then(e=>{const r=e.height,n=Math.ceil(r/t),o=[];for(let i=0;i<n;i++){const n=document.createElement("canvas"),f=n.getContext("2d"),_=i*t;n.width=e.width,n.height=Math.min(t,r-_),f.drawImage(e,0,_,e.width,n.height,0,0,e.width,n.height);const E=f.getImageData(0,0,n.width,n.height);o.push(E)}return o})}))}},,,,,,,function(e,t,r){"use strict";var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=this&&this.__importStar||(n=function(e){return(n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),f=0;f<r.length;f++)"default"!==r[f]&&o(t,e,r[f]);return i(t,e),t}),_=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function f(e){try{E(n.next(e))}catch(e){i(e)}}function _(e){try{E(n.throw(e))}catch(e){i(e)}}function E(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(f,_)}E((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),r(18),r(19);const E=r(20),C=r(21),a=r(35),s=r(36);function m(){return window.threadId}function A(e){if(window.parent==window)return;const t={type:"READY",source:"@runfoodapp/template-based-document-generator",threadId:m()};e&&(t.type+="INITIALIZATION_ERROR"),window.parent.postMessage(t,"*")}function h(e,t){window.addEventListener("message",(function(r){const n=r.data;n.type===e&&t(n.payload).then(t=>{var n;null===(n=r.source)||void 0===n||n.postMessage({type:e+".COMPLETED",payload:t,source:"@runfoodapp/template-based-document-generator",threadId:m()},"*")}).catch(t=>{var n;null===(n=r.source)||void 0===n||n.postMessage({type:e+".FAILED",payload:{message:t.message,name:t.name,code:t.code,stack:t.stack},source:"@runfoodapp/template-based-document-generator",threadId:m()},"*")})}))}window.TEMPLATE_TARGET_ID="template_target",document.addEventListener("DOMContentLoaded",(function(){return _(this,void 0,void 0,(function*(){try{const e=window,t=(yield Promise.resolve().then(()=>f(r(38)))).default;e.handlebars=t,e.html2canvas=(yield Promise.resolve().then(()=>f(r(60)))).default,e.threadId=new URL(window.location.href).searchParams.get("thread-id")||"",(0,s.setupHandlebars)(t),h("RENDER",a.RenderDocument),h("TO_POS_COMMANDS",C.ExportAsPOSCommands),h("TO_B64IMG",E.ExportAsImage),A();const n=document.getElementById("template_target");n&&(n.innerHTML='<div style="text-align:center;margin:auto"><h1 style="width:200px:" >📃</h1></div>')}catch(e){A(e)}}))}))},function(e,t,r){"use strict";r.r(t);var n=r(4),o=r.n(n),i=r(8),f={insert:"head",singleton:!1};o()(i.a,f);t.default=i.a.locals||{}},function(e,t,r){"use strict";r.r(t);var n=r(4),o=r.n(n),i=r(9),f={insert:"head",singleton:!1};o()(i.a,f);t.default=i.a.locals||{}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExportAsImage=function(e){if(null==e?void 0:e.chunks)return(0,n.DocumentToChunkImages)({grayscale:null==e?void 0:e.grayscale,imageScale:1});return(0,n.DocumentToImage)(e||{},"base64")};const n=r(10)},function(e,t,r){"use strict";(function(e){var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=this&&this.__importStar||(n=function(e){return(n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),f=0;f<r.length;f++)"default"!==r[f]&&o(t,e,r[f]);return i(t,e),t}),_=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function f(e){try{E(n.next(e))}catch(e){i(e)}}function _(e){try{E(n.throw(e))}catch(e){i(e)}}function E(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(f,_)}E((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExportAsPOSCommands=function(t){return _(this,void 0,void 0,(function*(){var r;const n=(0,C.default)(t.pos_lang),o=[];o.push((0,C.InitializeCommand)(n)),((null===(r=t.beep)||void 0===r?void 0:r.length)||0)>=2&&"beep"in n&&o.push(n.beep(t.beep[0],t.beep[1]));const i=yield(0,E.DocumentToChunkImages)(t);console.debug&&console.debug(`[${(new Date).toJSON()}] Image to data successfully. bytes: ${i.reduce((e,t)=>e+t.data.byteLength,0)} / chunks: ${i.length}`);for(const e of i)o.push(n.printImageBuffer(e.width,e.height,e.data)),console.debug&&console.debug(`[${(new Date).toJSON()}] images-as-buffer created successfully. bytes: ${e.data.byteLength}`);t.cut&&o.push((0,C.CutCommand)({verticalTabAmount:1},n)),t.cash_drawer&&o.push((0,C.OpenDrawerCommand)(n));const f=e.concat(o);return console.debug&&console.debug(`[${(new Date).toJSON()}] document buffer created successfully. bytes: ${f.byteLength}`),f}))};const E=r(10),C=f(r(26))}).call(this,r(2).Buffer)},,,,,function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PrinterTypes=void 0,t.default=function(e){if("epson"===e)return new o.default;if("tanca"===e)return new f.default;if("brother"===e)return new _.default;if("star"===e)return new i.default;throw new RangeError(`el tipo ${e} no existe`)},t.InitializeCommand=function(e){return e.config.HW_INIT},t.CutCommand=function({verticalTabAmount:t=2}={},r){const n=[];for(let e=0;e<t;e++)n.push(r.config.CTL_VT);return n.push(r.config.PAPER_FULL_CUT),n.push(r.config.HW_INIT),e.concat(n)},t.OpenDrawerCommand=function(t){const r=[];t.config.type===E.STAR?r.push(t.config.CD_KICK):(r.push(t.config.CD_KICK_2),r.push(t.config.CD_KICK_5));return e.concat(r)};const o=n(r(27)),i=n(r(29)),f=n(r(31)),_=n(r(33));var E;!function(e){e.EPSON="epson",e.TANCA="tanca",e.STAR="star",e.BROTHER="brother"}(E||(t.PrinterTypes=E={}))}).call(this,r(2).Buffer)},function(e,t,r){(function(t){const n=r(3),o=r(28);e.exports=class extends n{constructor(){super(),this.config=o}getStatus(){return this.config.TRANSMIT_PAPER_STATUS}append(e){this.buffer?this.buffer=t.concat([this.buffer,e]):this.buffer=e}beep(e=1,r=1){if(e<1||e>9)throw new Error("numberOfBeeps: Value must be between 1 and 9");if(r<1||r>9)throw new Error("lengthOfTheSound: Value must be between 1 and 9");return this.buffer=null,this.append(this.config.BEEP),this.append(t.from([e,r])),this.buffer}setTextSize(e,r){if(this.buffer=null,e>7||e<0)throw new Error("setTextSize: Height must be between 0 and 7");if(r>7||r<0)throw new Error("setTextSize: Width must be between 0 and 7");const n=t.from(`${e}${r}`,"hex");return this.append(t.from([29,33])),this.append(n),this.buffer}code128(e,r){return this.buffer=null,r={hriPos:0,hriFont:0,width:3,height:162,...r},this.append(t.from([29,72])),this.append(t.from([r.hriPos])),this.append(t.from([29,102])),this.append(t.from([r.hriFont])),this.append(t.from([29,119])),this.append(t.from([r.width])),this.append(t.from([29,104])),this.append(t.from([r.height])),this.append(this.config.BARCODE_CODE128),this.append(t.from([e.length+2])),this.append(t.from([123,66])),this.append(t.from(e)),this.buffer}printQR(e,r){this.buffer=null,1===(r={model:2,cellSize:3,correction:"M",...r}).model?this.append(this.config.QRCODE_MODEL1):3===r.model?this.append(this.config.QRCODE_MODEL3):this.append(this.config.QRCODE_MODEL2);const n="QRCODE_CELLSIZE_".concat(r.cellSize.toString());this.append(this.config[n]);const o="QRCODE_CORRECTION_".concat(r.correction.toUpperCase());this.append(this.config[o]);const i=e.length+3,f=parseInt(i%256),_=parseInt(i/256);return this.append(t.from([29,40,107,f,_,49,80,48])),this.append(t.from(e)),this.append(this.config.QRCODE_PRINT),this.buffer}pdf417(e,r){this.buffer=null,r={correction:1,rowHeight:3,width:3,columns:0,truncated:!1,...r},this.append(this.config.PDF417_CORRECTION),this.append(t.from([r.correction])),this.append(this.config.PDF417_ROW_HEIGHT),this.append(t.from([r.rowHeight])),this.append(this.config.PDF417_WIDTH),this.append(t.from([r.width])),this.append(this.config.PDF417_COLUMNS),this.append(t.from([r.columns])),r.truncated?this.append(this.config.PDF417_OPTION_TRUNCATED):this.append(this.config.PDF417_OPTION_STANDARD);const n=e.length+3,o=parseInt(n%256),i=parseInt(n/256);return this.append(t.from([29,40,107,o,i,48,80,48])),this.append(t.from(e.toString())),this.append(t.from(this.config.PDF417_PRINT)),this.buffer}maxiCode(e,r){this.buffer=null,2==(r={mode:4,...r}).mode?this.append(this.config.MAXI_MODE2):3==r.mode?this.append(this.config.MAXI_MODE3):5==r.mode?this.append(this.config.MAXI_MODE5):6==r.mode?this.append(this.config.MAXI_MODE6):this.append(this.config.MAXI_MODE4);const n=e.length+3,o=parseInt(n%256),i=parseInt(n/256);return this.append(t.from([29,40,107,o,i,50,80,48])),this.append(t.from(e.toString())),this.append(this.config.MAXI_PRINT),this.buffer}printBarcode(e,r,n){return this.buffer=null,n={hriPos:0,hriFont:0,width:3,height:162,...n},this.append(t.from([29,72])),this.append(t.from([n.hriPos])),this.append(t.from([29,102])),this.append(t.from([n.hriFont])),this.append(t.from([29,119])),this.append(t.from([n.width])),this.append(t.from([29,104])),this.append(t.from([n.height])),this.append(t.from([29,107])),73==r?(this.append(t.from([r,e.length+2])),this.append(t.from([123,66]))):this.append(t.from([r,e.length])),this.append(t.from(e)),this.buffer}printImageBuffer(e,r,n){this.buffer=null;const o=[];for(let t=0;t<r;t++){const r=[];for(let o=0;o<e;o++){const i=e*t+o<<2;r.push({r:n[i],g:n[i+1],b:n[i+2],a:n[i+3]})}o.push(r)}const i=[];for(let t=0;t<r;t++)for(let r=0;r<Math.ceil(e/8);r++){let e=0;for(let n=0;n<8;n++){let i=o[t][8*r+n];if(void 0===i&&(i={a:0,r:0,g:0,b:0}),i.a>126){if(parseInt(.2126*i.r+.7152*i.g+.0722*i.b)<128){e|=1<<7-n}}}i.push(e)}const f=t.from(i);return e%8!=0&&(e+=8),this.append(t.from([29,118,48,48])),this.append(t.from([e>>3&255])),this.append(t.from([0])),this.append(t.from([255&r])),this.append(t.from([r>>8&255])),this.append(f),this.buffer}}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){e.exports={CTL_LF:t.from([10]),CTL_FF:t.from([12]),CTL_CR:t.from([13]),CTL_HT:t.from([9]),CTL_SET_HT:t.from([27,68]),CTL_VT:t.from([27,100,4]),HW_INIT:t.from([27,64]),HW_SELECT:t.from([27,61,1]),HW_RESET:t.from([27,63,10,0]),TRANSMIT_PAPER_STATUS:t.from([29,114,1]),BEEP:t.from([27,66]),UPSIDE_DOWN_ON:t.from([27,123,1]),UPSIDE_DOWN_OFF:t.from([27,123,0]),CD_KICK_2:t.from([27,112,0]),CD_KICK_5:t.from([27,112,1]),PAPER_FULL_CUT:t.from([29,86,0]),PAPER_PART_CUT:t.from([29,86,1]),TXT_NORMAL:t.from([27,33,0]),TXT_2HEIGHT:t.from([27,33,16]),TXT_2WIDTH:t.from([27,33,32]),TXT_4SQUARE:t.from([27,33,48]),TXT_UNDERL_OFF:t.from([27,45,0]),TXT_UNDERL_ON:t.from([27,45,1]),TXT_UNDERL2_ON:t.from([27,45,2]),TXT_BOLD_OFF:t.from([27,69,0]),TXT_BOLD_ON:t.from([27,69,1]),TXT_INVERT_OFF:t.from([29,66,0]),TXT_INVERT_ON:t.from([29,66,1]),TXT_FONT_A:t.from([27,77,0]),TXT_FONT_B:t.from([27,77,1]),TXT_ALIGN_LT:t.from([27,97,0]),TXT_ALIGN_CT:t.from([27,97,1]),TXT_ALIGN_RT:t.from([27,97,2]),CODE_PAGE_PC437_USA:t.from([27,116,0]),CODE_PAGE_KATAKANA:t.from([27,116,1]),CODE_PAGE_PC850_MULTILINGUAL:t.from([27,116,2]),CODE_PAGE_PC860_PORTUGUESE:t.from([27,116,3]),CODE_PAGE_PC863_CANADIAN_FRENCH:t.from([27,116,4]),CODE_PAGE_PC865_NORDIC:t.from([27,116,5]),CODE_PAGE_PC851_GREEK:t.from([27,116,11]),CODE_PAGE_PC853_TURKISH:t.from([27,116,12]),CODE_PAGE_PC857_TURKISH:t.from([27,116,13]),CODE_PAGE_PC737_GREEK:t.from([27,116,14]),CODE_PAGE_ISO8859_7_GREEK:t.from([27,116,15]),CODE_PAGE_WPC1252:t.from([27,116,16]),CODE_PAGE_PC866_CYRILLIC2:t.from([27,116,17]),CODE_PAGE_PC852_LATIN2:t.from([27,116,18]),CODE_PAGE_SLOVENIA:t.from([27,116,18]),CODE_PAGE_PC858_EURO:t.from([27,116,19]),CODE_PAGE_KU42_THAI:t.from([27,116,20]),CODE_PAGE_TIS11_THAI:t.from([27,116,21]),CODE_PAGE_TIS18_THAI:t.from([27,116,26]),CODE_PAGE_TCVN3_VIETNAMESE_L:t.from([27,116,30]),CODE_PAGE_TCVN3_VIETNAMESE_U:t.from([27,116,31]),CODE_PAGE_PC720_ARABIC:t.from([27,116,32]),CODE_PAGE_WPC775_BALTIC_RIM:t.from([27,116,33]),CODE_PAGE_PC855_CYRILLIC:t.from([27,116,34]),CODE_PAGE_PC861_ICELANDIC:t.from([27,116,35]),CODE_PAGE_PC862_HEBREW:t.from([27,116,36]),CODE_PAGE_PC864_ARABIC:t.from([27,116,37]),CODE_PAGE_PC869_GREEK:t.from([27,116,38]),CODE_PAGE_ISO8859_2_LATIN2:t.from([27,116,39]),CODE_PAGE_ISO8859_15_LATIN9:t.from([27,116,40]),CODE_PAGE_PC1098_FARCI:t.from([27,116,41]),CODE_PAGE_PC1118_LITHUANIAN:t.from([27,116,42]),CODE_PAGE_PC1119_LITHUANIAN:t.from([27,116,43]),CODE_PAGE_PC1125_UKRANIAN:t.from([27,116,44]),CODE_PAGE_WPC1250_LATIN2:t.from([27,116,45]),CODE_PAGE_WPC1251_CYRILLIC:t.from([27,116,46]),CODE_PAGE_WPC1253_GREEK:t.from([27,116,47]),CODE_PAGE_WPC1254_TURKISH:t.from([27,116,48]),CODE_PAGE_WPC1255_HEBREW:t.from([27,116,49]),CODE_PAGE_WPC1256_ARABIC:t.from([27,116,50]),CODE_PAGE_WPC1257_BALTIC_RIM:t.from([27,116,51]),CODE_PAGE_WPC1258_VIETNAMESE:t.from([27,116,52]),CODE_PAGE_KZ1048_KAZAKHSTAN:t.from([27,116,53]),CODE_PAGE_JAPAN:t.from([27,82,8]),CODE_PAGE_KOREA:t.from([27,82,13]),CODE_PAGE_CHINA:t.from([27,82,15]),CODE_PAGE_HK_TW:t.from([27,82,0]),CODE_PAGE_TCVN_VIETNAMESE:t.from([27,116,52]),CODE_PAGES:{PC437_USA:"CP437",PC850_MULTILINGUAL:"CP850",PC860_PORTUGUESE:"CP860",PC863_CANADIAN_FRENCH:"CP863",PC865_NORDIC:"CP865",PC851_GREEK:"CP860",PC857_TURKISH:"CP857",PC737_GREEK:"CP737",ISO8859_7_GREEK:"ISO-8859-7",WPC1252:"CP1252",PC866_CYRILLIC2:"CP866",PC852_LATIN2:"CP852",SLOVENIA:"CP852",PC858_EURO:"CP858",WPC775_BALTIC_RIM:"CP775",PC855_CYRILLIC:"CP855",PC861_ICELANDIC:"CP861",PC862_HEBREW:"CP862",PC864_ARABIC:"CP864",PC869_GREEK:"CP869",ISO8859_2_LATIN2:"ISO-8859-2",ISO8859_15_LATIN9:"ISO-8859-15",PC1125_UKRANIAN:"CP1125",WPC1250_LATIN2:"WIN1250",WPC1251_CYRILLIC:"WIN1251",WPC1253_GREEK:"WIN1253",WPC1254_TURKISH:"WIN1254",WPC1255_HEBREW:"WIN1255",WPC1256_ARABIC:"WIN1256",WPC1257_BALTIC_RIM:"WIN1257",WPC1258_VIETNAMESE:"WIN1258",KZ1048_KAZAKHSTAN:"RK1048",JAPAN:"EUC-JP",KOREA:"EUC-KR",CHINA:"EUC-CN",HK_TW:"Big5-HKSCS",TCVN_VIETNAMESE:"tcvn",TIS11_THAI:"TIS-620",TIS18_THAI:"TIS-620"},BARCODE_TXT_OFF:t.from([29,72,0]),BARCODE_TXT_ABV:t.from([29,72,1]),BARCODE_TXT_BLW:t.from([29,72,2]),BARCODE_TXT_BTH:t.from([29,72,3]),BARCODE_FONT_A:t.from([29,102,0]),BARCODE_FONT_B:t.from([29,102,1]),BARCODE_HEIGHT:t.from([29,104,100]),BARCODE_WIDTH:t.from([29,119,3]),BARCODE_UPC_A:t.from([29,107,0]),BARCODE_UPC_E:t.from([29,107,1]),BARCODE_EAN13:t.from([29,107,2]),BARCODE_EAN8:t.from([29,107,3]),BARCODE_CODE39:t.from([29,107,4]),BARCODE_CODE128:t.from([29,107,73]),BARCODE_ITF:t.from([29,107,5]),BARCODE_NW7:t.from([29,107,6]),QRCODE_MODEL1:t.from([29,40,107,4,0,49,65,49,0]),QRCODE_MODEL2:t.from([29,40,107,4,0,49,65,50,0]),QRCODE_MODEL3:t.from([29,40,107,4,0,49,65,51,0]),QRCODE_CORRECTION_L:t.from([29,40,107,3,0,49,69,48]),QRCODE_CORRECTION_M:t.from([29,40,107,3,0,49,69,49]),QRCODE_CORRECTION_Q:t.from([29,40,107,3,0,49,69,50]),QRCODE_CORRECTION_H:t.from([29,40,107,3,0,49,69,51]),QRCODE_CELLSIZE_1:t.from([29,40,107,3,0,49,67,1]),QRCODE_CELLSIZE_2:t.from([29,40,107,3,0,49,67,2]),QRCODE_CELLSIZE_3:t.from([29,40,107,3,0,49,67,3]),QRCODE_CELLSIZE_4:t.from([29,40,107,3,0,49,67,4]),QRCODE_CELLSIZE_5:t.from([29,40,107,3,0,49,67,5]),QRCODE_CELLSIZE_6:t.from([29,40,107,3,0,49,67,6]),QRCODE_CELLSIZE_7:t.from([29,40,107,3,0,49,67,7]),QRCODE_CELLSIZE_8:t.from([29,40,107,3,0,49,67,8]),QRCODE_PRINT:t.from([29,40,107,3,0,49,81,48]),PDF417_CORRECTION:t.from([29,40,107,4,0,48,69,49]),PDF417_ROW_HEIGHT:t.from([29,40,107,3,0,48,68]),PDF417_WIDTH:t.from([29,40,107,3,0,48,67]),PDF417_COLUMNS:t.from([29,40,107,3,0,48,65]),PDF417_OPTION_STANDARD:t.from([29,40,107,3,0,48,70,0]),PDF417_OPTION_TRUNCATED:t.from([29,40,107,3,0,48,70,1]),PDF417_PRINT:t.from([29,40,107,3,0,48,81,48]),MAXI_MODE2:t.from([29,40,107,3,0,50,65,50]),MAXI_MODE3:t.from([29,40,107,3,0,50,65,51]),MAXI_MODE4:t.from([29,40,107,3,0,50,65,52]),MAXI_MODE5:t.from([29,40,107,3,0,50,65,53]),MAXI_MODE6:t.from([29,40,107,3,0,50,65,54]),MAXI_PRINT:t.from([29,40,107,3,0,50,81,48]),S_RASTER_N:t.from([29,118,48,0]),S_RASTER_2W:t.from([29,118,48,1]),S_RASTER_2H:t.from([29,118,48,2]),S_RASTER_Q:t.from([29,118,48,3]),PD_N50:t.from([29,124,0]),PD_N37:t.from([29,124,1]),PD_N25:t.from([29,124,2]),PD_N12:t.from([29,124,3]),PD_0:t.from([29,124,4]),PD_P50:t.from([29,124,8]),PD_P37:t.from([29,124,7]),PD_P25:t.from([29,124,6])}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){const n=r(3),o=r(30);e.exports=class extends n{constructor(){super(),this.config=o}append(e){this.buffer?this.buffer=t.concat([this.buffer,e]):this.buffer=e}printQR(e,r){this.buffer=null,r||(r={});const n={model:this.config.QRCODE_MODEL1,correctionLevel:this.config.QRCODE_CORRECTION_M,cellSize:this.config.QRCODE_CELLSIZE_4},o={1:this.config.QRCODE_MODEL1,2:this.config.QRCODE_MODEL2},i={L:this.config.QRCODE_CORRECTION_L,M:this.config.QRCODE_CORRECTION_M,Q:this.config.QRCODE_CORRECTION_Q,H:this.config.QRCODE_CORRECTION_H},f={1:this.config.QRCODE_CELLSIZE_1,2:this.config.QRCODE_CELLSIZE_2,3:this.config.QRCODE_CELLSIZE_3,4:this.config.QRCODE_CELLSIZE_4,5:this.config.QRCODE_CELLSIZE_5,6:this.config.QRCODE_CELLSIZE_6,7:this.config.QRCODE_CELLSIZE_7,8:this.config.QRCODE_CELLSIZE_8};o[r.model]&&(n.model=o[r.model]),i[r.correctionLevel]&&(n.correctionLevel=i[r.correctionLevel]),f[r.cellSize]&&(n.cellSize=f[r.cellSize]),this.append(n.model),this.append(n.correctionLevel),this.append(n.cellSize);const _=e.length,E=parseInt(_%256),C=parseInt(_/256);return this.append(t.from([E,C])),this.append(t.from(e.toString())),this.append(t.from([10])),this.append(this.config.QRCODE_PRINT),this.buffer}pdf417(e,r){if(this.buffer=null,r)throw new Error("PDF417 settings not yet available for star printers!");this.append(t.from([27,29,120,83,48,0,1,2])),this.append(t.from([27,29,120,83,49,2])),this.append(t.from([27,29,120,83,50,2])),this.append(t.from([27,29,120,83,51,3]));const n=e.length,o=parseInt(n%256),i=parseInt(n/256);return this.append(t.from([27,29,120,68])),this.append(t.from([o,i])),this.append(t.from(e.toString())),this.append(t.from([10])),this.append(t.from([27,29,120,80])),this.buffer}code128(e,r){return this.buffer=null,this.append(this.config.BARCODE_CODE128),r?1==r.text?this.append(this.config.BARCODE_CODE128_TEXT_1):2==r.text?this.append(this.config.BARCODE_CODE128_TEXT_2):3==r.text?this.append(this.config.BARCODE_CODE128_TEXT_3):4==r.text&&this.append(this.config.BARCODE_CODE128_TEXT_4):this.append(this.config.BARCODE_CODE128_TEXT_2),r?"SMALL"==r.width?this.append(this.config.BARCODE_CODE128_WIDTH_SMALL):"MEDIUM"==r.width?this.append(this.config.BARCODE_CODE128_WIDTH_MEDIUM):"LARGE"==r.width&&this.append(this.config.BARCODE_CODE128_WIDTH_LARGE):this.append(this.config.BARCODE_CODE128_WIDTH_LARGE),r&&r.height?this.append(t.from([r.height])):this.append(t.from([80])),this.append(t.from(e.toString())),this.append(t.from([30])),this.buffer}printImageBuffer(e,r,n){this.buffer=null;const o=[];for(let t=0;t<r;t++){const r=[];for(let o=0;o<e;o++){const i=e*t+o<<2;r.push({r:n[i],g:n[i+1],b:n[i+2],a:n[i+3]})}o.push(r)}this.append(t.from([27,48]));for(let n=0;n<Math.ceil(r/24);n++){let r=t.from([]);for(let i=0;i<24;i++)for(let f=0;f<Math.ceil(e/8);f++){let e=0;for(let t=0;t<8;t++)if(24*n+i<o.length&&8*f+t<o[24*n+i].length){const r=o[24*n+i][8*f+t];if(r.a>126){if(parseInt(.2126*r.r+.7152*r.g+.0722*r.b)<128){e|=1<<7-t}}}r=t.concat([r,t.from([e])])}this.append(t.from([27,107,parseInt(r.length/24),0])),this.append(r),this.append(t.from("\n"))}return this.append(t.from([27,122,1])),this.buffer}printBarcode(e,r,n){return this.buffer=null,n||(n={}),this.append(t.from([27,98])),this.append(t.from([r||7])),this.append(t.from([n.characters||1])),this.append(t.from([n.mode||2])),this.append(t.from([n.height||150])),this.append(t.from(e)),this.append(t.from([30])),this.buffer}}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){e.exports={CTL_LF:t.from([10]),CTL_FF:t.from([12]),CTL_CR:t.from([13]),CTL_HT:t.from([9]),CTL_VT:t.from([11]),CTL_SET_HT:t.from([27,68]),CTL_SET_VT:t.from([27,66]),HW_INIT:t.from([27,64]),HW_SELECT:t.from([27,61,1]),HW_RESET:t.from([27,63,10,0]),UPSIDE_DOWN_ON:t.from([15]),UPSIDE_DOWN_OFF:t.from([18]),CD_KICK_2:t.from([27,112,0]),CD_KICK_5:t.from([27,112,1]),CD_KICK:t.from([27,7,11,55,7]),PAPER_FULL_CUT:t.from([27,100,2]),PAPER_PART_CUT:t.from([27,100,3]),TXT_NORMAL:t.from([27,105,0,0]),TXT_2HEIGHT:t.from([27,105,1,0]),TXT_2WIDTH:t.from([27,105,0,1]),TXT_4SQUARE:t.from([27,105,1,1]),TXT_UNDERL_OFF:t.from([27,45,0]),TXT_UNDERL_ON:t.from([27,45,1]),TXT_UNDERL2_ON:t.from([27,45,2]),TXT_BOLD_OFF:t.from([27,70]),TXT_BOLD_ON:t.from([27,69]),TXT_INVERT_OFF:t.from([27,53]),TXT_INVERT_ON:t.from([27,52]),TXT_FONT_A:t.from([27,30,70,0]),TXT_FONT_B:t.from([27,30,70,1]),TXT_ALIGN_LT:t.from([27,29,97,0]),TXT_ALIGN_CT:t.from([27,29,97,1]),TXT_ALIGN_RT:t.from([27,29,97,2]),CODE_PAGE_NORMAL:t.from([27,29,116,0]),CODE_PAGE_PC850_MULTILINGUAL:t.from([27,29,116,0]),CODE_PAGE_ISO8859_2_LATIN2:t.from([27,29,116,0]),CODE_PAGE_ISO8859_15_LATIN9:t.from([27,29,116,0]),CODE_PAGE_PC437_USA:t.from([27,29,116,1]),CODE_PAGE_KATAKANA:t.from([27,29,116,2]),CODE_PAGE_CP437:t.from([27,29,116,3]),CODE_PAGE_PC858_EURO:t.from([27,29,116,4]),CODE_PAGE_PC852_LATIN2:t.from([27,29,116,5]),CODE_PAGE_PC860_PORTUGUESE:t.from([27,29,116,6]),CODE_PAGE_PC861_ICELANDIC:t.from([27,29,116,7]),CODE_PAGE_PC863_CANADIAN_FRENCH:t.from([27,29,116,8]),CODE_PAGE_PC865_NORDIC:t.from([27,29,116,9]),CODE_PAGE_PC866_CYRILLIC2:t.from([27,29,116,10]),CODE_PAGE_PC855_CYRILLIC:t.from([27,29,116,11]),CODE_PAGE_PC857_TURKISH:t.from([27,29,116,12]),CODE_PAGE_PC862_HEBREW:t.from([27,29,116,13]),CODE_PAGE_PC864_ARABIC:t.from([27,29,116,14]),CODE_PAGE_PC737_GREEK:t.from([27,29,116,15]),CODE_PAGE_PC851_GREEK:t.from([27,29,116,16]),CODE_PAGE_PC869_GREEK:t.from([27,29,116,17]),CODE_PAGE_PC928_GREEK:t.from([27,29,116,18]),CODE_PAGE_PC772_LITHUANIAN:t.from([27,29,116,19]),CODE_PAGE_PC774_LITHUANIAN:t.from([27,29,116,20]),CODE_PAGE_PC874_THAI:t.from([27,29,116,21]),CODE_PAGE_WPC1252:t.from([27,29,116,32]),CODE_PAGE_WPC1250_LATIN2:t.from([27,29,116,33]),CODE_PAGE_WPC1251_CYRILLIC:t.from([27,29,116,34]),CODE_PAGE_3840_IBM_Russian:t.from([27,29,116,64]),CODE_PAGE_3841_Gost:t.from([27,29,116,65]),CODE_PAGE_3843_POLISH:t.from([27,29,116,66]),CODE_PAGE_3844_CS2:t.from([27,29,116,67]),CODE_PAGE_3845_HUNGARIAN:t.from([27,29,116,68]),CODE_PAGE_3846_TURKISH:t.from([27,29,116,69]),CODE_PAGE_3847_BRAZIL_ABNT:t.from([27,29,116,70]),CODE_PAGE_3848_RAZIL_ABICOMP:t.from([27,29,116,71]),CODE_PAGE_1001_ARABIC:t.from([27,29,116,72]),CODE_PAGE_2001_LITHUANIAN_KBL:t.from([27,29,116,73]),CODE_PAGE_3001_ESTONIAN1:t.from([27,29,116,74]),CODE_PAGE_3002_ESTONIAN2:t.from([27,29,116,75]),CODE_PAGE_3011_LATVIAN1:t.from([27,29,116,76]),CODE_PAGE_3012_LATVIAN2:t.from([27,29,116,77]),CODE_PAGE_3021_BULGARIAN:t.from([27,29,116,78]),CODE_PAGE_3041_MALTESE:t.from([27,29,116,79]),CODE_PAGE_42_MALTESE:t.from([27,29,116,96]),CODE_PAGE_11_MALTESE:t.from([27,29,116,97]),CODE_PAGE_13_MALTESE:t.from([27,29,116,98]),CODE_PAGE_14_MALTESE:t.from([27,29,116,99]),CODE_PAGE_16_MALTESE:t.from([27,29,116,100]),CODE_PAGE_17_MALTESE:t.from([27,29,116,101]),CODE_PAGE_18_MALTESE:t.from([27,29,116,102]),CODE_PAGES:{PC437_USA:"CP437",PC850_MULTILINGUAL:"CP850",PC860_PORTUGUESE:"CP860",PC863_CANADIAN_FRENCH:"CP863",PC865_NORDIC:"CP865",PC851_GREEK:"CP860",PC857_TURKISH:"CP857",PC737_GREEK:"CP737",ISO8859_7_GREEK:"ISO-8859-7",WPC1252:"CP1252",PC866_CYRILLIC2:"CP866",PC852_LATIN2:"CP852",SLOVENIA:"CP852",PC858_EURO:"CP858",WPC775_BALTIC_RIM:"CP775",PC855_CYRILLIC:"CP855",PC861_ICELANDIC:"CP861",PC862_HEBREW:"CP862",PC864_ARABIC:"CP864",PC869_GREEK:"CP869",ISO8859_2_LATIN2:"ISO-8859-2",ISO8859_15_LATIN9:"ISO-8859-15",PC1125_UKRANIAN:"CP1125",WPC1250_LATIN2:"WIN1250",WPC1251_CYRILLIC:"WIN1251",WPC1253_GREEK:"WIN1253",WPC1254_TURKISH:"WIN1254",WPC1255_HEBREW:"WIN1255",WPC1256_ARABIC:"WIN1256",WPC1257_BALTIC_RIM:"WIN1257",WPC1258_VIETNAMESE:"WIN1258",KZ1048_KAZAKHSTAN:"RK1048",JAPAN:"EUC-JP",KOREA:"EUC-KR",CHINA:"EUC-CN"},BARCODE_TXT_OFF:t.from([29,72,0]),BARCODE_TXT_ABV:t.from([29,72,1]),BARCODE_TXT_BLW:t.from([29,72,2]),BARCODE_TXT_BTH:t.from([29,72,3]),BARCODE_FONT_A:t.from([29,102,0]),BARCODE_FONT_B:t.from([29,102,1]),BARCODE_HEIGHT:t.from([29,104,100]),BARCODE_WIDTH:t.from([29,119,3]),BARCODE_UPC_A:t.from([29,107,0]),BARCODE_UPC_E:t.from([29,107,1]),BARCODE_EAN13:t.from([29,107,2]),BARCODE_EAN8:t.from([29,107,3]),BARCODE_CODE39:t.from([29,107,4]),BARCODE_ITF:t.from([29,107,5]),BARCODE_NW7:t.from([29,107,6]),BARCODE_CODE128:t.from([27,98,54]),BARCODE_CODE128_TEXT_1:t.from([1]),BARCODE_CODE128_TEXT_2:t.from([2]),BARCODE_CODE128_TEXT_3:t.from([3]),BARCODE_CODE128_TEXT_4:t.from([4]),BARCODE_CODE128_WIDTH_SMALL:t.from([49]),BARCODE_CODE128_WIDTH_MEDIUM:t.from([50]),BARCODE_CODE128_WIDTH_LARGE:t.from([51]),QRCODE_MODEL1:t.from([27,29,121,83,48,1]),QRCODE_MODEL2:t.from([27,29,121,83,48,2]),QRCODE_CORRECTION_L:t.from([27,29,121,83,49,0]),QRCODE_CORRECTION_M:t.from([27,29,121,83,49,1]),QRCODE_CORRECTION_Q:t.from([27,29,121,83,49,2]),QRCODE_CORRECTION_H:t.from([27,29,121,83,49,3]),QRCODE_CELLSIZE_1:t.from([27,29,121,83,50,1]),QRCODE_CELLSIZE_2:t.from([27,29,121,83,50,2]),QRCODE_CELLSIZE_3:t.from([27,29,121,83,50,3]),QRCODE_CELLSIZE_4:t.from([27,29,121,83,50,4]),QRCODE_CELLSIZE_5:t.from([27,29,121,83,50,5]),QRCODE_CELLSIZE_6:t.from([27,29,121,83,50,6]),QRCODE_CELLSIZE_7:t.from([27,29,121,83,50,7]),QRCODE_CELLSIZE_8:t.from([27,29,121,83,50,8]),QRCODE_CELLSIZE:t.from([27,29,121,68,49,0]),QRCODE_PRINT:t.from([27,29,121,80]),S_RASTER_N:t.from([29,118,48,0]),S_RASTER_2W:t.from([29,118,48,1]),S_RASTER_2H:t.from([29,118,48,2]),S_RASTER_Q:t.from([29,118,48,3]),PD_N50:t.from([29,124,0]),PD_N37:t.from([29,124,1]),PD_N25:t.from([29,124,2]),PD_N12:t.from([29,124,3]),PD_0:t.from([29,124,4]),PD_P50:t.from([29,124,8]),PD_P37:t.from([29,124,7]),PD_P25:t.from([29,124,6])}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){const n=r(3),o=r(32);e.exports=class extends n{constructor(){super(),this.config=o}append(e){this.buffer?this.buffer=t.concat([this.buffer,e]):this.buffer=e}beep(){return this.config.BEEP}setTextSize(e,r){if(this.buffer=null,e>7||e<0)throw new Error("setTextSize: Height must be between 0 and 7");if(r>7||r<0)throw new Error("setTextSize: Width must be between 0 and 7");const n=t.from(`${e}${r}`,"hex");return this.append(t.from([29,33])),this.append(n),this.buffer}printQR(e,r){if(this.buffer=null,(r=r||{}).model?1===r.model?this.append(this.config.QRCODE_MODEL1):3===r.model?this.append(this.config.QRCODE_MODEL3):this.append(this.config.QRCODE_MODEL2):this.append(this.config.QRCODE_MODEL2),r.cellSize){const e="QRCODE_CELLSIZE_".concat(r.cellSize.toString());this.append(this.config[e])}else this.append(this.config.QRCODE_CELLSIZE_3);if(r.correction){const e="QRCODE_CORRECTION_".concat(r.correction.toUpperCase());this.append(this.config[e])}else this.append(this.config.QRCODE_CORRECTION_M);const n=e.length+3,o=parseInt(n%256),i=parseInt(n/256);return this.append(t.from([29,40,107,o,i,49,80,48])),this.append(t.from(e)),this.append(this.config.QRCODE_PRINT),this.buffer}pdf417(e,r){this.buffer=null,(r=r||{}).correction?(this.append(this.config.PDF417_CORRECTION),this.append(t.from([r.correction]))):(this.append(this.config.PDF417_CORRECTION),this.append(t.from([1]))),r.rowHeight?(this.append(this.config.PDF417_ROW_HEIGHT),this.append(t.from([r.rowHeight]))):(this.append(this.config.PDF417_ROW_HEIGHT),this.append(t.from([3]))),r.width?(this.append(this.config.PDF417_WIDTH),this.append(t.from([r.width]))):(this.append(this.config.PDF417_WIDTH),this.append(t.from([3]))),r.columns?(this.append(this.config.PDF417_COLUMNS),this.append(t.from([r.columns]))):(this.append(this.config.PDF417_COLUMNS),this.append(t.from([0]))),r.truncated?this.append(this.config.PDF417_OPTION_TRUNCATED):this.append(this.config.PDF417_OPTION_STANDARD);const n=e.length+3,o=parseInt(n%256),i=parseInt(n/256);return this.append(t.from([29,40,107,o,i,48,80,48])),this.append(t.from(e.toString())),this.append(t.from(this.config.PDF417_PRINT)),this.buffer}maxiCode(e,r){this.buffer=null,(r=r||{}).mode?2==r.mode?this.append(this.config.MAXI_MODE2):3==r.mode?this.append(this.config.MAXI_MODE3):5==r.mode?this.append(this.config.MAXI_MODE5):6==r.mode?this.append(this.config.MAXI_MODE6):this.append(this.config.MAXI_MODE4):this.append(this.config.MAXI_MODE4);const n=e.length+3,o=parseInt(n%256),i=parseInt(n/256);return this.append(t.from([29,40,107,o,i,50,80,48])),this.append(t.from(e.toString())),this.append(this.config.MAXI_PRINT),this.buffer}printBarcode(e,r,n){return this.buffer=null,(n=n||{}).hriPos?(this.append(t.from([29,72])),this.append(t.from([n.hriPos]))):this.append(t.from([29,72,0])),n.hriFont?(this.append(t.from([29,102])),this.append(t.from([n.hriFont]))):this.append(t.from([29,102,0])),n.width?(this.append(t.from([29,119])),this.append(t.from([n.width]))):this.append(t.from([29,119,3])),n.height?(this.append(t.from([29,104])),this.append(t.from([n.height]))):this.append(t.from([29,104,162])),this.append(t.from([29,107])),this.append(t.from([r,e.length])),this.append(t.from(e)),this.buffer}printImageBuffer(e,r,n){this.buffer=null;const o=[];for(let t=0;t<r;t++){const r=[];for(let o=0;o<e;o++){const i=e*t+o<<2;r.push({r:n[i],g:n[i+1],b:n[i+2],a:n[i+3]})}o.push(r)}const i=[];for(let t=0;t<r;t++)for(let r=0;r<Math.ceil(e/8);r++){let e=0;for(let n=0;n<8;n++){let i=o[t][8*r+n];if(void 0===i&&(i={a:0,r:0,g:0,b:0}),i.a>126){if(parseInt(.2126*i.r+.7152*i.g+.0722*i.b)<128){e|=1<<7-n}}}i.push(e)}const f=t.from(i);return e%8!=0&&(e+=8),this.append(t.from([29,118,48,48])),this.append(t.from([e>>3&255])),this.append(t.from([0])),this.append(t.from([255&r])),this.append(t.from([r>>8&255])),this.append(f),this.buffer}}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){e.exports={CTL_LF:t.from([10]),CTL_FF:t.from([12]),CTL_CR:t.from([13]),CTL_HT:t.from([9]),CTL_SET_HT:t.from([27,68]),CTL_VT:t.from([27,100,4]),HW_INIT:t.from([27,64]),HW_SELECT:t.from([27,61,1]),HW_RESET:t.from([27,63,10,0]),BEEP:t.from([27,66,5,1]),UPSIDE_DOWN_ON:t.from([27,123,1]),UPSIDE_DOWN_OFF:t.from([27,123,0]),CD_KICK_2:t.from([27,112,0]),CD_KICK_5:t.from([27,112,1]),PAPER_FULL_CUT:t.from([29,86,0]),PAPER_PART_CUT:t.from([29,86,1]),TXT_NORMAL:t.from([27,33,0]),TXT_2HEIGHT:t.from([27,33,16]),TXT_2WIDTH:t.from([27,33,32]),TXT_4SQUARE:t.from([27,33,48]),TXT_UNDERL_OFF:t.from([27,45,0]),TXT_UNDERL_ON:t.from([27,45,1]),TXT_UNDERL2_ON:t.from([27,45,2]),TXT_BOLD_OFF:t.from([27,69,0]),TXT_BOLD_ON:t.from([27,69,1]),TXT_INVERT_OFF:t.from([29,66,0]),TXT_INVERT_ON:t.from([29,66,1]),TXT_FONT_A:t.from([27,77,0]),TXT_FONT_B:t.from([27,77,1]),TXT_ALIGN_LT:t.from([27,97,0]),TXT_ALIGN_CT:t.from([27,97,1]),TXT_ALIGN_RT:t.from([27,97,2]),CODE_PAGE_PC437_USA:t.from([27,116,0]),CODE_PAGE_KATAKANA:t.from([27,116,1]),CODE_PAGE_PC850_MULTILINGUAL:t.from([27,116,2]),CODE_PAGE_PC860_PORTUGUESE:t.from([27,116,3]),CODE_PAGE_PC863_CANADIAN_FRENCH:t.from([27,116,4]),CODE_PAGE_PC865_NORDIC:t.from([27,116,5]),CODE_PAGE_PC851_GREEK:t.from([27,116,11]),CODE_PAGE_PC853_TURKISH:t.from([27,116,12]),CODE_PAGE_PC857_TURKISH:t.from([27,116,13]),CODE_PAGE_PC737_GREEK:t.from([27,116,14]),CODE_PAGE_ISO8859_7_GREEK:t.from([27,116,15]),CODE_PAGE_WPC1252:t.from([27,116,16]),CODE_PAGE_PC866_CYRILLIC2:t.from([27,116,17]),CODE_PAGE_PC852_LATIN2:t.from([27,116,18]),CODE_PAGE_SLOVENIA:t.from([27,116,18]),CODE_PAGE_PC858_EURO:t.from([27,116,19]),CODE_PAGE_KU42_THAI:t.from([27,116,20]),CODE_PAGE_TIS11_THAI:t.from([27,116,21]),CODE_PAGE_TIS18_THAI:t.from([27,116,26]),CODE_PAGE_TCVN3_VIETNAMESE_L:t.from([27,116,30]),CODE_PAGE_TCVN3_VIETNAMESE_U:t.from([27,116,31]),CODE_PAGE_PC720_ARABIC:t.from([27,116,32]),CODE_PAGE_WPC775_BALTIC_RIM:t.from([27,116,33]),CODE_PAGE_PC855_CYRILLIC:t.from([27,116,34]),CODE_PAGE_PC861_ICELANDIC:t.from([27,116,35]),CODE_PAGE_PC862_HEBREW:t.from([27,116,36]),CODE_PAGE_PC864_ARABIC:t.from([27,116,37]),CODE_PAGE_PC869_GREEK:t.from([27,116,38]),CODE_PAGE_ISO8859_2_LATIN2:t.from([27,116,39]),CODE_PAGE_ISO8859_15_LATIN9:t.from([27,116,40]),CODE_PAGE_PC1098_FARCI:t.from([27,116,41]),CODE_PAGE_PC1118_LITHUANIAN:t.from([27,116,42]),CODE_PAGE_PC1119_LITHUANIAN:t.from([27,116,43]),CODE_PAGE_PC1125_UKRANIAN:t.from([27,116,44]),CODE_PAGE_WPC1250_LATIN2:t.from([27,116,45]),CODE_PAGE_WPC1251_CYRILLIC:t.from([27,116,46]),CODE_PAGE_WPC1253_GREEK:t.from([27,116,47]),CODE_PAGE_WPC1254_TURKISH:t.from([27,116,48]),CODE_PAGE_WPC1255_HEBREW:t.from([27,116,49]),CODE_PAGE_WPC1256_ARABIC:t.from([27,116,50]),CODE_PAGE_WPC1257_BALTIC_RIM:t.from([27,116,51]),CODE_PAGE_WPC1258_VIETNAMESE:t.from([27,116,52]),CODE_PAGE_KZ1048_KAZAKHSTAN:t.from([27,116,53]),CODE_PAGE_JAPAN:t.from([27,82,8]),CODE_PAGE_KOREA:t.from([27,82,13]),CODE_PAGE_CHINA:t.from([27,82,15]),CODE_PAGE_HK_TW:t.from([27,82,0]),CODE_PAGES:{PC437_USA:"CP437",PC850_MULTILINGUAL:"CP850",PC860_PORTUGUESE:"CP860",PC863_CANADIAN_FRENCH:"CP863",PC865_NORDIC:"CP865",PC851_GREEK:"CP860",PC857_TURKISH:"CP857",PC737_GREEK:"CP737",ISO8859_7_GREEK:"ISO-8859-7",WPC1252:"CP1252",PC866_CYRILLIC2:"CP866",PC852_LATIN2:"CP852",SLOVENIA:"CP852",PC858_EURO:"CP858",WPC775_BALTIC_RIM:"CP775",PC855_CYRILLIC:"CP855",PC861_ICELANDIC:"CP861",PC862_HEBREW:"CP862",PC864_ARABIC:"CP864",PC869_GREEK:"CP869",ISO8859_2_LATIN2:"ISO-8859-2",ISO8859_15_LATIN9:"ISO-8859-15",PC1125_UKRANIAN:"CP1125",WPC1250_LATIN2:"WIN1250",WPC1251_CYRILLIC:"WIN1251",WPC1253_GREEK:"WIN1253",WPC1254_TURKISH:"WIN1254",WPC1255_HEBREW:"WIN1255",WPC1256_ARABIC:"WIN1256",WPC1257_BALTIC_RIM:"WIN1257",WPC1258_VIETNAMESE:"WIN1258",KZ1048_KAZAKHSTAN:"RK1048",JAPAN:"EUC-JP",KOREA:"EUC-KR",CHINA:"EUC-CN",HK_TW:"Big5-HKSCS"},BARCODE_TXT_OFF:t.from([29,72,0]),BARCODE_TXT_ABV:t.from([29,72,1]),BARCODE_TXT_BLW:t.from([29,72,2]),BARCODE_TXT_BTH:t.from([29,72,3]),BARCODE_FONT_A:t.from([29,102,0]),BARCODE_FONT_B:t.from([29,102,1]),BARCODE_HEIGHT:t.from([29,104,100]),BARCODE_WIDTH:t.from([29,119,3]),BARCODE_UPC_A:t.from([29,107,0]),BARCODE_UPC_E:t.from([29,107,1]),BARCODE_EAN13:t.from([29,107,2]),BARCODE_EAN8:t.from([29,107,3]),BARCODE_CODE39:t.from([29,107,4]),BARCODE_ITF:t.from([29,107,5]),BARCODE_NW7:t.from([29,107,6]),QRCODE_MODEL1:t.from([29,40,107,4,0,49,65,49,0]),QRCODE_MODEL2:t.from([29,40,107,4,0,49,65,50,0]),QRCODE_MODEL3:t.from([29,40,107,4,0,49,65,51,0]),QRCODE_CORRECTION_L:t.from([29,40,107,3,0,49,69,48]),QRCODE_CORRECTION_M:t.from([29,40,107,3,0,49,69,49]),QRCODE_CORRECTION_Q:t.from([29,40,107,3,0,49,69,50]),QRCODE_CORRECTION_H:t.from([29,40,107,3,0,49,69,51]),QRCODE_CELLSIZE_1:t.from([29,40,107,3,0,49,67,1]),QRCODE_CELLSIZE_2:t.from([29,40,107,3,0,49,67,2]),QRCODE_CELLSIZE_3:t.from([29,40,107,3,0,49,67,3]),QRCODE_CELLSIZE_4:t.from([29,40,107,3,0,49,67,4]),QRCODE_CELLSIZE_5:t.from([29,40,107,3,0,49,67,5]),QRCODE_CELLSIZE_6:t.from([29,40,107,3,0,49,67,6]),QRCODE_CELLSIZE_7:t.from([29,40,107,3,0,49,67,7]),QRCODE_CELLSIZE_8:t.from([29,40,107,3,0,49,67,8]),QRCODE_PRINT:t.from([29,40,107,3,0,49,81,48]),PDF417_CORRECTION:t.from([29,40,107,4,0,48,69,49]),PDF417_ROW_HEIGHT:t.from([29,40,107,3,0,48,68]),PDF417_WIDTH:t.from([29,40,107,3,0,48,67]),PDF417_COLUMNS:t.from([29,40,107,3,0,48,65]),PDF417_OPTION_STANDARD:t.from([29,40,107,3,0,48,70,0]),PDF417_OPTION_TRUNCATED:t.from([29,40,107,3,0,48,70,1]),PDF417_PRINT:t.from([29,40,107,3,0,48,81,48]),MAXI_MODE2:t.from([29,40,107,3,0,50,65,50]),MAXI_MODE3:t.from([29,40,107,3,0,50,65,51]),MAXI_MODE4:t.from([29,40,107,3,0,50,65,52]),MAXI_MODE5:t.from([29,40,107,3,0,50,65,53]),MAXI_MODE6:t.from([29,40,107,3,0,50,65,54]),MAXI_PRINT:t.from([29,40,107,3,0,50,81,48]),S_RASTER_N:t.from([29,118,48,0]),S_RASTER_2W:t.from([29,118,48,1]),S_RASTER_2H:t.from([29,118,48,2]),S_RASTER_Q:t.from([29,118,48,3]),PD_N50:t.from([29,124,0]),PD_N37:t.from([29,124,1]),PD_N25:t.from([29,124,2]),PD_N12:t.from([29,124,3]),PD_0:t.from([29,124,4]),PD_P50:t.from([29,124,8]),PD_P37:t.from([29,124,7]),PD_P25:t.from([29,124,6])}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){const n=r(3),o=r(34);e.exports=class extends n{constructor(){super(),this.config=o}append(e){this.buffer?this.buffer=t.concat([this.buffer,e]):this.buffer=e}setTextSize(e,r){if(this.buffer=null,e>144||e<0)throw new Error("setTextSize: Height must be between 0 and 7");let n=t.from([e]);return this.append(t.from([27,88,0])),this.append(n),this.append(t.from([0])),this.buffer}printBarcode(e,r,n){if(this.buffer=null,n=n||{},this.append(t.from([27,105])),this.append(t.from(r)),this.append(t.from(n.hri)),this.append(t.from(n.width)),this.append(t.from("h")),n.height<255)this.append(t.from((n.height.toString(16)+"").length<2?"0"+n.height.toString(16):n.height.toString(16),"hex")),this.append(t.from([0]));else{const e=n.height-256;this.append(t.from((e.toString(16)+"").length<2?"0"+e.toString(16):e.toString(16),"hex")),this.append(t.from([1]))}return"tb"!==r&&"tc"!==r||(this.append(t.from(n.o)),this.append(t.from(n.c))),this.append(t.from(n.e)),this.append(t.from(n.z)),this.append(t.from(n.f)),this.append(t.from([66])),this.append(t.from(e)),this.append(t.from([92])),this.buffer}printQR(e,r){return this.buffer=null,r=r||{},this.append(t.from([27,105,81])),this.append(t.from((r.cellSize.toString(16)+"").length<2?"0"+r.cellSize.toString(16):r.cellSize.toString(16),"hex")),this.append(t.from([2])),this.append(t.from([0])),this.append(t.from([0])),this.append(t.from([0])),this.append(t.from([0])),this.append(t.from([2])),this.append(t.from([0])),this.append(t.from(e)),this.append(t.from([92,92,92])),this.buffer}printImageBuffer(e,r,n){this.buffer=null,this.append(t.from([27,33,16]));for(var o=[],i=0;i<e;i++){for(var f=[],_=0;_<r;_++){var E=e*_+i<<2;f.push({r:n[E],g:n[E+1],b:n[E+2],a:n[E+3]})}o.push(f)}for(_=0;_<Math.ceil(r/48);_++){var C=[];for(i=0;i<e;i++)for(var a=0;a<6;a++){for(var s=0,m=0;m<8;m++){var A=o[i][48*_+8*a+m];if(void 0===A&&(A={a:0,r:0,g:0,b:0}),A.a>126)if(parseInt(.2126*A.r+.7152*A.g+.0722*A.b)<128)s|=1<<7-m}C.push(s)}this.append(t.from([27,42,72,e,0]));let r=t.from(C);this.append(r),this.append(t.from([10]))}return e%8!=0&&(e+=8),this.buffer}SetInternationalCharacterSet(e){return this.append(t.from([27,82,e])),this.buffer}}}).call(this,r(2).Buffer)},function(e,t,r){(function(t){e.exports={CTL_LF:t.from([10]),CTL_FF:t.from([12]),CTL_CR:t.from([13]),CTL_HT:t.from([9]),CTL_SET_HT:t.from([27,68]),CTL_VT:t.from([11]),HW_INIT:t.from([27,105,97,0,27,64]),HW_INITSOFT:t.from([27,64]),PAPER_FULL_CUT:t.from([27,105,67,1]),PAPER_PART_CUT:t.from([27,105,67,2]),TXT_2WIDTH:t.from([27,87,1]),TXT_2WIDTH_OFF:t.from([27,87,0]),TXT_UNDERL_OFF:t.from([27,45,0]),TXT_UNDERL_ON:t.from([27,45,1]),TXT_UNDERL2_ON:t.from([27,45,2]),TXT_BOLD_OFF:t.from([27,70]),TXT_BOLD_ON:t.from([27,69]),TXT_FONT_A:t.from([27,107,11]),TXT_ALIGN_LT:t.from([27,97,0]),TXT_ALIGN_CT:t.from([27,97,1]),TXT_ALIGN_RT:t.from([27,97,2]),CODE_PAGE_STANDARD:t.from([27,116,0]),CODE_PAGE_EASTERN_EUROPEAN:t.from([27,116,1]),CODE_PAGE_WESTERN_EUROPEAN:t.from([27,116,2]),CODE_PAGE_RESERVED:t.f