nfets 0.0.75 → 0.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CTG5M5GA.mjs → chunk-CQP3JLEA.mjs} +1 -1
- package/dist/{chunk-TVNW3GQ7.mjs → chunk-RBNELQ4L.mjs} +2 -2
- package/dist/core/index.cjs +20 -20
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.mjs +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/nfe/index.cjs +5 -5
- package/dist/nfe/index.d.cts +9 -9
- package/dist/nfe/index.d.ts +9 -9
- package/dist/nfe/index.mjs +1 -1
- package/dist/{xml-signer-CA6BEgl1.d.cts → xml-signer-CCwIT1uC.d.cts} +34 -31
- package/dist/{xml-signer-CA6BEgl1.d.ts → xml-signer-CCwIT1uC.d.ts} +34 -31
- package/package.json +1 -1
package/dist/nfe/index.cjs
CHANGED
|
@@ -96,20 +96,20 @@ Char: `+N.c),w=new Error(w),N.error=w,K(N,"onerror",w),N}o(ve,"error");function
|
|
|
96
96
|
Actual: `+N.attribValue);else if(L==="xmlns"&&N.attribValue!==y)Z(N,"xmlns: prefix must be bound to "+y+`
|
|
97
97
|
Actual: `+N.attribValue);else{var Ie=N.tag,Oe=N.tags[N.tags.length-1]||N;Ie.ns===Oe.ns&&(Ie.ns=Object.create(Oe.ns)),Ie.ns[L]=N.attribValue}N.attribList.push([N.attribName,N.attribValue])}else N.tag.attributes[N.attribName]=N.attribValue,H(N,"onattribute",{name:N.attribName,value:N.attribValue});N.attribName=N.attribValue=""}o(rt,"attrib");function se(N,w){if(N.opt.xmlns){var X=N.tag,L=je(N.tagName);X.prefix=L.prefix,X.local=L.local,X.uri=X.ns[L.prefix]||"",X.prefix&&!X.uri&&(Z(N,"Unbound namespace prefix: "+JSON.stringify(N.tagName)),X.uri=L.prefix);var Ie=N.tags[N.tags.length-1]||N;X.ns&&Ie.ns!==X.ns&&Object.keys(X.ns).forEach(function(Gi){H(N,"onopennamespace",{prefix:Gi,uri:X.ns[Gi]})});for(var Oe=0,De=N.attribList.length;Oe<De;Oe++){var nt=N.attribList[Oe],Vt=nt[0],We=nt[1],Ot=je(Vt,!0),ii=Ot.prefix,it=Ot.local,vn=ii===""?"":X.ns[ii]||"",Kn={name:Vt,value:We,prefix:ii,local:it,uri:vn};ii&&ii!=="xmlns"&&!vn&&(Z(N,"Unbound namespace prefix: "+JSON.stringify(ii)),Kn.uri=ii),N.tag.attributes[Vt]=Kn,H(N,"onattribute",Kn)}N.attribList.length=0}N.tag.isSelfClosing=!!w,N.sawRoot=!0,N.tags.push(N.tag),H(N,"onopentag",N.tag),w||(!N.noscript&&N.tagName.toLowerCase()==="script"?N.state=R.SCRIPT:N.state=R.TEXT,N.tag=null,N.tagName=""),N.attribName=N.attribValue="",N.attribList.length=0}o(se,"openTag");function te(N){if(!N.tagName){Z(N,"Weird empty close tag."),N.textNode+="</>",N.state=R.TEXT;return}if(N.script){if(N.tagName!=="script"){N.script+="</"+N.tagName+">",N.tagName="",N.state=R.SCRIPT;return}H(N,"onscript",N.script),N.script=""}var w=N.tags.length,X=N.tagName;N.strict||(X=X[N.looseCase]());for(var L=X;w--;){var Ie=N.tags[w];if(Ie.name!==L)Z(N,"Unexpected close tag");else break}if(w<0){Z(N,"Unmatched closing tag: "+N.tagName),N.textNode+="</"+N.tagName+">",N.state=R.TEXT;return}N.tagName=X;for(var Oe=N.tags.length;Oe-- >w;){var De=N.tag=N.tags.pop();N.tagName=N.tag.name,H(N,"onclosetag",N.tagName);var nt={};for(var Vt in De.ns)nt[Vt]=De.ns[Vt];var We=N.tags[N.tags.length-1]||N;N.opt.xmlns&&De.ns!==We.ns&&Object.keys(De.ns).forEach(function(Ot){var ii=De.ns[Ot];H(N,"onclosenamespace",{prefix:Ot,uri:ii})})}w===0&&(N.closedRoot=!0),N.tagName=N.attribValue=N.attribName="",N.attribList.length=0,N.state=R.TEXT}o(te,"closeTag");function Te(N){var w=N.entity,X=w.toLowerCase(),L,Ie="";return N.ENTITIES[w]?N.ENTITIES[w]:N.ENTITIES[X]?N.ENTITIES[X]:(w=X,w.charAt(0)==="#"&&(w.charAt(1)==="x"?(w=w.slice(2),L=parseInt(w,16),Ie=L.toString(16)):(w=w.slice(1),L=parseInt(w,10),Ie=L.toString(10))),w=w.replace(/^0+/,""),isNaN(L)||Ie.toLowerCase()!==w?(Z(N,"Invalid character entity"),"&"+N.entity+";"):String.fromCodePoint(L))}o(Te,"parseEntity");function Ye(N,w){w==="<"?(N.state=R.OPEN_WAKA,N.startTagPosition=N.position):C(w)||(Z(N,"Non-whitespace before first tag."),N.textNode=w,N.state=R.TEXT)}o(Ye,"beginWhiteSpace");function He(N,w){var X="";return w<N.length&&(X=N.charAt(w)),X}o(He,"charAt");function ct(N){var w=this;if(this.error)throw this.error;if(w.closed)return ve(w,"Cannot write after close. Assign an onready handler.");if(N===null)return le(w);typeof N=="object"&&(N=N.toString());for(var X=0,L="";L=He(N,X++),w.c=L,!!L;)switch(w.trackPosition&&(w.position++,L===`
|
|
98
98
|
`?(w.line++,w.column=0):w.column++),w.state){case R.BEGIN:if(w.state=R.BEGIN_WHITESPACE,L==="\uFEFF")continue;Ye(w,L);continue;case R.BEGIN_WHITESPACE:Ye(w,L);continue;case R.TEXT:if(w.sawRoot&&!w.closedRoot){for(var Ie=X-1;L&&L!=="<"&&L!=="&";)L=He(N,X++),L&&w.trackPosition&&(w.position++,L===`
|
|
99
|
-
`?(w.line++,w.column=0):w.column++);w.textNode+=N.substring(Ie,X-1)}L==="<"&&!(w.sawRoot&&w.closedRoot&&!w.strict)?(w.state=R.OPEN_WAKA,w.startTagPosition=w.position):(!C(L)&&(!w.sawRoot||w.closedRoot)&&Z(w,"Text data outside of root node."),L==="&"?w.state=R.TEXT_ENTITY:w.textNode+=L);continue;case R.SCRIPT:L==="<"?w.state=R.SCRIPT_ENDING:w.script+=L;continue;case R.SCRIPT_ENDING:L==="/"?w.state=R.CLOSE_TAG:(w.script+="<"+L,w.state=R.SCRIPT);continue;case R.OPEN_WAKA:if(L==="!")w.state=R.SGML_DECL,w.sgmlDecl="";else if(!C(L))if(B(x,L))w.state=R.OPEN_TAG,w.tagName=L;else if(L==="/")w.state=R.CLOSE_TAG,w.tagName="";else if(L==="?")w.state=R.PROC_INST,w.procInstName=w.procInstBody="";else{if(Z(w,"Unencoded <"),w.startTagPosition+1<w.position){var Oe=w.position-w.startTagPosition;L=new Array(Oe).join(" ")+L}w.textNode+="<"+L,w.state=R.TEXT}continue;case R.SGML_DECL:if(w.sgmlDecl+L==="--"){w.state=R.COMMENT,w.comment="",w.sgmlDecl="";continue}w.doctype&&w.doctype!==!0&&w.sgmlDecl?(w.state=R.DOCTYPE_DTD,w.doctype+="<!"+w.sgmlDecl+L,w.sgmlDecl=""):(w.sgmlDecl+L).toUpperCase()===p?(H(w,"onopencdata"),w.state=R.CDATA,w.sgmlDecl="",w.cdata=""):(w.sgmlDecl+L).toUpperCase()===d?(w.state=R.DOCTYPE,(w.doctype||w.sawRoot)&&Z(w,"Inappropriately located doctype declaration"),w.doctype="",w.sgmlDecl=""):L===">"?(H(w,"onsgmldeclaration",w.sgmlDecl),w.sgmlDecl="",w.state=R.TEXT):(E(L)&&(w.state=R.SGML_DECL_QUOTED),w.sgmlDecl+=L);continue;case R.SGML_DECL_QUOTED:L===w.q&&(w.state=R.SGML_DECL,w.q=""),w.sgmlDecl+=L;continue;case R.DOCTYPE:L===">"?(w.state=R.TEXT,H(w,"ondoctype",w.doctype),w.doctype=!0):(w.doctype+=L,L==="["?w.state=R.DOCTYPE_DTD:E(L)&&(w.state=R.DOCTYPE_QUOTED,w.q=L));continue;case R.DOCTYPE_QUOTED:w.doctype+=L,L===w.q&&(w.q="",w.state=R.DOCTYPE);continue;case R.DOCTYPE_DTD:L==="]"?(w.doctype+=L,w.state=R.DOCTYPE):L==="<"?(w.state=R.OPEN_WAKA,w.startTagPosition=w.position):E(L)?(w.doctype+=L,w.state=R.DOCTYPE_DTD_QUOTED,w.q=L):w.doctype+=L;continue;case R.DOCTYPE_DTD_QUOTED:w.doctype+=L,L===w.q&&(w.state=R.DOCTYPE_DTD,w.q="");continue;case R.COMMENT:L==="-"?w.state=R.COMMENT_ENDING:w.comment+=L;continue;case R.COMMENT_ENDING:L==="-"?(w.state=R.COMMENT_ENDED,w.comment=ge(w.opt,w.comment),w.comment&&H(w,"oncomment",w.comment),w.comment=""):(w.comment+="-"+L,w.state=R.COMMENT);continue;case R.COMMENT_ENDED:L!==">"?(Z(w,"Malformed comment"),w.comment+="--"+L,w.state=R.COMMENT):w.doctype&&w.doctype!==!0?w.state=R.DOCTYPE_DTD:w.state=R.TEXT;continue;case R.CDATA:L==="]"?w.state=R.CDATA_ENDING:w.cdata+=L;continue;case R.CDATA_ENDING:L==="]"?w.state=R.CDATA_ENDING_2:(w.cdata+="]"+L,w.state=R.CDATA);continue;case R.CDATA_ENDING_2:L===">"?(w.cdata&&H(w,"oncdata",w.cdata),H(w,"onclosecdata"),w.cdata="",w.state=R.TEXT):L==="]"?w.cdata+="]":(w.cdata+="]]"+L,w.state=R.CDATA);continue;case R.PROC_INST:L==="?"?w.state=R.PROC_INST_ENDING:C(L)?w.state=R.PROC_INST_BODY:w.procInstName+=L;continue;case R.PROC_INST_BODY:if(!w.procInstBody&&C(L))continue;L==="?"?w.state=R.PROC_INST_ENDING:w.procInstBody+=L;continue;case R.PROC_INST_ENDING:L===">"?(H(w,"onprocessinginstruction",{name:w.procInstName,body:w.procInstBody}),w.procInstName=w.procInstBody="",w.state=R.TEXT):(w.procInstBody+="?"+L,w.state=R.PROC_INST_BODY);continue;case R.OPEN_TAG:B(S,L)?w.tagName+=L:(xe(w),L===">"?se(w):L==="/"?w.state=R.OPEN_TAG_SLASH:(C(L)||Z(w,"Invalid character in tag name"),w.state=R.ATTRIB));continue;case R.OPEN_TAG_SLASH:L===">"?(se(w,!0),te(w)):(Z(w,"Forward-slash in opening tag not followed by >"),w.state=R.ATTRIB);continue;case R.ATTRIB:if(C(L))continue;L===">"?se(w):L==="/"?w.state=R.OPEN_TAG_SLASH:B(x,L)?(w.attribName=L,w.attribValue="",w.state=R.ATTRIB_NAME):Z(w,"Invalid attribute name");continue;case R.ATTRIB_NAME:L==="="?w.state=R.ATTRIB_VALUE:L===">"?(Z(w,"Attribute without value"),w.attribValue=w.attribName,rt(w),se(w)):C(L)?w.state=R.ATTRIB_NAME_SAW_WHITE:B(S,L)?w.attribName+=L:Z(w,"Invalid attribute name");continue;case R.ATTRIB_NAME_SAW_WHITE:if(L==="=")w.state=R.ATTRIB_VALUE;else{if(C(L))continue;Z(w,"Attribute without value"),w.tag.attributes[w.attribName]="",w.attribValue="",H(w,"onattribute",{name:w.attribName,value:""}),w.attribName="",L===">"?se(w):B(x,L)?(w.attribName=L,w.state=R.ATTRIB_NAME):(Z(w,"Invalid attribute name"),w.state=R.ATTRIB)}continue;case R.ATTRIB_VALUE:if(C(L))continue;E(L)?(w.q=L,w.state=R.ATTRIB_VALUE_QUOTED):(w.opt.unquotedAttributeValues||ve(w,"Unquoted attribute value"),w.state=R.ATTRIB_VALUE_UNQUOTED,w.attribValue=L);continue;case R.ATTRIB_VALUE_QUOTED:if(L!==w.q){L==="&"?w.state=R.ATTRIB_VALUE_ENTITY_Q:w.attribValue+=L;continue}rt(w),w.q="",w.state=R.ATTRIB_VALUE_CLOSED;continue;case R.ATTRIB_VALUE_CLOSED:C(L)?w.state=R.ATTRIB:L===">"?se(w):L==="/"?w.state=R.OPEN_TAG_SLASH:B(x,L)?(Z(w,"No whitespace between attributes"),w.attribName=L,w.attribValue="",w.state=R.ATTRIB_NAME):Z(w,"Invalid attribute name");continue;case R.ATTRIB_VALUE_UNQUOTED:if(!I(L)){L==="&"?w.state=R.ATTRIB_VALUE_ENTITY_U:w.attribValue+=L;continue}rt(w),L===">"?se(w):w.state=R.ATTRIB;continue;case R.CLOSE_TAG:if(w.tagName)L===">"?te(w):B(S,L)?w.tagName+=L:w.script?(w.script+="</"+w.tagName,w.tagName="",w.state=R.SCRIPT):(C(L)||Z(w,"Invalid tagname in closing tag"),w.state=R.CLOSE_TAG_SAW_WHITE);else{if(C(L))continue;q(x,L)?w.script?(w.script+="</"+L,w.state=R.SCRIPT):Z(w,"Invalid tagname in closing tag."):w.tagName=L}continue;case R.CLOSE_TAG_SAW_WHITE:if(C(L))continue;L===">"?te(w):Z(w,"Invalid characters in closing tag");continue;case R.TEXT_ENTITY:case R.ATTRIB_VALUE_ENTITY_Q:case R.ATTRIB_VALUE_ENTITY_U:var De,nt;switch(w.state){case R.TEXT_ENTITY:De=R.TEXT,nt="textNode";break;case R.ATTRIB_VALUE_ENTITY_Q:De=R.ATTRIB_VALUE_QUOTED,nt="attribValue";break;case R.ATTRIB_VALUE_ENTITY_U:De=R.ATTRIB_VALUE_UNQUOTED,nt="attribValue";break}if(L===";"){var Vt=Te(w);w.opt.unparsedEntities&&!Object.values(r.XML_ENTITIES).includes(Vt)?(w.entity="",w.state=De,w.write(Vt)):(w[nt]+=Vt,w.entity="",w.state=De)}else B(w.entity.length?D:A,L)?w.entity+=L:(Z(w,"Invalid character in entity name"),w[nt]+="&"+w.entity+L,w.entity="",w.state=De);continue;default:throw new Error(w,"Unknown state: "+w.state)}return w.position>=w.bufferCheckPosition&&n(w),w}o(ct,"write");String.fromCodePoint||(function(){var N=String.fromCharCode,w=Math.floor,X=o(function(){var L=16384,Ie=[],Oe,De,nt=-1,Vt=arguments.length;if(!Vt)return"";for(var We="";++nt<Vt;){var Ot=Number(arguments[nt]);if(!isFinite(Ot)||Ot<0||Ot>1114111||w(Ot)!==Ot)throw RangeError("Invalid code point: "+Ot);Ot<=65535?Ie.push(Ot):(Ot-=65536,Oe=(Ot>>10)+55296,De=Ot%1024+56320,Ie.push(Oe,De)),(nt+1===Vt||Ie.length>L)&&(We+=N.apply(null,Ie),Ie.length=0)}return We},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:X,configurable:!0,writable:!0}):String.fromCodePoint=X})()})(typeof hO>"u"?hO.sax={}:hO)});var $ee=Q(PV=>{"use strict";(function(){"use strict";PV.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(PV)});var _V=Q(J0=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),J0.normalize=function(e){return e.toLowerCase()},J0.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},J0.stripPrefix=function(e){return e.replace(r,"")},J0.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},J0.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(J0)});var Zee=Q(np=>{"use strict";(function(){"use strict";var r,e,t,n,i,s,a,u,c,l=o(function(g,y){return function(){return g.apply(y,arguments)}},"bind"),p=o(function(g,y){for(var v in y)d.call(y,v)&&(g[v]=y[v]);function x(){this.constructor=g}return o(x,"ctor"),x.prototype=y.prototype,g.prototype=new x,g.__super__=y.prototype,g},"extend"),d={}.hasOwnProperty;u=Qee(),n=require("events"),r=$ee(),a=_V(),c=require("timers").setImmediate,e=$D().defaults,i=o(function(g){return typeof g=="object"&&g!=null&&Object.keys(g).length===0},"isEmpty"),s=o(function(g,y,v){var x,S,A;for(x=0,S=g.length;x<S;x++)A=g[x],y=A(y,v);return y},"processItem"),t=o(function(g,y,v){var x;return x=Object.create(null),x.value=v,x.writable=!0,x.enumerable=!0,x.configurable=!0,Object.defineProperty(g,y,x)},"defineProperty"),np.Parser=(function(g){p(y,g);function y(v){this.parseStringPromise=l(this.parseStringPromise,this),this.parseString=l(this.parseString,this),this.reset=l(this.reset,this),this.assignOrPush=l(this.assignOrPush,this),this.processAsync=l(this.processAsync,this);var x,S,A;if(!(this instanceof np.Parser))return new np.Parser(v);this.options={},S=e["0.2"];for(x in S)d.call(S,x)&&(A=S[x],this.options[x]=A);for(x in v)d.call(v,x)&&(A=v[x],this.options[x]=A);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(y,"Parser"),y.prototype.processAsync=function(){var v,x;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),c(this.processAsync))}catch(S){if(x=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(x)}},y.prototype.assignOrPush=function(v,x,S){return x in v?(v[x]instanceof Array||t(v,x,[v[x]]),v[x].push(S)):this.options.explicitArray?t(v,x,[S]):t(v,x,S)},y.prototype.reset=function(){var v,x,S,A;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(D){return function(C){if(D.saxParser.resume(),!D.saxParser.errThrown)return D.saxParser.errThrown=!0,D.emit("error",C)}})(this),this.saxParser.onend=(function(D){return function(){if(!D.saxParser.ended)return D.saxParser.ended=!0,D.emit("end",D.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,A=[],v=this.options.attrkey,x=this.options.charkey,this.saxParser.onopentag=(function(D){return function(C){var E,I,B,q,R;if(B={},B[x]="",!D.options.ignoreAttrs){R=C.attributes;for(E in R)d.call(R,E)&&(!(v in B)&&!D.options.mergeAttrs&&(B[v]={}),I=D.options.attrValueProcessors?s(D.options.attrValueProcessors,C.attributes[E],E):C.attributes[E],q=D.options.attrNameProcessors?s(D.options.attrNameProcessors,E):E,D.options.mergeAttrs?D.assignOrPush(B,q,I):t(B[v],q,I))}return B["#name"]=D.options.tagNameProcessors?s(D.options.tagNameProcessors,C.name):C.name,D.options.xmlns&&(B[D.options.xmlnskey]={uri:C.uri,local:C.local}),A.push(B)}})(this),this.saxParser.onclosetag=(function(D){return function(){var C,E,I,B,q,R,z,K,H,J;if(R=A.pop(),q=R["#name"],(!D.options.explicitChildren||!D.options.preserveChildrenOrder)&&delete R["#name"],R.cdata===!0&&(C=R.cdata,delete R.cdata),H=A[A.length-1],R[x].match(/^\s*$/)&&!C?(E=R[x],delete R[x]):(D.options.trim&&(R[x]=R[x].trim()),D.options.normalize&&(R[x]=R[x].replace(/\s{2,}/g," ").trim()),R[x]=D.options.valueProcessors?s(D.options.valueProcessors,R[x],q):R[x],Object.keys(R).length===1&&x in R&&!D.EXPLICIT_CHARKEY&&(R=R[x])),i(R)&&(typeof D.options.emptyTag=="function"?R=D.options.emptyTag():R=D.options.emptyTag!==""?D.options.emptyTag:E),D.options.validator!=null&&(J="/"+(function(){var ge,ve,le;for(le=[],ge=0,ve=A.length;ge<ve;ge++)B=A[ge],le.push(B["#name"]);return le})().concat(q).join("/"),(function(){var ge;try{return R=D.options.validator(J,H&&H[q],R)}catch(ve){return ge=ve,D.emit("error",ge)}})()),D.options.explicitChildren&&!D.options.mergeAttrs&&typeof R=="object"){if(!D.options.preserveChildrenOrder)B={},D.options.attrkey in R&&(B[D.options.attrkey]=R[D.options.attrkey],delete R[D.options.attrkey]),!D.options.charsAsChildren&&D.options.charkey in R&&(B[D.options.charkey]=R[D.options.charkey],delete R[D.options.charkey]),Object.getOwnPropertyNames(R).length>0&&(B[D.options.childkey]=R),R=B;else if(H){H[D.options.childkey]=H[D.options.childkey]||[],z={};for(I in R)d.call(R,I)&&t(z,I,R[I]);H[D.options.childkey].push(z),delete R["#name"],Object.keys(R).length===1&&x in R&&!D.EXPLICIT_CHARKEY&&(R=R[x])}}return A.length>0?D.assignOrPush(H,q,R):(D.options.explicitRoot&&(K=R,R={},t(R,q,K)),D.resultObject=R,D.saxParser.ended=!0,D.emit("end",D.resultObject))}})(this),S=(function(D){return function(C){var E,I;if(I=A[A.length-1],I)return I[x]+=C,D.options.explicitChildren&&D.options.preserveChildrenOrder&&D.options.charsAsChildren&&(D.options.includeWhiteChars||C.replace(/\\n/g,"").trim()!=="")&&(I[D.options.childkey]=I[D.options.childkey]||[],E={"#name":"__text__"},E[x]=C,D.options.normalize&&(E[x]=E[x].replace(/\s{2,}/g," ").trim()),I[D.options.childkey].push(E)),I}})(this),this.saxParser.ontext=S,this.saxParser.oncdata=(function(D){return function(C){var E;if(E=S(C),E)return E.cdata=!0}})(this)},y.prototype.parseString=function(v,x){var S;x!=null&&typeof x=="function"&&(this.on("end",function(A){return this.reset(),x(null,A)}),this.on("error",function(A){return this.reset(),x(A)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=r.stripBOM(v),this.options.async?(this.remaining=v,c(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(A){if(S=A,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},y.prototype.parseStringPromise=function(v){return new Promise((function(x){return function(S,A){return x.parseString(v,function(D,C){return D?A(D):S(C)})}})(this))},y})(n),np.parseString=function(g,y,v){var x,S,A;return v!=null?(typeof v=="function"&&(x=v),typeof y=="object"&&(S=y)):(typeof y=="function"&&(x=y),S={}),A=new np.Parser(S),A.parseString(g,x)},np.parseStringPromise=function(g,y){var v,x;return typeof y=="object"&&(v=y),x=new np.Parser(v),x.parseStringPromise(g)}}).call(np)});var ete=Q(ip=>{"use strict";(function(){"use strict";var r,e,t,n,i=o(function(a,u){for(var c in u)s.call(u,c)&&(a[c]=u[c]);function l(){this.constructor=a}return o(l,"ctor"),l.prototype=u.prototype,a.prototype=new l,a.__super__=u.prototype,a},"extend"),s={}.hasOwnProperty;e=$D(),r=Yee(),t=Zee(),n=_V(),ip.defaults=e.defaults,ip.processors=n,ip.ValidationError=(function(a){i(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),ip.Builder=r.Builder,ip.Parser=t.Parser,ip.parseString=t.parseString,ip.parseStringPromise=t.parseStringPromise}).call(ip)});var rU=Q((rlt,Bie)=>{"use strict";Bie.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var n0=Q(ey=>{"use strict";var nU,wBe=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];ey.getSymbolSize=o(function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},"getSymbolSize");ey.getSymbolTotalCodewords=o(function(e){return wBe[e]},"getSymbolTotalCodewords");ey.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};ey.setToSJISFunction=o(function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nU=e},"setToSJISFunction");ey.isKanjiModeEnabled=function(){return typeof nU<"u"};ey.toSJIS=o(function(e){return nU(e)},"toSJIS")});var z_=Q(Yu=>{"use strict";Yu.L={bit:1};Yu.M={bit:0};Yu.Q={bit:3};Yu.H={bit:2};function CBe(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return Yu.L;case"m":case"medium":return Yu.M;case"q":case"quartile":return Yu.Q;case"h":case"high":return Yu.H;default:throw new Error("Unknown EC Level: "+r)}}o(CBe,"fromString");Yu.isValid=o(function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4},"isValid");Yu.from=o(function(e,t){if(Yu.isValid(e))return e;try{return CBe(e)}catch{return t}},"from")});var Lie=Q((olt,_ie)=>{"use strict";function Pie(){this.buffer=[],this.length=0}o(Pie,"BitBuffer");Pie.prototype={get:o(function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},"get"),put:o(function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},"put"),getLengthInBits:o(function(){return this.length},"getLengthInBits"),putBit:o(function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++},"putBit")};_ie.exports=Pie});var kie=Q((clt,Fie)=>{"use strict";function sI(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}o(sI,"BitMatrix");sI.prototype.set=function(r,e,t,n){let i=r*this.size+e;this.data[i]=t,n&&(this.reservedBit[i]=!0)};sI.prototype.get=function(r,e){return this.data[r*this.size+e]};sI.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};sI.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};Fie.exports=sI});var Vie=Q(K_=>{"use strict";var EBe=n0().getSymbolSize;K_.getRowColCoords=o(function(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=EBe(e),i=n===145?26:Math.ceil((n-13)/(2*t-2))*2,s=[n-7];for(let a=1;a<t-1;a++)s[a]=s[a-1]-i;return s.push(6),s.reverse()},"getRowColCoords");K_.getPositions=o(function(e){let t=[],n=K_.getRowColCoords(e),i=n.length;for(let s=0;s<i;s++)for(let a=0;a<i;a++)s===0&&a===0||s===0&&a===i-1||s===i-1&&a===0||t.push([n[s],n[a]]);return t},"getPositions")});var Uie=Q(Mie=>{"use strict";var ABe=n0().getSymbolSize,jie=7;Mie.getPositions=o(function(e){let t=ABe(e);return[[0,0],[t-jie,0],[0,t-jie]]},"getPositions")});var qie=Q(kn=>{"use strict";kn.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ty={N1:3,N2:3,N3:40,N4:10};kn.isValid=o(function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},"isValid");kn.from=o(function(e){return kn.isValid(e)?parseInt(e,10):void 0},"from");kn.getPenaltyN1=o(function(e){let t=e.size,n=0,i=0,s=0,a=null,u=null;for(let c=0;c<t;c++){i=s=0,a=u=null;for(let l=0;l<t;l++){let p=e.get(c,l);p===a?i++:(i>=5&&(n+=ty.N1+(i-5)),a=p,i=1),p=e.get(l,c),p===u?s++:(s>=5&&(n+=ty.N1+(s-5)),u=p,s=1)}i>=5&&(n+=ty.N1+(i-5)),s>=5&&(n+=ty.N1+(s-5))}return n},"getPenaltyN1");kn.getPenaltyN2=o(function(e){let t=e.size,n=0;for(let i=0;i<t-1;i++)for(let s=0;s<t-1;s++){let a=e.get(i,s)+e.get(i,s+1)+e.get(i+1,s)+e.get(i+1,s+1);(a===4||a===0)&&n++}return n*ty.N2},"getPenaltyN2");kn.getPenaltyN3=o(function(e){let t=e.size,n=0,i=0,s=0;for(let a=0;a<t;a++){i=s=0;for(let u=0;u<t;u++)i=i<<1&2047|e.get(a,u),u>=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(u,a),u>=10&&(s===1488||s===93)&&n++}return n*ty.N3},"getPenaltyN3");kn.getPenaltyN4=o(function(e){let t=0,n=e.data.length;for(let s=0;s<n;s++)t+=e.data[s];return Math.abs(Math.ceil(t*100/n/5)-10)*ty.N4},"getPenaltyN4");function NBe(r,e,t){switch(r){case kn.Patterns.PATTERN000:return(e+t)%2===0;case kn.Patterns.PATTERN001:return e%2===0;case kn.Patterns.PATTERN010:return t%3===0;case kn.Patterns.PATTERN011:return(e+t)%3===0;case kn.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case kn.Patterns.PATTERN101:return e*t%2+e*t%3===0;case kn.Patterns.PATTERN110:return(e*t%2+e*t%3)%2===0;case kn.Patterns.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}o(NBe,"getMaskAt");kn.applyMask=o(function(e,t){let n=t.size;for(let i=0;i<n;i++)for(let s=0;s<n;s++)t.isReserved(s,i)||t.xor(s,i,NBe(e,s,i))},"applyMask");kn.getBestMask=o(function(e,t){let n=Object.keys(kn.Patterns).length,i=0,s=1/0;for(let a=0;a<n;a++){t(a),kn.applyMask(a,e);let u=kn.getPenaltyN1(e)+kn.getPenaltyN2(e)+kn.getPenaltyN3(e)+kn.getPenaltyN4(e);kn.applyMask(a,e),u<s&&(s=u,i=a)}return i},"getBestMask")});var sU=Q(iU=>{"use strict";var i0=z_(),G_=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],X_=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];iU.getBlocksCount=o(function(e,t){switch(t){case i0.L:return G_[(e-1)*4+0];case i0.M:return G_[(e-1)*4+1];case i0.Q:return G_[(e-1)*4+2];case i0.H:return G_[(e-1)*4+3];default:return}},"getBlocksCount");iU.getTotalCodewordsCount=o(function(e,t){switch(t){case i0.L:return X_[(e-1)*4+0];case i0.M:return X_[(e-1)*4+1];case i0.Q:return X_[(e-1)*4+2];case i0.H:return X_[(e-1)*4+3];default:return}},"getTotalCodewordsCount")});var Hie=Q(J_=>{"use strict";var aI=new Uint8Array(512),W_=new Uint8Array(256);o((function(){let e=1;for(let t=0;t<255;t++)aI[t]=e,W_[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)aI[t]=aI[t-255]}),"initTables")();J_.log=o(function(e){if(e<1)throw new Error("log("+e+")");return W_[e]},"log");J_.exp=o(function(e){return aI[e]},"exp");J_.mul=o(function(e,t){return e===0||t===0?0:aI[W_[e]+W_[t]]},"mul")});var zie=Q(oI=>{"use strict";var aU=Hie();oI.mul=o(function(e,t){let n=new Uint8Array(e.length+t.length-1);for(let i=0;i<e.length;i++)for(let s=0;s<t.length;s++)n[i+s]^=aU.mul(e[i],t[s]);return n},"mul");oI.mod=o(function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){let i=n[0];for(let a=0;a<t.length;a++)n[a]^=aU.mul(t[a],i);let s=0;for(;s<n.length&&n[s]===0;)s++;n=n.slice(s)}return n},"mod");oI.generateECPolynomial=o(function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=oI.mul(t,new Uint8Array([1,aU.exp(n)]));return t},"generateECPolynomial")});var Xie=Q((Clt,Gie)=>{"use strict";var Kie=zie();function oU(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}o(oU,"ReedSolomonEncoder");oU.prototype.initialize=o(function(e){this.degree=e,this.genPoly=Kie.generateECPolynomial(this.degree)},"initialize");oU.prototype.encode=o(function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let n=Kie.mod(t,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n},"encode");Gie.exports=oU});var uU=Q(Wie=>{"use strict";Wie.isValid=o(function(e){return!isNaN(e)&&e>=1&&e<=40},"isValid")});var cU=Q(wh=>{"use strict";var Jie="[0-9]+",IBe="[A-Z $%*+\\-./:]+",uI="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";uI=uI.replace(/u/g,"\\u");var TBe="(?:(?![A-Z0-9 $%*+\\-./:]|"+uI+`)(?:.|[\r
|
|
100
|
-
]))+`;wh.KANJI=new RegExp(uI,"g");wh.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");wh.BYTE=new RegExp(TBe,"g");wh.NUMERIC=new RegExp(Jie,"g");wh.ALPHANUMERIC=new RegExp(IBe,"g");var RBe=new RegExp("^"+uI+"$"),DBe=new RegExp("^"+Jie+"$"),OBe=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");wh.testKanji=o(function(e){return RBe.test(e)},"testKanji");wh.testNumeric=o(function(e){return DBe.test(e)},"testNumeric");wh.testAlphanumeric=o(function(e){return OBe.test(e)},"testAlphanumeric")});var s0=Q(Ki=>{"use strict";var BBe=uU(),lU=cU();Ki.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Ki.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Ki.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Ki.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Ki.MIXED={bit:-1};Ki.getCharCountIndicator=o(function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!BBe.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},"getCharCountIndicator");Ki.getBestModeForData=o(function(e){return lU.testNumeric(e)?Ki.NUMERIC:lU.testAlphanumeric(e)?Ki.ALPHANUMERIC:lU.testKanji(e)?Ki.KANJI:Ki.BYTE},"getBestModeForData");Ki.toString=o(function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},"toString");Ki.isValid=o(function(e){return e&&e.bit&&e.ccBits},"isValid");function PBe(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return Ki.NUMERIC;case"alphanumeric":return Ki.ALPHANUMERIC;case"kanji":return Ki.KANJI;case"byte":return Ki.BYTE;default:throw new Error("Unknown mode: "+r)}}o(PBe,"fromString");Ki.from=o(function(e,t){if(Ki.isValid(e))return e;try{return PBe(e)}catch{return t}},"from")});var ese=Q(ry=>{"use strict";var Y_=n0(),_Be=sU(),Yie=z_(),a0=s0(),fU=uU(),$ie=7973,Qie=Y_.getBCHDigit($ie);function LBe(r,e,t){for(let n=1;n<=40;n++)if(e<=ry.getCapacity(n,t,r))return n}o(LBe,"getBestVersionForDataLength");function Zie(r,e){return a0.getCharCountIndicator(r,e)+4}o(Zie,"getReservedBitsCount");function FBe(r,e){let t=0;return r.forEach(function(n){let i=Zie(n.mode,e);t+=i+n.getBitsLength()}),t}o(FBe,"getTotalBitsFromDataArray");function kBe(r,e){for(let t=1;t<=40;t++)if(FBe(r,t)<=ry.getCapacity(t,e,a0.MIXED))return t}o(kBe,"getBestVersionForMixedData");ry.from=o(function(e,t){return fU.isValid(e)?parseInt(e,10):t},"from");ry.getCapacity=o(function(e,t,n){if(!fU.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=a0.BYTE);let i=Y_.getSymbolTotalCodewords(e),s=_Be.getTotalCodewordsCount(e,t),a=(i-s)*8;if(n===a0.MIXED)return a;let u=a-Zie(n,e);switch(n){case a0.NUMERIC:return Math.floor(u/10*3);case a0.ALPHANUMERIC:return Math.floor(u/11*2);case a0.KANJI:return Math.floor(u/13);case a0.BYTE:default:return Math.floor(u/8)}},"getCapacity");ry.getBestVersionForData=o(function(e,t){let n,i=Yie.from(t,Yie.M);if(Array.isArray(e)){if(e.length>1)return kBe(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return LBe(n.mode,n.getLength(),i)},"getBestVersionForData");ry.getEncodedBits=o(function(e){if(!fU.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Y_.getBCHDigit(t)-Qie>=0;)t^=$ie<<Y_.getBCHDigit(t)-Qie;return e<<12|t},"getEncodedBits")});var ise=Q(nse=>{"use strict";var pU=n0(),rse=1335,VBe=21522,tse=pU.getBCHDigit(rse);nse.getEncodedBits=o(function(e,t){let n=e.bit<<3|t,i=n<<10;for(;pU.getBCHDigit(i)-tse>=0;)i^=rse<<pU.getBCHDigit(i)-tse;return(n<<10|i)^VBe},"getEncodedBits")});var ase=Q((
|
|
101
|
-
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};fse.exports=rw});var hse=Q((
|
|
99
|
+
`?(w.line++,w.column=0):w.column++);w.textNode+=N.substring(Ie,X-1)}L==="<"&&!(w.sawRoot&&w.closedRoot&&!w.strict)?(w.state=R.OPEN_WAKA,w.startTagPosition=w.position):(!C(L)&&(!w.sawRoot||w.closedRoot)&&Z(w,"Text data outside of root node."),L==="&"?w.state=R.TEXT_ENTITY:w.textNode+=L);continue;case R.SCRIPT:L==="<"?w.state=R.SCRIPT_ENDING:w.script+=L;continue;case R.SCRIPT_ENDING:L==="/"?w.state=R.CLOSE_TAG:(w.script+="<"+L,w.state=R.SCRIPT);continue;case R.OPEN_WAKA:if(L==="!")w.state=R.SGML_DECL,w.sgmlDecl="";else if(!C(L))if(B(x,L))w.state=R.OPEN_TAG,w.tagName=L;else if(L==="/")w.state=R.CLOSE_TAG,w.tagName="";else if(L==="?")w.state=R.PROC_INST,w.procInstName=w.procInstBody="";else{if(Z(w,"Unencoded <"),w.startTagPosition+1<w.position){var Oe=w.position-w.startTagPosition;L=new Array(Oe).join(" ")+L}w.textNode+="<"+L,w.state=R.TEXT}continue;case R.SGML_DECL:if(w.sgmlDecl+L==="--"){w.state=R.COMMENT,w.comment="",w.sgmlDecl="";continue}w.doctype&&w.doctype!==!0&&w.sgmlDecl?(w.state=R.DOCTYPE_DTD,w.doctype+="<!"+w.sgmlDecl+L,w.sgmlDecl=""):(w.sgmlDecl+L).toUpperCase()===p?(H(w,"onopencdata"),w.state=R.CDATA,w.sgmlDecl="",w.cdata=""):(w.sgmlDecl+L).toUpperCase()===d?(w.state=R.DOCTYPE,(w.doctype||w.sawRoot)&&Z(w,"Inappropriately located doctype declaration"),w.doctype="",w.sgmlDecl=""):L===">"?(H(w,"onsgmldeclaration",w.sgmlDecl),w.sgmlDecl="",w.state=R.TEXT):(E(L)&&(w.state=R.SGML_DECL_QUOTED),w.sgmlDecl+=L);continue;case R.SGML_DECL_QUOTED:L===w.q&&(w.state=R.SGML_DECL,w.q=""),w.sgmlDecl+=L;continue;case R.DOCTYPE:L===">"?(w.state=R.TEXT,H(w,"ondoctype",w.doctype),w.doctype=!0):(w.doctype+=L,L==="["?w.state=R.DOCTYPE_DTD:E(L)&&(w.state=R.DOCTYPE_QUOTED,w.q=L));continue;case R.DOCTYPE_QUOTED:w.doctype+=L,L===w.q&&(w.q="",w.state=R.DOCTYPE);continue;case R.DOCTYPE_DTD:L==="]"?(w.doctype+=L,w.state=R.DOCTYPE):L==="<"?(w.state=R.OPEN_WAKA,w.startTagPosition=w.position):E(L)?(w.doctype+=L,w.state=R.DOCTYPE_DTD_QUOTED,w.q=L):w.doctype+=L;continue;case R.DOCTYPE_DTD_QUOTED:w.doctype+=L,L===w.q&&(w.state=R.DOCTYPE_DTD,w.q="");continue;case R.COMMENT:L==="-"?w.state=R.COMMENT_ENDING:w.comment+=L;continue;case R.COMMENT_ENDING:L==="-"?(w.state=R.COMMENT_ENDED,w.comment=ge(w.opt,w.comment),w.comment&&H(w,"oncomment",w.comment),w.comment=""):(w.comment+="-"+L,w.state=R.COMMENT);continue;case R.COMMENT_ENDED:L!==">"?(Z(w,"Malformed comment"),w.comment+="--"+L,w.state=R.COMMENT):w.doctype&&w.doctype!==!0?w.state=R.DOCTYPE_DTD:w.state=R.TEXT;continue;case R.CDATA:L==="]"?w.state=R.CDATA_ENDING:w.cdata+=L;continue;case R.CDATA_ENDING:L==="]"?w.state=R.CDATA_ENDING_2:(w.cdata+="]"+L,w.state=R.CDATA);continue;case R.CDATA_ENDING_2:L===">"?(w.cdata&&H(w,"oncdata",w.cdata),H(w,"onclosecdata"),w.cdata="",w.state=R.TEXT):L==="]"?w.cdata+="]":(w.cdata+="]]"+L,w.state=R.CDATA);continue;case R.PROC_INST:L==="?"?w.state=R.PROC_INST_ENDING:C(L)?w.state=R.PROC_INST_BODY:w.procInstName+=L;continue;case R.PROC_INST_BODY:if(!w.procInstBody&&C(L))continue;L==="?"?w.state=R.PROC_INST_ENDING:w.procInstBody+=L;continue;case R.PROC_INST_ENDING:L===">"?(H(w,"onprocessinginstruction",{name:w.procInstName,body:w.procInstBody}),w.procInstName=w.procInstBody="",w.state=R.TEXT):(w.procInstBody+="?"+L,w.state=R.PROC_INST_BODY);continue;case R.OPEN_TAG:B(S,L)?w.tagName+=L:(xe(w),L===">"?se(w):L==="/"?w.state=R.OPEN_TAG_SLASH:(C(L)||Z(w,"Invalid character in tag name"),w.state=R.ATTRIB));continue;case R.OPEN_TAG_SLASH:L===">"?(se(w,!0),te(w)):(Z(w,"Forward-slash in opening tag not followed by >"),w.state=R.ATTRIB);continue;case R.ATTRIB:if(C(L))continue;L===">"?se(w):L==="/"?w.state=R.OPEN_TAG_SLASH:B(x,L)?(w.attribName=L,w.attribValue="",w.state=R.ATTRIB_NAME):Z(w,"Invalid attribute name");continue;case R.ATTRIB_NAME:L==="="?w.state=R.ATTRIB_VALUE:L===">"?(Z(w,"Attribute without value"),w.attribValue=w.attribName,rt(w),se(w)):C(L)?w.state=R.ATTRIB_NAME_SAW_WHITE:B(S,L)?w.attribName+=L:Z(w,"Invalid attribute name");continue;case R.ATTRIB_NAME_SAW_WHITE:if(L==="=")w.state=R.ATTRIB_VALUE;else{if(C(L))continue;Z(w,"Attribute without value"),w.tag.attributes[w.attribName]="",w.attribValue="",H(w,"onattribute",{name:w.attribName,value:""}),w.attribName="",L===">"?se(w):B(x,L)?(w.attribName=L,w.state=R.ATTRIB_NAME):(Z(w,"Invalid attribute name"),w.state=R.ATTRIB)}continue;case R.ATTRIB_VALUE:if(C(L))continue;E(L)?(w.q=L,w.state=R.ATTRIB_VALUE_QUOTED):(w.opt.unquotedAttributeValues||ve(w,"Unquoted attribute value"),w.state=R.ATTRIB_VALUE_UNQUOTED,w.attribValue=L);continue;case R.ATTRIB_VALUE_QUOTED:if(L!==w.q){L==="&"?w.state=R.ATTRIB_VALUE_ENTITY_Q:w.attribValue+=L;continue}rt(w),w.q="",w.state=R.ATTRIB_VALUE_CLOSED;continue;case R.ATTRIB_VALUE_CLOSED:C(L)?w.state=R.ATTRIB:L===">"?se(w):L==="/"?w.state=R.OPEN_TAG_SLASH:B(x,L)?(Z(w,"No whitespace between attributes"),w.attribName=L,w.attribValue="",w.state=R.ATTRIB_NAME):Z(w,"Invalid attribute name");continue;case R.ATTRIB_VALUE_UNQUOTED:if(!I(L)){L==="&"?w.state=R.ATTRIB_VALUE_ENTITY_U:w.attribValue+=L;continue}rt(w),L===">"?se(w):w.state=R.ATTRIB;continue;case R.CLOSE_TAG:if(w.tagName)L===">"?te(w):B(S,L)?w.tagName+=L:w.script?(w.script+="</"+w.tagName,w.tagName="",w.state=R.SCRIPT):(C(L)||Z(w,"Invalid tagname in closing tag"),w.state=R.CLOSE_TAG_SAW_WHITE);else{if(C(L))continue;q(x,L)?w.script?(w.script+="</"+L,w.state=R.SCRIPT):Z(w,"Invalid tagname in closing tag."):w.tagName=L}continue;case R.CLOSE_TAG_SAW_WHITE:if(C(L))continue;L===">"?te(w):Z(w,"Invalid characters in closing tag");continue;case R.TEXT_ENTITY:case R.ATTRIB_VALUE_ENTITY_Q:case R.ATTRIB_VALUE_ENTITY_U:var De,nt;switch(w.state){case R.TEXT_ENTITY:De=R.TEXT,nt="textNode";break;case R.ATTRIB_VALUE_ENTITY_Q:De=R.ATTRIB_VALUE_QUOTED,nt="attribValue";break;case R.ATTRIB_VALUE_ENTITY_U:De=R.ATTRIB_VALUE_UNQUOTED,nt="attribValue";break}if(L===";"){var Vt=Te(w);w.opt.unparsedEntities&&!Object.values(r.XML_ENTITIES).includes(Vt)?(w.entity="",w.state=De,w.write(Vt)):(w[nt]+=Vt,w.entity="",w.state=De)}else B(w.entity.length?D:A,L)?w.entity+=L:(Z(w,"Invalid character in entity name"),w[nt]+="&"+w.entity+L,w.entity="",w.state=De);continue;default:throw new Error(w,"Unknown state: "+w.state)}return w.position>=w.bufferCheckPosition&&n(w),w}o(ct,"write");String.fromCodePoint||(function(){var N=String.fromCharCode,w=Math.floor,X=o(function(){var L=16384,Ie=[],Oe,De,nt=-1,Vt=arguments.length;if(!Vt)return"";for(var We="";++nt<Vt;){var Ot=Number(arguments[nt]);if(!isFinite(Ot)||Ot<0||Ot>1114111||w(Ot)!==Ot)throw RangeError("Invalid code point: "+Ot);Ot<=65535?Ie.push(Ot):(Ot-=65536,Oe=(Ot>>10)+55296,De=Ot%1024+56320,Ie.push(Oe,De)),(nt+1===Vt||Ie.length>L)&&(We+=N.apply(null,Ie),Ie.length=0)}return We},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:X,configurable:!0,writable:!0}):String.fromCodePoint=X})()})(typeof hO>"u"?hO.sax={}:hO)});var $ee=Q(PV=>{"use strict";(function(){"use strict";PV.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(PV)});var _V=Q(J0=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),J0.normalize=function(e){return e.toLowerCase()},J0.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},J0.stripPrefix=function(e){return e.replace(r,"")},J0.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},J0.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(J0)});var Zee=Q(np=>{"use strict";(function(){"use strict";var r,e,t,n,i,s,a,u,c,l=o(function(g,y){return function(){return g.apply(y,arguments)}},"bind"),p=o(function(g,y){for(var v in y)d.call(y,v)&&(g[v]=y[v]);function x(){this.constructor=g}return o(x,"ctor"),x.prototype=y.prototype,g.prototype=new x,g.__super__=y.prototype,g},"extend"),d={}.hasOwnProperty;u=Qee(),n=require("events"),r=$ee(),a=_V(),c=require("timers").setImmediate,e=$D().defaults,i=o(function(g){return typeof g=="object"&&g!=null&&Object.keys(g).length===0},"isEmpty"),s=o(function(g,y,v){var x,S,A;for(x=0,S=g.length;x<S;x++)A=g[x],y=A(y,v);return y},"processItem"),t=o(function(g,y,v){var x;return x=Object.create(null),x.value=v,x.writable=!0,x.enumerable=!0,x.configurable=!0,Object.defineProperty(g,y,x)},"defineProperty"),np.Parser=(function(g){p(y,g);function y(v){this.parseStringPromise=l(this.parseStringPromise,this),this.parseString=l(this.parseString,this),this.reset=l(this.reset,this),this.assignOrPush=l(this.assignOrPush,this),this.processAsync=l(this.processAsync,this);var x,S,A;if(!(this instanceof np.Parser))return new np.Parser(v);this.options={},S=e["0.2"];for(x in S)d.call(S,x)&&(A=S[x],this.options[x]=A);for(x in v)d.call(v,x)&&(A=v[x],this.options[x]=A);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(y,"Parser"),y.prototype.processAsync=function(){var v,x;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),c(this.processAsync))}catch(S){if(x=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(x)}},y.prototype.assignOrPush=function(v,x,S){return x in v?(v[x]instanceof Array||t(v,x,[v[x]]),v[x].push(S)):this.options.explicitArray?t(v,x,[S]):t(v,x,S)},y.prototype.reset=function(){var v,x,S,A;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(D){return function(C){if(D.saxParser.resume(),!D.saxParser.errThrown)return D.saxParser.errThrown=!0,D.emit("error",C)}})(this),this.saxParser.onend=(function(D){return function(){if(!D.saxParser.ended)return D.saxParser.ended=!0,D.emit("end",D.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,A=[],v=this.options.attrkey,x=this.options.charkey,this.saxParser.onopentag=(function(D){return function(C){var E,I,B,q,R;if(B={},B[x]="",!D.options.ignoreAttrs){R=C.attributes;for(E in R)d.call(R,E)&&(!(v in B)&&!D.options.mergeAttrs&&(B[v]={}),I=D.options.attrValueProcessors?s(D.options.attrValueProcessors,C.attributes[E],E):C.attributes[E],q=D.options.attrNameProcessors?s(D.options.attrNameProcessors,E):E,D.options.mergeAttrs?D.assignOrPush(B,q,I):t(B[v],q,I))}return B["#name"]=D.options.tagNameProcessors?s(D.options.tagNameProcessors,C.name):C.name,D.options.xmlns&&(B[D.options.xmlnskey]={uri:C.uri,local:C.local}),A.push(B)}})(this),this.saxParser.onclosetag=(function(D){return function(){var C,E,I,B,q,R,z,K,H,J;if(R=A.pop(),q=R["#name"],(!D.options.explicitChildren||!D.options.preserveChildrenOrder)&&delete R["#name"],R.cdata===!0&&(C=R.cdata,delete R.cdata),H=A[A.length-1],R[x].match(/^\s*$/)&&!C?(E=R[x],delete R[x]):(D.options.trim&&(R[x]=R[x].trim()),D.options.normalize&&(R[x]=R[x].replace(/\s{2,}/g," ").trim()),R[x]=D.options.valueProcessors?s(D.options.valueProcessors,R[x],q):R[x],Object.keys(R).length===1&&x in R&&!D.EXPLICIT_CHARKEY&&(R=R[x])),i(R)&&(typeof D.options.emptyTag=="function"?R=D.options.emptyTag():R=D.options.emptyTag!==""?D.options.emptyTag:E),D.options.validator!=null&&(J="/"+(function(){var ge,ve,le;for(le=[],ge=0,ve=A.length;ge<ve;ge++)B=A[ge],le.push(B["#name"]);return le})().concat(q).join("/"),(function(){var ge;try{return R=D.options.validator(J,H&&H[q],R)}catch(ve){return ge=ve,D.emit("error",ge)}})()),D.options.explicitChildren&&!D.options.mergeAttrs&&typeof R=="object"){if(!D.options.preserveChildrenOrder)B={},D.options.attrkey in R&&(B[D.options.attrkey]=R[D.options.attrkey],delete R[D.options.attrkey]),!D.options.charsAsChildren&&D.options.charkey in R&&(B[D.options.charkey]=R[D.options.charkey],delete R[D.options.charkey]),Object.getOwnPropertyNames(R).length>0&&(B[D.options.childkey]=R),R=B;else if(H){H[D.options.childkey]=H[D.options.childkey]||[],z={};for(I in R)d.call(R,I)&&t(z,I,R[I]);H[D.options.childkey].push(z),delete R["#name"],Object.keys(R).length===1&&x in R&&!D.EXPLICIT_CHARKEY&&(R=R[x])}}return A.length>0?D.assignOrPush(H,q,R):(D.options.explicitRoot&&(K=R,R={},t(R,q,K)),D.resultObject=R,D.saxParser.ended=!0,D.emit("end",D.resultObject))}})(this),S=(function(D){return function(C){var E,I;if(I=A[A.length-1],I)return I[x]+=C,D.options.explicitChildren&&D.options.preserveChildrenOrder&&D.options.charsAsChildren&&(D.options.includeWhiteChars||C.replace(/\\n/g,"").trim()!=="")&&(I[D.options.childkey]=I[D.options.childkey]||[],E={"#name":"__text__"},E[x]=C,D.options.normalize&&(E[x]=E[x].replace(/\s{2,}/g," ").trim()),I[D.options.childkey].push(E)),I}})(this),this.saxParser.ontext=S,this.saxParser.oncdata=(function(D){return function(C){var E;if(E=S(C),E)return E.cdata=!0}})(this)},y.prototype.parseString=function(v,x){var S;x!=null&&typeof x=="function"&&(this.on("end",function(A){return this.reset(),x(null,A)}),this.on("error",function(A){return this.reset(),x(A)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=r.stripBOM(v),this.options.async?(this.remaining=v,c(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(A){if(S=A,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},y.prototype.parseStringPromise=function(v){return new Promise((function(x){return function(S,A){return x.parseString(v,function(D,C){return D?A(D):S(C)})}})(this))},y})(n),np.parseString=function(g,y,v){var x,S,A;return v!=null?(typeof v=="function"&&(x=v),typeof y=="object"&&(S=y)):(typeof y=="function"&&(x=y),S={}),A=new np.Parser(S),A.parseString(g,x)},np.parseStringPromise=function(g,y){var v,x;return typeof y=="object"&&(v=y),x=new np.Parser(v),x.parseStringPromise(g)}}).call(np)});var ete=Q(ip=>{"use strict";(function(){"use strict";var r,e,t,n,i=o(function(a,u){for(var c in u)s.call(u,c)&&(a[c]=u[c]);function l(){this.constructor=a}return o(l,"ctor"),l.prototype=u.prototype,a.prototype=new l,a.__super__=u.prototype,a},"extend"),s={}.hasOwnProperty;e=$D(),r=Yee(),t=Zee(),n=_V(),ip.defaults=e.defaults,ip.processors=n,ip.ValidationError=(function(a){i(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),ip.Builder=r.Builder,ip.Parser=t.Parser,ip.parseString=t.parseString,ip.parseStringPromise=t.parseStringPromise}).call(ip)});var rU=Q((nlt,Bie)=>{"use strict";Bie.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var n0=Q(ey=>{"use strict";var nU,wBe=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];ey.getSymbolSize=o(function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},"getSymbolSize");ey.getSymbolTotalCodewords=o(function(e){return wBe[e]},"getSymbolTotalCodewords");ey.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};ey.setToSJISFunction=o(function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nU=e},"setToSJISFunction");ey.isKanjiModeEnabled=function(){return typeof nU<"u"};ey.toSJIS=o(function(e){return nU(e)},"toSJIS")});var z_=Q(Yu=>{"use strict";Yu.L={bit:1};Yu.M={bit:0};Yu.Q={bit:3};Yu.H={bit:2};function CBe(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return Yu.L;case"m":case"medium":return Yu.M;case"q":case"quartile":return Yu.Q;case"h":case"high":return Yu.H;default:throw new Error("Unknown EC Level: "+r)}}o(CBe,"fromString");Yu.isValid=o(function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4},"isValid");Yu.from=o(function(e,t){if(Yu.isValid(e))return e;try{return CBe(e)}catch{return t}},"from")});var Lie=Q((ult,_ie)=>{"use strict";function Pie(){this.buffer=[],this.length=0}o(Pie,"BitBuffer");Pie.prototype={get:o(function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},"get"),put:o(function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},"put"),getLengthInBits:o(function(){return this.length},"getLengthInBits"),putBit:o(function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++},"putBit")};_ie.exports=Pie});var kie=Q((llt,Fie)=>{"use strict";function sI(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}o(sI,"BitMatrix");sI.prototype.set=function(r,e,t,n){let i=r*this.size+e;this.data[i]=t,n&&(this.reservedBit[i]=!0)};sI.prototype.get=function(r,e){return this.data[r*this.size+e]};sI.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};sI.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};Fie.exports=sI});var Vie=Q(K_=>{"use strict";var EBe=n0().getSymbolSize;K_.getRowColCoords=o(function(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=EBe(e),i=n===145?26:Math.ceil((n-13)/(2*t-2))*2,s=[n-7];for(let a=1;a<t-1;a++)s[a]=s[a-1]-i;return s.push(6),s.reverse()},"getRowColCoords");K_.getPositions=o(function(e){let t=[],n=K_.getRowColCoords(e),i=n.length;for(let s=0;s<i;s++)for(let a=0;a<i;a++)s===0&&a===0||s===0&&a===i-1||s===i-1&&a===0||t.push([n[s],n[a]]);return t},"getPositions")});var Uie=Q(Mie=>{"use strict";var ABe=n0().getSymbolSize,jie=7;Mie.getPositions=o(function(e){let t=ABe(e);return[[0,0],[t-jie,0],[0,t-jie]]},"getPositions")});var qie=Q(kn=>{"use strict";kn.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ty={N1:3,N2:3,N3:40,N4:10};kn.isValid=o(function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},"isValid");kn.from=o(function(e){return kn.isValid(e)?parseInt(e,10):void 0},"from");kn.getPenaltyN1=o(function(e){let t=e.size,n=0,i=0,s=0,a=null,u=null;for(let c=0;c<t;c++){i=s=0,a=u=null;for(let l=0;l<t;l++){let p=e.get(c,l);p===a?i++:(i>=5&&(n+=ty.N1+(i-5)),a=p,i=1),p=e.get(l,c),p===u?s++:(s>=5&&(n+=ty.N1+(s-5)),u=p,s=1)}i>=5&&(n+=ty.N1+(i-5)),s>=5&&(n+=ty.N1+(s-5))}return n},"getPenaltyN1");kn.getPenaltyN2=o(function(e){let t=e.size,n=0;for(let i=0;i<t-1;i++)for(let s=0;s<t-1;s++){let a=e.get(i,s)+e.get(i,s+1)+e.get(i+1,s)+e.get(i+1,s+1);(a===4||a===0)&&n++}return n*ty.N2},"getPenaltyN2");kn.getPenaltyN3=o(function(e){let t=e.size,n=0,i=0,s=0;for(let a=0;a<t;a++){i=s=0;for(let u=0;u<t;u++)i=i<<1&2047|e.get(a,u),u>=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(u,a),u>=10&&(s===1488||s===93)&&n++}return n*ty.N3},"getPenaltyN3");kn.getPenaltyN4=o(function(e){let t=0,n=e.data.length;for(let s=0;s<n;s++)t+=e.data[s];return Math.abs(Math.ceil(t*100/n/5)-10)*ty.N4},"getPenaltyN4");function NBe(r,e,t){switch(r){case kn.Patterns.PATTERN000:return(e+t)%2===0;case kn.Patterns.PATTERN001:return e%2===0;case kn.Patterns.PATTERN010:return t%3===0;case kn.Patterns.PATTERN011:return(e+t)%3===0;case kn.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case kn.Patterns.PATTERN101:return e*t%2+e*t%3===0;case kn.Patterns.PATTERN110:return(e*t%2+e*t%3)%2===0;case kn.Patterns.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}o(NBe,"getMaskAt");kn.applyMask=o(function(e,t){let n=t.size;for(let i=0;i<n;i++)for(let s=0;s<n;s++)t.isReserved(s,i)||t.xor(s,i,NBe(e,s,i))},"applyMask");kn.getBestMask=o(function(e,t){let n=Object.keys(kn.Patterns).length,i=0,s=1/0;for(let a=0;a<n;a++){t(a),kn.applyMask(a,e);let u=kn.getPenaltyN1(e)+kn.getPenaltyN2(e)+kn.getPenaltyN3(e)+kn.getPenaltyN4(e);kn.applyMask(a,e),u<s&&(s=u,i=a)}return i},"getBestMask")});var sU=Q(iU=>{"use strict";var i0=z_(),G_=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],X_=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];iU.getBlocksCount=o(function(e,t){switch(t){case i0.L:return G_[(e-1)*4+0];case i0.M:return G_[(e-1)*4+1];case i0.Q:return G_[(e-1)*4+2];case i0.H:return G_[(e-1)*4+3];default:return}},"getBlocksCount");iU.getTotalCodewordsCount=o(function(e,t){switch(t){case i0.L:return X_[(e-1)*4+0];case i0.M:return X_[(e-1)*4+1];case i0.Q:return X_[(e-1)*4+2];case i0.H:return X_[(e-1)*4+3];default:return}},"getTotalCodewordsCount")});var Hie=Q(J_=>{"use strict";var aI=new Uint8Array(512),W_=new Uint8Array(256);o((function(){let e=1;for(let t=0;t<255;t++)aI[t]=e,W_[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)aI[t]=aI[t-255]}),"initTables")();J_.log=o(function(e){if(e<1)throw new Error("log("+e+")");return W_[e]},"log");J_.exp=o(function(e){return aI[e]},"exp");J_.mul=o(function(e,t){return e===0||t===0?0:aI[W_[e]+W_[t]]},"mul")});var zie=Q(oI=>{"use strict";var aU=Hie();oI.mul=o(function(e,t){let n=new Uint8Array(e.length+t.length-1);for(let i=0;i<e.length;i++)for(let s=0;s<t.length;s++)n[i+s]^=aU.mul(e[i],t[s]);return n},"mul");oI.mod=o(function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){let i=n[0];for(let a=0;a<t.length;a++)n[a]^=aU.mul(t[a],i);let s=0;for(;s<n.length&&n[s]===0;)s++;n=n.slice(s)}return n},"mod");oI.generateECPolynomial=o(function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=oI.mul(t,new Uint8Array([1,aU.exp(n)]));return t},"generateECPolynomial")});var Xie=Q((Elt,Gie)=>{"use strict";var Kie=zie();function oU(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}o(oU,"ReedSolomonEncoder");oU.prototype.initialize=o(function(e){this.degree=e,this.genPoly=Kie.generateECPolynomial(this.degree)},"initialize");oU.prototype.encode=o(function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let n=Kie.mod(t,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n},"encode");Gie.exports=oU});var uU=Q(Wie=>{"use strict";Wie.isValid=o(function(e){return!isNaN(e)&&e>=1&&e<=40},"isValid")});var cU=Q(wh=>{"use strict";var Jie="[0-9]+",IBe="[A-Z $%*+\\-./:]+",uI="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";uI=uI.replace(/u/g,"\\u");var TBe="(?:(?![A-Z0-9 $%*+\\-./:]|"+uI+`)(?:.|[\r
|
|
100
|
+
]))+`;wh.KANJI=new RegExp(uI,"g");wh.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");wh.BYTE=new RegExp(TBe,"g");wh.NUMERIC=new RegExp(Jie,"g");wh.ALPHANUMERIC=new RegExp(IBe,"g");var RBe=new RegExp("^"+uI+"$"),DBe=new RegExp("^"+Jie+"$"),OBe=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");wh.testKanji=o(function(e){return RBe.test(e)},"testKanji");wh.testNumeric=o(function(e){return DBe.test(e)},"testNumeric");wh.testAlphanumeric=o(function(e){return OBe.test(e)},"testAlphanumeric")});var s0=Q(Ki=>{"use strict";var BBe=uU(),lU=cU();Ki.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Ki.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Ki.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Ki.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Ki.MIXED={bit:-1};Ki.getCharCountIndicator=o(function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!BBe.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},"getCharCountIndicator");Ki.getBestModeForData=o(function(e){return lU.testNumeric(e)?Ki.NUMERIC:lU.testAlphanumeric(e)?Ki.ALPHANUMERIC:lU.testKanji(e)?Ki.KANJI:Ki.BYTE},"getBestModeForData");Ki.toString=o(function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},"toString");Ki.isValid=o(function(e){return e&&e.bit&&e.ccBits},"isValid");function PBe(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return Ki.NUMERIC;case"alphanumeric":return Ki.ALPHANUMERIC;case"kanji":return Ki.KANJI;case"byte":return Ki.BYTE;default:throw new Error("Unknown mode: "+r)}}o(PBe,"fromString");Ki.from=o(function(e,t){if(Ki.isValid(e))return e;try{return PBe(e)}catch{return t}},"from")});var ese=Q(ry=>{"use strict";var Y_=n0(),_Be=sU(),Yie=z_(),a0=s0(),fU=uU(),$ie=7973,Qie=Y_.getBCHDigit($ie);function LBe(r,e,t){for(let n=1;n<=40;n++)if(e<=ry.getCapacity(n,t,r))return n}o(LBe,"getBestVersionForDataLength");function Zie(r,e){return a0.getCharCountIndicator(r,e)+4}o(Zie,"getReservedBitsCount");function FBe(r,e){let t=0;return r.forEach(function(n){let i=Zie(n.mode,e);t+=i+n.getBitsLength()}),t}o(FBe,"getTotalBitsFromDataArray");function kBe(r,e){for(let t=1;t<=40;t++)if(FBe(r,t)<=ry.getCapacity(t,e,a0.MIXED))return t}o(kBe,"getBestVersionForMixedData");ry.from=o(function(e,t){return fU.isValid(e)?parseInt(e,10):t},"from");ry.getCapacity=o(function(e,t,n){if(!fU.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=a0.BYTE);let i=Y_.getSymbolTotalCodewords(e),s=_Be.getTotalCodewordsCount(e,t),a=(i-s)*8;if(n===a0.MIXED)return a;let u=a-Zie(n,e);switch(n){case a0.NUMERIC:return Math.floor(u/10*3);case a0.ALPHANUMERIC:return Math.floor(u/11*2);case a0.KANJI:return Math.floor(u/13);case a0.BYTE:default:return Math.floor(u/8)}},"getCapacity");ry.getBestVersionForData=o(function(e,t){let n,i=Yie.from(t,Yie.M);if(Array.isArray(e)){if(e.length>1)return kBe(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return LBe(n.mode,n.getLength(),i)},"getBestVersionForData");ry.getEncodedBits=o(function(e){if(!fU.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Y_.getBCHDigit(t)-Qie>=0;)t^=$ie<<Y_.getBCHDigit(t)-Qie;return e<<12|t},"getEncodedBits")});var ise=Q(nse=>{"use strict";var pU=n0(),rse=1335,VBe=21522,tse=pU.getBCHDigit(rse);nse.getEncodedBits=o(function(e,t){let n=e.bit<<3|t,i=n<<10;for(;pU.getBCHDigit(i)-tse>=0;)i^=rse<<pU.getBCHDigit(i)-tse;return(n<<10|i)^VBe},"getEncodedBits")});var ase=Q((Flt,sse)=>{"use strict";var jBe=s0();function Zx(r){this.mode=jBe.NUMERIC,this.data=r.toString()}o(Zx,"NumericData");Zx.getBitsLength=o(function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},"getBitsLength");Zx.prototype.getLength=o(function(){return this.data.length},"getLength");Zx.prototype.getBitsLength=o(function(){return Zx.getBitsLength(this.data.length)},"getBitsLength");Zx.prototype.write=o(function(e){let t,n,i;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-t;s>0&&(n=this.data.substr(t),i=parseInt(n,10),e.put(i,s*3+1))},"write");sse.exports=Zx});var use=Q((Vlt,ose)=>{"use strict";var MBe=s0(),hU=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ew(r){this.mode=MBe.ALPHANUMERIC,this.data=r}o(ew,"AlphanumericData");ew.getBitsLength=o(function(e){return 11*Math.floor(e/2)+6*(e%2)},"getBitsLength");ew.prototype.getLength=o(function(){return this.data.length},"getLength");ew.prototype.getBitsLength=o(function(){return ew.getBitsLength(this.data.length)},"getBitsLength");ew.prototype.write=o(function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=hU.indexOf(this.data[t])*45;n+=hU.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(hU.indexOf(this.data[t]),6)},"write");ose.exports=ew});var lse=Q((Mlt,cse)=>{"use strict";var UBe=s0();function tw(r){this.mode=UBe.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}o(tw,"ByteData");tw.getBitsLength=o(function(e){return e*8},"getBitsLength");tw.prototype.getLength=o(function(){return this.data.length},"getLength");tw.prototype.getBitsLength=o(function(){return tw.getBitsLength(this.data.length)},"getBitsLength");tw.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};cse.exports=tw});var pse=Q((qlt,fse)=>{"use strict";var qBe=s0(),HBe=n0();function rw(r){this.mode=qBe.KANJI,this.data=r}o(rw,"KanjiData");rw.getBitsLength=o(function(e){return e*13},"getBitsLength");rw.prototype.getLength=o(function(){return this.data.length},"getLength");rw.prototype.getBitsLength=o(function(){return rw.getBitsLength(this.data.length)},"getBitsLength");rw.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=HBe.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
101
|
+
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};fse.exports=rw});var hse=Q((zlt,dU)=>{"use strict";var cI={single_source_shortest_paths:o(function(r,e,t){var n={},i={};i[e]=0;var s=cI.PriorityQueue.make();s.push(e,0);for(var a,u,c,l,p,d,g,y,v;!s.empty();){a=s.pop(),u=a.value,l=a.cost,p=r[u]||{};for(c in p)p.hasOwnProperty(c)&&(d=p[c],g=l+d,y=i[c],v=typeof i[c]>"u",(v||y>g)&&(i[c]=g,s.push(c,g),n[c]=u))}if(typeof t<"u"&&typeof i[t]>"u"){var x=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(x)}return n},"single_source_shortest_paths"),extract_shortest_path_from_predecessor_list:o(function(r,e){for(var t=[],n=e,i;n;)t.push(n),i=r[n],n=r[n];return t.reverse(),t},"extract_shortest_path_from_predecessor_list"),find_path:o(function(r,e,t){var n=cI.single_source_shortest_paths(r,e,t);return cI.extract_shortest_path_from_predecessor_list(n,t)},"find_path"),PriorityQueue:{make:o(function(r){var e=cI.PriorityQueue,t={},n;r=r||{};for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},"make"),default_sorter:o(function(r,e){return r.cost-e.cost},"default_sorter"),push:o(function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},"push"),pop:o(function(){return this.queue.shift()},"pop"),empty:o(function(){return this.queue.length===0},"empty")}};typeof dU<"u"&&(dU.exports=cI)});var xse=Q(nw=>{"use strict";var sn=s0(),gse=ase(),vse=use(),yse=lse(),Sse=pse(),lI=cU(),Q_=n0(),zBe=hse();function dse(r){return unescape(encodeURIComponent(r)).length}o(dse,"getStringByteLength");function fI(r,e,t){let n=[],i;for(;(i=r.exec(t))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}o(fI,"getSegments");function bse(r){let e=fI(lI.NUMERIC,sn.NUMERIC,r),t=fI(lI.ALPHANUMERIC,sn.ALPHANUMERIC,r),n,i;return Q_.isKanjiModeEnabled()?(n=fI(lI.BYTE,sn.BYTE,r),i=fI(lI.KANJI,sn.KANJI,r)):(n=fI(lI.BYTE_KANJI,sn.BYTE,r),i=[]),e.concat(t,n,i).sort(function(a,u){return a.index-u.index}).map(function(a){return{data:a.data,mode:a.mode,length:a.length}})}o(bse,"getSegmentsFromString");function mU(r,e){switch(e){case sn.NUMERIC:return gse.getBitsLength(r);case sn.ALPHANUMERIC:return vse.getBitsLength(r);case sn.KANJI:return Sse.getBitsLength(r);case sn.BYTE:return yse.getBitsLength(r)}}o(mU,"getSegmentBitsLength");function KBe(r){return r.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}o(KBe,"mergeSegments");function GBe(r){let e=[];for(let t=0;t<r.length;t++){let n=r[t];switch(n.mode){case sn.NUMERIC:e.push([n,{data:n.data,mode:sn.ALPHANUMERIC,length:n.length},{data:n.data,mode:sn.BYTE,length:n.length}]);break;case sn.ALPHANUMERIC:e.push([n,{data:n.data,mode:sn.BYTE,length:n.length}]);break;case sn.KANJI:e.push([n,{data:n.data,mode:sn.BYTE,length:dse(n.data)}]);break;case sn.BYTE:e.push([{data:n.data,mode:sn.BYTE,length:dse(n.data)}])}}return e}o(GBe,"buildNodes");function XBe(r,e){let t={},n={start:{}},i=["start"];for(let s=0;s<r.length;s++){let a=r[s],u=[];for(let c=0;c<a.length;c++){let l=a[c],p=""+s+c;u.push(p),t[p]={node:l,lastCount:0},n[p]={};for(let d=0;d<i.length;d++){let g=i[d];t[g]&&t[g].node.mode===l.mode?(n[g][p]=mU(t[g].lastCount+l.length,l.mode)-mU(t[g].lastCount,l.mode),t[g].lastCount+=l.length):(t[g]&&(t[g].lastCount=l.length),n[g][p]=mU(l.length,l.mode)+4+sn.getCharCountIndicator(l.mode,e))}}i=u}for(let s=0;s<i.length;s++)n[i[s]].end=0;return{map:n,table:t}}o(XBe,"buildGraph");function mse(r,e){let t,n=sn.getBestModeForData(r);if(t=sn.from(e,n),t!==sn.BYTE&&t.bit<n.bit)throw new Error('"'+r+'" cannot be encoded with mode '+sn.toString(t)+`.
|
|
102
102
|
Suggested mode is: `+sn.toString(n));switch(t===sn.KANJI&&!Q_.isKanjiModeEnabled()&&(t=sn.BYTE),t){case sn.NUMERIC:return new gse(r);case sn.ALPHANUMERIC:return new vse(r);case sn.KANJI:return new Sse(r);case sn.BYTE:return new yse(r)}}o(mse,"buildSingleSegment");nw.fromArray=o(function(e){return e.reduce(function(t,n){return typeof n=="string"?t.push(mse(n,null)):n.data&&t.push(mse(n.data,n.mode)),t},[])},"fromArray");nw.fromString=o(function(e,t){let n=bse(e,Q_.isKanjiModeEnabled()),i=GBe(n),s=XBe(i,t),a=zBe.find_path(s.map,"start","end"),u=[];for(let c=1;c<a.length-1;c++)u.push(s.table[a[c]].node);return nw.fromArray(KBe(u))},"fromString");nw.rawSplit=o(function(e){return nw.fromArray(bse(e,Q_.isKanjiModeEnabled()))},"rawSplit")});var xU=Q(wse=>{"use strict";var Z_=n0(),gU=z_(),WBe=Lie(),JBe=kie(),YBe=Vie(),QBe=Uie(),SU=qie(),bU=sU(),$Be=Xie(),$_=ese(),ZBe=ise(),ePe=s0(),vU=xse();function tPe(r,e){let t=r.size,n=QBe.getPositions(e);for(let i=0;i<n.length;i++){let s=n[i][0],a=n[i][1];for(let u=-1;u<=7;u++)if(!(s+u<=-1||t<=s+u))for(let c=-1;c<=7;c++)a+c<=-1||t<=a+c||(u>=0&&u<=6&&(c===0||c===6)||c>=0&&c<=6&&(u===0||u===6)||u>=2&&u<=4&&c>=2&&c<=4?r.set(s+u,a+c,!0,!0):r.set(s+u,a+c,!1,!0))}}o(tPe,"setupFinderPattern");function rPe(r){let e=r.size;for(let t=8;t<e-8;t++){let n=t%2===0;r.set(t,6,n,!0),r.set(6,t,n,!0)}}o(rPe,"setupTimingPattern");function nPe(r,e){let t=YBe.getPositions(e);for(let n=0;n<t.length;n++){let i=t[n][0],s=t[n][1];for(let a=-2;a<=2;a++)for(let u=-2;u<=2;u++)a===-2||a===2||u===-2||u===2||a===0&&u===0?r.set(i+a,s+u,!0,!0):r.set(i+a,s+u,!1,!0)}}o(nPe,"setupAlignmentPattern");function iPe(r,e){let t=r.size,n=$_.getEncodedBits(e),i,s,a;for(let u=0;u<18;u++)i=Math.floor(u/3),s=u%3+t-8-3,a=(n>>u&1)===1,r.set(i,s,a,!0),r.set(s,i,a,!0)}o(iPe,"setupVersionInfo");function yU(r,e,t){let n=r.size,i=ZBe.getEncodedBits(e,t),s,a;for(s=0;s<15;s++)a=(i>>s&1)===1,s<6?r.set(s,8,a,!0):s<8?r.set(s+1,8,a,!0):r.set(n-15+s,8,a,!0),s<8?r.set(8,n-s-1,a,!0):s<9?r.set(8,15-s-1+1,a,!0):r.set(8,15-s-1,a,!0);r.set(n-8,8,1,!0)}o(yU,"setupFormatInfo");function sPe(r,e){let t=r.size,n=-1,i=t-1,s=7,a=0;for(let u=t-1;u>0;u-=2)for(u===6&&u--;;){for(let c=0;c<2;c++)if(!r.isReserved(i,u-c)){let l=!1;a<e.length&&(l=(e[a]>>>s&1)===1),r.set(i,u-c,l),s--,s===-1&&(a++,s=7)}if(i+=n,i<0||t<=i){i-=n,n=-n;break}}}o(sPe,"setupData");function aPe(r,e,t){let n=new WBe;t.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),ePe.getCharCountIndicator(c.mode,r)),c.write(n)});let i=Z_.getSymbolTotalCodewords(r),s=bU.getTotalCodewordsCount(r,e),a=(i-s)*8;for(n.getLengthInBits()+4<=a&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let u=(a-n.getLengthInBits())/8;for(let c=0;c<u;c++)n.put(c%2?17:236,8);return oPe(n,r,e)}o(aPe,"createData");function oPe(r,e,t){let n=Z_.getSymbolTotalCodewords(e),i=bU.getTotalCodewordsCount(e,t),s=n-i,a=bU.getBlocksCount(e,t),u=n%a,c=a-u,l=Math.floor(n/a),p=Math.floor(s/a),d=p+1,g=l-p,y=new $Be(g),v=0,x=new Array(a),S=new Array(a),A=0,D=new Uint8Array(r.buffer);for(let q=0;q<a;q++){let R=q<c?p:d;x[q]=D.slice(v,v+R),S[q]=y.encode(x[q]),v+=R,A=Math.max(A,R)}let C=new Uint8Array(n),E=0,I,B;for(I=0;I<A;I++)for(B=0;B<a;B++)I<x[B].length&&(C[E++]=x[B][I]);for(I=0;I<g;I++)for(B=0;B<a;B++)C[E++]=S[B][I];return C}o(oPe,"createCodewords");function uPe(r,e,t,n){let i;if(Array.isArray(r))i=vU.fromArray(r);else if(typeof r=="string"){let l=e;if(!l){let p=vU.rawSplit(r);l=$_.getBestVersionForData(p,t)}i=vU.fromString(r,l||40)}else throw new Error("Invalid data");let s=$_.getBestVersionForData(i,t);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
|
|
103
103
|
The chosen QR Code version cannot contain this amount of data.
|
|
104
104
|
Minimum version required to store current data is: `+s+`.
|
|
105
|
-
`);let a=aPe(e,t,i),u=Z_.getSymbolSize(e),c=new JBe(u);return tPe(c,e),rPe(c),nPe(c,e),yU(c,t,0),e>=7&&iPe(c,e),sPe(c,a),isNaN(n)&&(n=SU.getBestMask(c,yU.bind(null,c,t))),SU.applyMask(n,c),yU(c,t,n),{modules:c,version:e,errorCorrectionLevel:t,maskPattern:n,segments:i}}o(uPe,"createSymbol");wse.create=o(function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let n=gU.M,i,s;return typeof t<"u"&&(n=gU.from(t.errorCorrectionLevel,gU.M),i=$_.from(t.version),s=SU.from(t.maskPattern),t.toSJISFunc&&Z_.setToSJISFunction(t.toSJISFunc)),uPe(e,i,n,s)},"create")});var wU=Q((Jlt,Ese)=>{"use strict";var cPe=require("util"),Cse=require("stream"),el=Ese.exports=function(){Cse.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};cPe.inherits(el,Cse);el.prototype.read=function(r,e){this._reads.push({length:Math.abs(r),allowLess:r<0,func:e}),process.nextTick((function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}).bind(this))};el.prototype.write=function(r,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let t;return Buffer.isBuffer(r)?t=r:t=Buffer.from(r,e||this._encoding),this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused};el.prototype.end=function(r,e){r&&this.write(r,e),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))};el.prototype.destroySoon=el.prototype.end;el.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()};el.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))};el.prototype._processReadAllowingLess=function(r){this._reads.shift();let e=this._buffers[0];e.length>r.length?(this._buffered-=r.length,this._buffers[0]=e.slice(r.length),r.func.call(this,e.slice(0,r.length))):(this._buffered-=e.length,this._buffers.shift(),r.func.call(this,e))};el.prototype._processRead=function(r){this._reads.shift();let e=0,t=0,n=Buffer.alloc(r.length);for(;e<r.length;){let i=this._buffers[t++],s=Math.min(i.length,r.length-e);i.copy(n,e,0,s),e+=s,s!==i.length&&(this._buffers[--t]=i.slice(s))}t>0&&this._buffers.splice(0,t),this._buffered-=r.length,r.func.call(this,n)};el.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let r=this._reads[0];if(r.allowLess)this._processReadAllowingLess(r);else if(this._buffered>=r.length)this._processRead(r);else break}this._buffers&&!this.writable&&this._end()}catch(r){this.emit("error",r)}}});var EU=Q(CU=>{"use strict";var o0=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];CU.getImagePasses=function(r,e){let t=[],n=r%8,i=e%8,s=(r-n)/8,a=(e-i)/8;for(let u=0;u<o0.length;u++){let c=o0[u],l=s*c.x.length,p=a*c.y.length;for(let d=0;d<c.x.length&&c.x[d]<n;d++)l++;for(let d=0;d<c.y.length&&c.y[d]<i;d++)p++;l>0&&p>0&&t.push({width:l,height:p,index:u})}return t};CU.getInterlaceIterator=function(r){return function(e,t,n){let i=e%o0[n].x.length,s=(e-i)/o0[n].x.length*8+o0[n].x[i],a=t%o0[n].y.length,u=(t-a)/o0[n].y.length*8+o0[n].y[a];return s*4+u*r*4}}});var AU=Q((Qlt,Ase)=>{"use strict";Ase.exports=o(function(e,t,n){let i=e+t-n,s=Math.abs(i-e),a=Math.abs(i-t),u=Math.abs(i-n);return s<=a&&s<=u?e:a<=u?t:n},"paethPredictor")});var NU=Q((Zlt,Ise)=>{"use strict";var lPe=EU(),fPe=AU();function Nse(r,e,t){let n=r*e;return t!==8&&(n=Math.ceil(n/(8/t))),n}o(Nse,"getByteWidth");var iw=Ise.exports=function(r,e){let t=r.width,n=r.height,i=r.interlace,s=r.bpp,a=r.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],i){let u=lPe.getImagePasses(t,n);for(let c=0;c<u.length;c++)this._images.push({byteWidth:Nse(u[c].width,s,a),height:u[c].height,lineIndex:0})}else this._images.push({byteWidth:Nse(t,s,a),height:n,lineIndex:0});a===8?this._xComparison=s:a===16?this._xComparison=s*2:this._xComparison=1};iw.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};iw.prototype._unFilterType1=function(r,e,t){let n=this._xComparison,i=n-1;for(let s=0;s<t;s++){let a=r[1+s],u=s>i?e[s-n]:0;e[s]=a+u}};iw.prototype._unFilterType2=function(r,e,t){let n=this._lastLine;for(let i=0;i<t;i++){let s=r[1+i],a=n?n[i]:0;e[i]=s+a}};iw.prototype._unFilterType3=function(r,e,t){let n=this._xComparison,i=n-1,s=this._lastLine;for(let a=0;a<t;a++){let u=r[1+a],c=s?s[a]:0,l=a>i?e[a-n]:0,p=Math.floor((l+c)/2);e[a]=u+p}};iw.prototype._unFilterType4=function(r,e,t){let n=this._xComparison,i=n-1,s=this._lastLine;for(let a=0;a<t;a++){let u=r[1+a],c=s?s[a]:0,l=a>i?e[a-n]:0,p=a>i&&s?s[a-n]:0,d=fPe(l,c,p);e[a]=u+d}};iw.prototype._reverseFilterLine=function(r){let e=r[0],t,n=this._images[this._imageIndex],i=n.byteWidth;if(e===0)t=r.slice(1,i+1);else switch(t=Buffer.alloc(i),e){case 1:this._unFilterType1(r,t,i);break;case 2:this._unFilterType2(r,t,i);break;case 3:this._unFilterType3(r,t,i);break;case 4:this._unFilterType4(r,t,i);break;default:throw new Error("Unrecognised filter type - "+e)}this.write(t),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=t,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}});var Dse=Q((tft,Rse)=>{"use strict";var pPe=require("util"),Tse=wU(),hPe=NU(),dPe=Rse.exports=function(r){Tse.call(this);let e=[],t=this;this._filter=new hPe(r,{read:this.read.bind(this),write:o(function(n){e.push(n)},"write"),complete:o(function(){t.emit("complete",Buffer.concat(e))},"complete")}),this._filter.start()};pPe.inherits(dPe,Tse)});var sw=Q((nft,Ose)=>{"use strict";Ose.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var RU=Q((ift,Bse)=>{"use strict";var IU=[];(function(){for(let r=0;r<256;r++){let e=r;for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e=e>>>1;IU[r]=e}})();var TU=Bse.exports=function(){this._crc=-1};TU.prototype.write=function(r){for(let e=0;e<r.length;e++)this._crc=IU[(this._crc^r[e])&255]^this._crc>>>8;return!0};TU.prototype.crc32=function(){return this._crc^-1};TU.crc32=function(r){let e=-1;for(let t=0;t<r.length;t++)e=IU[(e^r[t])&255]^e>>>8;return e^-1}});var DU=Q((sft,Pse)=>{"use strict";var ss=sw(),mPe=RU(),Ts=Pse.exports=function(r,e){this._options=r,r.checkCRC=r.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[ss.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[ss.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[ss.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[ss.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[ss.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[ss.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};Ts.prototype.start=function(){this.read(ss.PNG_SIGNATURE.length,this._parseSignature.bind(this))};Ts.prototype._parseSignature=function(r){let e=ss.PNG_SIGNATURE;for(let t=0;t<e.length;t++)if(r[t]!==e[t]){this.error(new Error("Invalid file signature"));return}this.read(8,this._parseChunkBegin.bind(this))};Ts.prototype._parseChunkBegin=function(r){let e=r.readUInt32BE(0),t=r.readUInt32BE(4),n="";for(let s=4;s<8;s++)n+=String.fromCharCode(r[s]);let i=!!(r[4]&32);if(!this._hasIHDR&&t!==ss.TYPE_IHDR){this.error(new Error("Expected IHDR on beggining"));return}if(this._crc=new mPe,this._crc.write(Buffer.from(n)),this._chunks[t])return this._chunks[t](e);if(!i){this.error(new Error("Unsupported critical chunk type "+n));return}this.read(e+4,this._skipChunk.bind(this))};Ts.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};Ts.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};Ts.prototype._parseChunkEnd=function(r){let e=r.readInt32BE(0),t=this._crc.crc32();if(this._options.checkCRC&&t!==e){this.error(new Error("Crc error - "+e+" - "+t));return}this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))};Ts.prototype._handleIHDR=function(r){this.read(r,this._parseIHDR.bind(this))};Ts.prototype._parseIHDR=function(r){this._crc.write(r);let e=r.readUInt32BE(0),t=r.readUInt32BE(4),n=r[8],i=r[9],s=r[10],a=r[11],u=r[12];if(n!==8&&n!==4&&n!==2&&n!==1&&n!==16){this.error(new Error("Unsupported bit depth "+n));return}if(!(i in ss.COLORTYPE_TO_BPP_MAP)){this.error(new Error("Unsupported color type"));return}if(s!==0){this.error(new Error("Unsupported compression method"));return}if(a!==0){this.error(new Error("Unsupported filter method"));return}if(u!==0&&u!==1){this.error(new Error("Unsupported interlace method"));return}this._colorType=i;let c=ss.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:t,depth:n,interlace:!!u,palette:!!(i&ss.COLORTYPE_PALETTE),color:!!(i&ss.COLORTYPE_COLOR),alpha:!!(i&ss.COLORTYPE_ALPHA),bpp:c,colorType:i}),this._handleChunkEnd()};Ts.prototype._handlePLTE=function(r){this.read(r,this._parsePLTE.bind(this))};Ts.prototype._parsePLTE=function(r){this._crc.write(r);let e=Math.floor(r.length/3);for(let t=0;t<e;t++)this._palette.push([r[t*3],r[t*3+1],r[t*3+2],255]);this.palette(this._palette),this._handleChunkEnd()};Ts.prototype._handleTRNS=function(r){this.simpleTransparency(),this.read(r,this._parseTRNS.bind(this))};Ts.prototype._parseTRNS=function(r){if(this._crc.write(r),this._colorType===ss.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(new Error("Transparency chunk must be after palette"));return}if(r.length>this._palette.length){this.error(new Error("More transparent colors than palette size"));return}for(let e=0;e<r.length;e++)this._palette[e][3]=r[e];this.palette(this._palette)}this._colorType===ss.COLORTYPE_GRAYSCALE&&this.transColor([r.readUInt16BE(0)]),this._colorType===ss.COLORTYPE_COLOR&&this.transColor([r.readUInt16BE(0),r.readUInt16BE(2),r.readUInt16BE(4)]),this._handleChunkEnd()};Ts.prototype._handleGAMA=function(r){this.read(r,this._parseGAMA.bind(this))};Ts.prototype._parseGAMA=function(r){this._crc.write(r),this.gamma(r.readUInt32BE(0)/ss.GAMMA_DIVISION),this._handleChunkEnd()};Ts.prototype._handleIDAT=function(r){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-r,this._parseIDAT.bind(this,r))};Ts.prototype._parseIDAT=function(r,e){if(this._crc.write(e),this._colorType===ss.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw new Error("Expected palette not found");this.inflateData(e);let t=r-e.length;t>0?this._handleIDAT(t):this._handleChunkEnd()};Ts.prototype._handleIEND=function(r){this.read(r,this._parseIEND.bind(this))};Ts.prototype._parseIEND=function(r){this._crc.write(r),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}});var OU=Q(Lse=>{"use strict";var _se=EU(),gPe=[function(){},function(r,e,t,n){if(n===e.length)throw new Error("Ran out of data");let i=e[n];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=255},function(r,e,t,n){if(n+1>=e.length)throw new Error("Ran out of data");let i=e[n];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=e[n+1]},function(r,e,t,n){if(n+2>=e.length)throw new Error("Ran out of data");r[t]=e[n],r[t+1]=e[n+1],r[t+2]=e[n+2],r[t+3]=255},function(r,e,t,n){if(n+3>=e.length)throw new Error("Ran out of data");r[t]=e[n],r[t+1]=e[n+1],r[t+2]=e[n+2],r[t+3]=e[n+3]}],vPe=[function(){},function(r,e,t,n){let i=e[0];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=n},function(r,e,t){let n=e[0];r[t]=n,r[t+1]=n,r[t+2]=n,r[t+3]=e[1]},function(r,e,t,n){r[t]=e[0],r[t+1]=e[1],r[t+2]=e[2],r[t+3]=n},function(r,e,t){r[t]=e[0],r[t+1]=e[1],r[t+2]=e[2],r[t+3]=e[3]}];function yPe(r,e){let t=[],n=0;function i(){if(n===r.length)throw new Error("Ran out of data");let s=r[n];n++;let a,u,c,l,p,d,g,y;switch(e){default:throw new Error("unrecognised depth");case 16:g=r[n],n++,t.push((s<<8)+g);break;case 4:g=s&15,y=s>>4,t.push(y,g);break;case 2:p=s&3,d=s>>2&3,g=s>>4&3,y=s>>6&3,t.push(y,g,d,p);break;case 1:a=s&1,u=s>>1&1,c=s>>2&1,l=s>>3&1,p=s>>4&1,d=s>>5&1,g=s>>6&1,y=s>>7&1,t.push(y,g,d,p,l,c,u,a);break}}return o(i,"split"),{get:o(function(s){for(;t.length<s;)i();let a=t.slice(0,s);return t=t.slice(s),a},"get"),resetAfterLine:o(function(){t.length=0},"resetAfterLine"),end:o(function(){if(n!==r.length)throw new Error("extra data found")},"end")}}o(yPe,"bitRetriever");function SPe(r,e,t,n,i,s){let a=r.width,u=r.height,c=r.index;for(let l=0;l<u;l++)for(let p=0;p<a;p++){let d=t(p,l,c);gPe[n](e,i,d,s),s+=n}return s}o(SPe,"mapImage8Bit");function bPe(r,e,t,n,i,s){let a=r.width,u=r.height,c=r.index;for(let l=0;l<u;l++){for(let p=0;p<a;p++){let d=i.get(n),g=t(p,l,c);vPe[n](e,d,g,s)}i.resetAfterLine()}}o(bPe,"mapImageCustomBit");Lse.dataToBitMap=function(r,e){let t=e.width,n=e.height,i=e.depth,s=e.bpp,a=e.interlace,u;i!==8&&(u=yPe(r,i));let c;i<=8?c=Buffer.alloc(t*n*4):c=new Uint16Array(t*n*4);let l=Math.pow(2,i)-1,p=0,d,g;if(a)d=_se.getImagePasses(t,n),g=_se.getInterlaceIterator(t,n);else{let y=0;g=o(function(){let v=y;return y+=4,v},"getPxPos"),d=[{width:t,height:n}]}for(let y=0;y<d.length;y++)i===8?p=SPe(d[y],c,g,s,r,p):bPe(d[y],c,g,s,u,l);if(i===8){if(p!==r.length)throw new Error("extra data found")}else u.end();return c}});var BU=Q((uft,Fse)=>{"use strict";function xPe(r,e,t,n,i){let s=0;for(let a=0;a<n;a++)for(let u=0;u<t;u++){let c=i[r[s]];if(!c)throw new Error("index "+r[s]+" not in palette");for(let l=0;l<4;l++)e[s+l]=c[l];s+=4}}o(xPe,"dePalette");function wPe(r,e,t,n,i){let s=0;for(let a=0;a<n;a++)for(let u=0;u<t;u++){let c=!1;if(i.length===1?i[0]===r[s]&&(c=!0):i[0]===r[s]&&i[1]===r[s+1]&&i[2]===r[s+2]&&(c=!0),c)for(let l=0;l<4;l++)e[s+l]=0;s+=4}}o(wPe,"replaceTransparentColor");function CPe(r,e,t,n,i){let s=255,a=Math.pow(2,i)-1,u=0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){for(let p=0;p<4;p++)e[u+p]=Math.floor(r[u+p]*s/a+.5);u+=4}}o(CPe,"scaleDepth");Fse.exports=function(r,e){let t=e.depth,n=e.width,i=e.height,s=e.colorType,a=e.transColor,u=e.palette,c=r;return s===3?xPe(r,c,n,i,u):(a&&wPe(r,c,n,i,a),t!==8&&(t===16&&(c=Buffer.alloc(n*i*4)),CPe(r,c,n,i,t))),c}});var jse=Q((lft,Vse)=>{"use strict";var EPe=require("util"),PU=require("zlib"),kse=wU(),APe=Dse(),NPe=DU(),IPe=OU(),TPe=BU(),If=Vse.exports=function(r){kse.call(this),this._parser=new NPe(r,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=r,this.writable=!0,this._parser.start()};EPe.inherits(If,kse);If.prototype._handleError=function(r){this.emit("error",r),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0};If.prototype._inflateData=function(r){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=PU.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,n=Math.max(t,PU.Z_MIN_CHUNK);this._inflate=PU.createInflate({chunkSize:n});let i=t,s=this.emit.bind(this,"error");this._inflate.on("error",function(u){i&&s(u)}),this._filter.on("complete",this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on("data",function(u){i&&(u.length>i&&(u=u.slice(0,i)),i-=u.length,a(u))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(r)};If.prototype._handleMetaData=function(r){this._metaData=r,this._bitmapInfo=Object.create(r),this._filter=new APe(this._bitmapInfo)};If.prototype._handleTransColor=function(r){this._bitmapInfo.transColor=r};If.prototype._handlePalette=function(r){this._bitmapInfo.palette=r};If.prototype._simpleTransparency=function(){this._metaData.alpha=!0};If.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};If.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))};If.prototype._complete=function(r){if(this.errord)return;let e;try{let t=IPe.dataToBitMap(r,this._bitmapInfo);e=TPe(t,this._bitmapInfo),t=null}catch(t){this._handleError(t);return}this.emit("parsed",e)}});var Use=Q((fft,Mse)=>{"use strict";var Qu=sw();Mse.exports=function(r,e,t,n){let i=[Qu.COLORTYPE_COLOR_ALPHA,Qu.COLORTYPE_ALPHA].indexOf(n.colorType)!==-1;if(n.colorType===n.inputColorType){let v=(function(){let x=new ArrayBuffer(2);return new DataView(x).setInt16(0,256,!0),new Int16Array(x)[0]!==256})();if(n.bitDepth===8||n.bitDepth===16&&v)return r}let s=n.bitDepth!==16?r:new Uint16Array(r.buffer),a=255,u=Qu.COLORTYPE_TO_BPP_MAP[n.inputColorType];u===4&&!n.inputHasAlpha&&(u=3);let c=Qu.COLORTYPE_TO_BPP_MAP[n.colorType];n.bitDepth===16&&(a=65535,c*=2);let l=Buffer.alloc(e*t*c),p=0,d=0,g=n.bgColor||{};g.red===void 0&&(g.red=a),g.green===void 0&&(g.green=a),g.blue===void 0&&(g.blue=a);function y(){let v,x,S,A=a;switch(n.inputColorType){case Qu.COLORTYPE_COLOR_ALPHA:A=s[p+3],v=s[p],x=s[p+1],S=s[p+2];break;case Qu.COLORTYPE_COLOR:v=s[p],x=s[p+1],S=s[p+2];break;case Qu.COLORTYPE_ALPHA:A=s[p+1],v=s[p],x=v,S=v;break;case Qu.COLORTYPE_GRAYSCALE:v=s[p],x=v,S=v;break;default:throw new Error("input color type:"+n.inputColorType+" is not supported at present")}return n.inputHasAlpha&&(i||(A/=a,v=Math.min(Math.max(Math.round((1-A)*g.red+A*v),0),a),x=Math.min(Math.max(Math.round((1-A)*g.green+A*x),0),a),S=Math.min(Math.max(Math.round((1-A)*g.blue+A*S),0),a))),{red:v,green:x,blue:S,alpha:A}}o(y,"getRGBA");for(let v=0;v<t;v++)for(let x=0;x<e;x++){let S=y(s,p);switch(n.colorType){case Qu.COLORTYPE_COLOR_ALPHA:case Qu.COLORTYPE_COLOR:n.bitDepth===8?(l[d]=S.red,l[d+1]=S.green,l[d+2]=S.blue,i&&(l[d+3]=S.alpha)):(l.writeUInt16BE(S.red,d),l.writeUInt16BE(S.green,d+2),l.writeUInt16BE(S.blue,d+4),i&&l.writeUInt16BE(S.alpha,d+6));break;case Qu.COLORTYPE_ALPHA:case Qu.COLORTYPE_GRAYSCALE:{let A=(S.red+S.green+S.blue)/3;n.bitDepth===8?(l[d]=A,i&&(l[d+1]=S.alpha)):(l.writeUInt16BE(A,d),i&&l.writeUInt16BE(S.alpha,d+2));break}default:throw new Error("unrecognised color Type "+n.colorType)}p+=u,d+=c}return l}});var zse=Q((hft,Hse)=>{"use strict";var qse=AU();function RPe(r,e,t,n,i){for(let s=0;s<t;s++)n[i+s]=r[e+s]}o(RPe,"filterNone");function DPe(r,e,t){let n=0,i=e+t;for(let s=e;s<i;s++)n+=Math.abs(r[s]);return n}o(DPe,"filterSumNone");function OPe(r,e,t,n,i,s){for(let a=0;a<t;a++){let u=a>=s?r[e+a-s]:0,c=r[e+a]-u;n[i+a]=c}}o(OPe,"filterSub");function BPe(r,e,t,n){let i=0;for(let s=0;s<t;s++){let a=s>=n?r[e+s-n]:0,u=r[e+s]-a;i+=Math.abs(u)}return i}o(BPe,"filterSumSub");function PPe(r,e,t,n,i){for(let s=0;s<t;s++){let a=e>0?r[e+s-t]:0,u=r[e+s]-a;n[i+s]=u}}o(PPe,"filterUp");function _Pe(r,e,t){let n=0,i=e+t;for(let s=e;s<i;s++){let a=e>0?r[s-t]:0,u=r[s]-a;n+=Math.abs(u)}return n}o(_Pe,"filterSumUp");function LPe(r,e,t,n,i,s){for(let a=0;a<t;a++){let u=a>=s?r[e+a-s]:0,c=e>0?r[e+a-t]:0,l=r[e+a]-(u+c>>1);n[i+a]=l}}o(LPe,"filterAvg");function FPe(r,e,t,n){let i=0;for(let s=0;s<t;s++){let a=s>=n?r[e+s-n]:0,u=e>0?r[e+s-t]:0,c=r[e+s]-(a+u>>1);i+=Math.abs(c)}return i}o(FPe,"filterSumAvg");function kPe(r,e,t,n,i,s){for(let a=0;a<t;a++){let u=a>=s?r[e+a-s]:0,c=e>0?r[e+a-t]:0,l=e>0&&a>=s?r[e+a-(t+s)]:0,p=r[e+a]-qse(u,c,l);n[i+a]=p}}o(kPe,"filterPaeth");function VPe(r,e,t,n){let i=0;for(let s=0;s<t;s++){let a=s>=n?r[e+s-n]:0,u=e>0?r[e+s-t]:0,c=e>0&&s>=n?r[e+s-(t+n)]:0,l=r[e+s]-qse(a,u,c);i+=Math.abs(l)}return i}o(VPe,"filterSumPaeth");var jPe={0:RPe,1:OPe,2:PPe,3:LPe,4:kPe},MPe={0:DPe,1:BPe,2:_Pe,3:FPe,4:VPe};Hse.exports=function(r,e,t,n,i){let s;if(!("filterType"in n)||n.filterType===-1)s=[0,1,2,3,4];else if(typeof n.filterType=="number")s=[n.filterType];else throw new Error("unrecognised filter types");n.bitDepth===16&&(i*=2);let a=e*i,u=0,c=0,l=Buffer.alloc((a+1)*t),p=s[0];for(let d=0;d<t;d++){if(s.length>1){let g=1/0;for(let y=0;y<s.length;y++){let v=MPe[s[y]](r,c,a,i);v<g&&(p=s[y],g=v)}}l[u]=p,u++,jPe[p](r,c,a,l,u,i),u+=a,c+=a}return l}});var _U=Q((mft,Kse)=>{"use strict";var Ca=sw(),UPe=RU(),qPe=Use(),HPe=zse(),zPe=require("zlib"),u0=Kse.exports=function(r){if(this._options=r,r.deflateChunkSize=r.deflateChunkSize||32*1024,r.deflateLevel=r.deflateLevel!=null?r.deflateLevel:9,r.deflateStrategy=r.deflateStrategy!=null?r.deflateStrategy:3,r.inputHasAlpha=r.inputHasAlpha!=null?r.inputHasAlpha:!0,r.deflateFactory=r.deflateFactory||zPe.createDeflate,r.bitDepth=r.bitDepth||8,r.colorType=typeof r.colorType=="number"?r.colorType:Ca.COLORTYPE_COLOR_ALPHA,r.inputColorType=typeof r.inputColorType=="number"?r.inputColorType:Ca.COLORTYPE_COLOR_ALPHA,[Ca.COLORTYPE_GRAYSCALE,Ca.COLORTYPE_COLOR,Ca.COLORTYPE_COLOR_ALPHA,Ca.COLORTYPE_ALPHA].indexOf(r.colorType)===-1)throw new Error("option color type:"+r.colorType+" is not supported at present");if([Ca.COLORTYPE_GRAYSCALE,Ca.COLORTYPE_COLOR,Ca.COLORTYPE_COLOR_ALPHA,Ca.COLORTYPE_ALPHA].indexOf(r.inputColorType)===-1)throw new Error("option input color type:"+r.inputColorType+" is not supported at present");if(r.bitDepth!==8&&r.bitDepth!==16)throw new Error("option bit depth:"+r.bitDepth+" is not supported at present")};u0.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};u0.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};u0.prototype.filterData=function(r,e,t){let n=qPe(r,e,t,this._options),i=Ca.COLORTYPE_TO_BPP_MAP[this._options.colorType];return HPe(n,e,t,this._options,i)};u0.prototype._packChunk=function(r,e){let t=e?e.length:0,n=Buffer.alloc(t+12);return n.writeUInt32BE(t,0),n.writeUInt32BE(r,4),e&&e.copy(n,8),n.writeInt32BE(UPe.crc32(n.slice(4,n.length-4)),n.length-4),n};u0.prototype.packGAMA=function(r){let e=Buffer.alloc(4);return e.writeUInt32BE(Math.floor(r*Ca.GAMMA_DIVISION),0),this._packChunk(Ca.TYPE_gAMA,e)};u0.prototype.packIHDR=function(r,e){let t=Buffer.alloc(13);return t.writeUInt32BE(r,0),t.writeUInt32BE(e,4),t[8]=this._options.bitDepth,t[9]=this._options.colorType,t[10]=0,t[11]=0,t[12]=0,this._packChunk(Ca.TYPE_IHDR,t)};u0.prototype.packIDAT=function(r){return this._packChunk(Ca.TYPE_IDAT,r)};u0.prototype.packIEND=function(){return this._packChunk(Ca.TYPE_IEND,null)}});var Jse=Q((gft,Wse)=>{"use strict";var KPe=require("util"),Gse=require("stream"),GPe=sw(),XPe=_U(),Xse=Wse.exports=function(r){Gse.call(this);let e=r||{};this._packer=new XPe(e),this._deflate=this._packer.createDeflate(),this.readable=!0};KPe.inherits(Xse,Gse);Xse.prototype.pack=function(r,e,t,n){this.emit("data",Buffer.from(GPe.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,t)),n&&this.emit("data",this._packer.packGAMA(n));let i=this._packer.filterData(r,e,t);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",(function(s){this.emit("data",this._packer.packIDAT(s))}).bind(this)),this._deflate.on("end",(function(){this.emit("data",this._packer.packIEND()),this.emit("end")}).bind(this)),this._deflate.end(i)}});var tae=Q((pI,eae)=>{"use strict";var Yse=require("assert").ok,aw=require("zlib"),WPe=require("util"),Qse=require("buffer").kMaxLength;function ny(r){if(!(this instanceof ny))return new ny(r);r&&r.chunkSize<aw.Z_MIN_CHUNK&&(r.chunkSize=aw.Z_MIN_CHUNK),aw.Inflate.call(this,r),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,r&&r.maxLength!=null&&(this._maxLength=r.maxLength)}o(ny,"Inflate");function JPe(r){return new ny(r)}o(JPe,"createInflate");function $se(r,e){e&&process.nextTick(e),r._handle&&(r._handle.close(),r._handle=null)}o($se,"_close");ny.prototype._processChunk=function(r,e,t){if(typeof t=="function")return aw.Inflate._processChunk.call(this,r,e,t);let n=this,i=r&&r.length,s=this._chunkSize-this._offset,a=this._maxLength,u=0,c=[],l=0,p;this.on("error",function(v){p=v});function d(v,x){if(n._hadError)return;let S=s-x;if(Yse(S>=0,"have should not go down"),S>0){let A=n._buffer.slice(n._offset,n._offset+S);if(n._offset+=S,A.length>a&&(A=A.slice(0,a)),c.push(A),l+=A.length,a-=A.length,a===0)return!1}return(x===0||n._offset>=n._chunkSize)&&(s=n._chunkSize,n._offset=0,n._buffer=Buffer.allocUnsafe(n._chunkSize)),x===0?(u+=i-v,i=v,!0):!1}o(d,"handleChunk"),Yse(this._handle,"zlib binding closed");let g;do g=this._handle.writeSync(e,r,u,i,this._buffer,this._offset,s),g=g||this._writeState;while(!this._hadError&&d(g[0],g[1]));if(this._hadError)throw p;if(l>=Qse)throw $se(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+Qse.toString(16)+" bytes");let y=Buffer.concat(c,l);return $se(this),y};WPe.inherits(ny,aw.Inflate);function YPe(r,e){if(typeof e=="string"&&(e=Buffer.from(e)),!(e instanceof Buffer))throw new TypeError("Not a string or buffer");let t=r._finishFlushFlag;return t==null&&(t=aw.Z_FINISH),r._processChunk(e,t)}o(YPe,"zlibBufferSync");function Zse(r,e){return YPe(new ny(e),r)}o(Zse,"inflateSync");eae.exports=pI=Zse;pI.Inflate=ny;pI.createInflate=JPe;pI.inflateSync=Zse});var LU=Q((yft,nae)=>{"use strict";var rae=nae.exports=function(r){this._buffer=r,this._reads=[]};rae.prototype.read=function(r,e){this._reads.push({length:Math.abs(r),allowLess:r<0,func:e})};rae.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let r=this._reads[0];if(this._buffer.length&&(this._buffer.length>=r.length||r.allowLess)){this._reads.shift();let e=this._buffer;this._buffer=e.slice(r.length),r.func.call(this,e.slice(0,r.length))}else break}if(this._reads.length>0)return new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)return new Error("unrecognised content at end of stream")}});var sae=Q(iae=>{"use strict";var QPe=LU(),$Pe=NU();iae.process=function(r,e){let t=[],n=new QPe(r);return new $Pe(e,{read:n.read.bind(n),write:o(function(s){t.push(s)},"write"),complete:o(function(){},"complete")}).start(),n.process(),Buffer.concat(t)}});var cae=Q((xft,uae)=>{"use strict";var aae=!0,oae=require("zlib"),ZPe=tae();oae.deflateSync||(aae=!1);var e_e=LU(),t_e=sae(),r_e=DU(),n_e=OU(),i_e=BU();uae.exports=function(r,e){if(!aae)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t;function n(E){t=E}o(n,"handleError");let i;function s(E){i=E}o(s,"handleMetaData");function a(E){i.transColor=E}o(a,"handleTransColor");function u(E){i.palette=E}o(u,"handlePalette");function c(){i.alpha=!0}o(c,"handleSimpleTransparency");let l;function p(E){l=E}o(p,"handleGamma");let d=[];function g(E){d.push(E)}o(g,"handleInflateData");let y=new e_e(r);if(new r_e(e,{read:y.read.bind(y),error:n,metadata:s,gamma:p,palette:u,transColor:a,inflateData:g,simpleTransparency:c}).start(),y.process(),t)throw t;let x=Buffer.concat(d);d.length=0;let S;if(i.interlace)S=oae.inflateSync(x);else{let I=((i.width*i.bpp*i.depth+7>>3)+1)*i.height;S=ZPe(x,{chunkSize:I,maxLength:I})}if(x=null,!S||!S.length)throw new Error("bad png - invalid inflate data response");let A=t_e.process(S,i);x=null;let D=n_e.dataToBitMap(A,i);A=null;let C=i_e(D,i);return i.data=C,i.gamma=l||0,i}});var hae=Q((Cft,pae)=>{"use strict";var lae=!0,fae=require("zlib");fae.deflateSync||(lae=!1);var s_e=sw(),a_e=_U();pae.exports=function(r,e){if(!lae)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t=e||{},n=new a_e(t),i=[];i.push(Buffer.from(s_e.PNG_SIGNATURE)),i.push(n.packIHDR(r.width,r.height)),r.gamma&&i.push(n.packGAMA(r.gamma));let s=n.filterData(r.data,r.width,r.height),a=fae.deflateSync(s,n.getDeflateOptions());if(s=null,!a||!a.length)throw new Error("bad png - invalid compressed data response");return i.push(n.packIDAT(a)),i.push(n.packIEND()),Buffer.concat(i)}});var dae=Q(FU=>{"use strict";var o_e=cae(),u_e=hae();FU.read=function(r,e){return o_e(r,e||{})};FU.write=function(r,e){return u_e(r,e)}});var vae=Q(gae=>{"use strict";var c_e=require("util"),mae=require("stream"),l_e=jse(),f_e=Jse(),p_e=dae(),Ha=gae.PNG=function(r){mae.call(this),r=r||{},this.width=r.width|0,this.height=r.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,r.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new l_e(r),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",(function(e){this.data=e,this.emit("parsed",e)}).bind(this)),this._packer=new f_e(r),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};c_e.inherits(Ha,mae);Ha.sync=p_e;Ha.prototype.pack=function(){return!this.data||!this.data.length?(this.emit("error","No data provided"),this):(process.nextTick((function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}).bind(this)),this)};Ha.prototype.parse=function(r,e){if(e){let t,n;t=(function(i){this.removeListener("error",n),this.data=i,e(null,this)}).bind(this),n=(function(i){this.removeListener("parsed",t),e(i,null)}).bind(this),this.once("parsed",t),this.once("error",n)}return this.end(r),this};Ha.prototype.write=function(r){return this._parser.write(r),!0};Ha.prototype.end=function(r){this._parser.end(r)};Ha.prototype._metadata=function(r){this.width=r.width,this.height=r.height,this.emit("metadata",r)};Ha.prototype._gamma=function(r){this.gamma=r};Ha.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit("close")};Ha.bitblt=function(r,e,t,n,i,s,a,u){if(t|=0,n|=0,i|=0,s|=0,a|=0,u|=0,t>r.width||n>r.height||t+i>r.width||n+s>r.height)throw new Error("bitblt reading outside image");if(a>e.width||u>e.height||a+i>e.width||u+s>e.height)throw new Error("bitblt writing outside image");for(let c=0;c<s;c++)r.data.copy(e.data,(u+c)*e.width+a<<2,(n+c)*r.width+t<<2,(n+c)*r.width+t+i<<2)};Ha.prototype.bitblt=function(r,e,t,n,i,s,a){return Ha.bitblt(this,r,e,t,n,i,s,a),this};Ha.adjustGamma=function(r){if(r.gamma){for(let e=0;e<r.height;e++)for(let t=0;t<r.width;t++){let n=r.width*e+t<<2;for(let i=0;i<3;i++){let s=r.data[n+i]/255;s=Math.pow(s,1/2.2/r.gamma),r.data[n+i]=Math.round(s*255)}}r.gamma=0}};Ha.prototype.adjustGamma=function(){Ha.adjustGamma(this)}});var hI=Q(iy=>{"use strict";function yae(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}o(yae,"hex2rgba");iy.getOptions=o(function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:t,color:{dark:yae(e.color.dark||"#000000ff"),light:yae(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},"getOptions");iy.getScale=o(function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},"getScale");iy.getImageWidth=o(function(e,t){let n=iy.getScale(e,t);return Math.floor((e+t.margin*2)*n)},"getImageWidth");iy.qrToImageData=o(function(e,t,n){let i=t.modules.size,s=t.modules.data,a=iy.getScale(i,n),u=Math.floor((i+n.margin*2)*a),c=n.margin*a,l=[n.color.light,n.color.dark];for(let p=0;p<u;p++)for(let d=0;d<u;d++){let g=(p*u+d)*4,y=n.color.light;if(p>=c&&d>=c&&p<u-c&&d<u-c){let v=Math.floor((p-c)/a),x=Math.floor((d-c)/a);y=l[s[v*i+x]?1:0]}e[g++]=y.r,e[g++]=y.g,e[g++]=y.b,e[g]=y.a}},"qrToImageData")});var Sae=Q(Tf=>{"use strict";var h_e=require("fs"),d_e=vae().PNG,kU=hI();Tf.render=o(function(e,t){let n=kU.getOptions(t),i=n.rendererOpts,s=kU.getImageWidth(e.modules.size,n);i.width=s,i.height=s;let a=new d_e(i);return kU.qrToImageData(a.data,e,n),a},"render");Tf.renderToDataURL=o(function(e,t,n){typeof n>"u"&&(n=t,t=void 0),Tf.renderToBuffer(e,t,function(i,s){i&&n(i);let a="data:image/png;base64,";a+=s.toString("base64"),n(null,a)})},"renderToDataURL");Tf.renderToBuffer=o(function(e,t,n){typeof n>"u"&&(n=t,t=void 0);let i=Tf.render(e,t),s=[];i.on("error",n),i.on("data",function(a){s.push(a)}),i.on("end",function(){n(null,Buffer.concat(s))}),i.pack()},"renderToBuffer");Tf.renderToFile=o(function(e,t,n,i){typeof i>"u"&&(i=n,n=void 0);let s=!1,a=o((...c)=>{s||(s=!0,i.apply(null,c))},"done"),u=h_e.createWriteStream(e);u.on("error",a),u.on("close",a),Tf.renderToFileStream(u,t,n)},"renderToFile");Tf.renderToFileStream=o(function(e,t,n){Tf.render(t,n).pack().pipe(e)},"renderToFileStream")});var bae=Q(e4=>{"use strict";var m_e=hI(),g_e={WW:" ",WB:"\u2584",BB:"\u2588",BW:"\u2580"},v_e={BB:" ",BW:"\u2584",WW:"\u2588",WB:"\u2580"};function y_e(r,e,t){return r&&e?t.BB:r&&!e?t.BW:!r&&e?t.WB:t.WW}o(y_e,"getBlockChar");e4.render=function(r,e,t){let n=m_e.getOptions(e),i=g_e;(n.color.dark.hex==="#ffffff"||n.color.light.hex==="#000000")&&(i=v_e);let s=r.modules.size,a=r.modules.data,u="",c=Array(s+n.margin*2+1).join(i.WW);c=Array(n.margin/2+1).join(c+`
|
|
105
|
+
`);let a=aPe(e,t,i),u=Z_.getSymbolSize(e),c=new JBe(u);return tPe(c,e),rPe(c),nPe(c,e),yU(c,t,0),e>=7&&iPe(c,e),sPe(c,a),isNaN(n)&&(n=SU.getBestMask(c,yU.bind(null,c,t))),SU.applyMask(n,c),yU(c,t,n),{modules:c,version:e,errorCorrectionLevel:t,maskPattern:n,segments:i}}o(uPe,"createSymbol");wse.create=o(function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let n=gU.M,i,s;return typeof t<"u"&&(n=gU.from(t.errorCorrectionLevel,gU.M),i=$_.from(t.version),s=SU.from(t.maskPattern),t.toSJISFunc&&Z_.setToSJISFunction(t.toSJISFunc)),uPe(e,i,n,s)},"create")});var wU=Q((Ylt,Ese)=>{"use strict";var cPe=require("util"),Cse=require("stream"),el=Ese.exports=function(){Cse.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};cPe.inherits(el,Cse);el.prototype.read=function(r,e){this._reads.push({length:Math.abs(r),allowLess:r<0,func:e}),process.nextTick((function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}).bind(this))};el.prototype.write=function(r,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let t;return Buffer.isBuffer(r)?t=r:t=Buffer.from(r,e||this._encoding),this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused};el.prototype.end=function(r,e){r&&this.write(r,e),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))};el.prototype.destroySoon=el.prototype.end;el.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()};el.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))};el.prototype._processReadAllowingLess=function(r){this._reads.shift();let e=this._buffers[0];e.length>r.length?(this._buffered-=r.length,this._buffers[0]=e.slice(r.length),r.func.call(this,e.slice(0,r.length))):(this._buffered-=e.length,this._buffers.shift(),r.func.call(this,e))};el.prototype._processRead=function(r){this._reads.shift();let e=0,t=0,n=Buffer.alloc(r.length);for(;e<r.length;){let i=this._buffers[t++],s=Math.min(i.length,r.length-e);i.copy(n,e,0,s),e+=s,s!==i.length&&(this._buffers[--t]=i.slice(s))}t>0&&this._buffers.splice(0,t),this._buffered-=r.length,r.func.call(this,n)};el.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let r=this._reads[0];if(r.allowLess)this._processReadAllowingLess(r);else if(this._buffered>=r.length)this._processRead(r);else break}this._buffers&&!this.writable&&this._end()}catch(r){this.emit("error",r)}}});var EU=Q(CU=>{"use strict";var o0=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];CU.getImagePasses=function(r,e){let t=[],n=r%8,i=e%8,s=(r-n)/8,a=(e-i)/8;for(let u=0;u<o0.length;u++){let c=o0[u],l=s*c.x.length,p=a*c.y.length;for(let d=0;d<c.x.length&&c.x[d]<n;d++)l++;for(let d=0;d<c.y.length&&c.y[d]<i;d++)p++;l>0&&p>0&&t.push({width:l,height:p,index:u})}return t};CU.getInterlaceIterator=function(r){return function(e,t,n){let i=e%o0[n].x.length,s=(e-i)/o0[n].x.length*8+o0[n].x[i],a=t%o0[n].y.length,u=(t-a)/o0[n].y.length*8+o0[n].y[a];return s*4+u*r*4}}});var AU=Q(($lt,Ase)=>{"use strict";Ase.exports=o(function(e,t,n){let i=e+t-n,s=Math.abs(i-e),a=Math.abs(i-t),u=Math.abs(i-n);return s<=a&&s<=u?e:a<=u?t:n},"paethPredictor")});var NU=Q((eft,Ise)=>{"use strict";var lPe=EU(),fPe=AU();function Nse(r,e,t){let n=r*e;return t!==8&&(n=Math.ceil(n/(8/t))),n}o(Nse,"getByteWidth");var iw=Ise.exports=function(r,e){let t=r.width,n=r.height,i=r.interlace,s=r.bpp,a=r.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],i){let u=lPe.getImagePasses(t,n);for(let c=0;c<u.length;c++)this._images.push({byteWidth:Nse(u[c].width,s,a),height:u[c].height,lineIndex:0})}else this._images.push({byteWidth:Nse(t,s,a),height:n,lineIndex:0});a===8?this._xComparison=s:a===16?this._xComparison=s*2:this._xComparison=1};iw.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};iw.prototype._unFilterType1=function(r,e,t){let n=this._xComparison,i=n-1;for(let s=0;s<t;s++){let a=r[1+s],u=s>i?e[s-n]:0;e[s]=a+u}};iw.prototype._unFilterType2=function(r,e,t){let n=this._lastLine;for(let i=0;i<t;i++){let s=r[1+i],a=n?n[i]:0;e[i]=s+a}};iw.prototype._unFilterType3=function(r,e,t){let n=this._xComparison,i=n-1,s=this._lastLine;for(let a=0;a<t;a++){let u=r[1+a],c=s?s[a]:0,l=a>i?e[a-n]:0,p=Math.floor((l+c)/2);e[a]=u+p}};iw.prototype._unFilterType4=function(r,e,t){let n=this._xComparison,i=n-1,s=this._lastLine;for(let a=0;a<t;a++){let u=r[1+a],c=s?s[a]:0,l=a>i?e[a-n]:0,p=a>i&&s?s[a-n]:0,d=fPe(l,c,p);e[a]=u+d}};iw.prototype._reverseFilterLine=function(r){let e=r[0],t,n=this._images[this._imageIndex],i=n.byteWidth;if(e===0)t=r.slice(1,i+1);else switch(t=Buffer.alloc(i),e){case 1:this._unFilterType1(r,t,i);break;case 2:this._unFilterType2(r,t,i);break;case 3:this._unFilterType3(r,t,i);break;case 4:this._unFilterType4(r,t,i);break;default:throw new Error("Unrecognised filter type - "+e)}this.write(t),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=t,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}});var Dse=Q((rft,Rse)=>{"use strict";var pPe=require("util"),Tse=wU(),hPe=NU(),dPe=Rse.exports=function(r){Tse.call(this);let e=[],t=this;this._filter=new hPe(r,{read:this.read.bind(this),write:o(function(n){e.push(n)},"write"),complete:o(function(){t.emit("complete",Buffer.concat(e))},"complete")}),this._filter.start()};pPe.inherits(dPe,Tse)});var sw=Q((ift,Ose)=>{"use strict";Ose.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var RU=Q((sft,Bse)=>{"use strict";var IU=[];(function(){for(let r=0;r<256;r++){let e=r;for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e=e>>>1;IU[r]=e}})();var TU=Bse.exports=function(){this._crc=-1};TU.prototype.write=function(r){for(let e=0;e<r.length;e++)this._crc=IU[(this._crc^r[e])&255]^this._crc>>>8;return!0};TU.prototype.crc32=function(){return this._crc^-1};TU.crc32=function(r){let e=-1;for(let t=0;t<r.length;t++)e=IU[(e^r[t])&255]^e>>>8;return e^-1}});var DU=Q((aft,Pse)=>{"use strict";var ss=sw(),mPe=RU(),Ts=Pse.exports=function(r,e){this._options=r,r.checkCRC=r.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[ss.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[ss.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[ss.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[ss.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[ss.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[ss.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};Ts.prototype.start=function(){this.read(ss.PNG_SIGNATURE.length,this._parseSignature.bind(this))};Ts.prototype._parseSignature=function(r){let e=ss.PNG_SIGNATURE;for(let t=0;t<e.length;t++)if(r[t]!==e[t]){this.error(new Error("Invalid file signature"));return}this.read(8,this._parseChunkBegin.bind(this))};Ts.prototype._parseChunkBegin=function(r){let e=r.readUInt32BE(0),t=r.readUInt32BE(4),n="";for(let s=4;s<8;s++)n+=String.fromCharCode(r[s]);let i=!!(r[4]&32);if(!this._hasIHDR&&t!==ss.TYPE_IHDR){this.error(new Error("Expected IHDR on beggining"));return}if(this._crc=new mPe,this._crc.write(Buffer.from(n)),this._chunks[t])return this._chunks[t](e);if(!i){this.error(new Error("Unsupported critical chunk type "+n));return}this.read(e+4,this._skipChunk.bind(this))};Ts.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};Ts.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};Ts.prototype._parseChunkEnd=function(r){let e=r.readInt32BE(0),t=this._crc.crc32();if(this._options.checkCRC&&t!==e){this.error(new Error("Crc error - "+e+" - "+t));return}this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))};Ts.prototype._handleIHDR=function(r){this.read(r,this._parseIHDR.bind(this))};Ts.prototype._parseIHDR=function(r){this._crc.write(r);let e=r.readUInt32BE(0),t=r.readUInt32BE(4),n=r[8],i=r[9],s=r[10],a=r[11],u=r[12];if(n!==8&&n!==4&&n!==2&&n!==1&&n!==16){this.error(new Error("Unsupported bit depth "+n));return}if(!(i in ss.COLORTYPE_TO_BPP_MAP)){this.error(new Error("Unsupported color type"));return}if(s!==0){this.error(new Error("Unsupported compression method"));return}if(a!==0){this.error(new Error("Unsupported filter method"));return}if(u!==0&&u!==1){this.error(new Error("Unsupported interlace method"));return}this._colorType=i;let c=ss.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:t,depth:n,interlace:!!u,palette:!!(i&ss.COLORTYPE_PALETTE),color:!!(i&ss.COLORTYPE_COLOR),alpha:!!(i&ss.COLORTYPE_ALPHA),bpp:c,colorType:i}),this._handleChunkEnd()};Ts.prototype._handlePLTE=function(r){this.read(r,this._parsePLTE.bind(this))};Ts.prototype._parsePLTE=function(r){this._crc.write(r);let e=Math.floor(r.length/3);for(let t=0;t<e;t++)this._palette.push([r[t*3],r[t*3+1],r[t*3+2],255]);this.palette(this._palette),this._handleChunkEnd()};Ts.prototype._handleTRNS=function(r){this.simpleTransparency(),this.read(r,this._parseTRNS.bind(this))};Ts.prototype._parseTRNS=function(r){if(this._crc.write(r),this._colorType===ss.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(new Error("Transparency chunk must be after palette"));return}if(r.length>this._palette.length){this.error(new Error("More transparent colors than palette size"));return}for(let e=0;e<r.length;e++)this._palette[e][3]=r[e];this.palette(this._palette)}this._colorType===ss.COLORTYPE_GRAYSCALE&&this.transColor([r.readUInt16BE(0)]),this._colorType===ss.COLORTYPE_COLOR&&this.transColor([r.readUInt16BE(0),r.readUInt16BE(2),r.readUInt16BE(4)]),this._handleChunkEnd()};Ts.prototype._handleGAMA=function(r){this.read(r,this._parseGAMA.bind(this))};Ts.prototype._parseGAMA=function(r){this._crc.write(r),this.gamma(r.readUInt32BE(0)/ss.GAMMA_DIVISION),this._handleChunkEnd()};Ts.prototype._handleIDAT=function(r){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-r,this._parseIDAT.bind(this,r))};Ts.prototype._parseIDAT=function(r,e){if(this._crc.write(e),this._colorType===ss.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw new Error("Expected palette not found");this.inflateData(e);let t=r-e.length;t>0?this._handleIDAT(t):this._handleChunkEnd()};Ts.prototype._handleIEND=function(r){this.read(r,this._parseIEND.bind(this))};Ts.prototype._parseIEND=function(r){this._crc.write(r),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}});var OU=Q(Lse=>{"use strict";var _se=EU(),gPe=[function(){},function(r,e,t,n){if(n===e.length)throw new Error("Ran out of data");let i=e[n];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=255},function(r,e,t,n){if(n+1>=e.length)throw new Error("Ran out of data");let i=e[n];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=e[n+1]},function(r,e,t,n){if(n+2>=e.length)throw new Error("Ran out of data");r[t]=e[n],r[t+1]=e[n+1],r[t+2]=e[n+2],r[t+3]=255},function(r,e,t,n){if(n+3>=e.length)throw new Error("Ran out of data");r[t]=e[n],r[t+1]=e[n+1],r[t+2]=e[n+2],r[t+3]=e[n+3]}],vPe=[function(){},function(r,e,t,n){let i=e[0];r[t]=i,r[t+1]=i,r[t+2]=i,r[t+3]=n},function(r,e,t){let n=e[0];r[t]=n,r[t+1]=n,r[t+2]=n,r[t+3]=e[1]},function(r,e,t,n){r[t]=e[0],r[t+1]=e[1],r[t+2]=e[2],r[t+3]=n},function(r,e,t){r[t]=e[0],r[t+1]=e[1],r[t+2]=e[2],r[t+3]=e[3]}];function yPe(r,e){let t=[],n=0;function i(){if(n===r.length)throw new Error("Ran out of data");let s=r[n];n++;let a,u,c,l,p,d,g,y;switch(e){default:throw new Error("unrecognised depth");case 16:g=r[n],n++,t.push((s<<8)+g);break;case 4:g=s&15,y=s>>4,t.push(y,g);break;case 2:p=s&3,d=s>>2&3,g=s>>4&3,y=s>>6&3,t.push(y,g,d,p);break;case 1:a=s&1,u=s>>1&1,c=s>>2&1,l=s>>3&1,p=s>>4&1,d=s>>5&1,g=s>>6&1,y=s>>7&1,t.push(y,g,d,p,l,c,u,a);break}}return o(i,"split"),{get:o(function(s){for(;t.length<s;)i();let a=t.slice(0,s);return t=t.slice(s),a},"get"),resetAfterLine:o(function(){t.length=0},"resetAfterLine"),end:o(function(){if(n!==r.length)throw new Error("extra data found")},"end")}}o(yPe,"bitRetriever");function SPe(r,e,t,n,i,s){let a=r.width,u=r.height,c=r.index;for(let l=0;l<u;l++)for(let p=0;p<a;p++){let d=t(p,l,c);gPe[n](e,i,d,s),s+=n}return s}o(SPe,"mapImage8Bit");function bPe(r,e,t,n,i,s){let a=r.width,u=r.height,c=r.index;for(let l=0;l<u;l++){for(let p=0;p<a;p++){let d=i.get(n),g=t(p,l,c);vPe[n](e,d,g,s)}i.resetAfterLine()}}o(bPe,"mapImageCustomBit");Lse.dataToBitMap=function(r,e){let t=e.width,n=e.height,i=e.depth,s=e.bpp,a=e.interlace,u;i!==8&&(u=yPe(r,i));let c;i<=8?c=Buffer.alloc(t*n*4):c=new Uint16Array(t*n*4);let l=Math.pow(2,i)-1,p=0,d,g;if(a)d=_se.getImagePasses(t,n),g=_se.getInterlaceIterator(t,n);else{let y=0;g=o(function(){let v=y;return y+=4,v},"getPxPos"),d=[{width:t,height:n}]}for(let y=0;y<d.length;y++)i===8?p=SPe(d[y],c,g,s,r,p):bPe(d[y],c,g,s,u,l);if(i===8){if(p!==r.length)throw new Error("extra data found")}else u.end();return c}});var BU=Q((cft,Fse)=>{"use strict";function xPe(r,e,t,n,i){let s=0;for(let a=0;a<n;a++)for(let u=0;u<t;u++){let c=i[r[s]];if(!c)throw new Error("index "+r[s]+" not in palette");for(let l=0;l<4;l++)e[s+l]=c[l];s+=4}}o(xPe,"dePalette");function wPe(r,e,t,n,i){let s=0;for(let a=0;a<n;a++)for(let u=0;u<t;u++){let c=!1;if(i.length===1?i[0]===r[s]&&(c=!0):i[0]===r[s]&&i[1]===r[s+1]&&i[2]===r[s+2]&&(c=!0),c)for(let l=0;l<4;l++)e[s+l]=0;s+=4}}o(wPe,"replaceTransparentColor");function CPe(r,e,t,n,i){let s=255,a=Math.pow(2,i)-1,u=0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){for(let p=0;p<4;p++)e[u+p]=Math.floor(r[u+p]*s/a+.5);u+=4}}o(CPe,"scaleDepth");Fse.exports=function(r,e){let t=e.depth,n=e.width,i=e.height,s=e.colorType,a=e.transColor,u=e.palette,c=r;return s===3?xPe(r,c,n,i,u):(a&&wPe(r,c,n,i,a),t!==8&&(t===16&&(c=Buffer.alloc(n*i*4)),CPe(r,c,n,i,t))),c}});var jse=Q((fft,Vse)=>{"use strict";var EPe=require("util"),PU=require("zlib"),kse=wU(),APe=Dse(),NPe=DU(),IPe=OU(),TPe=BU(),If=Vse.exports=function(r){kse.call(this),this._parser=new NPe(r,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=r,this.writable=!0,this._parser.start()};EPe.inherits(If,kse);If.prototype._handleError=function(r){this.emit("error",r),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0};If.prototype._inflateData=function(r){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=PU.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,n=Math.max(t,PU.Z_MIN_CHUNK);this._inflate=PU.createInflate({chunkSize:n});let i=t,s=this.emit.bind(this,"error");this._inflate.on("error",function(u){i&&s(u)}),this._filter.on("complete",this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on("data",function(u){i&&(u.length>i&&(u=u.slice(0,i)),i-=u.length,a(u))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(r)};If.prototype._handleMetaData=function(r){this._metaData=r,this._bitmapInfo=Object.create(r),this._filter=new APe(this._bitmapInfo)};If.prototype._handleTransColor=function(r){this._bitmapInfo.transColor=r};If.prototype._handlePalette=function(r){this._bitmapInfo.palette=r};If.prototype._simpleTransparency=function(){this._metaData.alpha=!0};If.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};If.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))};If.prototype._complete=function(r){if(this.errord)return;let e;try{let t=IPe.dataToBitMap(r,this._bitmapInfo);e=TPe(t,this._bitmapInfo),t=null}catch(t){this._handleError(t);return}this.emit("parsed",e)}});var Use=Q((pft,Mse)=>{"use strict";var Qu=sw();Mse.exports=function(r,e,t,n){let i=[Qu.COLORTYPE_COLOR_ALPHA,Qu.COLORTYPE_ALPHA].indexOf(n.colorType)!==-1;if(n.colorType===n.inputColorType){let v=(function(){let x=new ArrayBuffer(2);return new DataView(x).setInt16(0,256,!0),new Int16Array(x)[0]!==256})();if(n.bitDepth===8||n.bitDepth===16&&v)return r}let s=n.bitDepth!==16?r:new Uint16Array(r.buffer),a=255,u=Qu.COLORTYPE_TO_BPP_MAP[n.inputColorType];u===4&&!n.inputHasAlpha&&(u=3);let c=Qu.COLORTYPE_TO_BPP_MAP[n.colorType];n.bitDepth===16&&(a=65535,c*=2);let l=Buffer.alloc(e*t*c),p=0,d=0,g=n.bgColor||{};g.red===void 0&&(g.red=a),g.green===void 0&&(g.green=a),g.blue===void 0&&(g.blue=a);function y(){let v,x,S,A=a;switch(n.inputColorType){case Qu.COLORTYPE_COLOR_ALPHA:A=s[p+3],v=s[p],x=s[p+1],S=s[p+2];break;case Qu.COLORTYPE_COLOR:v=s[p],x=s[p+1],S=s[p+2];break;case Qu.COLORTYPE_ALPHA:A=s[p+1],v=s[p],x=v,S=v;break;case Qu.COLORTYPE_GRAYSCALE:v=s[p],x=v,S=v;break;default:throw new Error("input color type:"+n.inputColorType+" is not supported at present")}return n.inputHasAlpha&&(i||(A/=a,v=Math.min(Math.max(Math.round((1-A)*g.red+A*v),0),a),x=Math.min(Math.max(Math.round((1-A)*g.green+A*x),0),a),S=Math.min(Math.max(Math.round((1-A)*g.blue+A*S),0),a))),{red:v,green:x,blue:S,alpha:A}}o(y,"getRGBA");for(let v=0;v<t;v++)for(let x=0;x<e;x++){let S=y(s,p);switch(n.colorType){case Qu.COLORTYPE_COLOR_ALPHA:case Qu.COLORTYPE_COLOR:n.bitDepth===8?(l[d]=S.red,l[d+1]=S.green,l[d+2]=S.blue,i&&(l[d+3]=S.alpha)):(l.writeUInt16BE(S.red,d),l.writeUInt16BE(S.green,d+2),l.writeUInt16BE(S.blue,d+4),i&&l.writeUInt16BE(S.alpha,d+6));break;case Qu.COLORTYPE_ALPHA:case Qu.COLORTYPE_GRAYSCALE:{let A=(S.red+S.green+S.blue)/3;n.bitDepth===8?(l[d]=A,i&&(l[d+1]=S.alpha)):(l.writeUInt16BE(A,d),i&&l.writeUInt16BE(S.alpha,d+2));break}default:throw new Error("unrecognised color Type "+n.colorType)}p+=u,d+=c}return l}});var zse=Q((dft,Hse)=>{"use strict";var qse=AU();function RPe(r,e,t,n,i){for(let s=0;s<t;s++)n[i+s]=r[e+s]}o(RPe,"filterNone");function DPe(r,e,t){let n=0,i=e+t;for(let s=e;s<i;s++)n+=Math.abs(r[s]);return n}o(DPe,"filterSumNone");function OPe(r,e,t,n,i,s){for(let a=0;a<t;a++){let u=a>=s?r[e+a-s]:0,c=r[e+a]-u;n[i+a]=c}}o(OPe,"filterSub");function BPe(r,e,t,n){let i=0;for(let s=0;s<t;s++){let a=s>=n?r[e+s-n]:0,u=r[e+s]-a;i+=Math.abs(u)}return i}o(BPe,"filterSumSub");function PPe(r,e,t,n,i){for(let s=0;s<t;s++){let a=e>0?r[e+s-t]:0,u=r[e+s]-a;n[i+s]=u}}o(PPe,"filterUp");function _Pe(r,e,t){let n=0,i=e+t;for(let s=e;s<i;s++){let a=e>0?r[s-t]:0,u=r[s]-a;n+=Math.abs(u)}return n}o(_Pe,"filterSumUp");function LPe(r,e,t,n,i,s){for(let a=0;a<t;a++){let u=a>=s?r[e+a-s]:0,c=e>0?r[e+a-t]:0,l=r[e+a]-(u+c>>1);n[i+a]=l}}o(LPe,"filterAvg");function FPe(r,e,t,n){let i=0;for(let s=0;s<t;s++){let a=s>=n?r[e+s-n]:0,u=e>0?r[e+s-t]:0,c=r[e+s]-(a+u>>1);i+=Math.abs(c)}return i}o(FPe,"filterSumAvg");function kPe(r,e,t,n,i,s){for(let a=0;a<t;a++){let u=a>=s?r[e+a-s]:0,c=e>0?r[e+a-t]:0,l=e>0&&a>=s?r[e+a-(t+s)]:0,p=r[e+a]-qse(u,c,l);n[i+a]=p}}o(kPe,"filterPaeth");function VPe(r,e,t,n){let i=0;for(let s=0;s<t;s++){let a=s>=n?r[e+s-n]:0,u=e>0?r[e+s-t]:0,c=e>0&&s>=n?r[e+s-(t+n)]:0,l=r[e+s]-qse(a,u,c);i+=Math.abs(l)}return i}o(VPe,"filterSumPaeth");var jPe={0:RPe,1:OPe,2:PPe,3:LPe,4:kPe},MPe={0:DPe,1:BPe,2:_Pe,3:FPe,4:VPe};Hse.exports=function(r,e,t,n,i){let s;if(!("filterType"in n)||n.filterType===-1)s=[0,1,2,3,4];else if(typeof n.filterType=="number")s=[n.filterType];else throw new Error("unrecognised filter types");n.bitDepth===16&&(i*=2);let a=e*i,u=0,c=0,l=Buffer.alloc((a+1)*t),p=s[0];for(let d=0;d<t;d++){if(s.length>1){let g=1/0;for(let y=0;y<s.length;y++){let v=MPe[s[y]](r,c,a,i);v<g&&(p=s[y],g=v)}}l[u]=p,u++,jPe[p](r,c,a,l,u,i),u+=a,c+=a}return l}});var _U=Q((gft,Kse)=>{"use strict";var Ca=sw(),UPe=RU(),qPe=Use(),HPe=zse(),zPe=require("zlib"),u0=Kse.exports=function(r){if(this._options=r,r.deflateChunkSize=r.deflateChunkSize||32*1024,r.deflateLevel=r.deflateLevel!=null?r.deflateLevel:9,r.deflateStrategy=r.deflateStrategy!=null?r.deflateStrategy:3,r.inputHasAlpha=r.inputHasAlpha!=null?r.inputHasAlpha:!0,r.deflateFactory=r.deflateFactory||zPe.createDeflate,r.bitDepth=r.bitDepth||8,r.colorType=typeof r.colorType=="number"?r.colorType:Ca.COLORTYPE_COLOR_ALPHA,r.inputColorType=typeof r.inputColorType=="number"?r.inputColorType:Ca.COLORTYPE_COLOR_ALPHA,[Ca.COLORTYPE_GRAYSCALE,Ca.COLORTYPE_COLOR,Ca.COLORTYPE_COLOR_ALPHA,Ca.COLORTYPE_ALPHA].indexOf(r.colorType)===-1)throw new Error("option color type:"+r.colorType+" is not supported at present");if([Ca.COLORTYPE_GRAYSCALE,Ca.COLORTYPE_COLOR,Ca.COLORTYPE_COLOR_ALPHA,Ca.COLORTYPE_ALPHA].indexOf(r.inputColorType)===-1)throw new Error("option input color type:"+r.inputColorType+" is not supported at present");if(r.bitDepth!==8&&r.bitDepth!==16)throw new Error("option bit depth:"+r.bitDepth+" is not supported at present")};u0.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};u0.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};u0.prototype.filterData=function(r,e,t){let n=qPe(r,e,t,this._options),i=Ca.COLORTYPE_TO_BPP_MAP[this._options.colorType];return HPe(n,e,t,this._options,i)};u0.prototype._packChunk=function(r,e){let t=e?e.length:0,n=Buffer.alloc(t+12);return n.writeUInt32BE(t,0),n.writeUInt32BE(r,4),e&&e.copy(n,8),n.writeInt32BE(UPe.crc32(n.slice(4,n.length-4)),n.length-4),n};u0.prototype.packGAMA=function(r){let e=Buffer.alloc(4);return e.writeUInt32BE(Math.floor(r*Ca.GAMMA_DIVISION),0),this._packChunk(Ca.TYPE_gAMA,e)};u0.prototype.packIHDR=function(r,e){let t=Buffer.alloc(13);return t.writeUInt32BE(r,0),t.writeUInt32BE(e,4),t[8]=this._options.bitDepth,t[9]=this._options.colorType,t[10]=0,t[11]=0,t[12]=0,this._packChunk(Ca.TYPE_IHDR,t)};u0.prototype.packIDAT=function(r){return this._packChunk(Ca.TYPE_IDAT,r)};u0.prototype.packIEND=function(){return this._packChunk(Ca.TYPE_IEND,null)}});var Jse=Q((vft,Wse)=>{"use strict";var KPe=require("util"),Gse=require("stream"),GPe=sw(),XPe=_U(),Xse=Wse.exports=function(r){Gse.call(this);let e=r||{};this._packer=new XPe(e),this._deflate=this._packer.createDeflate(),this.readable=!0};KPe.inherits(Xse,Gse);Xse.prototype.pack=function(r,e,t,n){this.emit("data",Buffer.from(GPe.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,t)),n&&this.emit("data",this._packer.packGAMA(n));let i=this._packer.filterData(r,e,t);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",(function(s){this.emit("data",this._packer.packIDAT(s))}).bind(this)),this._deflate.on("end",(function(){this.emit("data",this._packer.packIEND()),this.emit("end")}).bind(this)),this._deflate.end(i)}});var tae=Q((pI,eae)=>{"use strict";var Yse=require("assert").ok,aw=require("zlib"),WPe=require("util"),Qse=require("buffer").kMaxLength;function ny(r){if(!(this instanceof ny))return new ny(r);r&&r.chunkSize<aw.Z_MIN_CHUNK&&(r.chunkSize=aw.Z_MIN_CHUNK),aw.Inflate.call(this,r),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,r&&r.maxLength!=null&&(this._maxLength=r.maxLength)}o(ny,"Inflate");function JPe(r){return new ny(r)}o(JPe,"createInflate");function $se(r,e){e&&process.nextTick(e),r._handle&&(r._handle.close(),r._handle=null)}o($se,"_close");ny.prototype._processChunk=function(r,e,t){if(typeof t=="function")return aw.Inflate._processChunk.call(this,r,e,t);let n=this,i=r&&r.length,s=this._chunkSize-this._offset,a=this._maxLength,u=0,c=[],l=0,p;this.on("error",function(v){p=v});function d(v,x){if(n._hadError)return;let S=s-x;if(Yse(S>=0,"have should not go down"),S>0){let A=n._buffer.slice(n._offset,n._offset+S);if(n._offset+=S,A.length>a&&(A=A.slice(0,a)),c.push(A),l+=A.length,a-=A.length,a===0)return!1}return(x===0||n._offset>=n._chunkSize)&&(s=n._chunkSize,n._offset=0,n._buffer=Buffer.allocUnsafe(n._chunkSize)),x===0?(u+=i-v,i=v,!0):!1}o(d,"handleChunk"),Yse(this._handle,"zlib binding closed");let g;do g=this._handle.writeSync(e,r,u,i,this._buffer,this._offset,s),g=g||this._writeState;while(!this._hadError&&d(g[0],g[1]));if(this._hadError)throw p;if(l>=Qse)throw $se(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+Qse.toString(16)+" bytes");let y=Buffer.concat(c,l);return $se(this),y};WPe.inherits(ny,aw.Inflate);function YPe(r,e){if(typeof e=="string"&&(e=Buffer.from(e)),!(e instanceof Buffer))throw new TypeError("Not a string or buffer");let t=r._finishFlushFlag;return t==null&&(t=aw.Z_FINISH),r._processChunk(e,t)}o(YPe,"zlibBufferSync");function Zse(r,e){return YPe(new ny(e),r)}o(Zse,"inflateSync");eae.exports=pI=Zse;pI.Inflate=ny;pI.createInflate=JPe;pI.inflateSync=Zse});var LU=Q((Sft,nae)=>{"use strict";var rae=nae.exports=function(r){this._buffer=r,this._reads=[]};rae.prototype.read=function(r,e){this._reads.push({length:Math.abs(r),allowLess:r<0,func:e})};rae.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let r=this._reads[0];if(this._buffer.length&&(this._buffer.length>=r.length||r.allowLess)){this._reads.shift();let e=this._buffer;this._buffer=e.slice(r.length),r.func.call(this,e.slice(0,r.length))}else break}if(this._reads.length>0)return new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)return new Error("unrecognised content at end of stream")}});var sae=Q(iae=>{"use strict";var QPe=LU(),$Pe=NU();iae.process=function(r,e){let t=[],n=new QPe(r);return new $Pe(e,{read:n.read.bind(n),write:o(function(s){t.push(s)},"write"),complete:o(function(){},"complete")}).start(),n.process(),Buffer.concat(t)}});var cae=Q((wft,uae)=>{"use strict";var aae=!0,oae=require("zlib"),ZPe=tae();oae.deflateSync||(aae=!1);var e_e=LU(),t_e=sae(),r_e=DU(),n_e=OU(),i_e=BU();uae.exports=function(r,e){if(!aae)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t;function n(E){t=E}o(n,"handleError");let i;function s(E){i=E}o(s,"handleMetaData");function a(E){i.transColor=E}o(a,"handleTransColor");function u(E){i.palette=E}o(u,"handlePalette");function c(){i.alpha=!0}o(c,"handleSimpleTransparency");let l;function p(E){l=E}o(p,"handleGamma");let d=[];function g(E){d.push(E)}o(g,"handleInflateData");let y=new e_e(r);if(new r_e(e,{read:y.read.bind(y),error:n,metadata:s,gamma:p,palette:u,transColor:a,inflateData:g,simpleTransparency:c}).start(),y.process(),t)throw t;let x=Buffer.concat(d);d.length=0;let S;if(i.interlace)S=oae.inflateSync(x);else{let I=((i.width*i.bpp*i.depth+7>>3)+1)*i.height;S=ZPe(x,{chunkSize:I,maxLength:I})}if(x=null,!S||!S.length)throw new Error("bad png - invalid inflate data response");let A=t_e.process(S,i);x=null;let D=n_e.dataToBitMap(A,i);A=null;let C=i_e(D,i);return i.data=C,i.gamma=l||0,i}});var hae=Q((Eft,pae)=>{"use strict";var lae=!0,fae=require("zlib");fae.deflateSync||(lae=!1);var s_e=sw(),a_e=_U();pae.exports=function(r,e){if(!lae)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t=e||{},n=new a_e(t),i=[];i.push(Buffer.from(s_e.PNG_SIGNATURE)),i.push(n.packIHDR(r.width,r.height)),r.gamma&&i.push(n.packGAMA(r.gamma));let s=n.filterData(r.data,r.width,r.height),a=fae.deflateSync(s,n.getDeflateOptions());if(s=null,!a||!a.length)throw new Error("bad png - invalid compressed data response");return i.push(n.packIDAT(a)),i.push(n.packIEND()),Buffer.concat(i)}});var dae=Q(FU=>{"use strict";var o_e=cae(),u_e=hae();FU.read=function(r,e){return o_e(r,e||{})};FU.write=function(r,e){return u_e(r,e)}});var vae=Q(gae=>{"use strict";var c_e=require("util"),mae=require("stream"),l_e=jse(),f_e=Jse(),p_e=dae(),Ha=gae.PNG=function(r){mae.call(this),r=r||{},this.width=r.width|0,this.height=r.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,r.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new l_e(r),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",(function(e){this.data=e,this.emit("parsed",e)}).bind(this)),this._packer=new f_e(r),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};c_e.inherits(Ha,mae);Ha.sync=p_e;Ha.prototype.pack=function(){return!this.data||!this.data.length?(this.emit("error","No data provided"),this):(process.nextTick((function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}).bind(this)),this)};Ha.prototype.parse=function(r,e){if(e){let t,n;t=(function(i){this.removeListener("error",n),this.data=i,e(null,this)}).bind(this),n=(function(i){this.removeListener("parsed",t),e(i,null)}).bind(this),this.once("parsed",t),this.once("error",n)}return this.end(r),this};Ha.prototype.write=function(r){return this._parser.write(r),!0};Ha.prototype.end=function(r){this._parser.end(r)};Ha.prototype._metadata=function(r){this.width=r.width,this.height=r.height,this.emit("metadata",r)};Ha.prototype._gamma=function(r){this.gamma=r};Ha.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit("close")};Ha.bitblt=function(r,e,t,n,i,s,a,u){if(t|=0,n|=0,i|=0,s|=0,a|=0,u|=0,t>r.width||n>r.height||t+i>r.width||n+s>r.height)throw new Error("bitblt reading outside image");if(a>e.width||u>e.height||a+i>e.width||u+s>e.height)throw new Error("bitblt writing outside image");for(let c=0;c<s;c++)r.data.copy(e.data,(u+c)*e.width+a<<2,(n+c)*r.width+t<<2,(n+c)*r.width+t+i<<2)};Ha.prototype.bitblt=function(r,e,t,n,i,s,a){return Ha.bitblt(this,r,e,t,n,i,s,a),this};Ha.adjustGamma=function(r){if(r.gamma){for(let e=0;e<r.height;e++)for(let t=0;t<r.width;t++){let n=r.width*e+t<<2;for(let i=0;i<3;i++){let s=r.data[n+i]/255;s=Math.pow(s,1/2.2/r.gamma),r.data[n+i]=Math.round(s*255)}}r.gamma=0}};Ha.prototype.adjustGamma=function(){Ha.adjustGamma(this)}});var hI=Q(iy=>{"use strict";function yae(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}o(yae,"hex2rgba");iy.getOptions=o(function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:t,color:{dark:yae(e.color.dark||"#000000ff"),light:yae(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},"getOptions");iy.getScale=o(function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},"getScale");iy.getImageWidth=o(function(e,t){let n=iy.getScale(e,t);return Math.floor((e+t.margin*2)*n)},"getImageWidth");iy.qrToImageData=o(function(e,t,n){let i=t.modules.size,s=t.modules.data,a=iy.getScale(i,n),u=Math.floor((i+n.margin*2)*a),c=n.margin*a,l=[n.color.light,n.color.dark];for(let p=0;p<u;p++)for(let d=0;d<u;d++){let g=(p*u+d)*4,y=n.color.light;if(p>=c&&d>=c&&p<u-c&&d<u-c){let v=Math.floor((p-c)/a),x=Math.floor((d-c)/a);y=l[s[v*i+x]?1:0]}e[g++]=y.r,e[g++]=y.g,e[g++]=y.b,e[g]=y.a}},"qrToImageData")});var Sae=Q(Tf=>{"use strict";var h_e=require("fs"),d_e=vae().PNG,kU=hI();Tf.render=o(function(e,t){let n=kU.getOptions(t),i=n.rendererOpts,s=kU.getImageWidth(e.modules.size,n);i.width=s,i.height=s;let a=new d_e(i);return kU.qrToImageData(a.data,e,n),a},"render");Tf.renderToDataURL=o(function(e,t,n){typeof n>"u"&&(n=t,t=void 0),Tf.renderToBuffer(e,t,function(i,s){i&&n(i);let a="data:image/png;base64,";a+=s.toString("base64"),n(null,a)})},"renderToDataURL");Tf.renderToBuffer=o(function(e,t,n){typeof n>"u"&&(n=t,t=void 0);let i=Tf.render(e,t),s=[];i.on("error",n),i.on("data",function(a){s.push(a)}),i.on("end",function(){n(null,Buffer.concat(s))}),i.pack()},"renderToBuffer");Tf.renderToFile=o(function(e,t,n,i){typeof i>"u"&&(i=n,n=void 0);let s=!1,a=o((...c)=>{s||(s=!0,i.apply(null,c))},"done"),u=h_e.createWriteStream(e);u.on("error",a),u.on("close",a),Tf.renderToFileStream(u,t,n)},"renderToFile");Tf.renderToFileStream=o(function(e,t,n){Tf.render(t,n).pack().pipe(e)},"renderToFileStream")});var bae=Q(e4=>{"use strict";var m_e=hI(),g_e={WW:" ",WB:"\u2584",BB:"\u2588",BW:"\u2580"},v_e={BB:" ",BW:"\u2584",WW:"\u2588",WB:"\u2580"};function y_e(r,e,t){return r&&e?t.BB:r&&!e?t.BW:!r&&e?t.WB:t.WW}o(y_e,"getBlockChar");e4.render=function(r,e,t){let n=m_e.getOptions(e),i=g_e;(n.color.dark.hex==="#ffffff"||n.color.light.hex==="#000000")&&(i=v_e);let s=r.modules.size,a=r.modules.data,u="",c=Array(s+n.margin*2+1).join(i.WW);c=Array(n.margin/2+1).join(c+`
|
|
106
106
|
`);let l=Array(n.margin+1).join(i.WW);u+=c;for(let p=0;p<s;p+=2){u+=l;for(let d=0;d<s;d++){let g=a[p*s+d],y=a[(p+1)*s+d];u+=y_e(g,y,i)}u+=l+`
|
|
107
107
|
`}return u+=c.slice(0,-1),typeof t=="function"&&t(null,u),u};e4.renderToFile=o(function(e,t,n,i){typeof i>"u"&&(i=n,n=void 0);let s=require("fs"),a=e4.render(t,n);s.writeFile(e,a,i)},"renderToFile")});var wae=Q(xae=>{"use strict";xae.render=function(r,e,t){let n=r.modules.size,i=r.modules.data,s="\x1B[40m \x1B[0m",a="\x1B[47m \x1B[0m",u="",c=Array(n+3).join(a),l=Array(2).join(a);u+=c+`
|
|
108
108
|
`;for(let p=0;p<n;++p){u+=a;for(let d=0;d<n;d++)u+=i[p*n+d]?s:a;u+=l+`
|
|
109
109
|
`}return u+=c+`
|
|
110
110
|
`,typeof t=="function"&&t(null,u),u}});var Nae=Q(Aae=>{"use strict";var S_e="\x1B[47m",b_e="\x1B[40m",VU="\x1B[37m",jU="\x1B[30m",sy="\x1B[0m",x_e=S_e+jU,w_e=b_e+VU,C_e=o(function(r,e,t){return{"00":sy+" "+r,"01":sy+e+"\u2584"+r,"02":sy+t+"\u2584"+r,10:sy+e+"\u2580"+r,11:" ",12:"\u2584",20:sy+t+"\u2580"+r,21:"\u2580",22:"\u2588"}},"createPalette"),Cae=o(function(r,e,t,n){let i=e+1;if(t>=i||n>=i||n<-1||t<-1)return"0";if(t>=e||n>=e||n<0||t<0)return"1";let s=n*e+t;return r[s]?"2":"1"},"mkCodePixel"),Eae=o(function(r,e,t,n){return Cae(r,e,t,n)+Cae(r,e,t,n+1)},"mkCode");Aae.render=function(r,e,t){let n=r.modules.size,i=r.modules.data,s=!!(e&&e.inverse),a=e&&e.inverse?w_e:x_e,l=C_e(a,s?jU:VU,s?VU:jU),p=sy+`
|
|
111
111
|
`+a,d=a;for(let g=-1;g<n+1;g+=2){for(let y=-1;y<n;y++)d+=l[Eae(i,n,y,g)];d+=l[Eae(i,n,n,g)]+p}return d+=sy,typeof t=="function"&&t(null,d),d}});var Tae=Q(Iae=>{"use strict";var E_e=wae(),A_e=Nae();Iae.render=function(r,e,t){return e&&e.small?A_e.render(r,e,t):E_e.render(r,e,t)}});var UU=Q(Dae=>{"use strict";var N_e=hI();function Rae(r,e){let t=r.a/255,n=e+'="'+r.hex+'"';return t<1?n+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':n}o(Rae,"getColorAttrib");function MU(r,e,t){let n=r+e;return typeof t<"u"&&(n+=" "+t),n}o(MU,"svgCmd");function I_e(r,e,t){let n="",i=0,s=!1,a=0;for(let u=0;u<r.length;u++){let c=Math.floor(u%e),l=Math.floor(u/e);!c&&!s&&(s=!0),r[u]?(a++,u>0&&c>0&&r[u-1]||(n+=s?MU("M",c+t,.5+l+t):MU("m",i,0),i=0,s=!1),c+1<e&&r[u+1]||(n+=MU("h",a),a=0)):i++}return n}o(I_e,"qrToPath");Dae.render=o(function(e,t,n){let i=N_e.getOptions(t),s=e.modules.size,a=e.modules.data,u=s+i.margin*2,c=i.color.light.a?"<path "+Rae(i.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",l="<path "+Rae(i.color.dark,"stroke")+' d="'+I_e(a,s,i.margin)+'"/>',p='viewBox="0 0 '+u+" "+u+'"',g='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+p+' shape-rendering="crispEdges">'+c+l+`</svg>
|
|
112
|
-
`;return typeof n=="function"&&n(null,g),g},"render")});var Oae=Q(t4=>{"use strict";var T_e=UU();t4.render=T_e.render;t4.renderToFile=o(function(e,t,n,i){typeof i>"u"&&(i=n,n=void 0);let s=require("fs"),u='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+t4.render(t,n);s.writeFile(e,u,i)},"renderToFile")});var Bae=Q(r4=>{"use strict";var qU=hI();function R_e(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}o(R_e,"clearCanvas");function D_e(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}o(D_e,"getCanvasElement");r4.render=o(function(e,t,n){let i=n,s=t;typeof i>"u"&&(!t||!t.getContext)&&(i=t,t=void 0),t||(s=D_e()),i=qU.getOptions(i);let a=qU.getImageWidth(e.modules.size,i),u=s.getContext("2d"),c=u.createImageData(a,a);return qU.qrToImageData(c.data,e,i),R_e(u,s,a),u.putImageData(c,0,0),s},"render");r4.renderToDataURL=o(function(e,t,n){let i=n;typeof i>"u"&&(!t||!t.getContext)&&(i=t,t=void 0),i||(i={});let s=r4.render(e,t,i),a=i.type||"image/png",u=i.rendererOpts||{};return s.toDataURL(a,u.quality)},"renderToDataURL")});var _ae=Q(dI=>{"use strict";var O_e=rU(),HU=xU(),Pae=Bae(),B_e=UU();function zU(r,e,t,n,i){let s=[].slice.call(arguments,1),a=s.length,u=typeof s[a-1]=="function";if(!u&&!O_e())throw new Error("Callback required as last argument");if(u){if(a<2)throw new Error("Too few arguments provided");a===2?(i=t,t=e,e=n=void 0):a===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=t,t=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(t=e,e=n=void 0):a===2&&!e.getContext&&(n=t,t=e,e=void 0),new Promise(function(c,l){try{let p=HU.create(t,n);c(r(p,e,n))}catch(p){l(p)}})}try{let c=HU.create(t,n);i(null,r(c,e,n))}catch(c){i(c)}}o(zU,"renderCanvas");dI.create=HU.create;dI.toCanvas=zU.bind(null,Pae.render);dI.toDataURL=zU.bind(null,Pae.renderToDataURL);dI.toString=zU.bind(null,function(r,e,t){return B_e.render(r,t)})});var Vae=Q(c0=>{"use strict";var Lae=rU(),KU=xU(),P_e=Sae(),Fae=bae(),__e=Tae(),kae=Oae();function mI(r,e,t){if(typeof r>"u")throw new Error("String required as first argument");if(typeof t>"u"&&(t=e,e={}),typeof t!="function")if(Lae())e=t||{},t=null;else throw new Error("Callback required as last argument");return{opts:e,cb:t}}o(mI,"checkParams");function L_e(r){return r.slice((r.lastIndexOf(".")-1>>>0)+2).toLowerCase()}o(L_e,"getTypeFromFilename");function n4(r){switch(r){case"svg":return kae;case"txt":case"utf8":return Fae;case"png":case"image/png":default:return P_e}}o(n4,"getRendererFromType");function F_e(r){switch(r){case"svg":return kae;case"terminal":return __e;case"utf8":default:return Fae}}o(F_e,"getStringRendererFromType");function gI(r,e,t){if(!t.cb)return new Promise(function(n,i){try{let s=KU.create(e,t.opts);return r(s,t.opts,function(a,u){return a?i(a):n(u)})}catch(s){i(s)}});try{let n=KU.create(e,t.opts);return r(n,t.opts,t.cb)}catch(n){t.cb(n)}}o(gI,"render");c0.create=KU.create;c0.toCanvas=_ae().toCanvas;c0.toString=o(function(e,t,n){let i=mI(e,t,n),s=i.opts?i.opts.type:void 0,a=F_e(s);return gI(a.render,e,i)},"toString");c0.toDataURL=o(function(e,t,n){let i=mI(e,t,n),s=n4(i.opts.type);return gI(s.renderToDataURL,e,i)},"toDataURL");c0.toBuffer=o(function(e,t,n){let i=mI(e,t,n),s=n4(i.opts.type);return gI(s.renderToBuffer,e,i)},"toBuffer");c0.toFile=o(function(e,t,n,i){if(typeof e!="string"||!(typeof t=="string"||typeof t=="object"))throw new Error("Invalid argument");if(arguments.length<3&&!Lae())throw new Error("Too few arguments provided");let s=mI(t,n,i),a=s.opts.type||L_e(e),c=n4(a).renderToFile.bind(null,e);return gI(c,t,s)},"toFile");c0.toFileStream=o(function(e,t,n){if(arguments.length<2)throw new Error("Too few arguments provided");let i=mI(t,n,e.emit.bind(e,"error")),a=n4("png").renderToFileStream.bind(null,e);gI(a,t,i)},"toFileStream")});var Mae=Q((Gft,jae)=>{"use strict";jae.exports=Vae()});var V_e={};aT(V_e,{AccessKeyBuilder:()=>Rw,DanfceDefaultPdfDocument:()=>XU,DanfceReducedPdfDocument:()=>WU,DefaultDetBuilderAggregator:()=>S2,DefaultTotalBuilderAggregator:()=>b2,NFCeDto:()=>Nf,NFeDto:()=>bh,NfceAuthorizerPipeline:()=>vM,NfceConsultStatusPipeline:()=>yM,NfceQrcode:()=>Vv,NfceRemoteTransmitter:()=>Pm,NfceXmlBuilder:()=>iI,NfceXmlBuilderPipeline:()=>tU,NfeAuthorizationResponsePipeline:()=>SM,NfeAuthorizerPipeline:()=>E2,NfeConsultStatusPipeline:()=>N2,NfeDetXmlBuilder:()=>Is,NfeNfceCancelPipeline:()=>xM,NfeNfceVoidRangePipeline:()=>v_,NfeRemoteTransmitter:()=>go,NfeXmlBuilder:()=>Fn,NfeXmlBuilderPipeline:()=>nI,TpEmis:()=>ia,TpEvent:()=>Vf,schemas:()=>Tw});module.exports=ude(V_e);var ia=(function(r){return r.Normal="1",r.EPEC="4",r.SVCAN="6",r.SVCRS="7",r.OFFLINE="9",r})({});var Vf=(function(r){return r.Cancelamento="110111",r})({});var Do=require("path"),b0=require("fs");var A3=require("path"),E3=require("module"),oT=require("url");var cde=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,xy,xq=o(()=>{if(xy!==void 0)return xy;if(cde){xy=void 0;return}try{xy=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{xy=void 0}return xy},"getImportMetaUrl"),wq=o(()=>{if(typeof require<"u")return require;let r=xq();if(r)return(0,E3.createRequire)(r);let e=(0,oT.pathToFileURL)((0,A3.resolve)(process.cwd(),"package.json")).href;return(0,E3.createRequire)(e)},"getRequireFn"),Cq=o(()=>{if(typeof __filename<"u")return __filename;let r=xq();return r?(0,oT.fileURLToPath)(r):(0,A3.resolve)(process.cwd())},"getCurrentFile");var Eq=o(()=>typeof process<"u"&&typeof process.versions<"u"&&"electron"in process.versions,"isElectron"),lde=o(()=>{if(!Eq())return null;try{let e=require("electron").app;if(e?.getAppPath&&typeof e.getAppPath=="function")return{getAppPath:e.getAppPath}}catch{}return null},"getElectronApp"),fde=o(()=>{if(!Eq())return null;let r=process;if(r.resourcesPath)return r.resourcesPath;let e=lde();if(e)try{let t=e.getAppPath();if(typeof t=="string")return(0,Do.dirname)(t.replace(/\.asar$/,""))}catch{}return null},"getElectronResourcesPath"),wy=o((r,{onFound:e,onNotFound:t})=>{let n=fde();if(n){let l=(0,Do.resolve)(n,"node_modules","nfets",r);if((0,b0.existsSync)(l))return e(l);let p=(0,Do.resolve)(n,"app.asar.unpacked","node_modules","nfets",r);if((0,b0.existsSync)(p))return e(p)}let i=Cq(),s=i.includes(".asar")?process.cwd():i,a=(0,Do.resolve)(s,"../../../../"),u=(0,Do.resolve)(a,r);if((0,b0.existsSync)(u))return e(u);let c=s;for(let l=0;l<5;l++){let p=(0,Do.resolve)(c,r);if((0,b0.existsSync)(p))return e(p);let d=(0,Do.dirname)(c);if(d===c)break;c=d}c=s;for(let l=0;l<5;l++){let p=(0,Do.resolve)(c,"node_modules","nfets",r);if((0,b0.existsSync)(p))return e(p);let d=(0,Do.dirname)(c);if(d===c)break;c=d}c=s;for(let l=0;l<5;l++){let p=(0,Do.resolve)(c,r.replace(/^build\//,"Release/"));if((0,b0.existsSync)(p))return e(p);let d=(0,Do.dirname)(c);if(d===c)break;c=d}return t()},"search");var pde={PL_009_V4:"PL_009_V4",PL_010_V1:"PL_010_V1",PL_010_V1_21:"PL_010_V1.21",PL_010_V1_30:"PL_010_V1.30"},Tw=o(()=>{if(process.env.NFETS_NFE_SCHEMAS_DIR)return process.env.NFETS_NFE_SCHEMAS_DIR;try{return wy("packages/nfe/schemas",{onFound:o(r=>r,"onFound"),onNotFound:o(()=>{throw new Error("Schemas not found on packages/nfe/schemas")},"onNotFound")})}catch{return wy("nfe/schemas",{onFound:o(r=>r,"onFound"),onNotFound:o(()=>{throw new Error("Schemas not found on nfe/schemas")},"onNotFound")})}},"schemas"),jf=pde;var Rw=class{static{o(this,"AccessKeyBuilder")}compile(e){let t=e.cUF.toString().padStart(2,"0"),n=e.year.toString().padStart(2,"0"),i=e.month.toString().padStart(2,"0"),s=(e.identification??"").padStart(14,"0"),a=e.mod.toString().padStart(2,"0"),u=e.serie.toString().padStart(3,"0"),c=e.nNF.toString().padStart(9,"0"),l=e.tpEmis.toString().padStart(1,"0"),p=(e.cNF??this.code()).toString().padStart(8,"0"),d=`${t}${n}${i}${s}${a}${u}${c}${l}${p}`;return`${d}${this.verifyingDigit(d)}`}decompile(e){if(e.length!==44)return;let n=/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{14})([0-9]{2})([0-9]{3})([0-9]{9})([0-9]{1})([0-9]{8})([0-9]{1})$/.exec(e);if(!n)return;let[i,s,a,u,c,l,p,d,g,y,v]=n;return{cUF:s,year:a,month:u,identification:c,mod:l,serie:p,nNF:d,tpEmis:g,cNF:y,vd:v}}code(){let e=Math.floor(Math.random()*1e8).toString().padStart(8,"0");return this.isCodeValid(e)?e:this.code()}isCodeValid(e){return!~["00000000","11111111","22222222","33333333","44444444","55555555","66666666","77777777","88888888","99999999","12345678","23456789","34567890","45678901","56789012","67890123","78901234","89012345","90123456","01234567"].indexOf(e)}verifyingDigit(e){let t=[2,3,4,5,6,7,8,9],n=42,i=0;for(;n>=0;)for(let a=0;a<8&&n>=0;a++){let u=parseInt(e[n]);i+=u*t[a],n--}let s=11-i%11;return s>9?0:s}};var Cy=9e15,Fh=1e9,N3="0123456789abcdef",lT="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",fT="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",I3={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Cy,maxE:Cy,crypto:!1},Tq,Mf,Yt=!0,hT="[DecimalError] ",Lh=hT+"Invalid argument: ",Rq=hT+"Precision limit exceeded",Dq=hT+"crypto unavailable",Oq="[object Decimal]",sa=Math.floor,Ji=Math.pow,hde=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,dde=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,mde=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Bq=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,nc=1e7,Lt=7,gde=9007199254740991,vde=lT.length-1,T3=fT.length-1,ze={toStringTag:Oq};ze.absoluteValue=ze.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),It(r)};ze.ceil=function(){return It(new this.constructor(this),this.e+1,2)};ze.clampedTo=ze.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Lh+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};ze.comparedTo=ze.cmp=function(r){var e,t,n,i,s=this,a=s.d,u=(r=new s.constructor(r)).d,c=s.s,l=r.s;if(!a||!u)return!c||!l?NaN:c!==l?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-l:0;if(c!==l)return c;if(s.e!==r.e)return s.e>r.e^c<0?1:-1;for(n=a.length,i=u.length,e=0,t=n<i?n:i;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};ze.cosine=ze.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Lt,n.rounding=1,t=yde(n,kq(n,t)),n.precision=r,n.rounding=e,It(Mf==2||Mf==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};ze.cubeRoot=ze.cbrt=function(){var r,e,t,n,i,s,a,u,c,l,p=this,d=p.constructor;if(!p.isFinite()||p.isZero())return new d(p);for(Yt=!1,s=p.s*Ji(p.s*p,1/3),!s||Math.abs(s)==1/0?(t=Bs(p.d),r=p.e,(s=(r-t.length+1)%3)&&(t+=s==1||s==-2?"0":"00"),s=Ji(t,1/3),r=sa((r+1)/3)-(r%3==(r<0?-1:2)),s==1/0?t="5e"+r:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new d(t),n.s=p.s):n=new d(s.toString()),a=(r=d.precision)+3;;)if(u=n,c=u.times(u).times(u),l=c.plus(p),n=Sn(l.plus(p).times(u),l.plus(c),a+2,1),Bs(u.d).slice(0,a)===(t=Bs(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!i&&t=="4999"){if(!i&&(It(u,r+1,0),u.times(u).times(u).eq(p))){n=u;break}a+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(It(n,r+1,1),e=!n.times(n).times(n).eq(p));break}return Yt=!0,It(n,r,d.rounding,e)};ze.decimalPlaces=ze.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-sa(this.e/Lt))*Lt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};ze.dividedBy=ze.div=function(r){return Sn(this,new this.constructor(r))};ze.dividedToIntegerBy=ze.divToInt=function(r){var e=this,t=e.constructor;return It(Sn(e,new t(r),0,1,1),t.precision,t.rounding)};ze.equals=ze.eq=function(r){return this.cmp(r)===0};ze.floor=function(){return It(new this.constructor(this),this.e+1,3)};ze.greaterThan=ze.gt=function(r){return this.cmp(r)>0};ze.greaterThanOrEqualTo=ze.gte=function(r){var e=this.cmp(r);return e==1||e===0};ze.hyperbolicCosine=ze.cosh=function(){var r,e,t,n,i,s=this,a=s.constructor,u=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return u;t=a.precision,n=a.rounding,a.precision=t+Math.max(s.e,s.sd())+4,a.rounding=1,i=s.d.length,i<32?(r=Math.ceil(i/3),e=(1/mT(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),s=Ey(a,1,s.times(e),new a(1),!0);for(var c,l=r,p=new a(8);l--;)c=s.times(s),s=u.minus(c.times(p.minus(c.times(p))));return It(s,a.precision=t,a.rounding=n,!0)};ze.hyperbolicSine=ze.sinh=function(){var r,e,t,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(e=s.precision,t=s.rounding,s.precision=e+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Ey(s,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/mT(5,r)),i=Ey(s,2,i,i,!0);for(var a,u=new s(5),c=new s(16),l=new s(20);r--;)a=i.times(i),i=i.times(u.plus(a.times(c.times(a).plus(l))))}return s.precision=e,s.rounding=t,It(i,e,t,!0)};ze.hyperbolicTangent=ze.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,Sn(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};ze.inverseCosine=ze.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,i=e.rounding;return t!==-1?t===0?r.isNeg()?ol(e,n,i):new e(0):new e(NaN):r.isZero()?ol(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,r.times(2))};ze.inverseHyperbolicCosine=ze.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Yt=!1,t=t.times(t).minus(1).sqrt().plus(t),Yt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};ze.inverseHyperbolicSine=ze.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Yt=!1,t=t.times(t).plus(1).sqrt().plus(t),Yt=!0,n.precision=r,n.rounding=e,t.ln())};ze.inverseHyperbolicTangent=ze.atanh=function(){var r,e,t,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=s.precision,e=s.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?It(new s(i),r,e,!0):(s.precision=t=n-i.e,i=Sn(i.plus(1),new s(1).minus(i),t+r,1),s.precision=r+4,s.rounding=1,i=i.ln(),s.precision=r,s.rounding=e,i.times(.5))):new s(NaN)};ze.inverseSine=ze.asin=function(){var r,e,t,n,i=this,s=i.constructor;return i.isZero()?new s(i):(e=i.abs().cmp(1),t=s.precision,n=s.rounding,e!==-1?e===0?(r=ol(s,t+4,n).times(.5),r.s=i.s,r):new s(NaN):(s.precision=t+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=t,s.rounding=n,i.times(2)))};ze.inverseTangent=ze.atan=function(){var r,e,t,n,i,s,a,u,c,l=this,p=l.constructor,d=p.precision,g=p.rounding;if(l.isFinite()){if(l.isZero())return new p(l);if(l.abs().eq(1)&&d+4<=T3)return a=ol(p,d+4,g).times(.25),a.s=l.s,a}else{if(!l.s)return new p(NaN);if(d+4<=T3)return a=ol(p,d+4,g).times(.5),a.s=l.s,a}for(p.precision=u=d+10,p.rounding=1,t=Math.min(28,u/Lt+2|0),r=t;r;--r)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(Yt=!1,e=Math.ceil(u/Lt),n=1,c=l.times(l),a=new p(l),i=l;r!==-1;)if(i=i.times(c),s=a.minus(i.div(n+=2)),i=i.times(c),a=s.plus(i.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===s.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),Yt=!0,It(a,p.precision=d,p.rounding=g,!0)};ze.isFinite=function(){return!!this.d};ze.isInteger=ze.isInt=function(){return!!this.d&&sa(this.e/Lt)>this.d.length-2};ze.isNaN=function(){return!this.s};ze.isNegative=ze.isNeg=function(){return this.s<0};ze.isPositive=ze.isPos=function(){return this.s>0};ze.isZero=function(){return!!this.d&&this.d[0]===0};ze.lessThan=ze.lt=function(r){return this.cmp(r)<0};ze.lessThanOrEqualTo=ze.lte=function(r){return this.cmp(r)<1};ze.logarithm=ze.log=function(r){var e,t,n,i,s,a,u,c,l=this,p=l.constructor,d=p.precision,g=p.rounding,y=5;if(r==null)r=new p(10),e=!0;else{if(r=new p(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new p(NaN);e=r.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new p(t&&!t[0]?-1/0:l.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)s=!0;else{for(i=t[0];i%10===0;)i/=10;s=i!==1}if(Yt=!1,u=d+y,a=_h(l,u),n=e?pT(p,u+10):_h(r,u),c=Sn(a,n,u,1),Dw(c.d,i=d,g))do if(u+=10,a=_h(l,u),n=e?pT(p,u+10):_h(r,u),c=Sn(a,n,u,1),!s){+Bs(c.d).slice(i+1,i+15)+1==1e14&&(c=It(c,d+1,0));break}while(Dw(c.d,i+=10,g));return Yt=!0,It(c,d,g)};ze.minus=ze.sub=function(r){var e,t,n,i,s,a,u,c,l,p,d,g,y=this,v=y.constructor;if(r=new v(r),!y.d||!r.d)return!y.s||!r.s?r=new v(NaN):y.d?r.s=-r.s:r=new v(r.d||y.s!==r.s?y:NaN),r;if(y.s!=r.s)return r.s=-r.s,y.plus(r);if(l=y.d,g=r.d,u=v.precision,c=v.rounding,!l[0]||!g[0]){if(g[0])r.s=-r.s;else if(l[0])r=new v(y);else return new v(c===3?-0:0);return Yt?It(r,u,c):r}if(t=sa(r.e/Lt),p=sa(y.e/Lt),l=l.slice(),s=p-t,s){for(d=s<0,d?(e=l,s=-s,a=g.length):(e=g,t=p,a=l.length),n=Math.max(Math.ceil(u/Lt),a)+2,s>n&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for(n=l.length,a=g.length,d=n<a,d&&(a=n),n=0;n<a;n++)if(l[n]!=g[n]){d=l[n]<g[n];break}s=0}for(d&&(e=l,l=g,g=e,r.s=-r.s),a=l.length,n=g.length-a;n>0;--n)l[a++]=0;for(n=g.length;n>s;){if(l[--n]<g[n]){for(i=n;i&&l[--i]===0;)l[i]=nc-1;--l[i],l[n]+=nc}l[n]-=g[n]}for(;l[--a]===0;)l.pop();for(;l[0]===0;l.shift())--t;return l[0]?(r.d=l,r.e=dT(l,t),Yt?It(r,u,c):r):new v(c===3?-0:0)};ze.modulo=ze.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?It(new n(t),n.precision,n.rounding):(Yt=!1,n.modulo==9?(e=Sn(t,r.abs(),0,3,1),e.s*=r.s):e=Sn(t,r,0,n.modulo,1),e=e.times(r),Yt=!0,t.minus(e))};ze.naturalExponential=ze.exp=function(){return R3(this)};ze.naturalLogarithm=ze.ln=function(){return _h(this)};ze.negated=ze.neg=function(){var r=new this.constructor(this);return r.s=-r.s,It(r)};ze.plus=ze.add=function(r){var e,t,n,i,s,a,u,c,l,p,d=this,g=d.constructor;if(r=new g(r),!d.d||!r.d)return!d.s||!r.s?r=new g(NaN):d.d||(r=new g(r.d||d.s===r.s?d:NaN)),r;if(d.s!=r.s)return r.s=-r.s,d.minus(r);if(l=d.d,p=r.d,u=g.precision,c=g.rounding,!l[0]||!p[0])return p[0]||(r=new g(d)),Yt?It(r,u,c):r;if(s=sa(d.e/Lt),n=sa(r.e/Lt),l=l.slice(),i=s-n,i){for(i<0?(t=l,i=-i,a=p.length):(t=p,n=s,a=l.length),s=Math.ceil(u/Lt),a=s>a?s+1:a+1,i>a&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(a=l.length,i=p.length,a-i<0&&(i=a,t=p,p=l,l=t),e=0;i;)e=(l[--i]=l[i]+p[i]+e)/nc|0,l[i]%=nc;for(e&&(l.unshift(e),++n),a=l.length;l[--a]==0;)l.pop();return r.d=l,r.e=dT(l,n),Yt?It(r,u,c):r};ze.precision=ze.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Lh+r);return t.d?(e=Pq(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};ze.round=function(){var r=this,e=r.constructor;return It(new e(r),r.e+1,e.rounding)};ze.sine=ze.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Lt,n.rounding=1,t=bde(n,kq(n,t)),n.precision=r,n.rounding=e,It(Mf>2?t.neg():t,r,e,!0)):new n(NaN)};ze.squareRoot=ze.sqrt=function(){var r,e,t,n,i,s,a=this,u=a.d,c=a.e,l=a.s,p=a.constructor;if(l!==1||!u||!u[0])return new p(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);for(Yt=!1,l=Math.sqrt(+a),l==0||l==1/0?(e=Bs(u),(e.length+c)%2==0&&(e+="0"),l=Math.sqrt(e),c=sa((c+1)/2)-(c<0||c%2),l==1/0?e="5e"+c:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new p(e)):n=new p(l.toString()),t=(c=p.precision)+3;;)if(s=n,n=s.plus(Sn(a,s,t+2,1)).times(.5),Bs(s.d).slice(0,t)===(e=Bs(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(It(s,c+1,0),s.times(s).eq(a))){n=s;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(It(n,c+1,1),r=!n.times(n).eq(a));break}return Yt=!0,It(n,c,p.rounding,r)};ze.tangent=ze.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=Sn(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,It(Mf==2||Mf==4?t.neg():t,r,e,!0)):new n(NaN)};ze.times=ze.mul=function(r){var e,t,n,i,s,a,u,c,l,p=this,d=p.constructor,g=p.d,y=(r=new d(r)).d;if(r.s*=p.s,!g||!g[0]||!y||!y[0])return new d(!r.s||g&&!g[0]&&!y||y&&!y[0]&&!g?NaN:!g||!y?r.s/0:r.s*0);for(t=sa(p.e/Lt)+sa(r.e/Lt),c=g.length,l=y.length,c<l&&(s=g,g=y,y=s,a=c,c=l,l=a),s=[],a=c+l,n=a;n--;)s.push(0);for(n=l;--n>=0;){for(e=0,i=c+n;i>n;)u=s[i]+y[n]*g[i-n-1]+e,s[i--]=u%nc|0,e=u/nc|0;s[i]=(s[i]+e)%nc|0}for(;!s[--a];)s.pop();return e?++t:s.shift(),r.d=s,r.e=dT(s,t),Yt?It(r,d.precision,d.rounding):r};ze.toBinary=function(r,e){return D3(this,2,r,e)};ze.toDecimalPlaces=ze.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Ja(r,0,Fh),e===void 0?e=n.rounding:Ja(e,0,8),It(t,r+t.e+1,e))};ze.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=ul(n,!0):(Ja(r,0,Fh),e===void 0?e=i.rounding:Ja(e,0,8),n=It(new i(n),r+1,e),t=ul(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};ze.toFixed=function(r,e){var t,n,i=this,s=i.constructor;return r===void 0?t=ul(i):(Ja(r,0,Fh),e===void 0?e=s.rounding:Ja(e,0,8),n=It(new s(i),r+i.e+1,e),t=ul(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};ze.toFraction=function(r){var e,t,n,i,s,a,u,c,l,p,d,g,y=this,v=y.d,x=y.constructor;if(!v)return new x(y);if(l=t=new x(1),n=c=new x(0),e=new x(n),s=e.e=Pq(v)-y.e-1,a=s%Lt,e.d[0]=Ji(10,a<0?Lt+a:a),r==null)r=s>0?e:l;else{if(u=new x(r),!u.isInt()||u.lt(l))throw Error(Lh+u);r=u.gt(e)?s>0?e:l:u}for(Yt=!1,u=new x(Bs(v)),p=x.precision,x.precision=s=v.length*Lt*2;d=Sn(u,e,0,1,1),i=t.plus(d.times(n)),i.cmp(r)!=1;)t=n,n=i,i=l,l=c.plus(d.times(i)),c=i,i=e,e=u.minus(d.times(i)),u=i;return i=Sn(r.minus(t),n,0,1,1),c=c.plus(i.times(l)),t=t.plus(i.times(n)),c.s=l.s=y.s,g=Sn(l,n,s,1).minus(y).abs().cmp(Sn(c,t,s,1).minus(y).abs())<1?[l,n]:[c,t],x.precision=p,Yt=!0,g};ze.toHexadecimal=ze.toHex=function(r,e){return D3(this,16,r,e)};ze.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Ja(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(Yt=!1,t=Sn(t,r,0,e,1).times(r),Yt=!0,It(t)):(r.s=t.s,t=r),t};ze.toNumber=function(){return+this};ze.toOctal=function(r,e){return D3(this,8,r,e)};ze.toPower=ze.pow=function(r){var e,t,n,i,s,a,u=this,c=u.constructor,l=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Ji(+u,l));if(u=new c(u),u.eq(1))return u;if(n=c.precision,s=c.rounding,r.eq(1))return It(u,n,s);if(e=sa(r.e/Lt),e>=r.d.length-1&&(t=l<0?-l:l)<=gde)return i=_q(c,u,t,n),r.s<0?new c(1).div(i):It(i,n,s);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Ji(+u,l),e=t==0||!isFinite(t)?sa(l*(Math.log("0."+Bs(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(Yt=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),i=R3(r.times(_h(u,n+t)),n),i.d&&(i=It(i,n+5,1),Dw(i.d,n,s)&&(e=n+10,i=It(R3(r.times(_h(u,e+t)),e),e+5,1),+Bs(i.d).slice(n+1,n+15)+1==1e14&&(i=It(i,n+1,0)))),i.s=a,Yt=!0,c.rounding=s,It(i,n,s))};ze.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=ul(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ja(r,1,Fh),e===void 0?e=i.rounding:Ja(e,0,8),n=It(new i(n),r,e),t=ul(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};ze.toSignificantDigits=ze.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Ja(r,1,Fh),e===void 0?e=n.rounding:Ja(e,0,8)),It(new n(t),r,e)};ze.toString=function(){var r=this,e=r.constructor,t=ul(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};ze.truncated=ze.trunc=function(){return It(new this.constructor(this),this.e+1,1)};ze.valueOf=ze.toJSON=function(){var r=this,e=r.constructor,t=ul(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Bs(r){var e,t,n,i=r.length-1,s="",a=r[0];if(i>0){for(s+=a,e=1;e<i;e++)n=r[e]+"",t=Lt-n.length,t&&(s+=Ph(t)),s+=n;a=r[e],n=a+"",t=Lt-n.length,t&&(s+=Ph(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}o(Bs,"digitsToString");function Ja(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Lh+r)}o(Ja,"checkInt32");function Dw(r,e,t,n){var i,s,a,u;for(s=r[0];s>=10;s/=10)--e;return--e<0?(e+=Lt,i=0):(i=Math.ceil((e+1)/Lt),e%=Lt),s=Ji(10,Lt-e),u=r[i]%s|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==s||t>3&&u+1==s/2)&&(r[i+1]/s/100|0)==Ji(10,e-2)-1||(u==s/2||u==0)&&(r[i+1]/s/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==s||!n&&t>3&&u+1==s/2)&&(r[i+1]/s/1e3|0)==Ji(10,e-3)-1,a}o(Dw,"checkRoundingDigits");function uT(r,e,t){for(var n,i=[0],s,a=0,u=r.length;a<u;){for(s=i.length;s--;)i[s]*=e;for(i[0]+=N3.indexOf(r.charAt(a++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}o(uT,"convertBase");function yde(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/mT(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Ey(r,1,e.times(i),new r(1));for(var s=t;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}o(yde,"cosine");var Sn=(function(){function r(n,i,s){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*i+u,n[c]=a%s|0,u=a/s|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,i,s,a){var u,c;if(s!=a)c=s>a?1:-1;else for(u=c=0;u<s;u++)if(n[u]!=i[u]){c=n[u]>i[u]?1:-1;break}return c}o(e,"compare");function t(n,i,s,a){for(var u=0;s--;)n[s]-=u,u=n[s]<i[s]?1:0,n[s]=u*a+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,i,s,a,u,c){var l,p,d,g,y,v,x,S,A,D,C,E,I,B,q,R,z,K,H,J,ge=n.constructor,ve=n.s==i.s?1:-1,le=n.d,Z=i.d;if(!le||!le[0]||!Z||!Z[0])return new ge(!n.s||!i.s||(le?Z&&le[0]==Z[0]:!Z)?NaN:le&&le[0]==0||!Z?ve*0:ve/0);for(c?(y=1,p=n.e-i.e):(c=nc,y=Lt,p=sa(n.e/y)-sa(i.e/y)),H=Z.length,z=le.length,A=new ge(ve),D=A.d=[],d=0;Z[d]==(le[d]||0);d++);if(Z[d]>(le[d]||0)&&p--,s==null?(B=s=ge.precision,a=ge.rounding):u?B=s+(n.e-i.e)+1:B=s,B<0)D.push(1),v=!0;else{if(B=B/y+2|0,d=0,H==1){for(g=0,Z=Z[0],B++;(d<z||g)&&B--;d++)q=g*c+(le[d]||0),D[d]=q/Z|0,g=q%Z|0;v=g||d<z}else{for(g=c/(Z[0]+1)|0,g>1&&(Z=r(Z,g,c),le=r(le,g,c),H=Z.length,z=le.length),R=H,C=le.slice(0,H),E=C.length;E<H;)C[E++]=0;J=Z.slice(),J.unshift(0),K=Z[0],Z[1]>=c/2&&++K;do g=0,l=e(Z,C,H,E),l<0?(I=C[0],H!=E&&(I=I*c+(C[1]||0)),g=I/K|0,g>1?(g>=c&&(g=c-1),x=r(Z,g,c),S=x.length,E=C.length,l=e(x,C,S,E),l==1&&(g--,t(x,H<S?J:Z,S,c))):(g==0&&(l=g=1),x=Z.slice()),S=x.length,S<E&&x.unshift(0),t(C,x,E,c),l==-1&&(E=C.length,l=e(Z,C,H,E),l<1&&(g++,t(C,H<E?J:Z,E,c))),E=C.length):l===0&&(g++,C=[0]),D[d++]=g,l&&C[0]?C[E++]=le[R]||0:(C=[le[R]],E=1);while((R++<z||C[0]!==void 0)&&B--);v=C[0]!==void 0}D[0]||D.shift()}if(y==1)A.e=p,Tq=v;else{for(d=1,g=D[0];g>=10;g/=10)d++;A.e=d+p*y-1,It(A,u?s+A.e+1:s,a,v)}return A}})();function It(r,e,t,n){var i,s,a,u,c,l,p,d,g,y=r.constructor;e:if(e!=null){if(d=r.d,!d)return r;for(i=1,u=d[0];u>=10;u/=10)i++;if(s=e-i,s<0)s+=Lt,a=e,p=d[g=0],c=p/Ji(10,i-a-1)%10|0;else if(g=Math.ceil((s+1)/Lt),u=d.length,g>=u)if(n){for(;u++<=g;)d.push(0);p=c=0,i=1,s%=Lt,a=s-Lt+1}else break e;else{for(p=u=d[g],i=1;u>=10;u/=10)i++;s%=Lt,a=s-Lt+i,c=a<0?0:p/Ji(10,i-a-1)%10|0}if(n=n||e<0||d[g+1]!==void 0||(a<0?p:p%Ji(10,i-a-1)),l=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(s>0?a>0?p/Ji(10,i-a):0:d[g-1])%10&1||t==(r.s<0?8:7)),e<1||!d[0])return d.length=0,l?(e-=r.e+1,d[0]=Ji(10,(Lt-e%Lt)%Lt),r.e=-e||0):d[0]=r.e=0,r;if(s==0?(d.length=g,u=1,g--):(d.length=g+1,u=Ji(10,Lt-s),d[g]=a>0?(p/Ji(10,i-a)%Ji(10,a)|0)*u:0),l)for(;;)if(g==0){for(s=1,a=d[0];a>=10;a/=10)s++;for(a=d[0]+=u,u=1;a>=10;a/=10)u++;s!=u&&(r.e++,d[0]==nc&&(d[0]=1));break}else{if(d[g]+=u,d[g]!=nc)break;d[g--]=0,u=1}for(s=d.length;d[--s]===0;)d.pop()}return Yt&&(r.e>y.maxE?(r.d=null,r.e=NaN):r.e<y.minE&&(r.e=0,r.d=[0])),r}o(It,"finalise");function ul(r,e,t){if(!r.isFinite())return Fq(r);var n,i=r.e,s=Bs(r.d),a=s.length;return e?(t&&(n=t-a)>0?s=s.charAt(0)+"."+s.slice(1)+Ph(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(r.e<0?"e":"e+")+r.e):i<0?(s="0."+Ph(-i-1)+s,t&&(n=t-a)>0&&(s+=Ph(n))):i>=a?(s+=Ph(i+1-a),t&&(n=t-i-1)>0&&(s=s+"."+Ph(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(s+="."),s+=Ph(n))),s}o(ul,"finiteToString");function dT(r,e){var t=r[0];for(e*=Lt;t>=10;t/=10)e++;return e}o(dT,"getBase10Exponent");function pT(r,e,t){if(e>vde)throw Yt=!0,t&&(r.precision=t),Error(Rq);return It(new r(lT),e,1,!0)}o(pT,"getLn10");function ol(r,e,t){if(e>T3)throw Error(Rq);return It(new r(fT),e,t,!0)}o(ol,"getPi");function Pq(r){var e=r.length-1,t=e*Lt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(Pq,"getPrecision");function Ph(r){for(var e="";r--;)e+="0";return e}o(Ph,"getZeroString");function _q(r,e,t,n){var i,s=new r(1),a=Math.ceil(n/Lt+4);for(Yt=!1;;){if(t%2&&(s=s.times(e),Nq(s.d,a)&&(i=!0)),t=sa(t/2),t===0){t=s.d.length-1,i&&s.d[t]===0&&++s.d[t];break}e=e.times(e),Nq(e.d,a)}return Yt=!0,s}o(_q,"intPow");function Aq(r){return r.d[r.d.length-1]&1}o(Aq,"isOdd");function Lq(r,e,t){for(var n,i,s=new r(e[0]),a=0;++a<e.length;){if(i=new r(e[a]),!i.s){s=i;break}n=s.cmp(i),(n===t||n===0&&s.s===t)&&(s=i)}return s}o(Lq,"maxOrMin");function R3(r,e){var t,n,i,s,a,u,c,l=0,p=0,d=0,g=r.constructor,y=g.rounding,v=g.precision;if(!r.d||!r.d[0]||r.e>17)return new g(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(Yt=!1,c=v):c=e,u=new g(.03125);r.e>-2;)r=r.times(u),d+=5;for(n=Math.log(Ji(2,d))/Math.LN10*2+5|0,c+=n,t=s=a=new g(1),g.precision=c;;){if(s=It(s.times(r),c,1),t=t.times(++p),u=a.plus(Sn(s,t,c,1)),Bs(u.d).slice(0,c)===Bs(a.d).slice(0,c)){for(i=d;i--;)a=It(a.times(a),c,1);if(e==null)if(l<3&&Dw(a.d,c-n,y,l))g.precision=c+=10,t=s=u=new g(1),p=0,l++;else return It(a,g.precision=v,y,Yt=!0);else return g.precision=v,a}a=u}}o(R3,"naturalExponential");function _h(r,e){var t,n,i,s,a,u,c,l,p,d,g,y=1,v=10,x=r,S=x.d,A=x.constructor,D=A.rounding,C=A.precision;if(x.s<0||!S||!S[0]||!x.e&&S[0]==1&&S.length==1)return new A(S&&!S[0]?-1/0:x.s!=1?NaN:S?0:x);if(e==null?(Yt=!1,p=C):p=e,A.precision=p+=v,t=Bs(S),n=t.charAt(0),Math.abs(s=x.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)x=x.times(r),t=Bs(x.d),n=t.charAt(0),y++;s=x.e,n>1?(x=new A("0."+t),s++):x=new A(n+"."+t.slice(1))}else return l=pT(A,p+2,C).times(s+""),x=_h(new A(n+"."+t.slice(1)),p-v).plus(l),A.precision=C,e==null?It(x,C,D,Yt=!0):x;for(d=x,c=a=x=Sn(x.minus(1),x.plus(1),p,1),g=It(x.times(x),p,1),i=3;;){if(a=It(a.times(g),p,1),l=c.plus(Sn(a,new A(i),p,1)),Bs(l.d).slice(0,p)===Bs(c.d).slice(0,p))if(c=c.times(2),s!==0&&(c=c.plus(pT(A,p+2,C).times(s+""))),c=Sn(c,new A(y),p,1),e==null)if(Dw(c.d,p-v,D,u))A.precision=p+=v,l=a=x=Sn(d.minus(1),d.plus(1),p,1),g=It(x.times(x),p,1),i=u=1;else return It(c,A.precision=C,D,Yt=!0);else return A.precision=C,c;c=l,i+=2}}o(_h,"naturalLogarithm");function Fq(r){return String(r.s*r.s/0)}o(Fq,"nonFiniteToString");function cT(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%Lt,t<0&&(n+=Lt),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=Lt;n<i;)r.d.push(+e.slice(n,n+=Lt));e=e.slice(n),n=Lt-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),Yt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}o(cT,"parseDecimal");function Sde(r,e){var t,n,i,s,a,u,c,l,p;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Bq.test(e))return cT(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(dde.test(e))t=16,e=e.toLowerCase();else if(hde.test(e))t=2;else if(mde.test(e))t=8;else throw Error(Lh+e);for(s=e.search(/p/i),s>0?(c=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),s=e.indexOf("."),a=s>=0,n=r.constructor,a&&(e=e.replace(".",""),u=e.length,s=u-s,i=_q(n,new n(t),s,s*2)),l=uT(e,t,nc),p=l.length-1,s=p;l[s]===0;--s)l.pop();return s<0?new n(r.s*0):(r.e=dT(l,p),r.d=l,Yt=!1,a&&(r=Sn(r,i,u*4)),c&&(r=r.times(Math.abs(c)<54?Ji(2,c):Ay.pow(2,c))),Yt=!0,r)}o(Sde,"parseOther");function bde(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Ey(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/mT(5,t)),e=Ey(r,2,e,e);for(var i,s=new r(5),a=new r(16),u=new r(20);t--;)i=e.times(e),e=e.times(s.plus(i.times(a.times(i).minus(u))));return e}o(bde,"sine");function Ey(r,e,t,n,i){var s,a,u,c,l=1,p=r.precision,d=Math.ceil(p/Lt);for(Yt=!1,c=t.times(t),u=new r(n);;){if(a=Sn(u.times(c),new r(e++*e++),p,1),u=i?n.plus(a):n.minus(a),n=Sn(a.times(c),new r(e++*e++),p,1),a=u.plus(n),a.d[d]!==void 0){for(s=d;a.d[s]===u.d[s]&&s--;);if(s==-1)break}s=u,u=n,n=a,a=s,l++}return Yt=!0,a.d.length=d+1,a}o(Ey,"taylorSeries");function mT(r,e){for(var t=r;--e;)t*=r;return t}o(mT,"tinyPow");function kq(r,e){var t,n=e.s<0,i=ol(r,r.precision,1),s=i.times(.5);if(e=e.abs(),e.lte(s))return Mf=n?4:1,e;if(t=e.divToInt(i),t.isZero())Mf=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(s))return Mf=Aq(t)?n?2:3:n?4:1,e;Mf=Aq(t)?n?1:4:n?3:2}return e.minus(i).abs()}o(kq,"toLessThanHalfPi");function D3(r,e,t,n){var i,s,a,u,c,l,p,d,g,y=r.constructor,v=t!==void 0;if(v?(Ja(t,1,Fh),n===void 0?n=y.rounding:Ja(n,0,8)):(t=y.precision,n=y.rounding),!r.isFinite())p=Fq(r);else{for(p=ul(r),a=p.indexOf("."),v?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,a>=0&&(p=p.replace(".",""),g=new y(1),g.e=p.length-a,g.d=uT(ul(g),10,i),g.e=g.d.length),d=uT(p,10,i),s=c=d.length;d[--c]==0;)d.pop();if(!d[0])p=v?"0p+0":"0";else{if(a<0?s--:(r=new y(r),r.d=d,r.e=s,r=Sn(r,g,t,n,0,i),d=r.d,s=r.e,l=Tq),a=d[t],u=i/2,l=l||d[t+1]!==void 0,l=n<4?(a!==void 0||l)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||l||n===6&&d[t-1]&1||n===(r.s<0?8:7)),d.length=t,l)for(;++d[--t]>i-1;)d[t]=0,t||(++s,d.unshift(1));for(c=d.length;!d[c-1];--c);for(a=0,p="";a<c;a++)p+=N3.charAt(d[a]);if(v){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)p+="0";for(d=uT(p,i,e),c=d.length;!d[c-1];--c);for(a=1,p="1.";a<c;a++)p+=N3.charAt(d[a])}else p=p.charAt(0)+"."+p.slice(1);p=p+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)p="0"+p;p="0."+p}else if(++s>c)for(s-=c;s--;)p+="0";else s<c&&(p=p.slice(0,s)+"."+p.slice(s))}p=(e==16?"0x":e==2?"0b":e==8?"0o":"")+p}return r.s<0?"-"+p:p}o(D3,"toStringBinary");function Nq(r,e){if(r.length>e)return r.length=e,!0}o(Nq,"truncate");function xde(r){return new this(r).abs()}o(xde,"abs");function wde(r){return new this(r).acos()}o(wde,"acos");function Cde(r){return new this(r).acosh()}o(Cde,"acosh");function Ede(r,e){return new this(r).plus(e)}o(Ede,"add");function Ade(r){return new this(r).asin()}o(Ade,"asin");function Nde(r){return new this(r).asinh()}o(Nde,"asinh");function Ide(r){return new this(r).atan()}o(Ide,"atan");function Tde(r){return new this(r).atanh()}o(Tde,"atanh");function Rde(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,s=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=ol(this,s,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ol(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ol(this,s,1).times(.5),t.s=r.s):e.s<0?(this.precision=s,this.rounding=1,t=this.atan(Sn(r,e,s,1)),e=ol(this,s,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(Sn(r,e,s,1)),t}o(Rde,"atan2");function Dde(r){return new this(r).cbrt()}o(Dde,"cbrt");function Ode(r){return It(r=new this(r),r.e+1,2)}o(Ode,"ceil");function Bde(r,e,t){return new this(r).clamp(e,t)}o(Bde,"clamp");function Pde(r){if(!r||typeof r!="object")throw Error(hT+"Object expected");var e,t,n,i=r.defaults===!0,s=["precision",1,Fh,"rounding",0,8,"toExpNeg",-Cy,0,"toExpPos",0,Cy,"maxE",0,Cy,"minE",-Cy,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(t=s[e],i&&(this[t]=I3[t]),(n=r[t])!==void 0)if(sa(n)===n&&n>=s[e+1]&&n<=s[e+2])this[t]=n;else throw Error(Lh+t+": "+n);if(t="crypto",i&&(this[t]=I3[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(Dq);else this[t]=!1;else throw Error(Lh+t+": "+n);return this}o(Pde,"config");function _de(r){return new this(r).cos()}o(_de,"cos");function Lde(r){return new this(r).cosh()}o(Lde,"cosh");function Vq(r){var e,t,n;function i(s){var a,u,c,l=this;if(!(l instanceof i))return new i(s);if(l.constructor=i,Iq(s)){l.s=s.s,Yt?!s.d||s.e>i.maxE?(l.e=NaN,l.d=null):s.e<i.minE?(l.e=0,l.d=[0]):(l.e=s.e,l.d=s.d.slice()):(l.e=s.e,l.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){l.s=1/s<0?-1:1,l.e=0,l.d=[0];return}if(s<0?(s=-s,l.s=-1):l.s=1,s===~~s&&s<1e7){for(a=0,u=s;u>=10;u/=10)a++;Yt?a>i.maxE?(l.e=NaN,l.d=null):a<i.minE?(l.e=0,l.d=[0]):(l.e=a,l.d=[s]):(l.e=a,l.d=[s]);return}if(s*0!==0){s||(l.s=NaN),l.e=NaN,l.d=null;return}return cT(l,s.toString())}if(c==="string")return(u=s.charCodeAt(0))===45?(s=s.slice(1),l.s=-1):(u===43&&(s=s.slice(1)),l.s=1),Bq.test(s)?cT(l,s):Sde(l,s);if(c==="bigint")return s<0?(s=-s,l.s=-1):l.s=1,cT(l,s.toString());throw Error(Lh+s)}if(o(i,"Decimal"),i.prototype=ze,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Pde,i.clone=Vq,i.isDecimal=Iq,i.abs=xde,i.acos=wde,i.acosh=Cde,i.add=Ede,i.asin=Ade,i.asinh=Nde,i.atan=Ide,i.atanh=Tde,i.atan2=Rde,i.cbrt=Dde,i.ceil=Ode,i.clamp=Bde,i.cos=_de,i.cosh=Lde,i.div=Fde,i.exp=kde,i.floor=Vde,i.hypot=jde,i.ln=Mde,i.log=Ude,i.log10=Hde,i.log2=qde,i.max=zde,i.min=Kde,i.mod=Gde,i.mul=Xde,i.pow=Wde,i.random=Jde,i.round=Yde,i.sign=Qde,i.sin=$de,i.sinh=Zde,i.sqrt=eme,i.sub=tme,i.sum=rme,i.tan=nme,i.tanh=ime,i.trunc=sme,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}o(Vq,"clone");function Fde(r,e){return new this(r).div(e)}o(Fde,"div");function kde(r){return new this(r).exp()}o(kde,"exp");function Vde(r){return It(r=new this(r),r.e+1,3)}o(Vde,"floor");function jde(){var r,e,t=new this(0);for(Yt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Yt=!0,new this(1/0);t=e}return Yt=!0,t.sqrt()}o(jde,"hypot");function Iq(r){return r instanceof Ay||r&&r.toStringTag===Oq||!1}o(Iq,"isDecimalInstance");function Mde(r){return new this(r).ln()}o(Mde,"ln");function Ude(r,e){return new this(r).log(e)}o(Ude,"log");function qde(r){return new this(r).log(2)}o(qde,"log2");function Hde(r){return new this(r).log(10)}o(Hde,"log10");function zde(){return Lq(this,arguments,-1)}o(zde,"max");function Kde(){return Lq(this,arguments,1)}o(Kde,"min");function Gde(r,e){return new this(r).mod(e)}o(Gde,"mod");function Xde(r,e){return new this(r).mul(e)}o(Xde,"mul");function Wde(r,e){return new this(r).pow(e)}o(Wde,"pow");function Jde(r){var e,t,n,i,s=0,a=new this(1),u=[];if(r===void 0?r=this.precision:Ja(r,1,Fh),n=Math.ceil(r/Lt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));s<n;)i=e[s],i>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:u[s++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);s<n;)i=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((e[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,s):(u.push(i%1e7),s+=4);s=n/4}else throw Error(Dq);else for(;s<n;)u[s++]=Math.random()*1e7|0;for(n=u[--s],r%=Lt,n&&r&&(i=Ji(10,Lt-r),u[s]=(n/i|0)*i);u[s]===0;s--)u.pop();if(s<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Lt)u.shift();for(n=1,i=u[0];i>=10;i/=10)n++;n<Lt&&(t-=Lt-n)}return a.e=t,a.d=u,a}o(Jde,"random");function Yde(r){return It(r=new this(r),r.e+1,this.rounding)}o(Yde,"round");function Qde(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(Qde,"sign");function $de(r){return new this(r).sin()}o($de,"sin");function Zde(r){return new this(r).sinh()}o(Zde,"sinh");function eme(r){return new this(r).sqrt()}o(eme,"sqrt");function tme(r,e){return new this(r).sub(e)}o(tme,"sub");function rme(){var r=0,e=arguments,t=new this(e[r]);for(Yt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return Yt=!0,It(t,this.precision,this.rounding)}o(rme,"sum");function nme(r){return new this(r).tan()}o(nme,"tan");function ime(r){return new this(r).tanh()}o(ime,"tanh");function sme(r){return It(r=new this(r),r.e+1,1)}o(sme,"trunc");ze[Symbol.for("nodejs.util.inspect.custom")]=ze.toString;ze[Symbol.toStringTag]="Decimal";var Ay=ze.constructor=Vq(I3);lT=new Ay(lT);fT=new Ay(fT);var en=class r extends Ay{static{o(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};var jq=lr(require("pdfkit"),1);var gT=class r{static{o(this,"PdfkitPdfBuilder")}defaults={autoFirstPage:!1};doc=new jq.default(this.defaults);constructor(e){e&&this.configure(e)}static new(e){return new r(e)}configure(e){return this.doc.options={...this.doc.options,...e},this}pipe(e){return this.doc.pipe(e),this}end(){return this.doc.end()}restore(){return this.doc.restore(),this}save(){return this.doc.save(),this}stroke(e){return this.doc.stroke(e),this}page(e){return this.doc.addPage(e),this}table(e){return this.doc.table(e),this}text(e,t){let{x:n,y:i,...s}=t??{};return n||i?(this.doc.text(e,n,i,s),this):(this.doc.text(e,t),this)}fontSize(e){return this.doc.fontSize(e),this}font(e,t,n){return typeof t=="string"?(this.doc.font(e,t,n),this):typeof t=="number"?(this.doc.font(e,t),this):(this.doc.font(e),this)}image(e,t,n,i){return typeof t=="number"&&typeof n=="number"?(this.doc.image(e,t,n,i),this):(this.doc.image(e,t),this)}rect(e,t,n,i){return this.doc.rect(e,t,n,i),this}path(e){return this.doc.path(e),this}translate(e,t){return this.doc.translate(e,t),this}scale(e,t){return this.doc.scale(e,t),this}fill(e,t){return this.doc.fill(e,t),this}pageWidth(){return this.doc.page.width}pageHeight(){return this.doc.page.height}heightOfString(e,t){return this.doc.heightOfString(e,t)}widthOfString(e,t){return this.doc.widthOfString(e,t)}pageMargins(){return this.doc.page.margins}currentLineHeight(e){return this.doc.currentLineHeight(e)}x(){return this.doc.x}y(){return this.doc.y}moveDown(e){return this.doc.moveDown(e),this}row(e,...t){let n,i;typeof e=="function"?(n={},i=[e,...t]):(n=e??{},i=t),n.columns??=1;let s=this.y(),a=n.right??0,u=n.left??0,c=n.gap??0,l=this.pageWidth(),p=l-u-a-c*(n.columns-1);n.size??=Array(n.columns).fill(12/n.columns);let d=[];for(let g=0;g<n.columns;g++){let y=n.size[g]/12;d[g]=p*y}for(let g=0,y=u;g<n.columns;g++){let v=g===n.columns-1,x=d[g];if(v&&n.columns>1){let D=l-a-y;D>0&&Math.abs(D-x)>.01&&(x=D)}let S={y:s,x:y,width:x};i[g](S),y+=x,c>0&&!v&&(y+=c)}return this}};var vT=class{static{o(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var ML=lr(require("fs"),1),h7=lr(require("path"),1),Ww=lr(require("crypto"),1),Jh=lr(t7(),1);var Ir=class extends Error{static{o(this,"NFeTsError")}};var _L=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},YT=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},Qr=o(r=>new _L(r),"left"),gr=o(r=>r===void 0?new YT(void 0):new YT(r),"right");var qve=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),Kf=o(r=>typeof r=="string"?Qr(new Ir(r)):r instanceof Error?Qr(new Ir(r.message,{cause:r.cause})):qve(r)?Qr(new Ir(r.message)):Qr(new Ir("unexpected error")),"leftFromError");var QT=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var LL="http://www.w3.org/2000/09/xmldsig#",r7="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",FL=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),Sl=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),kL=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var Gw={includeComments:!1,exclusive:!0};var D0=o(r=>{throw new Ir("Didn't expect to get here")},"unreachable");var Uy=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=Sl.SHA1,i=Gw){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=i}assemble(e,t,n){let i=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:LL},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:i}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:r7}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:LL},...e},{rootName:"SignedInfo"}),this.canonical);return this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case Sl.SHA256:return kL.SHA256;case Sl.SHA1:return kL.SHA1;default:return D0(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case Sl.SHA256:return FL.RSA_SHA256;case Sl.SHA1:return FL.RSA_SHA1;default:return D0(this.algorithm)}}};var $T=class extends Uy{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:i,mark:s}=t,{certificate:a}=n;if(!e[i])return Qr(new Ir(`Node ${String(i)} not found`));let u=await this.toolkit.build(this.ns(e,i),{headless:!0,rootName:String(i),renderOpts:{pretty:!1}}),c=this.signedInfo(u,s),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let p=e;return p.Signature=this.assemble(c,l.value,a),gr(p)}ns(e,t){let n=e.$?.xmlns,{$:i,...s}=e[t],{xmlns:a,...u}=i??{};return{$:{xmlns:n,...u},...s}}};var ZT=class extends Uy{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:i,mark:s}=t,{certificate:a}=n,u=this.toolkit.getNode(e,i);if(!u)return Qr(new Ir(`Node ${i} not found`));let c=this.signedInfo(u,s),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let p=await this.toolkit.build(this.assemble(c,l.value,a),{rootName:"Signature"});return gr(this.toolkit.appendNode(e,p))}};var hLe=require("reflect-metadata"),i7=require("class-validator");var uLe=require("reflect-metadata");var VL="__SkipValidation__";var n7=require("class-transformer");var eR=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&eR(t)},"clearEmptyValues"),tR=o((r,e,t={})=>{let n=(0,n7.plainToInstance)(e,r);return t.clearEmptyValues&&eR(n),n},"plainToInstance");var gu="__ValidateErrors__",s7=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(s7(n.children,e?`${e}.${n.property}`:n.property));let i=Object.values(n.constraints??{}).map(s=>e?`${e}.${s}`:s).join(", ");return i?t.concat(i):t},[]),"mapConstraintsToErrors"),Ht=o(r=>(e,t,n)=>{let i=n.value;n.value=function(...s){let a=Reflect.getMetadata(VL,this.constructor);if(Reflect.getMetadata(VL,this.constructor.prototype,t.toString())===!0||a===!0)return i?.apply(this,s);let[c,...l]=s,p=tR(c,r),d=(0,i7.validateSync)(p,{whitelist:!0});if(eR(p),d.length){let g=Reflect.getMetadata(gu,this)??[];Reflect.defineMetadata(gu,g.concat(s7(d,i?.name)),this)}return i?.apply(this,[p,...l])}},"Validates");var yLe=require("reflect-metadata");var a7=require("class-validator");var o7=o(r=>(e,t)=>{(0,a7.registerDecorator)({name:"isDecimal",target:e.constructor,propertyName:t,options:r,validator:{validate(n){return n instanceof en?!0:typeof n=="string"||typeof n=="number"||typeof n=="bigint"},defaultMessage(n){return`${n.property} is not a valid Decimal value`}}})},"IsDecimal");var wLe=require("reflect-metadata"),jL=require("class-validator");var qy=Symbol("choice"),Hy=o(r=>r==null||r==="","isEmpty"),on=o(r=>e=>{let{properties:t,required:n=!1,...i}=r,s=Reflect.getMetadata(qy,e)??[],a={properties:t,required:n};s.push(a),Reflect.defineMetadata(qy,s,e);for(let u of t)(0,jL.registerDecorator)({name:"choice",target:e,propertyName:u,options:i,validator:{validate(c,l){let p=l.object,d=l.property,g=Reflect.getMetadata(qy,e);if(!g)return!0;let y=g.find(v=>v.properties.includes(d));if(!y||Hy(c))return!0;for(let v of y.properties){if(v===d)continue;let x=p[v];if(!Hy(x))return!1}for(let v of g)if(v!==y)for(let x of v.properties){let S=p[x];if(!Hy(S))return!1}return!0},defaultMessage(c){let l=Reflect.getMetadata(qy,e);if(!l)return`${c.property} validation error`;let p=l.find(g=>g.properties.includes(c.property));if(!p)return`${c.property} validation error`;let d=c.object;for(let g of p.properties){let y=d[g];if(!Hy(y)&&g!==c.property)return`${c.property} cannot be set because ${g} is already set. Only one property from this choice group is allowed.`}for(let g of l)if(g!==p)for(let y of g.properties){let v=d[y];if(!Hy(v))return`${c.property} cannot be set because ${y} from a different choice group is already set.`}return`${c.property} validation error`}}});if(n)for(let u of t)(0,jL.registerDecorator)({name:"choiceGroupRequired",target:e,propertyName:u,options:{...i,always:!0},validator:{validate(c,l){let p=l.object,d=Reflect.getMetadata(qy,e);if(!d)return!0;let g=d.find(y=>y.properties.includes(l.property));if(!g?.required)return!0;for(let y of g.properties){let v=p[y];if(!Hy(v))return!0}return l.property!==g.properties[0]},defaultMessage(c){let l=Reflect.getMetadata(qy,e);if(!l)return"At least one property from a choice group must be provided";let p=l.find(d=>d.properties.includes(c.property));return p?`You must provide a value for one of the following properties: ${p.properties.join(", ")}`:"At least one property from a choice group must be provided"}}})},"Choice");var ALe=require("reflect-metadata");var u7=require("class-transformer");var ne=o(({fixed:r,...e}={fixed:2})=>(t,n)=>{o7(e)(t,n),(0,u7.Transform)(({value:i})=>en.newOrUndefined(i)?.toFixed(r))(t,n)},"TransformDecimal");var f7=require("class-transformer"),p7=require("class-validator");var rR=lr(require("dayjs"),1),c7=lr(require("dayjs/plugin/utc"),1),l7=lr(require("dayjs/plugin/timezone"),1);rR.default.extend(c7.default);rR.default.extend(l7.default);var Xw=rR.default;var Wh=o((r={})=>(e,t)=>{(0,f7.Transform)(({value:n})=>{let i=n instanceof Date?n.toISOString():n;return i?Xw(i).tz("America/Sao_Paulo").format(r.format):void 0})(e,t),(0,p7.IsDateString)()(e,t)},"TransformDateString");var zy=class{static{o(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
|
|
112
|
+
`;return typeof n=="function"&&n(null,g),g},"render")});var Oae=Q(t4=>{"use strict";var T_e=UU();t4.render=T_e.render;t4.renderToFile=o(function(e,t,n,i){typeof i>"u"&&(i=n,n=void 0);let s=require("fs"),u='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+t4.render(t,n);s.writeFile(e,u,i)},"renderToFile")});var Bae=Q(r4=>{"use strict";var qU=hI();function R_e(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}o(R_e,"clearCanvas");function D_e(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}o(D_e,"getCanvasElement");r4.render=o(function(e,t,n){let i=n,s=t;typeof i>"u"&&(!t||!t.getContext)&&(i=t,t=void 0),t||(s=D_e()),i=qU.getOptions(i);let a=qU.getImageWidth(e.modules.size,i),u=s.getContext("2d"),c=u.createImageData(a,a);return qU.qrToImageData(c.data,e,i),R_e(u,s,a),u.putImageData(c,0,0),s},"render");r4.renderToDataURL=o(function(e,t,n){let i=n;typeof i>"u"&&(!t||!t.getContext)&&(i=t,t=void 0),i||(i={});let s=r4.render(e,t,i),a=i.type||"image/png",u=i.rendererOpts||{};return s.toDataURL(a,u.quality)},"renderToDataURL")});var _ae=Q(dI=>{"use strict";var O_e=rU(),HU=xU(),Pae=Bae(),B_e=UU();function zU(r,e,t,n,i){let s=[].slice.call(arguments,1),a=s.length,u=typeof s[a-1]=="function";if(!u&&!O_e())throw new Error("Callback required as last argument");if(u){if(a<2)throw new Error("Too few arguments provided");a===2?(i=t,t=e,e=n=void 0):a===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=t,t=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(t=e,e=n=void 0):a===2&&!e.getContext&&(n=t,t=e,e=void 0),new Promise(function(c,l){try{let p=HU.create(t,n);c(r(p,e,n))}catch(p){l(p)}})}try{let c=HU.create(t,n);i(null,r(c,e,n))}catch(c){i(c)}}o(zU,"renderCanvas");dI.create=HU.create;dI.toCanvas=zU.bind(null,Pae.render);dI.toDataURL=zU.bind(null,Pae.renderToDataURL);dI.toString=zU.bind(null,function(r,e,t){return B_e.render(r,t)})});var Vae=Q(c0=>{"use strict";var Lae=rU(),KU=xU(),P_e=Sae(),Fae=bae(),__e=Tae(),kae=Oae();function mI(r,e,t){if(typeof r>"u")throw new Error("String required as first argument");if(typeof t>"u"&&(t=e,e={}),typeof t!="function")if(Lae())e=t||{},t=null;else throw new Error("Callback required as last argument");return{opts:e,cb:t}}o(mI,"checkParams");function L_e(r){return r.slice((r.lastIndexOf(".")-1>>>0)+2).toLowerCase()}o(L_e,"getTypeFromFilename");function n4(r){switch(r){case"svg":return kae;case"txt":case"utf8":return Fae;case"png":case"image/png":default:return P_e}}o(n4,"getRendererFromType");function F_e(r){switch(r){case"svg":return kae;case"terminal":return __e;case"utf8":default:return Fae}}o(F_e,"getStringRendererFromType");function gI(r,e,t){if(!t.cb)return new Promise(function(n,i){try{let s=KU.create(e,t.opts);return r(s,t.opts,function(a,u){return a?i(a):n(u)})}catch(s){i(s)}});try{let n=KU.create(e,t.opts);return r(n,t.opts,t.cb)}catch(n){t.cb(n)}}o(gI,"render");c0.create=KU.create;c0.toCanvas=_ae().toCanvas;c0.toString=o(function(e,t,n){let i=mI(e,t,n),s=i.opts?i.opts.type:void 0,a=F_e(s);return gI(a.render,e,i)},"toString");c0.toDataURL=o(function(e,t,n){let i=mI(e,t,n),s=n4(i.opts.type);return gI(s.renderToDataURL,e,i)},"toDataURL");c0.toBuffer=o(function(e,t,n){let i=mI(e,t,n),s=n4(i.opts.type);return gI(s.renderToBuffer,e,i)},"toBuffer");c0.toFile=o(function(e,t,n,i){if(typeof e!="string"||!(typeof t=="string"||typeof t=="object"))throw new Error("Invalid argument");if(arguments.length<3&&!Lae())throw new Error("Too few arguments provided");let s=mI(t,n,i),a=s.opts.type||L_e(e),c=n4(a).renderToFile.bind(null,e);return gI(c,t,s)},"toFile");c0.toFileStream=o(function(e,t,n){if(arguments.length<2)throw new Error("Too few arguments provided");let i=mI(t,n,e.emit.bind(e,"error")),a=n4("png").renderToFileStream.bind(null,e);gI(a,t,i)},"toFileStream")});var Mae=Q((Xft,jae)=>{"use strict";jae.exports=Vae()});var V_e={};aT(V_e,{AccessKeyBuilder:()=>Rw,DanfceDefaultPdfDocument:()=>XU,DanfceReducedPdfDocument:()=>WU,DefaultDetBuilderAggregator:()=>S2,DefaultTotalBuilderAggregator:()=>b2,NFCeDto:()=>Nf,NFeDto:()=>bh,NfceAuthorizerPipeline:()=>vM,NfceConsultStatusPipeline:()=>yM,NfceQrcode:()=>Vv,NfceRemoteTransmitter:()=>Pm,NfceXmlBuilder:()=>iI,NfceXmlBuilderPipeline:()=>tU,NfeAuthorizationResponsePipeline:()=>SM,NfeAuthorizerPipeline:()=>E2,NfeConsultStatusPipeline:()=>N2,NfeDetXmlBuilder:()=>Is,NfeNfceCancelPipeline:()=>xM,NfeNfceVoidRangePipeline:()=>v_,NfeRemoteTransmitter:()=>go,NfeXmlBuilder:()=>Fn,NfeXmlBuilderPipeline:()=>nI,TpEmis:()=>ia,TpEvent:()=>Vf,schemas:()=>Tw});module.exports=ude(V_e);var ia=(function(r){return r.Normal="1",r.EPEC="4",r.SVCAN="6",r.SVCRS="7",r.OFFLINE="9",r})({});var Vf=(function(r){return r.Cancelamento="110111",r})({});var Do=require("path"),b0=require("fs");var A3=require("path"),E3=require("module"),oT=require("url");var cde=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,xy,xq=o(()=>{if(xy!==void 0)return xy;if(cde){xy=void 0;return}try{xy=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{xy=void 0}return xy},"getImportMetaUrl"),wq=o(()=>{if(typeof require<"u")return require;let r=xq();if(r)return(0,E3.createRequire)(r);let e=(0,oT.pathToFileURL)((0,A3.resolve)(process.cwd(),"package.json")).href;return(0,E3.createRequire)(e)},"getRequireFn"),Cq=o(()=>{if(typeof __filename<"u")return __filename;let r=xq();return r?(0,oT.fileURLToPath)(r):(0,A3.resolve)(process.cwd())},"getCurrentFile");var Eq=o(()=>typeof process<"u"&&typeof process.versions<"u"&&"electron"in process.versions,"isElectron"),lde=o(()=>{if(!Eq())return null;try{let e=require("electron").app;if(e?.getAppPath&&typeof e.getAppPath=="function")return{getAppPath:e.getAppPath}}catch{}return null},"getElectronApp"),fde=o(()=>{if(!Eq())return null;let r=process;if(r.resourcesPath)return r.resourcesPath;let e=lde();if(e)try{let t=e.getAppPath();if(typeof t=="string")return(0,Do.dirname)(t.replace(/\.asar$/,""))}catch{}return null},"getElectronResourcesPath"),wy=o((r,{onFound:e,onNotFound:t})=>{let n=fde();if(n){let l=(0,Do.resolve)(n,"node_modules","nfets",r);if((0,b0.existsSync)(l))return e(l);let p=(0,Do.resolve)(n,"app.asar.unpacked","node_modules","nfets",r);if((0,b0.existsSync)(p))return e(p)}let i=Cq(),s=i.includes(".asar")?process.cwd():i,a=(0,Do.resolve)(s,"../../../../"),u=(0,Do.resolve)(a,r);if((0,b0.existsSync)(u))return e(u);let c=s;for(let l=0;l<5;l++){let p=(0,Do.resolve)(c,r);if((0,b0.existsSync)(p))return e(p);let d=(0,Do.dirname)(c);if(d===c)break;c=d}c=s;for(let l=0;l<5;l++){let p=(0,Do.resolve)(c,"node_modules","nfets",r);if((0,b0.existsSync)(p))return e(p);let d=(0,Do.dirname)(c);if(d===c)break;c=d}c=s;for(let l=0;l<5;l++){let p=(0,Do.resolve)(c,r.replace(/^build\//,"Release/"));if((0,b0.existsSync)(p))return e(p);let d=(0,Do.dirname)(c);if(d===c)break;c=d}return t()},"search");var pde={PL_009_V4:"PL_009_V4",PL_010_V1:"PL_010_V1",PL_010_V1_21:"PL_010_V1.21",PL_010_V1_30:"PL_010_V1.30"},Tw=o(()=>{if(process.env.NFETS_NFE_SCHEMAS_DIR)return process.env.NFETS_NFE_SCHEMAS_DIR;try{return wy("packages/nfe/schemas",{onFound:o(r=>r,"onFound"),onNotFound:o(()=>{throw new Error("Schemas not found on packages/nfe/schemas")},"onNotFound")})}catch{return wy("nfe/schemas",{onFound:o(r=>r,"onFound"),onNotFound:o(()=>{throw new Error("Schemas not found on nfe/schemas")},"onNotFound")})}},"schemas"),jf=pde;var Rw=class{static{o(this,"AccessKeyBuilder")}compile(e){let t=e.cUF.toString().padStart(2,"0"),n=e.year.toString().padStart(2,"0"),i=e.month.toString().padStart(2,"0"),s=(e.identification??"").padStart(14,"0"),a=e.mod.toString().padStart(2,"0"),u=e.serie.toString().padStart(3,"0"),c=e.nNF.toString().padStart(9,"0"),l=e.tpEmis.toString().padStart(1,"0"),p=(e.cNF??this.code()).toString().padStart(8,"0"),d=`${t}${n}${i}${s}${a}${u}${c}${l}${p}`;return`${d}${this.verifyingDigit(d)}`}decompile(e){if(e.length!==44)return;let n=/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{14})([0-9]{2})([0-9]{3})([0-9]{9})([0-9]{1})([0-9]{8})([0-9]{1})$/.exec(e);if(!n)return;let[i,s,a,u,c,l,p,d,g,y,v]=n;return{cUF:s,year:a,month:u,identification:c,mod:l,serie:p,nNF:d,tpEmis:g,cNF:y,vd:v}}code(){let e=Math.floor(Math.random()*1e8).toString().padStart(8,"0");return this.isCodeValid(e)?e:this.code()}isCodeValid(e){return!~["00000000","11111111","22222222","33333333","44444444","55555555","66666666","77777777","88888888","99999999","12345678","23456789","34567890","45678901","56789012","67890123","78901234","89012345","90123456","01234567"].indexOf(e)}verifyingDigit(e){let t=[2,3,4,5,6,7,8,9],n=42,i=0;for(;n>=0;)for(let a=0;a<8&&n>=0;a++){let u=parseInt(e[n]);i+=u*t[a],n--}let s=11-i%11;return s>9?0:s}};var Cy=9e15,Fh=1e9,N3="0123456789abcdef",lT="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",fT="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",I3={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Cy,maxE:Cy,crypto:!1},Tq,Mf,Yt=!0,hT="[DecimalError] ",Lh=hT+"Invalid argument: ",Rq=hT+"Precision limit exceeded",Dq=hT+"crypto unavailable",Oq="[object Decimal]",sa=Math.floor,Ji=Math.pow,hde=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,dde=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,mde=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Bq=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,nc=1e7,Lt=7,gde=9007199254740991,vde=lT.length-1,T3=fT.length-1,ze={toStringTag:Oq};ze.absoluteValue=ze.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),It(r)};ze.ceil=function(){return It(new this.constructor(this),this.e+1,2)};ze.clampedTo=ze.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Lh+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};ze.comparedTo=ze.cmp=function(r){var e,t,n,i,s=this,a=s.d,u=(r=new s.constructor(r)).d,c=s.s,l=r.s;if(!a||!u)return!c||!l?NaN:c!==l?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-l:0;if(c!==l)return c;if(s.e!==r.e)return s.e>r.e^c<0?1:-1;for(n=a.length,i=u.length,e=0,t=n<i?n:i;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};ze.cosine=ze.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Lt,n.rounding=1,t=yde(n,kq(n,t)),n.precision=r,n.rounding=e,It(Mf==2||Mf==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};ze.cubeRoot=ze.cbrt=function(){var r,e,t,n,i,s,a,u,c,l,p=this,d=p.constructor;if(!p.isFinite()||p.isZero())return new d(p);for(Yt=!1,s=p.s*Ji(p.s*p,1/3),!s||Math.abs(s)==1/0?(t=Bs(p.d),r=p.e,(s=(r-t.length+1)%3)&&(t+=s==1||s==-2?"0":"00"),s=Ji(t,1/3),r=sa((r+1)/3)-(r%3==(r<0?-1:2)),s==1/0?t="5e"+r:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new d(t),n.s=p.s):n=new d(s.toString()),a=(r=d.precision)+3;;)if(u=n,c=u.times(u).times(u),l=c.plus(p),n=Sn(l.plus(p).times(u),l.plus(c),a+2,1),Bs(u.d).slice(0,a)===(t=Bs(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!i&&t=="4999"){if(!i&&(It(u,r+1,0),u.times(u).times(u).eq(p))){n=u;break}a+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(It(n,r+1,1),e=!n.times(n).times(n).eq(p));break}return Yt=!0,It(n,r,d.rounding,e)};ze.decimalPlaces=ze.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-sa(this.e/Lt))*Lt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};ze.dividedBy=ze.div=function(r){return Sn(this,new this.constructor(r))};ze.dividedToIntegerBy=ze.divToInt=function(r){var e=this,t=e.constructor;return It(Sn(e,new t(r),0,1,1),t.precision,t.rounding)};ze.equals=ze.eq=function(r){return this.cmp(r)===0};ze.floor=function(){return It(new this.constructor(this),this.e+1,3)};ze.greaterThan=ze.gt=function(r){return this.cmp(r)>0};ze.greaterThanOrEqualTo=ze.gte=function(r){var e=this.cmp(r);return e==1||e===0};ze.hyperbolicCosine=ze.cosh=function(){var r,e,t,n,i,s=this,a=s.constructor,u=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return u;t=a.precision,n=a.rounding,a.precision=t+Math.max(s.e,s.sd())+4,a.rounding=1,i=s.d.length,i<32?(r=Math.ceil(i/3),e=(1/mT(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),s=Ey(a,1,s.times(e),new a(1),!0);for(var c,l=r,p=new a(8);l--;)c=s.times(s),s=u.minus(c.times(p.minus(c.times(p))));return It(s,a.precision=t,a.rounding=n,!0)};ze.hyperbolicSine=ze.sinh=function(){var r,e,t,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(e=s.precision,t=s.rounding,s.precision=e+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Ey(s,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/mT(5,r)),i=Ey(s,2,i,i,!0);for(var a,u=new s(5),c=new s(16),l=new s(20);r--;)a=i.times(i),i=i.times(u.plus(a.times(c.times(a).plus(l))))}return s.precision=e,s.rounding=t,It(i,e,t,!0)};ze.hyperbolicTangent=ze.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,Sn(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};ze.inverseCosine=ze.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,i=e.rounding;return t!==-1?t===0?r.isNeg()?ol(e,n,i):new e(0):new e(NaN):r.isZero()?ol(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,r.times(2))};ze.inverseHyperbolicCosine=ze.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Yt=!1,t=t.times(t).minus(1).sqrt().plus(t),Yt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};ze.inverseHyperbolicSine=ze.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Yt=!1,t=t.times(t).plus(1).sqrt().plus(t),Yt=!0,n.precision=r,n.rounding=e,t.ln())};ze.inverseHyperbolicTangent=ze.atanh=function(){var r,e,t,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=s.precision,e=s.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?It(new s(i),r,e,!0):(s.precision=t=n-i.e,i=Sn(i.plus(1),new s(1).minus(i),t+r,1),s.precision=r+4,s.rounding=1,i=i.ln(),s.precision=r,s.rounding=e,i.times(.5))):new s(NaN)};ze.inverseSine=ze.asin=function(){var r,e,t,n,i=this,s=i.constructor;return i.isZero()?new s(i):(e=i.abs().cmp(1),t=s.precision,n=s.rounding,e!==-1?e===0?(r=ol(s,t+4,n).times(.5),r.s=i.s,r):new s(NaN):(s.precision=t+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=t,s.rounding=n,i.times(2)))};ze.inverseTangent=ze.atan=function(){var r,e,t,n,i,s,a,u,c,l=this,p=l.constructor,d=p.precision,g=p.rounding;if(l.isFinite()){if(l.isZero())return new p(l);if(l.abs().eq(1)&&d+4<=T3)return a=ol(p,d+4,g).times(.25),a.s=l.s,a}else{if(!l.s)return new p(NaN);if(d+4<=T3)return a=ol(p,d+4,g).times(.5),a.s=l.s,a}for(p.precision=u=d+10,p.rounding=1,t=Math.min(28,u/Lt+2|0),r=t;r;--r)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(Yt=!1,e=Math.ceil(u/Lt),n=1,c=l.times(l),a=new p(l),i=l;r!==-1;)if(i=i.times(c),s=a.minus(i.div(n+=2)),i=i.times(c),a=s.plus(i.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===s.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),Yt=!0,It(a,p.precision=d,p.rounding=g,!0)};ze.isFinite=function(){return!!this.d};ze.isInteger=ze.isInt=function(){return!!this.d&&sa(this.e/Lt)>this.d.length-2};ze.isNaN=function(){return!this.s};ze.isNegative=ze.isNeg=function(){return this.s<0};ze.isPositive=ze.isPos=function(){return this.s>0};ze.isZero=function(){return!!this.d&&this.d[0]===0};ze.lessThan=ze.lt=function(r){return this.cmp(r)<0};ze.lessThanOrEqualTo=ze.lte=function(r){return this.cmp(r)<1};ze.logarithm=ze.log=function(r){var e,t,n,i,s,a,u,c,l=this,p=l.constructor,d=p.precision,g=p.rounding,y=5;if(r==null)r=new p(10),e=!0;else{if(r=new p(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new p(NaN);e=r.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new p(t&&!t[0]?-1/0:l.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)s=!0;else{for(i=t[0];i%10===0;)i/=10;s=i!==1}if(Yt=!1,u=d+y,a=_h(l,u),n=e?pT(p,u+10):_h(r,u),c=Sn(a,n,u,1),Dw(c.d,i=d,g))do if(u+=10,a=_h(l,u),n=e?pT(p,u+10):_h(r,u),c=Sn(a,n,u,1),!s){+Bs(c.d).slice(i+1,i+15)+1==1e14&&(c=It(c,d+1,0));break}while(Dw(c.d,i+=10,g));return Yt=!0,It(c,d,g)};ze.minus=ze.sub=function(r){var e,t,n,i,s,a,u,c,l,p,d,g,y=this,v=y.constructor;if(r=new v(r),!y.d||!r.d)return!y.s||!r.s?r=new v(NaN):y.d?r.s=-r.s:r=new v(r.d||y.s!==r.s?y:NaN),r;if(y.s!=r.s)return r.s=-r.s,y.plus(r);if(l=y.d,g=r.d,u=v.precision,c=v.rounding,!l[0]||!g[0]){if(g[0])r.s=-r.s;else if(l[0])r=new v(y);else return new v(c===3?-0:0);return Yt?It(r,u,c):r}if(t=sa(r.e/Lt),p=sa(y.e/Lt),l=l.slice(),s=p-t,s){for(d=s<0,d?(e=l,s=-s,a=g.length):(e=g,t=p,a=l.length),n=Math.max(Math.ceil(u/Lt),a)+2,s>n&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for(n=l.length,a=g.length,d=n<a,d&&(a=n),n=0;n<a;n++)if(l[n]!=g[n]){d=l[n]<g[n];break}s=0}for(d&&(e=l,l=g,g=e,r.s=-r.s),a=l.length,n=g.length-a;n>0;--n)l[a++]=0;for(n=g.length;n>s;){if(l[--n]<g[n]){for(i=n;i&&l[--i]===0;)l[i]=nc-1;--l[i],l[n]+=nc}l[n]-=g[n]}for(;l[--a]===0;)l.pop();for(;l[0]===0;l.shift())--t;return l[0]?(r.d=l,r.e=dT(l,t),Yt?It(r,u,c):r):new v(c===3?-0:0)};ze.modulo=ze.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?It(new n(t),n.precision,n.rounding):(Yt=!1,n.modulo==9?(e=Sn(t,r.abs(),0,3,1),e.s*=r.s):e=Sn(t,r,0,n.modulo,1),e=e.times(r),Yt=!0,t.minus(e))};ze.naturalExponential=ze.exp=function(){return R3(this)};ze.naturalLogarithm=ze.ln=function(){return _h(this)};ze.negated=ze.neg=function(){var r=new this.constructor(this);return r.s=-r.s,It(r)};ze.plus=ze.add=function(r){var e,t,n,i,s,a,u,c,l,p,d=this,g=d.constructor;if(r=new g(r),!d.d||!r.d)return!d.s||!r.s?r=new g(NaN):d.d||(r=new g(r.d||d.s===r.s?d:NaN)),r;if(d.s!=r.s)return r.s=-r.s,d.minus(r);if(l=d.d,p=r.d,u=g.precision,c=g.rounding,!l[0]||!p[0])return p[0]||(r=new g(d)),Yt?It(r,u,c):r;if(s=sa(d.e/Lt),n=sa(r.e/Lt),l=l.slice(),i=s-n,i){for(i<0?(t=l,i=-i,a=p.length):(t=p,n=s,a=l.length),s=Math.ceil(u/Lt),a=s>a?s+1:a+1,i>a&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(a=l.length,i=p.length,a-i<0&&(i=a,t=p,p=l,l=t),e=0;i;)e=(l[--i]=l[i]+p[i]+e)/nc|0,l[i]%=nc;for(e&&(l.unshift(e),++n),a=l.length;l[--a]==0;)l.pop();return r.d=l,r.e=dT(l,n),Yt?It(r,u,c):r};ze.precision=ze.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Lh+r);return t.d?(e=Pq(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};ze.round=function(){var r=this,e=r.constructor;return It(new e(r),r.e+1,e.rounding)};ze.sine=ze.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Lt,n.rounding=1,t=bde(n,kq(n,t)),n.precision=r,n.rounding=e,It(Mf>2?t.neg():t,r,e,!0)):new n(NaN)};ze.squareRoot=ze.sqrt=function(){var r,e,t,n,i,s,a=this,u=a.d,c=a.e,l=a.s,p=a.constructor;if(l!==1||!u||!u[0])return new p(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);for(Yt=!1,l=Math.sqrt(+a),l==0||l==1/0?(e=Bs(u),(e.length+c)%2==0&&(e+="0"),l=Math.sqrt(e),c=sa((c+1)/2)-(c<0||c%2),l==1/0?e="5e"+c:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new p(e)):n=new p(l.toString()),t=(c=p.precision)+3;;)if(s=n,n=s.plus(Sn(a,s,t+2,1)).times(.5),Bs(s.d).slice(0,t)===(e=Bs(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(It(s,c+1,0),s.times(s).eq(a))){n=s;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(It(n,c+1,1),r=!n.times(n).eq(a));break}return Yt=!0,It(n,c,p.rounding,r)};ze.tangent=ze.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=Sn(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,It(Mf==2||Mf==4?t.neg():t,r,e,!0)):new n(NaN)};ze.times=ze.mul=function(r){var e,t,n,i,s,a,u,c,l,p=this,d=p.constructor,g=p.d,y=(r=new d(r)).d;if(r.s*=p.s,!g||!g[0]||!y||!y[0])return new d(!r.s||g&&!g[0]&&!y||y&&!y[0]&&!g?NaN:!g||!y?r.s/0:r.s*0);for(t=sa(p.e/Lt)+sa(r.e/Lt),c=g.length,l=y.length,c<l&&(s=g,g=y,y=s,a=c,c=l,l=a),s=[],a=c+l,n=a;n--;)s.push(0);for(n=l;--n>=0;){for(e=0,i=c+n;i>n;)u=s[i]+y[n]*g[i-n-1]+e,s[i--]=u%nc|0,e=u/nc|0;s[i]=(s[i]+e)%nc|0}for(;!s[--a];)s.pop();return e?++t:s.shift(),r.d=s,r.e=dT(s,t),Yt?It(r,d.precision,d.rounding):r};ze.toBinary=function(r,e){return D3(this,2,r,e)};ze.toDecimalPlaces=ze.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Ja(r,0,Fh),e===void 0?e=n.rounding:Ja(e,0,8),It(t,r+t.e+1,e))};ze.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=ul(n,!0):(Ja(r,0,Fh),e===void 0?e=i.rounding:Ja(e,0,8),n=It(new i(n),r+1,e),t=ul(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};ze.toFixed=function(r,e){var t,n,i=this,s=i.constructor;return r===void 0?t=ul(i):(Ja(r,0,Fh),e===void 0?e=s.rounding:Ja(e,0,8),n=It(new s(i),r+i.e+1,e),t=ul(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};ze.toFraction=function(r){var e,t,n,i,s,a,u,c,l,p,d,g,y=this,v=y.d,x=y.constructor;if(!v)return new x(y);if(l=t=new x(1),n=c=new x(0),e=new x(n),s=e.e=Pq(v)-y.e-1,a=s%Lt,e.d[0]=Ji(10,a<0?Lt+a:a),r==null)r=s>0?e:l;else{if(u=new x(r),!u.isInt()||u.lt(l))throw Error(Lh+u);r=u.gt(e)?s>0?e:l:u}for(Yt=!1,u=new x(Bs(v)),p=x.precision,x.precision=s=v.length*Lt*2;d=Sn(u,e,0,1,1),i=t.plus(d.times(n)),i.cmp(r)!=1;)t=n,n=i,i=l,l=c.plus(d.times(i)),c=i,i=e,e=u.minus(d.times(i)),u=i;return i=Sn(r.minus(t),n,0,1,1),c=c.plus(i.times(l)),t=t.plus(i.times(n)),c.s=l.s=y.s,g=Sn(l,n,s,1).minus(y).abs().cmp(Sn(c,t,s,1).minus(y).abs())<1?[l,n]:[c,t],x.precision=p,Yt=!0,g};ze.toHexadecimal=ze.toHex=function(r,e){return D3(this,16,r,e)};ze.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Ja(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(Yt=!1,t=Sn(t,r,0,e,1).times(r),Yt=!0,It(t)):(r.s=t.s,t=r),t};ze.toNumber=function(){return+this};ze.toOctal=function(r,e){return D3(this,8,r,e)};ze.toPower=ze.pow=function(r){var e,t,n,i,s,a,u=this,c=u.constructor,l=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Ji(+u,l));if(u=new c(u),u.eq(1))return u;if(n=c.precision,s=c.rounding,r.eq(1))return It(u,n,s);if(e=sa(r.e/Lt),e>=r.d.length-1&&(t=l<0?-l:l)<=gde)return i=_q(c,u,t,n),r.s<0?new c(1).div(i):It(i,n,s);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Ji(+u,l),e=t==0||!isFinite(t)?sa(l*(Math.log("0."+Bs(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(Yt=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),i=R3(r.times(_h(u,n+t)),n),i.d&&(i=It(i,n+5,1),Dw(i.d,n,s)&&(e=n+10,i=It(R3(r.times(_h(u,e+t)),e),e+5,1),+Bs(i.d).slice(n+1,n+15)+1==1e14&&(i=It(i,n+1,0)))),i.s=a,Yt=!0,c.rounding=s,It(i,n,s))};ze.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=ul(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ja(r,1,Fh),e===void 0?e=i.rounding:Ja(e,0,8),n=It(new i(n),r,e),t=ul(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};ze.toSignificantDigits=ze.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Ja(r,1,Fh),e===void 0?e=n.rounding:Ja(e,0,8)),It(new n(t),r,e)};ze.toString=function(){var r=this,e=r.constructor,t=ul(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};ze.truncated=ze.trunc=function(){return It(new this.constructor(this),this.e+1,1)};ze.valueOf=ze.toJSON=function(){var r=this,e=r.constructor,t=ul(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Bs(r){var e,t,n,i=r.length-1,s="",a=r[0];if(i>0){for(s+=a,e=1;e<i;e++)n=r[e]+"",t=Lt-n.length,t&&(s+=Ph(t)),s+=n;a=r[e],n=a+"",t=Lt-n.length,t&&(s+=Ph(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}o(Bs,"digitsToString");function Ja(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Lh+r)}o(Ja,"checkInt32");function Dw(r,e,t,n){var i,s,a,u;for(s=r[0];s>=10;s/=10)--e;return--e<0?(e+=Lt,i=0):(i=Math.ceil((e+1)/Lt),e%=Lt),s=Ji(10,Lt-e),u=r[i]%s|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==s||t>3&&u+1==s/2)&&(r[i+1]/s/100|0)==Ji(10,e-2)-1||(u==s/2||u==0)&&(r[i+1]/s/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==s||!n&&t>3&&u+1==s/2)&&(r[i+1]/s/1e3|0)==Ji(10,e-3)-1,a}o(Dw,"checkRoundingDigits");function uT(r,e,t){for(var n,i=[0],s,a=0,u=r.length;a<u;){for(s=i.length;s--;)i[s]*=e;for(i[0]+=N3.indexOf(r.charAt(a++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}o(uT,"convertBase");function yde(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/mT(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Ey(r,1,e.times(i),new r(1));for(var s=t;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}o(yde,"cosine");var Sn=(function(){function r(n,i,s){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*i+u,n[c]=a%s|0,u=a/s|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,i,s,a){var u,c;if(s!=a)c=s>a?1:-1;else for(u=c=0;u<s;u++)if(n[u]!=i[u]){c=n[u]>i[u]?1:-1;break}return c}o(e,"compare");function t(n,i,s,a){for(var u=0;s--;)n[s]-=u,u=n[s]<i[s]?1:0,n[s]=u*a+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,i,s,a,u,c){var l,p,d,g,y,v,x,S,A,D,C,E,I,B,q,R,z,K,H,J,ge=n.constructor,ve=n.s==i.s?1:-1,le=n.d,Z=i.d;if(!le||!le[0]||!Z||!Z[0])return new ge(!n.s||!i.s||(le?Z&&le[0]==Z[0]:!Z)?NaN:le&&le[0]==0||!Z?ve*0:ve/0);for(c?(y=1,p=n.e-i.e):(c=nc,y=Lt,p=sa(n.e/y)-sa(i.e/y)),H=Z.length,z=le.length,A=new ge(ve),D=A.d=[],d=0;Z[d]==(le[d]||0);d++);if(Z[d]>(le[d]||0)&&p--,s==null?(B=s=ge.precision,a=ge.rounding):u?B=s+(n.e-i.e)+1:B=s,B<0)D.push(1),v=!0;else{if(B=B/y+2|0,d=0,H==1){for(g=0,Z=Z[0],B++;(d<z||g)&&B--;d++)q=g*c+(le[d]||0),D[d]=q/Z|0,g=q%Z|0;v=g||d<z}else{for(g=c/(Z[0]+1)|0,g>1&&(Z=r(Z,g,c),le=r(le,g,c),H=Z.length,z=le.length),R=H,C=le.slice(0,H),E=C.length;E<H;)C[E++]=0;J=Z.slice(),J.unshift(0),K=Z[0],Z[1]>=c/2&&++K;do g=0,l=e(Z,C,H,E),l<0?(I=C[0],H!=E&&(I=I*c+(C[1]||0)),g=I/K|0,g>1?(g>=c&&(g=c-1),x=r(Z,g,c),S=x.length,E=C.length,l=e(x,C,S,E),l==1&&(g--,t(x,H<S?J:Z,S,c))):(g==0&&(l=g=1),x=Z.slice()),S=x.length,S<E&&x.unshift(0),t(C,x,E,c),l==-1&&(E=C.length,l=e(Z,C,H,E),l<1&&(g++,t(C,H<E?J:Z,E,c))),E=C.length):l===0&&(g++,C=[0]),D[d++]=g,l&&C[0]?C[E++]=le[R]||0:(C=[le[R]],E=1);while((R++<z||C[0]!==void 0)&&B--);v=C[0]!==void 0}D[0]||D.shift()}if(y==1)A.e=p,Tq=v;else{for(d=1,g=D[0];g>=10;g/=10)d++;A.e=d+p*y-1,It(A,u?s+A.e+1:s,a,v)}return A}})();function It(r,e,t,n){var i,s,a,u,c,l,p,d,g,y=r.constructor;e:if(e!=null){if(d=r.d,!d)return r;for(i=1,u=d[0];u>=10;u/=10)i++;if(s=e-i,s<0)s+=Lt,a=e,p=d[g=0],c=p/Ji(10,i-a-1)%10|0;else if(g=Math.ceil((s+1)/Lt),u=d.length,g>=u)if(n){for(;u++<=g;)d.push(0);p=c=0,i=1,s%=Lt,a=s-Lt+1}else break e;else{for(p=u=d[g],i=1;u>=10;u/=10)i++;s%=Lt,a=s-Lt+i,c=a<0?0:p/Ji(10,i-a-1)%10|0}if(n=n||e<0||d[g+1]!==void 0||(a<0?p:p%Ji(10,i-a-1)),l=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(s>0?a>0?p/Ji(10,i-a):0:d[g-1])%10&1||t==(r.s<0?8:7)),e<1||!d[0])return d.length=0,l?(e-=r.e+1,d[0]=Ji(10,(Lt-e%Lt)%Lt),r.e=-e||0):d[0]=r.e=0,r;if(s==0?(d.length=g,u=1,g--):(d.length=g+1,u=Ji(10,Lt-s),d[g]=a>0?(p/Ji(10,i-a)%Ji(10,a)|0)*u:0),l)for(;;)if(g==0){for(s=1,a=d[0];a>=10;a/=10)s++;for(a=d[0]+=u,u=1;a>=10;a/=10)u++;s!=u&&(r.e++,d[0]==nc&&(d[0]=1));break}else{if(d[g]+=u,d[g]!=nc)break;d[g--]=0,u=1}for(s=d.length;d[--s]===0;)d.pop()}return Yt&&(r.e>y.maxE?(r.d=null,r.e=NaN):r.e<y.minE&&(r.e=0,r.d=[0])),r}o(It,"finalise");function ul(r,e,t){if(!r.isFinite())return Fq(r);var n,i=r.e,s=Bs(r.d),a=s.length;return e?(t&&(n=t-a)>0?s=s.charAt(0)+"."+s.slice(1)+Ph(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(r.e<0?"e":"e+")+r.e):i<0?(s="0."+Ph(-i-1)+s,t&&(n=t-a)>0&&(s+=Ph(n))):i>=a?(s+=Ph(i+1-a),t&&(n=t-i-1)>0&&(s=s+"."+Ph(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(s+="."),s+=Ph(n))),s}o(ul,"finiteToString");function dT(r,e){var t=r[0];for(e*=Lt;t>=10;t/=10)e++;return e}o(dT,"getBase10Exponent");function pT(r,e,t){if(e>vde)throw Yt=!0,t&&(r.precision=t),Error(Rq);return It(new r(lT),e,1,!0)}o(pT,"getLn10");function ol(r,e,t){if(e>T3)throw Error(Rq);return It(new r(fT),e,t,!0)}o(ol,"getPi");function Pq(r){var e=r.length-1,t=e*Lt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(Pq,"getPrecision");function Ph(r){for(var e="";r--;)e+="0";return e}o(Ph,"getZeroString");function _q(r,e,t,n){var i,s=new r(1),a=Math.ceil(n/Lt+4);for(Yt=!1;;){if(t%2&&(s=s.times(e),Nq(s.d,a)&&(i=!0)),t=sa(t/2),t===0){t=s.d.length-1,i&&s.d[t]===0&&++s.d[t];break}e=e.times(e),Nq(e.d,a)}return Yt=!0,s}o(_q,"intPow");function Aq(r){return r.d[r.d.length-1]&1}o(Aq,"isOdd");function Lq(r,e,t){for(var n,i,s=new r(e[0]),a=0;++a<e.length;){if(i=new r(e[a]),!i.s){s=i;break}n=s.cmp(i),(n===t||n===0&&s.s===t)&&(s=i)}return s}o(Lq,"maxOrMin");function R3(r,e){var t,n,i,s,a,u,c,l=0,p=0,d=0,g=r.constructor,y=g.rounding,v=g.precision;if(!r.d||!r.d[0]||r.e>17)return new g(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(Yt=!1,c=v):c=e,u=new g(.03125);r.e>-2;)r=r.times(u),d+=5;for(n=Math.log(Ji(2,d))/Math.LN10*2+5|0,c+=n,t=s=a=new g(1),g.precision=c;;){if(s=It(s.times(r),c,1),t=t.times(++p),u=a.plus(Sn(s,t,c,1)),Bs(u.d).slice(0,c)===Bs(a.d).slice(0,c)){for(i=d;i--;)a=It(a.times(a),c,1);if(e==null)if(l<3&&Dw(a.d,c-n,y,l))g.precision=c+=10,t=s=u=new g(1),p=0,l++;else return It(a,g.precision=v,y,Yt=!0);else return g.precision=v,a}a=u}}o(R3,"naturalExponential");function _h(r,e){var t,n,i,s,a,u,c,l,p,d,g,y=1,v=10,x=r,S=x.d,A=x.constructor,D=A.rounding,C=A.precision;if(x.s<0||!S||!S[0]||!x.e&&S[0]==1&&S.length==1)return new A(S&&!S[0]?-1/0:x.s!=1?NaN:S?0:x);if(e==null?(Yt=!1,p=C):p=e,A.precision=p+=v,t=Bs(S),n=t.charAt(0),Math.abs(s=x.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)x=x.times(r),t=Bs(x.d),n=t.charAt(0),y++;s=x.e,n>1?(x=new A("0."+t),s++):x=new A(n+"."+t.slice(1))}else return l=pT(A,p+2,C).times(s+""),x=_h(new A(n+"."+t.slice(1)),p-v).plus(l),A.precision=C,e==null?It(x,C,D,Yt=!0):x;for(d=x,c=a=x=Sn(x.minus(1),x.plus(1),p,1),g=It(x.times(x),p,1),i=3;;){if(a=It(a.times(g),p,1),l=c.plus(Sn(a,new A(i),p,1)),Bs(l.d).slice(0,p)===Bs(c.d).slice(0,p))if(c=c.times(2),s!==0&&(c=c.plus(pT(A,p+2,C).times(s+""))),c=Sn(c,new A(y),p,1),e==null)if(Dw(c.d,p-v,D,u))A.precision=p+=v,l=a=x=Sn(d.minus(1),d.plus(1),p,1),g=It(x.times(x),p,1),i=u=1;else return It(c,A.precision=C,D,Yt=!0);else return A.precision=C,c;c=l,i+=2}}o(_h,"naturalLogarithm");function Fq(r){return String(r.s*r.s/0)}o(Fq,"nonFiniteToString");function cT(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%Lt,t<0&&(n+=Lt),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=Lt;n<i;)r.d.push(+e.slice(n,n+=Lt));e=e.slice(n),n=Lt-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),Yt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}o(cT,"parseDecimal");function Sde(r,e){var t,n,i,s,a,u,c,l,p;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Bq.test(e))return cT(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(dde.test(e))t=16,e=e.toLowerCase();else if(hde.test(e))t=2;else if(mde.test(e))t=8;else throw Error(Lh+e);for(s=e.search(/p/i),s>0?(c=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),s=e.indexOf("."),a=s>=0,n=r.constructor,a&&(e=e.replace(".",""),u=e.length,s=u-s,i=_q(n,new n(t),s,s*2)),l=uT(e,t,nc),p=l.length-1,s=p;l[s]===0;--s)l.pop();return s<0?new n(r.s*0):(r.e=dT(l,p),r.d=l,Yt=!1,a&&(r=Sn(r,i,u*4)),c&&(r=r.times(Math.abs(c)<54?Ji(2,c):Ay.pow(2,c))),Yt=!0,r)}o(Sde,"parseOther");function bde(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Ey(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/mT(5,t)),e=Ey(r,2,e,e);for(var i,s=new r(5),a=new r(16),u=new r(20);t--;)i=e.times(e),e=e.times(s.plus(i.times(a.times(i).minus(u))));return e}o(bde,"sine");function Ey(r,e,t,n,i){var s,a,u,c,l=1,p=r.precision,d=Math.ceil(p/Lt);for(Yt=!1,c=t.times(t),u=new r(n);;){if(a=Sn(u.times(c),new r(e++*e++),p,1),u=i?n.plus(a):n.minus(a),n=Sn(a.times(c),new r(e++*e++),p,1),a=u.plus(n),a.d[d]!==void 0){for(s=d;a.d[s]===u.d[s]&&s--;);if(s==-1)break}s=u,u=n,n=a,a=s,l++}return Yt=!0,a.d.length=d+1,a}o(Ey,"taylorSeries");function mT(r,e){for(var t=r;--e;)t*=r;return t}o(mT,"tinyPow");function kq(r,e){var t,n=e.s<0,i=ol(r,r.precision,1),s=i.times(.5);if(e=e.abs(),e.lte(s))return Mf=n?4:1,e;if(t=e.divToInt(i),t.isZero())Mf=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(s))return Mf=Aq(t)?n?2:3:n?4:1,e;Mf=Aq(t)?n?1:4:n?3:2}return e.minus(i).abs()}o(kq,"toLessThanHalfPi");function D3(r,e,t,n){var i,s,a,u,c,l,p,d,g,y=r.constructor,v=t!==void 0;if(v?(Ja(t,1,Fh),n===void 0?n=y.rounding:Ja(n,0,8)):(t=y.precision,n=y.rounding),!r.isFinite())p=Fq(r);else{for(p=ul(r),a=p.indexOf("."),v?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,a>=0&&(p=p.replace(".",""),g=new y(1),g.e=p.length-a,g.d=uT(ul(g),10,i),g.e=g.d.length),d=uT(p,10,i),s=c=d.length;d[--c]==0;)d.pop();if(!d[0])p=v?"0p+0":"0";else{if(a<0?s--:(r=new y(r),r.d=d,r.e=s,r=Sn(r,g,t,n,0,i),d=r.d,s=r.e,l=Tq),a=d[t],u=i/2,l=l||d[t+1]!==void 0,l=n<4?(a!==void 0||l)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||l||n===6&&d[t-1]&1||n===(r.s<0?8:7)),d.length=t,l)for(;++d[--t]>i-1;)d[t]=0,t||(++s,d.unshift(1));for(c=d.length;!d[c-1];--c);for(a=0,p="";a<c;a++)p+=N3.charAt(d[a]);if(v){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)p+="0";for(d=uT(p,i,e),c=d.length;!d[c-1];--c);for(a=1,p="1.";a<c;a++)p+=N3.charAt(d[a])}else p=p.charAt(0)+"."+p.slice(1);p=p+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)p="0"+p;p="0."+p}else if(++s>c)for(s-=c;s--;)p+="0";else s<c&&(p=p.slice(0,s)+"."+p.slice(s))}p=(e==16?"0x":e==2?"0b":e==8?"0o":"")+p}return r.s<0?"-"+p:p}o(D3,"toStringBinary");function Nq(r,e){if(r.length>e)return r.length=e,!0}o(Nq,"truncate");function xde(r){return new this(r).abs()}o(xde,"abs");function wde(r){return new this(r).acos()}o(wde,"acos");function Cde(r){return new this(r).acosh()}o(Cde,"acosh");function Ede(r,e){return new this(r).plus(e)}o(Ede,"add");function Ade(r){return new this(r).asin()}o(Ade,"asin");function Nde(r){return new this(r).asinh()}o(Nde,"asinh");function Ide(r){return new this(r).atan()}o(Ide,"atan");function Tde(r){return new this(r).atanh()}o(Tde,"atanh");function Rde(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,s=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=ol(this,s,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ol(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ol(this,s,1).times(.5),t.s=r.s):e.s<0?(this.precision=s,this.rounding=1,t=this.atan(Sn(r,e,s,1)),e=ol(this,s,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(Sn(r,e,s,1)),t}o(Rde,"atan2");function Dde(r){return new this(r).cbrt()}o(Dde,"cbrt");function Ode(r){return It(r=new this(r),r.e+1,2)}o(Ode,"ceil");function Bde(r,e,t){return new this(r).clamp(e,t)}o(Bde,"clamp");function Pde(r){if(!r||typeof r!="object")throw Error(hT+"Object expected");var e,t,n,i=r.defaults===!0,s=["precision",1,Fh,"rounding",0,8,"toExpNeg",-Cy,0,"toExpPos",0,Cy,"maxE",0,Cy,"minE",-Cy,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(t=s[e],i&&(this[t]=I3[t]),(n=r[t])!==void 0)if(sa(n)===n&&n>=s[e+1]&&n<=s[e+2])this[t]=n;else throw Error(Lh+t+": "+n);if(t="crypto",i&&(this[t]=I3[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(Dq);else this[t]=!1;else throw Error(Lh+t+": "+n);return this}o(Pde,"config");function _de(r){return new this(r).cos()}o(_de,"cos");function Lde(r){return new this(r).cosh()}o(Lde,"cosh");function Vq(r){var e,t,n;function i(s){var a,u,c,l=this;if(!(l instanceof i))return new i(s);if(l.constructor=i,Iq(s)){l.s=s.s,Yt?!s.d||s.e>i.maxE?(l.e=NaN,l.d=null):s.e<i.minE?(l.e=0,l.d=[0]):(l.e=s.e,l.d=s.d.slice()):(l.e=s.e,l.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){l.s=1/s<0?-1:1,l.e=0,l.d=[0];return}if(s<0?(s=-s,l.s=-1):l.s=1,s===~~s&&s<1e7){for(a=0,u=s;u>=10;u/=10)a++;Yt?a>i.maxE?(l.e=NaN,l.d=null):a<i.minE?(l.e=0,l.d=[0]):(l.e=a,l.d=[s]):(l.e=a,l.d=[s]);return}if(s*0!==0){s||(l.s=NaN),l.e=NaN,l.d=null;return}return cT(l,s.toString())}if(c==="string")return(u=s.charCodeAt(0))===45?(s=s.slice(1),l.s=-1):(u===43&&(s=s.slice(1)),l.s=1),Bq.test(s)?cT(l,s):Sde(l,s);if(c==="bigint")return s<0?(s=-s,l.s=-1):l.s=1,cT(l,s.toString());throw Error(Lh+s)}if(o(i,"Decimal"),i.prototype=ze,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Pde,i.clone=Vq,i.isDecimal=Iq,i.abs=xde,i.acos=wde,i.acosh=Cde,i.add=Ede,i.asin=Ade,i.asinh=Nde,i.atan=Ide,i.atanh=Tde,i.atan2=Rde,i.cbrt=Dde,i.ceil=Ode,i.clamp=Bde,i.cos=_de,i.cosh=Lde,i.div=Fde,i.exp=kde,i.floor=Vde,i.hypot=jde,i.ln=Mde,i.log=Ude,i.log10=Hde,i.log2=qde,i.max=zde,i.min=Kde,i.mod=Gde,i.mul=Xde,i.pow=Wde,i.random=Jde,i.round=Yde,i.sign=Qde,i.sin=$de,i.sinh=Zde,i.sqrt=eme,i.sub=tme,i.sum=rme,i.tan=nme,i.tanh=ime,i.trunc=sme,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}o(Vq,"clone");function Fde(r,e){return new this(r).div(e)}o(Fde,"div");function kde(r){return new this(r).exp()}o(kde,"exp");function Vde(r){return It(r=new this(r),r.e+1,3)}o(Vde,"floor");function jde(){var r,e,t=new this(0);for(Yt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Yt=!0,new this(1/0);t=e}return Yt=!0,t.sqrt()}o(jde,"hypot");function Iq(r){return r instanceof Ay||r&&r.toStringTag===Oq||!1}o(Iq,"isDecimalInstance");function Mde(r){return new this(r).ln()}o(Mde,"ln");function Ude(r,e){return new this(r).log(e)}o(Ude,"log");function qde(r){return new this(r).log(2)}o(qde,"log2");function Hde(r){return new this(r).log(10)}o(Hde,"log10");function zde(){return Lq(this,arguments,-1)}o(zde,"max");function Kde(){return Lq(this,arguments,1)}o(Kde,"min");function Gde(r,e){return new this(r).mod(e)}o(Gde,"mod");function Xde(r,e){return new this(r).mul(e)}o(Xde,"mul");function Wde(r,e){return new this(r).pow(e)}o(Wde,"pow");function Jde(r){var e,t,n,i,s=0,a=new this(1),u=[];if(r===void 0?r=this.precision:Ja(r,1,Fh),n=Math.ceil(r/Lt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));s<n;)i=e[s],i>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:u[s++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);s<n;)i=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((e[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,s):(u.push(i%1e7),s+=4);s=n/4}else throw Error(Dq);else for(;s<n;)u[s++]=Math.random()*1e7|0;for(n=u[--s],r%=Lt,n&&r&&(i=Ji(10,Lt-r),u[s]=(n/i|0)*i);u[s]===0;s--)u.pop();if(s<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Lt)u.shift();for(n=1,i=u[0];i>=10;i/=10)n++;n<Lt&&(t-=Lt-n)}return a.e=t,a.d=u,a}o(Jde,"random");function Yde(r){return It(r=new this(r),r.e+1,this.rounding)}o(Yde,"round");function Qde(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(Qde,"sign");function $de(r){return new this(r).sin()}o($de,"sin");function Zde(r){return new this(r).sinh()}o(Zde,"sinh");function eme(r){return new this(r).sqrt()}o(eme,"sqrt");function tme(r,e){return new this(r).sub(e)}o(tme,"sub");function rme(){var r=0,e=arguments,t=new this(e[r]);for(Yt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return Yt=!0,It(t,this.precision,this.rounding)}o(rme,"sum");function nme(r){return new this(r).tan()}o(nme,"tan");function ime(r){return new this(r).tanh()}o(ime,"tanh");function sme(r){return It(r=new this(r),r.e+1,1)}o(sme,"trunc");ze[Symbol.for("nodejs.util.inspect.custom")]=ze.toString;ze[Symbol.toStringTag]="Decimal";var Ay=ze.constructor=Vq(I3);lT=new Ay(lT);fT=new Ay(fT);var en=class r extends Ay{static{o(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};var jq=lr(require("pdfkit"),1);var gT=class r{static{o(this,"PdfkitPdfBuilder")}defaults={autoFirstPage:!1};doc=new jq.default(this.defaults);constructor(e){e&&this.configure(e)}static new(e){return new r(e)}configure(e){return this.doc.options={...this.doc.options,...e},this}pipe(e){return this.doc.pipe(e),this}end(){return this.doc.end()}restore(){return this.doc.restore(),this}save(){return this.doc.save(),this}stroke(e){return this.doc.stroke(e),this}page(e){return this.doc.addPage(e),this}table(e){return this.doc.table(e),this}text(e,t){let{x:n,y:i,...s}=t??{};return n||i?(this.doc.text(e,n,i,s),this):(this.doc.text(e,t),this)}fontSize(e){return this.doc.fontSize(e),this}font(e,t,n){return typeof t=="string"?(this.doc.font(e,t,n),this):typeof t=="number"?(this.doc.font(e,t),this):(this.doc.font(e),this)}image(e,t,n,i){return typeof t=="number"&&typeof n=="number"?(this.doc.image(e,t,n,i),this):(this.doc.image(e,t),this)}rect(e,t,n,i){return this.doc.rect(e,t,n,i),this}path(e){return this.doc.path(e),this}translate(e,t){return this.doc.translate(e,t),this}scale(e,t){return this.doc.scale(e,t),this}fill(e,t){return this.doc.fill(e,t),this}pageWidth(){return this.doc.page.width}pageHeight(){return this.doc.page.height}heightOfString(e,t){return this.doc.heightOfString(e,t)}widthOfString(e,t){return this.doc.widthOfString(e,t)}pageMargins(){return this.doc.page.margins}currentLineHeight(e){return this.doc.currentLineHeight(e)}x(){return this.doc.x}y(){return this.doc.y}moveDown(e){return this.doc.moveDown(e),this}row(e,...t){let n,i;typeof e=="function"?(n={},i=[e,...t]):(n=e??{},i=t),n.columns??=1;let s=this.y(),a=n.right??0,u=n.left??0,c=n.gap??0,l=this.pageWidth(),p=l-u-a-c*(n.columns-1);n.size??=Array(n.columns).fill(12/n.columns);let d=[];for(let g=0;g<n.columns;g++){let y=n.size[g]/12;d[g]=p*y}for(let g=0,y=u;g<n.columns;g++){let v=g===n.columns-1,x=d[g];if(v&&n.columns>1){let D=l-a-y;D>0&&Math.abs(D-x)>.01&&(x=D)}let S={y:s,x:y,width:x};i[g](S),y+=x,c>0&&!v&&(y+=c)}return this}};var vT=class{static{o(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var ML=lr(require("fs"),1),h7=lr(require("path"),1),Ww=lr(require("crypto"),1),Jh=lr(t7(),1);var Ir=class extends Error{static{o(this,"NFeTsError")}};var _L=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},YT=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},Qr=o(r=>new _L(r),"left"),gr=o(r=>r===void 0?new YT(void 0):new YT(r),"right");var qve=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),Kf=o(r=>typeof r=="string"?Qr(new Ir(r)):r instanceof Error?Qr(new Ir(r.message,{cause:r.cause})):qve(r)?Qr(new Ir(r.message)):Qr(new Ir("unexpected error")),"leftFromError");var QT=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var LL="http://www.w3.org/2000/09/xmldsig#",r7="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",FL=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),Sl=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),kL=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var Gw={includeComments:!1,exclusive:!0};var D0=o(r=>{throw new Ir("Didn't expect to get here")},"unreachable");var Uy=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=Sl.SHA1,i=Gw){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=i}assemble(e,t,n){let i=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:LL},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:i}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:r7}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:LL},...e},{rootName:"SignedInfo"}),this.canonical);return this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case Sl.SHA256:return kL.SHA256;case Sl.SHA1:return kL.SHA1;default:return D0(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case Sl.SHA256:return FL.RSA_SHA256;case Sl.SHA1:return FL.RSA_SHA1;default:return D0(this.algorithm)}}};var $T=class extends Uy{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:i,mark:s}=t,{certificate:a}=n;if(!e[i])return Qr(new Ir(`Node ${String(i)} not found`));let u=await this.toolkit.build(this.ns(e,i),{headless:!0,rootName:String(i),renderOpts:{pretty:!1}}),c=this.signedInfo(u,s),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let p=e;return p.Signature=this.assemble(c,l.value,a),gr(p)}ns(e,t){let n=e.$?.xmlns,{$:i,...s}=e[t],{xmlns:a,...u}=i??{};return{$:{xmlns:n,...u},...s}}};var ZT=class extends Uy{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:i,mark:s}=t,{certificate:a}=n,u=this.toolkit.getNode(e,i);if(!u)return Qr(new Ir(`Node ${i} not found`));let c=this.signedInfo(u,s),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let p=await this.toolkit.build(this.assemble(c,l.value,a),{rootName:"Signature"});return gr(this.toolkit.appendNode(e,p))}};var hLe=require("reflect-metadata"),i7=require("class-validator");var uLe=require("reflect-metadata");var VL="__SkipValidation__";var n7=require("class-transformer");var eR=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&eR(t)},"clearEmptyValues"),tR=o((r,e,t={})=>{let n=(0,n7.plainToInstance)(e,r);return t.clearEmptyValues&&eR(n),n},"plainToInstance");var gu="__ValidateErrors__",s7=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(s7(n.children,e?`${e}.${n.property}`:n.property));let i=Object.values(n.constraints??{}).map(s=>e?`${e}.${s}`:s).join(", ");return i?t.concat(i):t},[]),"mapConstraintsToErrors"),Ht=o(r=>(e,t,n)=>{let i=n.value;n.value=function(...s){let a=Reflect.getMetadata(VL,this.constructor);if(Reflect.getMetadata(VL,this.constructor.prototype,t.toString())===!0||a===!0)return i?.apply(this,s);let[c,...l]=s,p=tR(c,r),d=(0,i7.validateSync)(p,{whitelist:!0});if(eR(p),d.length){let g=Reflect.getMetadata(gu,this)??[];Reflect.defineMetadata(gu,g.concat(s7(d,i?.name)),this)}return i?.apply(this,[p,...l])}},"Validates");var yLe=require("reflect-metadata");var a7=require("class-validator");var o7=o(r=>(e,t)=>{(0,a7.registerDecorator)({name:"isDecimal",target:e.constructor,propertyName:t,options:r,validator:{validate(n){return n instanceof en?!0:typeof n=="string"||typeof n=="number"||typeof n=="bigint"},defaultMessage(n){return`${n.property} is not a valid Decimal value`}}})},"IsDecimal");var wLe=require("reflect-metadata"),jL=require("class-validator");var qy=Symbol("choice"),Hy=o(r=>r==null||r==="","isEmpty"),on=o(r=>e=>{let{properties:t,required:n=!1,...i}=r,s=Reflect.getMetadata(qy,e)??[],a={properties:t,required:n};s.push(a),Reflect.defineMetadata(qy,s,e);for(let u of t)(0,jL.registerDecorator)({name:"choice",target:e,propertyName:u,options:i,validator:{validate(c,l){let p=l.object,d=l.property,g=Reflect.getMetadata(qy,e);if(!g)return!0;let y=g.find(v=>v.properties.includes(d));if(!y||Hy(c))return!0;for(let v of y.properties){if(v===d)continue;let x=p[v];if(!Hy(x))return!1}for(let v of g)if(v!==y)for(let x of v.properties){let S=p[x];if(!Hy(S))return!1}return!0},defaultMessage(c){let l=Reflect.getMetadata(qy,e);if(!l)return`${c.property} validation error`;let p=l.find(g=>g.properties.includes(c.property));if(!p)return`${c.property} validation error`;let d=c.object;for(let g of p.properties){let y=d[g];if(!Hy(y)&&g!==c.property)return`${c.property} cannot be set because ${g} is already set. Only one property from this choice group is allowed.`}for(let g of l)if(g!==p)for(let y of g.properties){let v=d[y];if(!Hy(v))return`${c.property} cannot be set because ${y} from a different choice group is already set.`}return`${c.property} validation error`}}});if(n)for(let u of t)(0,jL.registerDecorator)({name:"choiceGroupRequired",target:e,propertyName:u,options:{...i,always:!0},validator:{validate(c,l){let p=l.object,d=Reflect.getMetadata(qy,e);if(!d)return!0;let g=d.find(y=>y.properties.includes(l.property));if(!g?.required)return!0;for(let y of g.properties){let v=p[y];if(!Hy(v))return!0}return l.property!==g.properties[0]},defaultMessage(c){let l=Reflect.getMetadata(qy,e);if(!l)return"At least one property from a choice group must be provided";let p=l.find(d=>d.properties.includes(c.property));return p?`You must provide a value for one of the following properties: ${p.properties.join(", ")}`:"At least one property from a choice group must be provided"}}})},"Choice");var ALe=require("reflect-metadata");var u7=require("class-transformer");var ne=o(({fixed:r,...e}={fixed:2})=>(t,n)=>{o7(e)(t,n),(0,u7.Transform)(({value:i})=>en.newOrUndefined(i)?.toFixed(r))(t,n)},"TransformDecimal");var f7=require("class-transformer"),p7=require("class-validator");var rR=lr(require("dayjs"),1),c7=lr(require("dayjs/plugin/utc"),1),l7=lr(require("dayjs/plugin/timezone"),1);rR.default.extend(c7.default);rR.default.extend(l7.default);var Xw=rR.default;var Wh=o((r={})=>(e,t)=>{(0,f7.Transform)(({value:n})=>{let i=n instanceof Date?n.toISOString():n;return i?Xw(i).tz("America/Sao_Paulo").format(r.format):void 0})(e,t),(0,p7.IsDateString)()(e,t)},"TransformDateString");var zy=class{static{o(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
|
|
113
113
|
`).reduce((s,a)=>{let[u,c]=a.split("=").map(l=>l.trim());return!u||!c?s:s.set(u,c)},new Map),i=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:i,CN:n.get("CN"),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),i=t.indexOf(n);if(i===-1)return;let s=[t.subarray(0,i),t.subarray(i)];if(s.length<=1)return;let u=s[0].subarray(-4),c=u.subarray(-2);u[0]===48?c=u:u[1]===48&&(c=u.subarray(-3));let l=Buffer.concat([c,n,s[1]]),p=this.length(l),d=n.length,g=l.subarray(2+d,2+d+p),y=g.length-c.length-2;if(y<=0||y>g.length)return;let x=g.subarray(-y).toString("utf8");return x.substring(Buffer.from(x).findIndex((S,A)=>x.charCodeAt(A)>=32&&x.charCodeAt(A)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((i,s)=>{let a=this.base128(i,Number.parseInt(s,10),!0);return i.length=0,i.push(...a),i},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let i=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,i.push(...a)}let s=t%128;return n?i.push(s):i.push(128|s),i}};var nR=class{static{o(this,"NativeCertificateRepository")}httpClient;signer;cache;constructor(e,t,n=new QT){this.httpClient=e,this.signer=t,this.cache=n}async read(e){try{let{password:t}=e,n=await this.getPfxBuffer(e);if(n.isLeft())return n;let i=Jh.default.asn1.fromDer(n.value.toString("binary")),s=Jh.default.pkcs12.pkcs12FromAsn1(i,t),{certBag:a}=Jh.default.pki.oids,c=s.getBags({bagType:a})[a];if(!c?.length)return Qr(new Ir("Cannot read certificate"));let[{cert:l},...p]=c;if(!l)return Qr(new Ir("Issuer Certificate not found"));let d=p.reduce((y,{cert:v})=>(v&&y.push(new Ww.default.X509Certificate(Jh.default.pki.certificateToPem(v))),y),[]),g=new Ww.default.X509Certificate(Jh.default.pki.certificateToPem(l));return gr({ca:d,password:t,certificate:g,privateKey:this.getPrivateKey(s)})}catch(t){return Kf(t)}}getPrivateKey(e){let{pkcs8ShroudedKeyBag:t}=Jh.default.pki.oids,i=e.getBags({bagType:t})[t]?.[0]?.key;if(i)return Ww.default.createPrivateKey(Jh.default.pki.privateKeyToPem(i))}async sign(e,t,n=Sl.SHA1){return this.signer.sign(e,t,n)}getCertificateInfo(e){return new zy().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"})}catch{throw new Ir("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,i=this.getCacheKey(t,n),s=await this.cache.get(i);if(s)return gr(s);if(h7.default.isAbsolute(t)||ML.default.existsSync(t))return this.hitBufferOnCache(i,ML.default.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(i,Buffer.from(a.data))}catch(a){return Kf(a)}return this.hitBufferOnCache(i,Buffer.from(t,"base64"))}getCacheKey(e,t){return Ww.default.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),gr(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var TZ=lr(require("os"),1),RZ=require("crypto"),YD=require("https"),DZ=lr(m$(),1);function HC(r,e){return o(function(){return r.apply(e,arguments)},"wrap")}o(HC,"bind");var{toString:b2e}=Object.prototype,{getPrototypeOf:J8}=Object,{iterator:_D,toStringTag:v$}=Symbol,LD=(r=>e=>{let t=b2e.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),pc=o(r=>(r=r.toLowerCase(),e=>LD(e)===r),"kindOfTest"),FD=o(r=>e=>typeof e===r,"typeOfTest"),{isArray:I1}=Array,N1=FD("undefined");function zC(r){return r!==null&&!N1(r)&&r.constructor!==null&&!N1(r.constructor)&&oo(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}o(zC,"isBuffer");var y$=pc("ArrayBuffer");function x2e(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&y$(r.buffer),e}o(x2e,"isArrayBufferView");var w2e=FD("string"),oo=FD("function"),S$=FD("number"),KC=o(r=>r!==null&&typeof r=="object","isObject"),C2e=o(r=>r===!0||r===!1,"isBoolean"),PD=o(r=>{if(LD(r)!=="object")return!1;let e=J8(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(v$ in r)&&!(_D in r)},"isPlainObject"),E2e=o(r=>{if(!KC(r)||zC(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),A2e=pc("Date"),N2e=pc("File"),I2e=pc("Blob"),T2e=pc("FileList"),R2e=o(r=>KC(r)&&oo(r.pipe),"isStream"),D2e=o(r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||oo(r.append)&&((e=LD(r))==="formdata"||e==="object"&&oo(r.toString)&&r.toString()==="[object FormData]"))},"isFormData"),O2e=pc("URLSearchParams"),[B2e,P2e,_2e,L2e]=["ReadableStream","Request","Response","Headers"].map(pc),F2e=o(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function GC(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),I1(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{if(zC(r))return;let s=t?Object.getOwnPropertyNames(r):Object.keys(r),a=s.length,u;for(n=0;n<a;n++)u=s[n],e.call(null,r[u],u,r)}}o(GC,"forEach");function b$(r,e){if(zC(r))return null;e=e.toLowerCase();let t=Object.keys(r),n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}o(b$,"findKey");var z0=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,x$=o(r=>!N1(r)&&r!==z0,"isContextDefined");function W8(){let{caseless:r,skipUndefined:e}=x$(this)&&this||{},t={},n=o((i,s)=>{let a=r&&b$(t,s)||s;PD(t[a])&&PD(i)?t[a]=W8(t[a],i):PD(i)?t[a]=W8({},i):I1(i)?t[a]=i.slice():(!e||!N1(i))&&(t[a]=i)},"assignValue");for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&GC(arguments[i],n);return t}o(W8,"merge");var k2e=o((r,e,t,{allOwnKeys:n}={})=>(GC(e,(i,s)=>{t&&oo(i)?Object.defineProperty(r,s,{value:HC(i,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),r),"extend"),V2e=o(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),j2e=o((r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),M2e=o((r,e,t,n)=>{let i,s,a,u={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),s=i.length;s-- >0;)a=i[s],(!n||n(a,r,e))&&!u[a]&&(e[a]=r[a],u[a]=!0);r=t!==!1&&J8(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),U2e=o((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let n=r.indexOf(e,t);return n!==-1&&n===t},"endsWith"),q2e=o(r=>{if(!r)return null;if(I1(r))return r;let e=r.length;if(!S$(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),H2e=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&J8(Uint8Array)),z2e=o((r,e)=>{let n=(r&&r[_D]).call(r),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(r,s[0],s[1])}},"forEachEntry"),K2e=o((r,e)=>{let t,n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},"matchAll"),G2e=pc("HTMLFormElement"),X2e=o(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function(t,n,i){return n.toUpperCase()+i},"replacer")),"toCamelCase"),g$=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),W2e=pc("RegExp"),w$=o((r,e)=>{let t=Object.getOwnPropertyDescriptors(r),n={};GC(t,(i,s)=>{let a;(a=e(i,s,r))!==!1&&(n[s]=a||i)}),Object.defineProperties(r,n)},"reduceDescriptors"),J2e=o(r=>{w$(r,(e,t)=>{if(oo(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let n=r[t];if(oo(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),Y2e=o((r,e)=>{let t={},n=o(i=>{i.forEach(s=>{t[s]=!0})},"define");return I1(r)?n(r):n(String(r).split(e)),t},"toObjectSet"),Q2e=o(()=>{},"noop"),$2e=o((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function Z2e(r){return!!(r&&oo(r.append)&&r[v$]==="FormData"&&r[_D])}o(Z2e,"isSpecCompliantForm");var eIe=o(r=>{let e=new Array(10),t=o((n,i)=>{if(KC(n)){if(e.indexOf(n)>=0)return;if(zC(n))return n;if(!("toJSON"in n)){e[i]=n;let s=I1(n)?[]:{};return GC(n,(a,u)=>{let c=t(a,i+1);!N1(c)&&(s[u]=c)}),e[i]=void 0,s}}return n},"visit");return t(r,0)},"toJSONObject"),tIe=pc("AsyncFunction"),rIe=o(r=>r&&(KC(r)||oo(r))&&oo(r.then)&&oo(r.catch),"isThenable"),C$=((r,e)=>r?setImmediate:e?((t,n)=>(z0.addEventListener("message",({source:i,data:s})=>{i===z0&&s===t&&n.length&&n.shift()()},!1),i=>{n.push(i),z0.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",oo(z0.postMessage)),nIe=typeof queueMicrotask<"u"?queueMicrotask.bind(z0):typeof process<"u"&&process.nextTick||C$,iIe=o(r=>r!=null&&oo(r[_D]),"isIterable"),oe={isArray:I1,isArrayBuffer:y$,isBuffer:zC,isFormData:D2e,isArrayBufferView:x2e,isString:w2e,isNumber:S$,isBoolean:C2e,isObject:KC,isPlainObject:PD,isEmptyObject:E2e,isReadableStream:B2e,isRequest:P2e,isResponse:_2e,isHeaders:L2e,isUndefined:N1,isDate:A2e,isFile:N2e,isBlob:I2e,isRegExp:W2e,isFunction:oo,isStream:R2e,isURLSearchParams:O2e,isTypedArray:H2e,isFileList:T2e,forEach:GC,merge:W8,extend:k2e,trim:F2e,stripBOM:V2e,inherits:j2e,toFlatObject:M2e,kindOf:LD,kindOfTest:pc,endsWith:U2e,toArray:q2e,forEachEntry:z2e,matchAll:K2e,isHTMLForm:G2e,hasOwnProperty:g$,hasOwnProp:g$,reduceDescriptors:w$,freezeMethods:J2e,toObjectSet:Y2e,toCamelCase:X2e,noop:Q2e,toFiniteNumber:$2e,findKey:b$,global:z0,isContextDefined:x$,isSpecCompliantForm:Z2e,toJSONObject:eIe,isAsyncFn:tIe,isThenable:rIe,setImmediate:C$,asap:nIe,isIterable:iIe};var Lo=class E$ extends Error{static{o(this,"AxiosError")}static from(e,t,n,i,s,a){let u=new E$(e.message,t||e.code,n,i,s);return u.cause=e,u.name=e.name,a&&Object.assign(u,a),u}constructor(e,t,n,i,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:oe.toJSONObject(this.config),code:this.code,status:this.status}}};Lo.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Lo.ERR_BAD_OPTION="ERR_BAD_OPTION";Lo.ECONNABORTED="ECONNABORTED";Lo.ETIMEDOUT="ETIMEDOUT";Lo.ERR_NETWORK="ERR_NETWORK";Lo.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Lo.ERR_DEPRECATED="ERR_DEPRECATED";Lo.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Lo.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Lo.ERR_CANCELED="ERR_CANCELED";Lo.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Lo.ERR_INVALID_URL="ERR_INVALID_URL";var st=Lo;var R$=lr(T$(),1),kD=R$.default;function eV(r){return oe.isPlainObject(r)||oe.isArray(r)}o(eV,"isVisitable");function O$(r){return oe.endsWith(r,"[]")?r.slice(0,-2):r}o(O$,"removeBrackets");function D$(r,e,t){return r?r.concat(e).map(o(function(i,s){return i=O$(i),!t&&s?"["+i+"]":i},"each")).join(t?".":""):e}o(D$,"renderKey");function dIe(r){return oe.isArray(r)&&!r.some(eV)}o(dIe,"isFlatArray");var mIe=oe.toFlatObject(oe,{},null,o(function(e){return/^is[A-Z]/.test(e)},"filter"));function gIe(r,e,t){if(!oe.isObject(r))throw new TypeError("target must be an object");e=e||new(kD||FormData),t=oe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,o(function(x,S){return!oe.isUndefined(S[x])},"defined"));let n=t.metaTokens,i=t.visitor||p,s=t.dots,a=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&oe.isSpecCompliantForm(e);if(!oe.isFunction(i))throw new TypeError("visitor must be a function");function l(v){if(v===null)return"";if(oe.isDate(v))return v.toISOString();if(oe.isBoolean(v))return v.toString();if(!c&&oe.isBlob(v))throw new st("Blob is not supported. Use a Buffer instead.");return oe.isArrayBuffer(v)||oe.isTypedArray(v)?c&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}o(l,"convertValue");function p(v,x,S){let A=v;if(v&&!S&&typeof v=="object"){if(oe.endsWith(x,"{}"))x=n?x:x.slice(0,-2),v=JSON.stringify(v);else if(oe.isArray(v)&&dIe(v)||(oe.isFileList(v)||oe.endsWith(x,"[]"))&&(A=oe.toArray(v)))return x=O$(x),A.forEach(o(function(C,E){!(oe.isUndefined(C)||C===null)&&e.append(a===!0?D$([x],E,s):a===null?x:x+"[]",l(C))},"each")),!1}return eV(v)?!0:(e.append(D$(S,x,s),l(v)),!1)}o(p,"defaultVisitor");let d=[],g=Object.assign(mIe,{defaultVisitor:p,convertValue:l,isVisitable:eV});function y(v,x){if(!oe.isUndefined(v)){if(d.indexOf(v)!==-1)throw Error("Circular reference detected in "+x.join("."));d.push(v),oe.forEach(v,o(function(A,D){(!(oe.isUndefined(A)||A===null)&&i.call(e,A,oe.isString(D)?D.trim():D,x,g))===!0&&y(A,x?x.concat(D):[D])},"each")),d.pop()}}if(o(y,"build"),!oe.isObject(r))throw new TypeError("data must be an object");return y(r),e}o(gIe,"toFormData");var xd=gIe;function B$(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,o(function(n){return e[n]},"replacer"))}o(B$,"encode");function P$(r,e){this._pairs=[],r&&xd(r,this,e)}o(P$,"AxiosURLSearchParams");var _$=P$.prototype;_$.append=o(function(e,t){this._pairs.push([e,t])},"append");_$.toString=o(function(e){let t=e?function(n){return e.call(this,n,B$)}:B$;return this._pairs.map(o(function(i){return t(i[0])+"="+t(i[1])},"each"),"").join("&")},"toString");var L$=P$;function vIe(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}o(vIe,"encode");function K0(r,e,t){if(!e)return r;let n=t&&t.encode||vIe,i=oe.isFunction(t)?{serialize:t}:t,s=i&&i.serialize,a;if(s?a=s(e,i):a=oe.isURLSearchParams(e)?e.toString():new L$(e,i).toString(n),a){let u=r.indexOf("#");u!==-1&&(r=r.slice(0,u)),r+=(r.indexOf("?")===-1?"?":"&")+a}return r}o(K0,"buildURL");var yIe=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){oe.forEach(this.handlers,o(function(n){n!==null&&e(n)},"forEachHandler"))}},tV=yIe;var T1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var j$=lr(require("crypto"),1);var F$=lr(require("url"),1),k$=F$.default.URLSearchParams;var rV="abcdefghijklmnopqrstuvwxyz",V$="0123456789",M$={DIGIT:V$,ALPHA:rV,ALPHA_DIGIT:rV+rV.toUpperCase()+V$},SIe=o((r=16,e=M$.ALPHA_DIGIT)=>{let t="",{length:n}=e,i=new Uint32Array(r);j$.default.randomFillSync(i);for(let s=0;s<r;s++)t+=e[i[s]%n];return t},"generateString"),U$={isNode:!0,classes:{URLSearchParams:k$,FormData:kD,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:M$,generateString:SIe,protocols:["http","https","file","data"]};var sV={};aT(sV,{hasBrowserEnv:()=>iV,hasStandardBrowserEnv:()=>bIe,hasStandardBrowserWebWorkerEnv:()=>xIe,navigator:()=>nV,origin:()=>wIe});var iV=typeof window<"u"&&typeof document<"u",nV=typeof navigator=="object"&&navigator||void 0,bIe=iV&&(!nV||["ReactNative","NativeScript","NS"].indexOf(nV.product)<0),xIe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",wIe=iV&&window.location.href||"http://localhost";var Jr={...sV,...U$};function aV(r,e){return xd(r,new Jr.classes.URLSearchParams,{visitor:o(function(t,n,i,s){return Jr.isNode&&oe.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},"visitor"),...e})}o(aV,"toURLEncodedForm");function CIe(r){return oe.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}o(CIe,"parsePropPath");function EIe(r){let e={},t=Object.keys(r),n,i=t.length,s;for(n=0;n<i;n++)s=t[n],e[s]=r[s];return e}o(EIe,"arrayToObject");function AIe(r){function e(t,n,i,s){let a=t[s++];if(a==="__proto__")return!0;let u=Number.isFinite(+a),c=s>=t.length;return a=!a&&oe.isArray(i)?i.length:a,c?(oe.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!u):((!i[a]||!oe.isObject(i[a]))&&(i[a]=[]),e(t,n,i[a],s)&&oe.isArray(i[a])&&(i[a]=EIe(i[a])),!u)}if(o(e,"buildPath"),oe.isFormData(r)&&oe.isFunction(r.entries)){let t={};return oe.forEachEntry(r,(n,i)=>{e(CIe(n),i,t,0)}),t}return null}o(AIe,"formDataToJSON");var VD=AIe;function NIe(r,e,t){if(oe.isString(r))try{return(e||JSON.parse)(r),oe.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}o(NIe,"stringifySafely");var oV={transitional:T1,adapter:["xhr","http","fetch"],transformRequest:[o(function(e,t){let n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=oe.isObject(e);if(s&&oe.isHTMLForm(e)&&(e=new FormData(e)),oe.isFormData(e))return i?JSON.stringify(VD(e)):e;if(oe.isArrayBuffer(e)||oe.isBuffer(e)||oe.isStream(e)||oe.isFile(e)||oe.isBlob(e)||oe.isReadableStream(e))return e;if(oe.isArrayBufferView(e))return e.buffer;if(oe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return aV(e,this.formSerializer).toString();if((u=oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return xd(u?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),NIe(e)):e},"transformRequest")],transformResponse:[o(function(e){let t=this.transitional||oV.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(oe.isResponse(e)||oe.isReadableStream(e))return e;if(e&&oe.isString(e)&&(n&&!this.responseType||i)){let a=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(u){if(a)throw u.name==="SyntaxError"?st.from(u,st.ERR_BAD_RESPONSE,this,null,this.response):u}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jr.classes.FormData,Blob:Jr.classes.Blob},validateStatus:o(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};oe.forEach(["delete","get","head","post","put","patch"],r=>{oV.headers[r]={}});var R1=oV;var IIe=oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),q$=o((r=>{let e={},t,n,i;return r&&r.split(`
|
|
114
114
|
`).forEach(o(function(a){i=a.indexOf(":"),t=a.substring(0,i).trim().toLowerCase(),n=a.substring(i+1).trim(),!(!t||e[t]&&IIe[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)},"parser")),e}),"default");var H$=Symbol("internals");function XC(r){return r&&String(r).trim().toLowerCase()}o(XC,"normalizeHeader");function jD(r){return r===!1||r==null?r:oe.isArray(r)?r.map(jD):String(r)}o(jD,"normalizeValue");function TIe(r){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}o(TIe,"parseTokens");var RIe=o(r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()),"isValidHeaderName");function uV(r,e,t,n,i){if(oe.isFunction(n))return n.call(this,e,t);if(i&&(e=t),!!oe.isString(e)){if(oe.isString(n))return e.indexOf(n)!==-1;if(oe.isRegExp(n))return n.test(e)}}o(uV,"matchHeaderValue");function DIe(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}o(DIe,"formatHeader");function OIe(r,e){let t=oe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:o(function(i,s,a){return this[n].call(this,e,i,s,a)},"value"),configurable:!0})})}o(OIe,"buildAccessors");var MD=class{static{o(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,n){let i=this;function s(u,c,l){let p=XC(c);if(!p)throw new Error("header name must be a non-empty string");let d=oe.findKey(i,p);(!d||i[d]===void 0||l===!0||l===void 0&&i[d]!==!1)&&(i[d||c]=jD(u))}o(s,"setHeader");let a=o((u,c)=>oe.forEach(u,(l,p)=>s(l,p,c)),"setHeaders");if(oe.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(oe.isString(e)&&(e=e.trim())&&!RIe(e))a(q$(e),t);else if(oe.isObject(e)&&oe.isIterable(e)){let u={},c,l;for(let p of e){if(!oe.isArray(p))throw TypeError("Object iterator must return a key-value pair");u[l=p[0]]=(c=u[l])?oe.isArray(c)?[...c,p[1]]:[c,p[1]]:p[1]}a(u,t)}else e!=null&&s(t,e,n);return this}get(e,t){if(e=XC(e),e){let n=oe.findKey(this,e);if(n){let i=this[n];if(!t)return i;if(t===!0)return TIe(i);if(oe.isFunction(t))return t.call(this,i,n);if(oe.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=XC(e),e){let n=oe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||uV(this,this[n],n,t)))}return!1}delete(e,t){let n=this,i=!1;function s(a){if(a=XC(a),a){let u=oe.findKey(n,a);u&&(!t||uV(n,n[u],u,t))&&(delete n[u],i=!0)}}return o(s,"deleteHeader"),oe.isArray(e)?e.forEach(s):s(e),i}clear(e){let t=Object.keys(this),n=t.length,i=!1;for(;n--;){let s=t[n];(!e||uV(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let t=this,n={};return oe.forEach(this,(i,s)=>{let a=oe.findKey(n,s);if(a){t[a]=jD(i),delete t[s];return}let u=e?DIe(s):String(s).trim();u!==s&&delete t[s],t[u]=jD(i),n[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return oe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(t[i]=e&&oe.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
115
115
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[H$]=this[H$]={accessors:{}}).accessors,i=this.prototype;function s(a){let u=XC(a);n[u]||(OIe(i,a),n[u]=!0)}return o(s,"defineAccessor"),oe.isArray(e)?e.forEach(s):s(e),this}};MD.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);oe.reduceDescriptors(MD.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:o(()=>r,"get"),set(n){this[t]=n}}});oe.freezeMethods(MD);var oi=MD;function WC(r,e){let t=this||R1,n=e||t,i=oi.from(n.headers),s=n.data;return oe.forEach(r,o(function(u){s=u.call(t,s,i.normalize(),e?e.status:void 0)},"transform")),i.normalize(),s}o(WC,"transformData");function JC(r){return!!(r&&r.__CANCEL__)}o(JC,"isCancel");var BIe=class extends st{static{o(this,"CanceledError")}constructor(e,t,n){super(e??"canceled",st.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}},Fo=BIe;function Ll(r,e,t){let n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new st("Request failed with status code "+t.status,[st.ERR_BAD_REQUEST,st.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}o(Ll,"settle");function cV(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}o(cV,"isAbsoluteURL");function lV(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}o(lV,"combineURLs");function G0(r,e,t){let n=!cV(e);return r&&(n||t==!1)?lV(r,e):e}o(G0,"buildFullPath");var sZ=lr(mF(),1),aZ=lr(require("http"),1),oZ=lr(require("https"),1),mV=lr(require("http2"),1),gV=lr(require("util"),1),uZ=lr(TF(),1),rp=lr(require("zlib"),1);var X0="1.13.3";function YC(r){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}o(YC,"parseProtocol");var PIe=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function fV(r,e,t){let n=t&&t.Blob||Jr.classes.Blob,i=YC(r);if(e===void 0&&n&&(e=!0),i==="data"){r=i.length?r.slice(i.length+1):r;let s=PIe.exec(r);if(!s)throw new st("Invalid URL",st.ERR_INVALID_URL);let a=s[1],u=s[2],c=s[3],l=Buffer.from(decodeURIComponent(c),u?"base64":"utf8");if(e){if(!n)throw new st("Blob is not supported",st.ERR_NOT_SUPPORT);return new n([l],{type:a})}return l}throw new st("Unsupported protocol "+i,st.ERR_NOT_SUPPORT)}o(fV,"fromDataURI");var tp=lr(require("stream"),1);var z$=lr(require("stream"),1);var pV=Symbol("internals"),_Ie=class extends z$.default.Transform{static{o(this,"AxiosTransformStream")}constructor(e){e=oe.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!oe.isUndefined(i[n])),super({readableHighWaterMark:e.chunkSize});let t=this[pV]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",n=>{n==="progress"&&(t.isCaptured||(t.isCaptured=!0))})}_read(e){let t=this[pV];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){let i=this[pV],s=i.maxRate,a=this.readableHighWaterMark,u=i.timeWindow,c=1e3/u,l=s/c,p=i.minChunkSize!==!1?Math.max(i.minChunkSize,l*.01):0,d=o((y,v)=>{let x=Buffer.byteLength(y);i.bytesSeen+=x,i.bytes+=x,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(y)?process.nextTick(v):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(v)}},"pushChunk"),g=o((y,v)=>{let x=Buffer.byteLength(y),S=null,A=a,D,C=0;if(s){let E=Date.now();(!i.ts||(C=E-i.ts)>=u)&&(i.ts=E,D=l-i.bytes,i.bytes=D<0?-D:0,C=0),D=l-i.bytes}if(s){if(D<=0)return setTimeout(()=>{v(null,y)},u-C);D<A&&(A=D)}A&&x>A&&x-A>p&&(S=y.subarray(A),y=y.subarray(0,A)),d(y,S?()=>{process.nextTick(v,null,S)}:v)},"transformChunk");g(e,o(function y(v,x){if(v)return n(v);x?g(x,y):n(null)},"transformNextChunk"))}},hV=_Ie;var cZ=require("events");var G$=lr(require("util"),1),X$=require("stream");var{asyncIterator:K$}=Symbol,LIe=o(async function*(r){r.stream?yield*r.stream():r.arrayBuffer?yield await r.arrayBuffer():r[K$]?yield*r[K$]():yield r},"readBlob"),UD=LIe;var FIe=Jr.ALPHABET.ALPHA_DIGIT+"-_",QC=typeof TextEncoder=="function"?new TextEncoder:new G$.default.TextEncoder,W0=`\r
|