@likable-hair/cciaa-service 0.0.7 → 0.0.9
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/cciaa-service.cjs +9 -9
- package/dist/cciaa-service.cjs.map +1 -1
- package/dist/cciaa-service.js +1166 -1025
- package/dist/cciaa-service.js.map +1 -1
- package/dist/index.d.ts +27 -7
- package/package.json +1 -1
package/dist/cciaa-service.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`&&t[o]!=="\r";o++)l+=t[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!
|
|
3
|
-
`||t==="\r"}function ze(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return b("InvalidXml","XML declaration allowed only at the start of the document.",A(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function qe(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const zt='"',qt="'";function Ht(t,e){let n="",r="",s=!1;for(;e<t.length;e++){if(t[e]===zt||t[e]===qt)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){s=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:s}}const Xt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function He(t,e){const n=lt(t,Xt),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return b("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Y(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return b("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Y(n[s]));if(n[s][3]===void 0&&!e.allowBooleanAttributes)return b("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Y(n[s]));const o=n[s][2];if(!Kt(o))return b("InvalidAttr","Attribute '"+o+"' is an invalid name.",Y(n[s]));if(!Object.prototype.hasOwnProperty.call(r,o))r[o]=1;else return b("InvalidAttr","Attribute '"+o+"' is repeated.",Y(n[s]))}return!0}function Jt(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function Wt(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Jt(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function b(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Kt(t){return de(t)}function Yt(t){return de(t)}function A(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Y(t){return t.startIndex+t[1].length}const Zt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0};function ut(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:ut(!0)}const Gt=function(t){const e=Object.assign({},Zt,t);return e.processEntities=ut(e.processEntities),e};let ue;typeof Symbol!="function"?ue="@@xmlMetadata":ue=Symbol("XML Node Metadata");class M{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][ue]={startIndex:n})}static getMetaDataSymbol(){return ue}}class Qt{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,n){const r=Object.create(null);if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let s=1,o=!1,i=!1,a="";for(;n<e.length;n++)if(e[n]==="<"&&!i){if(o&&$(e,"!ENTITY",n)){n+=7;let l,c;if([l,c,n]=this.readEntityExp(e,n+1,this.suppressValidationErr),c.indexOf("&")===-1){const f=l.replace(/[.\-+*:]/g,"\\.");r[l]={regx:RegExp(`&${f};`,"g"),val:c}}}else if(o&&$(e,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(e,n+1);n=l}else if(o&&$(e,"!ATTLIST",n))n+=8;else if(o&&$(e,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l}else if($(e,"!--",n))i=!0;else throw new Error("Invalid DOCTYPE");s++,a=""}else if(e[n]===">"){if(i?e[n-1]==="-"&&e[n-2]==="-"&&(i=!1,s--):s--,s===0)break}else e[n]==="["?o=!0:a+=e[n];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(e,n){n=I(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)r+=e[n],n++;if(Z(r),n=I(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let s="";if([n,s]=this.readIdentifierVal(e,n,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&s.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[r,s,n]}readNotationExp(e,n){n=I(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;!this.suppressValidationErr&&Z(r),n=I(e,n);const s=e.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);n+=s.length,n=I(e,n);let o=null,i=null;if(s==="PUBLIC")[n,o]=this.readIdentifierVal(e,n,"publicIdentifier"),n=I(e,n),(e[n]==='"'||e[n]==="'")&&([n,i]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(s==="SYSTEM"&&([n,i]=this.readIdentifierVal(e,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:o,systemIdentifier:i,index:--n}}readIdentifierVal(e,n,r){let s="";const o=e[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<e.length&&e[n]!==o;)s+=e[n],n++;if(e[n]!==o)throw new Error(`Unterminated ${r} value`);return n++,[n,s]}readElementExp(e,n){n=I(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;if(!this.suppressValidationErr&&!de(r))throw new Error(`Invalid element name: "${r}"`);n=I(e,n);let s="";if(e[n]==="E"&&$(e,"MPTY",n))n+=4;else if(e[n]==="A"&&$(e,"NY",n))n+=2;else if(e[n]==="("){for(n++;n<e.length&&e[n]!==")";)s+=e[n],n++;if(e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:r,contentModel:s.trim(),index:n}}readAttlistExp(e,n){n=I(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;Z(r),n=I(e,n);let s="";for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;if(!Z(s))throw new Error(`Invalid attribute name: "${s}"`);n=I(e,n);let o="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=I(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let a=[];for(;n<e.length&&e[n]!==")";){let l="";for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)l+=e[n],n++;if(l=l.trim(),!Z(l))throw new Error(`Invalid notation name: "${l}"`);a.push(l),e[n]==="|"&&(n++,n=I(e,n))}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+a.join("|")+")"}else{for(;n<e.length&&!/\s/.test(e[n]);)o+=e[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=I(e,n);let i="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:r,attributeName:s,attributeType:o,defaultValue:i,index:n}}}const I=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function $(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return!1;return!0}function Z(t){if(de(t))return t;throw new Error(`Invalid entity name ${t}`)}const Dt=/^[-+]?0x[a-fA-F0-9]+$/,en=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,tn={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function nn(t,e={}){if(e=Object.assign({},tn,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(t==="0")return 0;if(e.hex&&Dt.test(n))return an(n,16);if(n.includes("e")||n.includes("E"))return sn(t,n,e);{const r=en.exec(n);if(r){const s=r[1]||"",o=r[2];let i=on(r[3]);const a=s?t[o.length+1]===".":t[o.length]===".";if(!e.leadingZeros&&(o.length>1||o.length===1&&!a))return t;{const l=Number(n),c=String(l);if(l===0)return l;if(c.search(/[eE]/)!==-1)return e.eNotation?l:t;if(n.indexOf(".")!==-1)return c==="0"||c===i||c===`${s}${i}`?l:t;let f=o?i:n;return o?f===c||s+f===c?l:t:f===c||f===s+c?l:t}}else return t}}const rn=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function sn(t,e,n){if(!n.eNotation)return t;const r=e.match(rn);if(r){let s=r[1]||"";const o=r[3].indexOf("e")===-1?"E":"e",i=r[2],a=s?t[i.length+1]===o:t[i.length]===o;return i.length>1&&a?t:i.length===1&&(r[3].startsWith(`.${o}`)||r[3][0]===o)?Number(e):n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t}else return t}function on(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function an(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function cn(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}class ln{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>Xe(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>Xe(r,16,"&#x")}},this.addExternalEntities=un,this.parseXml=gn,this.parseTextData=fn,this.resolveNameSpace=dn,this.buildAttributesMap=hn,this.isItStopNode=bn,this.replaceEntitiesValue=yn,this.readStopNodeData=Sn,this.saveTextToParentTag=En,this.addChild=mn,this.ignoreAttributesFn=cn(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function un(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n],s=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+s+";","g"),val:t[r]}}}function fn(t,e,n,r,s,o,i){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,n));const a=this.options.tagValueProcessor(e,t,n,s,o);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?Ae(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Ae(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function dn(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const pn=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function hn(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=lt(t,pn),s=r.length,o={};for(let i=0;i<s;i++){const a=this.resolveNameSpace(r[i][1]);if(this.ignoreAttributesFn(a,e))continue;let l=r[i][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l,n,e);const f=this.options.attributeValueProcessor(a,l,e);f==null?o[c]=l:typeof f!=typeof l||f!==l?o[c]=f:o[c]=Ae(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[c]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const gn=function(t){t=t.replace(/\r\n?/g,`
|
|
4
|
-
`);const e=new M("!xml");let n=e,r="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;const o=new Qt(this.options.processEntities);for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){const l=V(t,">",i,"Closing Tag is not closed.");let c=t.substring(i+2,l).trim();if(this.options.removeNSPrefix){const y=c.indexOf(":");y!==-1&&(c=c.substr(y+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,s));const f=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let d=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(d=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=s.lastIndexOf("."),s=s.substring(0,d),n=this.tagsNodeStack.pop(),r="",i=l}else if(t[i+1]==="?"){let l=Re(t,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const c=new M(l.tagName);c.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(c[":@"]=this.buildAttributesMap(l.tagExp,s,l.tagName)),this.addChild(n,c,s,i)}i=l.closeIndex+1}else if(t.substr(i+1,3)==="!--"){const l=V(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const c=t.substring(i+4,l-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=l}else if(t.substr(i+1,2)==="!D"){const l=o.readDocType(t,i);this.docTypeEntities=l.entities,i=l.i}else if(t.substr(i+1,2)==="!["){const l=V(t,"]]>",i,"CDATA is not closed.")-2,c=t.substring(i+9,l);r=this.saveTextToParentTag(r,n,s);let f=this.parseTextData(c,n.tagname,s,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,f),i=l+2}else{let l=Re(t,i,this.options.removeNSPrefix),c=l.tagName;const f=l.rawTagName;let d=l.tagExp,y=l.attrExpPresent,S=l.closeIndex;if(this.options.transformTagName){const h=this.options.transformTagName(c);d===c&&(d=h),c=h}if(this.options.strictReservedNames&&(c===this.options.commentPropName||c===this.options.cdataPropName))throw new Error(`Invalid tag name: ${c}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));const p=n;p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==e.tagname&&(s+=s?"."+c:c);const g=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,s,c)){let h="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),d=c):d=d.substr(0,d.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=l.closeIndex;else{const N=this.readStopNodeData(t,f,S+1);if(!N)throw new Error(`Unexpected end of ${f}`);i=N.i,h=N.tagContent}const E=new M(c);c!==d&&y&&(E[":@"]=this.buildAttributesMap(d,s,c)),h&&(h=this.parseTextData(h,c,s,!0,y,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),E.add(this.options.textNodeName,h),this.addChild(n,E,s,g)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){if(c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),d=c):d=d.substr(0,d.length-1),this.options.transformTagName){const E=this.options.transformTagName(c);d===c&&(d=E),c=E}const h=new M(c);c!==d&&y&&(h[":@"]=this.buildAttributesMap(d,s,c)),this.addChild(n,h,s,g),s=s.substr(0,s.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(c)!==-1){const h=new M(c);c!==d&&y&&(h[":@"]=this.buildAttributesMap(d,s)),this.addChild(n,h,s,g),s=s.substr(0,s.lastIndexOf(".")),i=l.closeIndex;continue}else{const h=new M(c);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),c!==d&&y&&(h[":@"]=this.buildAttributesMap(d,s,c)),this.addChild(n,h,s,g),n=h}r="",i=S}}else r+=t[i];return e.child};function mn(t,e,n,r){this.options.captureMetaData||(r=void 0);const s=this.options.updateTag(e.tagname,n,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e,r))}const yn=function(t,e,n){if(t.indexOf("&")===-1)return t;const r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(e)||r.tagFilter&&!r.tagFilter(e,n))return t;for(let s in this.docTypeEntities){const o=this.docTypeEntities[s],i=t.match(o.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const a=t.length;if(t=t.replace(o.regx,o.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(let s in this.lastEntities){const o=this.lastEntities[s];t=t.replace(o.regex,o.val)}if(t.indexOf("&")===-1)return t;if(this.options.htmlEntities)for(let s in this.htmlEntities){const o=this.htmlEntities[s];t=t.replace(o.regex,o.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t};function En(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function bn(t,e,n,r){return!!(e&&e.has(r)||t&&t.has(n))}function wn(t,e,n=">"){let r,s="";for(let o=e;o<t.length;o++){let i=t[o];if(r)i===r&&(r="");else if(i==='"'||i==="'")r=i;else if(i===n[0])if(n[1]){if(t[o+1]===n[1])return{data:s,index:o}}else return{data:s,index:o};else i===" "&&(i=" ");s+=i}}function V(t,e,n,r){const s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s+e.length-1}function Re(t,e,n,r=">"){const s=wn(t,e+1,r);if(!s)return;let o=s.data;const i=s.index,a=o.search(/\s/);let l=o,c=!0;a!==-1&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const f=l;if(n){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1),c=l!==s.data.substr(d+1))}return{tagName:l,tagExp:o,closeIndex:i,attrExpPresent:c,rawTagName:f}}function Sn(t,e,n){const r=n;let s=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const o=V(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(s--,s===0))return{tagContent:t.substring(r,n),i:o};n=o}else if(t[n+1]==="?")n=V(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=V(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=V(t,"]]>",n,"StopNode is not closed.")-2;else{const o=Re(t,n,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,n=o.closeIndex)}}function Ae(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:nn(t,n)}else return jt(t)?t:""}function Xe(t,e,n){const r=Number.parseInt(t,e);return r>=0&&r<=1114111?String.fromCodePoint(r):n+t+";"}const we=M.getMetaDataSymbol();function Tn(t,e){return ft(t,e)}function ft(t,e,n){let r;const s={};for(let o=0;o<t.length;o++){const i=t[o],a=Nn(i);let l="";if(n===void 0?l=a:l=n+"."+a,a===e.textNodeName)r===void 0?r=i[a]:r+=""+i[a];else{if(a===void 0)continue;if(i[a]){let c=ft(i[a],e,l);const f=An(c,e);i[":@"]?Rn(c,i[":@"],l,e):Object.keys(c).length===1&&c[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?c=c[e.textNodeName]:Object.keys(c).length===0&&(e.alwaysCreateTextNode?c[e.textNodeName]="":c=""),i[we]!==void 0&&typeof c=="object"&&c!==null&&(c[we]=i[we]),s[a]!==void 0&&Object.prototype.hasOwnProperty.call(s,a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(c)):e.isArray(a,l,f)?s[a]=[c]:s[a]=c}}}return typeof r=="string"?r.length>0&&(s[e.textNodeName]=r):r!==void 0&&(s[e.textNodeName]=r),s}function Nn(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Rn(t,e,n,r){if(e){const s=Object.keys(e),o=s.length;for(let i=0;i<o;i++){const a=s[i];r.isArray(a,n+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function An(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}class dt{constructor(e){this.externalEntities={},this.options=Gt(e)}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=Vt(e,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const r=new ln(this.options);r.addExternalEntities(this.externalEntities);const s=r.parseXml(e);return this.options.preserveOrder||s===void 0?s:Tn(s,this.options)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return M.getMetaDataSymbol()}}class On{async mapAnagraficaImpresaToCompanySummary(e){return await{companyName:e.Denominazione,companyFiscalCode:e.CodFisc,companyVatNumber:e.PIva,companyLegalFormCode:e.NatGiu,companyLegalFormDescription:e.DescNatGiu,companyCciaaCode:e.Cciaa,companyCciaaDescription:e.DescCciaa,companyReaNumber:e.NRea,companyStatusCode:e.StatoAttivita,companyStatusDescription:e.DescStatoAttivita,companyRegistryStatusCode:e.StatoAttivitaReg,companyRegistryStatusDescription:e.DescStatoAttivitaReg,companySourceCode:e.Fonte,companySourceDescription:e.DescFonte,companyDeclaredActivity:e.AttivitaDichiarata,companyAtecoCode:e.ClassificazioneAteco.CodAttivita,companyAtecoDescription:e.ClassificazioneAteco.DescAttivita,companyAtecoClassificationCode:e.ClassificazioneAteco.CodCodifica,companyAtecoClassificationDescription:e.ClassificazioneAteco.DescCodifica,companyProvinceCode:e.IndirizzoSede.SglPrvSede,companyProvinceDescription:e.IndirizzoSede.DescPrvSede,companyMunicipalityCode:e.IndirizzoSede.CodComSede,companyMunicipalityDescription:e.IndirizzoSede.DescComSede,companyToponymCode:e.IndirizzoSede.CodToponSede,companyToponymDescription:e.IndirizzoSede.DescToponSede,companyStreet:e.IndirizzoSede.ViaSede,companyStreetNumber:String(e.IndirizzoSede.NCivicoSede),companyPostalCode:e.IndirizzoSede.CapSede,companyPec:e.IndirizzoPostaCertificata,companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:[]}}}class Cn{async getFinancialValues(e){const n=e.Risposta.dati;if(!n)throw new Error("XBRL empty in response");const r=Buffer.from(n,"base64").toString("utf-8"),o=new dt({ignoreAttributes:!1,attributeNamePrefix:""}).parse(r);if(!o.xbrl)throw new Error("Error on XBRL structure");const i=o.xbrl,a=this.findByContext(i,"itcc-ci:UtilePerditaEsercizio","cntxCorr_d"),l=this.findByContext(i,"itcc-ci:ValoreProduzioneRicaviVenditePrestazioni","cntxCorr_d");return{companyProfit:a?Number(a["#text"]):0,companyRevenue:l?Number(l["#text"]):0}}findByContext(e,n,r){console.log(typeof e);const s=e[n];return s?(Array.isArray(s)?s:[s]).find(i=>i.contextRef===r):null}}class In{parseAddress(e){if(e)return{street:e.via,number:e["n-civico"],city:e.comune,province:e.provincia,cap:e.cap}}parseCapital(e){return parseFloat(e.replace(".","").replace(",","."))}async getShares(e,n){const r=[],s=Array.isArray(e)?e:[e];for(const o of s){const i=this.parseCapital(o["composizione-quote"]["valore-nominale"]),a=Array.isArray(o.titolari.titolare)?o.titolari.titolare:[o.titolari.titolare];for(const l of a){const c={type:l["anagrafica-titolare"].tipo,fiscalCode:l["anagrafica-titolare"]["c-fiscale"],firstName:l["anagrafica-titolare"].nome||l["anagrafica-titolare"].denominazione,lastName:l["anagrafica-titolare"].cognome,shareValue:i,sharePercentage:i/n*100,isRepresentative:l["f-rappresentante"]==="S",address:this.parseAddress(l.domicilio)};r.push(c)}}return r}}class Pn{constructor(e){this.client=e}parser=new dt({ignoreAttributes:!1,attributeNamePrefix:""});checkResponseStatus(e,n,r="CCIAA"){switch(e){case 200:return;case 404:throw new Error(`${r} non trovata`);case 503:throw new Error(`${r} temporaneamente non disponibile`);case 500:throw new Error(`Errore HTTP ${r}: ${n}`);default:throw new Error(`Errore HTTP ${r}: ${e}`)}}parseXml(e){try{return this.parser.parse(e)}catch(n){throw new Error(`Errore nel parsing XML: ${n}`)}}async getCompanySummaryByVatNumber(e){try{const n=await this.client.get("/registroimprese/imprese/ricerca/partitaiva",{params:{partitaIva:e,fSoloSedi:"S"}});this.checkResponseStatus(n.status,n.data);const r=this.parseXml(n.data),s=r.Risposta.ListaImpreseRI.Impresa.AnagraficaImpresa;if(!s)throw new Error(`Impresa non trovata. Risposta: ${JSON.stringify(r.Risposta.Testata.Riepilogo)}`);return await new On().mapAnagraficaImpresaToCompanySummary(s)}catch(n){throw new Error(`Errore getCompanySummaryByVatNumber: ${n}`)}}async getFinancialsByVatNumber(e){try{const n=await this.client.get("/registroimprese/bilanci/xbrl/codicefiscale",{params:{codiceFiscale:e,allXbrl:"S"}});this.checkResponseStatus(n.status,n.data);const r=this.parseXml(n.data);return await new Cn().getFinancialValues(r)}catch(n){throw new Error(`Errore getFinancialValueByVatNumber: ${n}`)}}async getSharesByRea(e,n){try{const r=await this.client.get("/registroimprese/output/impresa/soci/nrea/xml",{params:{cciaa:e,nRea:n}});this.checkResponseStatus(r.status,r.data);const s=this.parseXml(r.data),o=new In,i=o.parseCapital(s.Risposta.dati["blocchi-impresa"]["sintesi-cifre-impresa"]["capitale-sociale"].sottoscritto.ammontare),a=s.Risposta.dati["blocchi-impresa"]["elenco-soci"].riquadri.riquadro;return await o.getShares(a,i)}catch(r){throw new Error(`Errore getSharesByRea: ${r}`)}}async getCompany(e){let n=null,r=null,s=[],o=[];try{n=await this.getCompanySummaryByVatNumber(e)}catch(i){const a=`Errore recupero dati CompanySummary: ${i}`;o.push(a)}try{r=await this.getFinancialsByVatNumber(e)}catch(i){const a=`Errore recupero dei dati Financials: ${i}`;r={companyRevenue:0,companyProfit:0},o.push(a)}if(n){try{if(n.companyCciaaCode&&n.companyReaNumber)s=await this.getSharesByRea(n.companyCciaaCode,n.companyReaNumber);else{const a="Impossibile recuperare soci: CCIAA o REA mancanti";s=[],o.push(a)}}catch(a){const l=`Errore recupero delle shares: ${a}`;s=[],o.push(l)}return{...n,...r,companyShares:s,aiwsError:o}}}}function pt(t,e){return function(){return t.apply(e,arguments)}}const{toString:xn}=Object.prototype,{getPrototypeOf:xe}=Object,{iterator:pe,toStringTag:ht}=Symbol,he=(t=>e=>{const n=xn.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),B=t=>(t=t.toLowerCase(),e=>he(e)===t),ge=t=>e=>typeof e===t,{isArray:W}=Array,J=ge("undefined");function Q(t){return t!==null&&!J(t)&&t.constructor!==null&&!J(t.constructor)&&P(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const gt=B("ArrayBuffer");function _n(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&>(t.buffer),e}const Fn=ge("string"),P=ge("function"),mt=ge("number"),D=t=>t!==null&&typeof t=="object",Ln=t=>t===!0||t===!1,ae=t=>{if(he(t)!=="object")return!1;const e=xe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ht in t)&&!(pe in t)},Bn=t=>{if(!D(t)||Q(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Un=B("Date"),kn=B("File"),Mn=B("Blob"),vn=B("FileList"),jn=t=>D(t)&&P(t.pipe),$n=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||P(t.append)&&((e=he(t))==="formdata"||e==="object"&&P(t.toString)&&t.toString()==="[object FormData]"))},Vn=B("URLSearchParams"),[zn,qn,Hn,Xn]=["ReadableStream","Request","Response","Headers"].map(B),Jn=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ee(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),W(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(Q(t))return;const o=n?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(r=0;r<i;r++)a=o[r],e.call(null,t[a],a,t)}}function yt(t,e){if(Q(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const z=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Et=t=>!J(t)&&t!==z;function Oe(){const{caseless:t,skipUndefined:e}=Et(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&yt(n,o)||o;ae(n[i])&&ae(s)?n[i]=Oe(n[i],s):ae(s)?n[i]=Oe({},s):W(s)?n[i]=s.slice():(!e||!J(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ee(arguments[s],r);return n}const Wn=(t,e,n,{allOwnKeys:r}={})=>(ee(e,(s,o)=>{n&&P(s)?Object.defineProperty(t,o,{value:pt(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),Kn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Yn=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Zn=(t,e,n,r)=>{let s,o,i;const a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!r||r(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=n!==!1&&xe(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Gn=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Qn=t=>{if(!t)return null;if(W(t))return t;let e=t.length;if(!mt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Dn=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&xe(Uint8Array)),er=(t,e)=>{const r=(t&&t[pe]).call(t);let s;for(;(s=r.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},tr=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},nr=B("HTMLFormElement"),rr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Je=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),sr=B("RegExp"),bt=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};ee(n,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(r[o]=i||s)}),Object.defineProperties(t,r)},or=t=>{bt(t,(e,n)=>{if(P(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(P(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},ir=(t,e)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return W(t)?r(t):r(String(t).split(e)),n},ar=()=>{},cr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function lr(t){return!!(t&&P(t.append)&&t[ht]==="FormData"&&t[pe])}const ur=t=>{const e=new Array(10),n=(r,s)=>{if(D(r)){if(e.indexOf(r)>=0)return;if(Q(r))return r;if(!("toJSON"in r)){e[s]=r;const o=W(r)?[]:{};return ee(r,(i,a)=>{const l=n(i,s+1);!J(l)&&(o[a]=l)}),e[s]=void 0,o}}return r};return n(t,0)},fr=B("AsyncFunction"),dr=t=>t&&(D(t)||P(t))&&P(t.then)&&P(t.catch),wt=((t,e)=>t?setImmediate:e?((n,r)=>(z.addEventListener("message",({source:s,data:o})=>{s===z&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),z.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",P(z.postMessage)),pr=typeof queueMicrotask<"u"?queueMicrotask.bind(z):typeof process<"u"&&process.nextTick||wt,hr=t=>t!=null&&P(t[pe]),u={isArray:W,isArrayBuffer:gt,isBuffer:Q,isFormData:$n,isArrayBufferView:_n,isString:Fn,isNumber:mt,isBoolean:Ln,isObject:D,isPlainObject:ae,isEmptyObject:Bn,isReadableStream:zn,isRequest:qn,isResponse:Hn,isHeaders:Xn,isUndefined:J,isDate:Un,isFile:kn,isBlob:Mn,isRegExp:sr,isFunction:P,isStream:jn,isURLSearchParams:Vn,isTypedArray:Dn,isFileList:vn,forEach:ee,merge:Oe,extend:Wn,trim:Jn,stripBOM:Kn,inherits:Yn,toFlatObject:Zn,kindOf:he,kindOfTest:B,endsWith:Gn,toArray:Qn,forEachEntry:er,matchAll:tr,isHTMLForm:nr,hasOwnProperty:Je,hasOwnProp:Je,reduceDescriptors:bt,freezeMethods:or,toObjectSet:ir,toCamelCase:rr,noop:ar,toFiniteNumber:cr,findKey:yt,global:z,isContextDefined:Et,isSpecCompliantForm:lr,toJSONObject:ur,isAsyncFn:fr,isThenable:dr,setImmediate:wt,asap:pr,isIterable:hr};let m=class St extends Error{static from(e,n,r,s,o,i){const a=new St(e.message,n||e.code,r,s,o);return a.cause=e,a.name=e.name,i&&Object.assign(a,i),a}constructor(e,n,r,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.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:u.toJSONObject(this.config),code:this.code,status:this.status}}};m.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";m.ERR_BAD_OPTION="ERR_BAD_OPTION";m.ECONNABORTED="ECONNABORTED";m.ETIMEDOUT="ETIMEDOUT";m.ERR_NETWORK="ERR_NETWORK";m.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";m.ERR_DEPRECATED="ERR_DEPRECATED";m.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";m.ERR_BAD_REQUEST="ERR_BAD_REQUEST";m.ERR_CANCELED="ERR_CANCELED";m.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";m.ERR_INVALID_URL="ERR_INVALID_URL";const gr=null;function Ce(t){return u.isPlainObject(t)||u.isArray(t)}function Tt(t){return u.endsWith(t,"[]")?t.slice(0,-2):t}function We(t,e,n){return t?t.concat(e).map(function(s,o){return s=Tt(s),!n&&o?"["+s+"]":s}).join(n?".":""):e}function mr(t){return u.isArray(t)&&!t.some(Ce)}const yr=u.toFlatObject(u,{},null,function(e){return/^is[A-Z]/.test(e)});function me(t,e,n){if(!u.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=u.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,h){return!u.isUndefined(h[g])});const r=n.metaTokens,s=n.visitor||f,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(e);if(!u.isFunction(s))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(u.isDate(p))return p.toISOString();if(u.isBoolean(p))return p.toString();if(!l&&u.isBlob(p))throw new m("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(p)||u.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,g,h){let E=p;if(p&&!h&&typeof p=="object"){if(u.endsWith(g,"{}"))g=r?g:g.slice(0,-2),p=JSON.stringify(p);else if(u.isArray(p)&&mr(p)||(u.isFileList(p)||u.endsWith(g,"[]"))&&(E=u.toArray(p)))return g=Tt(g),E.forEach(function(T,O){!(u.isUndefined(T)||T===null)&&e.append(i===!0?We([g],O,o):i===null?g:g+"[]",c(T))}),!1}return Ce(p)?!0:(e.append(We(h,g,o),c(p)),!1)}const d=[],y=Object.assign(yr,{defaultVisitor:f,convertValue:c,isVisitable:Ce});function S(p,g){if(!u.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(p),u.forEach(p,function(E,N){(!(u.isUndefined(E)||E===null)&&s.call(e,E,u.isString(N)?N.trim():N,g,y))===!0&&S(E,g?g.concat(N):[N])}),d.pop()}}if(!u.isObject(t))throw new TypeError("data must be an object");return S(t),e}function Ke(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function _e(t,e){this._pairs=[],t&&me(t,this,e)}const Nt=_e.prototype;Nt.append=function(e,n){this._pairs.push([e,n])};Nt.toString=function(e){const n=e?function(r){return e.call(this,r,Ke)}:Ke;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Er(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Rt(t,e,n){if(!e)return t;const r=n&&n.encode||Er,s=u.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(e,s):i=u.isURLSearchParams(e)?e.toString():new _e(e,s).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Ye{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){u.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Fe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},br=typeof URLSearchParams<"u"?URLSearchParams:_e,wr=typeof FormData<"u"?FormData:null,Sr=typeof Blob<"u"?Blob:null,Tr={isBrowser:!0,classes:{URLSearchParams:br,FormData:wr,Blob:Sr},protocols:["http","https","file","blob","url","data"]},Le=typeof window<"u"&&typeof document<"u",Ie=typeof navigator=="object"&&navigator||void 0,Nr=Le&&(!Ie||["ReactNative","NativeScript","NS"].indexOf(Ie.product)<0),Rr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ar=Le&&window.location.href||"http://localhost",Or=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Nr,hasStandardBrowserWebWorkerEnv:Rr,navigator:Ie,origin:Ar},Symbol.toStringTag,{value:"Module"})),R={...Or,...Tr};function Cr(t,e){return me(t,new R.classes.URLSearchParams,{visitor:function(n,r,s,o){return R.isNode&&u.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Ir(t){return u.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Pr(t){const e={},n=Object.keys(t);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],e[o]=t[o];return e}function At(t){function e(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),l=o>=n.length;return i=!i&&u.isArray(s)?s.length:i,l?(u.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!u.isObject(s[i]))&&(s[i]=[]),e(n,r,s[i],o)&&u.isArray(s[i])&&(s[i]=Pr(s[i])),!a)}if(u.isFormData(t)&&u.isFunction(t.entries)){const n={};return u.forEachEntry(t,(r,s)=>{e(Ir(r),s,n,0)}),n}return null}function xr(t,e,n){if(u.isString(t))try{return(e||JSON.parse)(t),u.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const te={transitional:Fe,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=u.isObject(e);if(o&&u.isHTMLForm(e)&&(e=new FormData(e)),u.isFormData(e))return s?JSON.stringify(At(e)):e;if(u.isArrayBuffer(e)||u.isBuffer(e)||u.isStream(e)||u.isFile(e)||u.isBlob(e)||u.isReadableStream(e))return e;if(u.isArrayBufferView(e))return e.buffer;if(u.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Cr(e,this.formSerializer).toString();if((a=u.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return me(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),xr(e)):e}],transformResponse:[function(e){const n=this.transitional||te.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(u.isResponse(e)||u.isReadableStream(e))return e;if(e&&u.isString(e)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?m.from(a,m.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:R.classes.FormData,Blob:R.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],t=>{te.headers[t]={}});const _r=u.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"]),Fr=t=>{const e={};let n,r,s;return t&&t.split(`
|
|
5
|
-
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&
|
|
6
|
-
`)}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,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Ze]=this[Ze]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=G(i);r[a]||(kr(s,i),r[a]=!0)}return u.isArray(e)?e.forEach(o):o(e),this}};x.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);u.reduceDescriptors(x.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});u.freezeMethods(x);function Te(t,e){const n=this||te,r=e||n,s=x.from(r.headers);let o=r.data;return u.forEach(t,function(a){o=a.call(n,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function Ot(t){return!!(t&&t.__CANCEL__)}let ne=class extends m{constructor(e,n,r){super(e??"canceled",m.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Ct(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Mr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function vr(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),f=r[o];i||(i=c),n[s]=l,r[s]=c;let d=o,y=0;for(;d!==s;)y+=n[d++],d=d%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),c-i<e)return;const S=f&&c-f;return S?Math.round(y*1e3/S):void 0}}function jr(t,e){let n=0,r=1e3/e,s,o;const i=(c,f=Date.now())=>{n=f,s=null,o&&(clearTimeout(o),o=null),t(...c)};return[(...c)=>{const f=Date.now(),d=f-n;d>=r?i(c,f):(s=c,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const fe=(t,e,n=3)=>{let r=0;const s=vr(50,250);return jr(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,l=i-r,c=s(l),f=i<=a;r=i;const d={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&f?(a-i)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},Ge=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Qe=t=>(...e)=>u.asap(()=>t(...e)),$r=R.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,R.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(R.origin),R.navigator&&/(msie|trident)/i.test(R.navigator.userAgent)):()=>!0,Vr=R.hasStandardBrowserEnv?{write(t,e,n,r,s,o,i){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];u.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),u.isString(r)&&a.push(`path=${r}`),u.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),u.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function zr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function qr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function It(t,e,n){let r=!zr(e);return t&&(r||n==!1)?qr(t,e):e}const De=t=>t instanceof x?{...t}:t;function H(t,e){e=e||{};const n={};function r(c,f,d,y){return u.isPlainObject(c)&&u.isPlainObject(f)?u.merge.call({caseless:y},c,f):u.isPlainObject(f)?u.merge({},f):u.isArray(f)?f.slice():f}function s(c,f,d,y){if(u.isUndefined(f)){if(!u.isUndefined(c))return r(void 0,c,d,y)}else return r(c,f,d,y)}function o(c,f){if(!u.isUndefined(f))return r(void 0,f)}function i(c,f){if(u.isUndefined(f)){if(!u.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function a(c,f,d){if(d in e)return r(c,f);if(d in t)return r(void 0,c)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,f,d)=>s(De(c),De(f),d,!0)};return u.forEach(Object.keys({...t,...e}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const d=u.hasOwnProp(l,f)?l[f]:s,y=d(t[f],e[f],f);u.isUndefined(y)&&d!==a||(n[f]=y)}),n}const Pt=t=>{const e=H({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=e;if(e.headers=i=x.from(i),e.url=Rt(It(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),u.isFormData(n)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(u.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([f,d])=>{c.includes(f.toLowerCase())&&i.set(f,d)})}}if(R.hasStandardBrowserEnv&&(r&&u.isFunction(r)&&(r=r(e)),r||r!==!1&&$r(e.url))){const l=s&&o&&Vr.read(o);l&&i.set(s,l)}return e},Hr=typeof XMLHttpRequest<"u",Xr=Hr&&function(t){return new Promise(function(n,r){const s=Pt(t);let o=s.data;const i=x.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,f,d,y,S,p;function g(){S&&S(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function E(){if(!h)return;const T=x.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:T,config:t,request:h};Ct(function(_){n(_),g()},function(_){r(_),g()},L),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(r(new m("Request aborted",m.ECONNABORTED,t,h)),h=null)},h.onerror=function(O){const L=O&&O.message?O.message:"Network Error",v=new m(L,m.ERR_NETWORK,t,h);v.event=O||null,r(v),h=null},h.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const L=s.transitional||Fe;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),r(new m(O,L.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&u.forEach(i.toJSON(),function(O,L){h.setRequestHeader(L,O)}),u.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),c&&([y,p]=fe(c,!0),h.addEventListener("progress",y)),l&&h.upload&&([d,S]=fe(l),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",S)),(s.cancelToken||s.signal)&&(f=T=>{h&&(r(!T||T.type?new ne(null,t,h):T),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=Mr(s.url);if(N&&R.protocols.indexOf(N)===-1){r(new m("Unsupported protocol "+N+":",m.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Jr=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const o=function(c){if(!s){s=!0,a();const f=c instanceof Error?c:this.reason;r.abort(f instanceof m?f:new ne(f instanceof Error?f.message:f))}};let i=e&&setTimeout(()=>{i=null,o(new m(`timeout of ${e}ms exceeded`,m.ETIMEDOUT))},e);const a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>c.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>u.asap(a),l}},Wr=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Kr=async function*(t,e){for await(const n of Yr(t))yield*Wr(n,e)},Yr=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},et=(t,e,n,r)=>{const s=Kr(t,e);let o=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:f}=await s.next();if(c){a(),l.close();return}let d=f.byteLength;if(n){let y=o+=d;n(y)}l.enqueue(new Uint8Array(f))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},tt=64*1024,{isFunction:ie}=u,Zr=(({Request:t,Response:e})=>({Request:t,Response:e}))(u.global),{ReadableStream:nt,TextEncoder:rt}=u.global,st=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Gr=t=>{t=u.merge.call({skipUndefined:!0},Zr,t);const{fetch:e,Request:n,Response:r}=t,s=e?ie(e):typeof fetch=="function",o=ie(n),i=ie(r);if(!s)return!1;const a=s&&ie(nt),l=s&&(typeof rt=="function"?(p=>g=>p.encode(g))(new rt):async p=>new Uint8Array(await new n(p).arrayBuffer())),c=o&&a&&st(()=>{let p=!1;const g=new n(R.origin,{body:new nt,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!g}),f=i&&a&&st(()=>u.isReadableStream(new r("").body)),d={stream:f&&(p=>p.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(g,h)=>{let E=g&&g[p];if(E)return E.call(g);throw new m(`Response type '${p}' is not supported`,m.ERR_NOT_SUPPORT,h)})});const y=async p=>{if(p==null)return 0;if(u.isBlob(p))return p.size;if(u.isSpecCompliantForm(p))return(await new n(R.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(u.isArrayBufferView(p)||u.isArrayBuffer(p))return p.byteLength;if(u.isURLSearchParams(p)&&(p=p+""),u.isString(p))return(await l(p)).byteLength},S=async(p,g)=>{const h=u.toFiniteNumber(p.getContentLength());return h??y(g)};return async p=>{let{url:g,method:h,data:E,signal:N,cancelToken:T,timeout:O,onDownloadProgress:L,onUploadProgress:v,responseType:_,headers:Ee,withCredentials:re="same-origin",fetchOptions:Ue}=Pt(p),ke=e||fetch;_=_?(_+"").toLowerCase():"text";let se=Jr([N,T&&T.toAbortSignal()],O),K=null;const j=se&&se.unsubscribe&&(()=>{se.unsubscribe()});let Me;try{if(v&&c&&h!=="get"&&h!=="head"&&(Me=await S(Ee,E))!==0){let k=new n(g,{method:"POST",body:E,duplex:"half"}),X;if(u.isFormData(E)&&(X=k.headers.get("content-type"))&&Ee.setContentType(X),k.body){const[be,oe]=Ge(Me,fe(Qe(v)));E=et(k.body,tt,be,oe)}}u.isString(re)||(re=re?"include":"omit");const C=o&&"credentials"in n.prototype,ve={...Ue,signal:se,method:h.toUpperCase(),headers:Ee.normalize().toJSON(),body:E,duplex:"half",credentials:C?re:void 0};K=o&&new n(g,ve);let U=await(o?ke(K,Ue):ke(g,ve));const je=f&&(_==="stream"||_==="response");if(f&&(L||je&&j)){const k={};["status","statusText","headers"].forEach($e=>{k[$e]=U[$e]});const X=u.toFiniteNumber(U.headers.get("content-length")),[be,oe]=L&&Ge(X,fe(Qe(L),!0))||[];U=new r(et(U.body,tt,be,()=>{oe&&oe(),j&&j()}),k)}_=_||"text";let Ut=await d[u.findKey(d,_)||"text"](U,p);return!je&&j&&j(),await new Promise((k,X)=>{Ct(k,X,{data:Ut,headers:x.from(U.headers),status:U.status,statusText:U.statusText,config:p,request:K})})}catch(C){throw j&&j(),C&&C.name==="TypeError"&&/Load failed|fetch/i.test(C.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,p,K,C&&C.response),{cause:C.cause||C}):m.from(C,C&&C.code,p,K,C&&C.response)}}},Qr=new Map,xt=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,o=[r,s,n];let i=o.length,a=i,l,c,f=Qr;for(;a--;)l=o[a],c=f.get(l),c===void 0&&f.set(l,c=a?new Map:Gr(e)),f=c;return c};xt();const Be={http:gr,xhr:Xr,fetch:{get:xt}};u.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ot=t=>`- ${t}`,Dr=t=>u.isFunction(t)||t===null||t===!1;function es(t,e){t=u.isArray(t)?t:[t];const{length:n}=t;let r,s;const o={};for(let i=0;i<n;i++){r=t[i];let a;if(s=r,!Dr(r)&&(s=Be[(a=String(r)).toLowerCase()],s===void 0))throw new m(`Unknown adapter '${a}'`);if(s&&(u.isFunction(s)||(s=s.get(e))))break;o[a||"#"+i]=s}if(!s){const i=Object.entries(o).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
|
|
7
|
-
`+i.map(
|
|
8
|
-
`):" "+
|
|
9
|
-
`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ft=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",jt=ft+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Vt="["+ft+"]["+jt+"]*",Ht=new RegExp("^"+Vt+"$");function dt(t,e){const n=[];let r=e.exec(t);for(;r;){const s=[];s.startIndex=e.lastIndex-r[0].length;const o=r.length;for(let i=0;i<o;i++)s.push(r[i]);n.push(s),r=e.exec(t)}return n}const ge=function(t){const e=Ht.exec(t);return!(e===null||typeof e>"u")};function zt(t){return typeof t<"u"}const $t={allowBooleanAttributes:!1,unpairedTags:[]};function qt(t,e){e=Object.assign({},$t,e);const n=[];let r=!1,s=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=Xe(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=Ye(t,o);continue}else{let c=!1;t[o]==="/"&&(c=!0,o++);let l="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
|
|
2
|
+
`&&t[o]!=="\r";o++)l+=t[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!Qt(l)){let d;return l.trim().length===0?d="Invalid space after '<'.":d="Tag '"+l+"' is an invalid name.",w("InvalidTag",d,O(t,o))}const a=Jt(t,o);if(a===!1)return w("InvalidAttr","Attributes for '"+l+"' have open quote.",O(t,o));let f=a.value;if(o=a.index,f[f.length-1]==="/"){const d=o-f.length;f=f.substring(0,f.length-1);const m=Je(f,e);if(m===!0)r=!0;else return w(m.err.code,m.err.msg,O(t,d+m.err.line))}else if(c)if(a.tagClosed){if(f.trim().length>0)return w("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",O(t,i));if(n.length===0)return w("InvalidTag","Closing tag '"+l+"' has not been opened.",O(t,i));{const d=n.pop();if(l!==d.tagName){let m=O(t,d.tagStartPos);return w("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+m.line+", col "+m.col+") instead of closing tag '"+l+"'.",O(t,i))}n.length==0&&(s=!0)}}else return w("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",O(t,o));else{const d=Je(f,e);if(d!==!0)return w(d.err.code,d.err.msg,O(t,o-f.length+d.err.line));if(s===!0)return w("InvalidXml","Multiple possible root nodes found.",O(t,o));e.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:i}),r=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Ye(t,o);continue}else if(t[o+1]==="?"){if(o=Xe(t,++o),o.err)return o}else break;else if(t[o]==="&"){const d=Gt(t,o);if(d==-1)return w("InvalidChar","char '&' is not expected.",O(t,o));o=d}else if(s===!0&&!qe(t[o]))return w("InvalidXml","Extra text at the end",O(t,o));t[o]==="<"&&o--}}else{if(qe(t[o]))continue;return w("InvalidChar","char '"+t[o]+"' is not expected.",O(t,o))}if(r){if(n.length==1)return w("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",O(t,n[0].tagStartPos));if(n.length>0)return w("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return w("InvalidXml","Start tag expected.",1);return!0}function qe(t){return t===" "||t===" "||t===`
|
|
3
|
+
`||t==="\r"}function Xe(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return w("InvalidXml","XML declaration allowed only at the start of the document.",O(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Ye(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const Xt='"',Yt="'";function Jt(t,e){let n="",r="",s=!1;for(;e<t.length;e++){if(t[e]===Xt||t[e]===Yt)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){s=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:s}}const Kt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Je(t,e){const n=dt(t,Kt),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return w("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Q(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return w("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Q(n[s]));if(n[s][3]===void 0&&!e.allowBooleanAttributes)return w("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Q(n[s]));const o=n[s][2];if(!Zt(o))return w("InvalidAttr","Attribute '"+o+"' is an invalid name.",Q(n[s]));if(!Object.prototype.hasOwnProperty.call(r,o))r[o]=1;else return w("InvalidAttr","Attribute '"+o+"' is repeated.",Q(n[s]))}return!0}function Wt(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function Gt(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Wt(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function w(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Zt(t){return ge(t)}function Qt(t){return ge(t)}function O(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Q(t){return t.startIndex+t[1].length}const Dt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0};function pt(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:pt(!0)}const en=function(t){const e=Object.assign({},Dt,t);return e.processEntities=pt(e.processEntities),e};let pe;typeof Symbol!="function"?pe="@@xmlMetadata":pe=Symbol("XML Node Metadata");class V{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][pe]={startIndex:n})}static getMetaDataSymbol(){return pe}}class tn{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,n){const r=Object.create(null);if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let s=1,o=!1,i=!1,c="";for(;n<e.length;n++)if(e[n]==="<"&&!i){if(o&&$(e,"!ENTITY",n)){n+=7;let l,a;if([l,a,n]=this.readEntityExp(e,n+1,this.suppressValidationErr),a.indexOf("&")===-1){const f=l.replace(/[.\-+*:]/g,"\\.");r[l]={regx:RegExp(`&${f};`,"g"),val:a}}}else if(o&&$(e,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(e,n+1);n=l}else if(o&&$(e,"!ATTLIST",n))n+=8;else if(o&&$(e,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l}else if($(e,"!--",n))i=!0;else throw new Error("Invalid DOCTYPE");s++,c=""}else if(e[n]===">"){if(i?e[n-1]==="-"&&e[n-2]==="-"&&(i=!1,s--):s--,s===0)break}else e[n]==="["?o=!0:c+=e[n];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(e,n){n=P(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)r+=e[n],n++;if(D(r),n=P(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let s="";if([n,s]=this.readIdentifierVal(e,n,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&s.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[r,s,n]}readNotationExp(e,n){n=P(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;!this.suppressValidationErr&&D(r),n=P(e,n);const s=e.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);n+=s.length,n=P(e,n);let o=null,i=null;if(s==="PUBLIC")[n,o]=this.readIdentifierVal(e,n,"publicIdentifier"),n=P(e,n),(e[n]==='"'||e[n]==="'")&&([n,i]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(s==="SYSTEM"&&([n,i]=this.readIdentifierVal(e,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:o,systemIdentifier:i,index:--n}}readIdentifierVal(e,n,r){let s="";const o=e[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<e.length&&e[n]!==o;)s+=e[n],n++;if(e[n]!==o)throw new Error(`Unterminated ${r} value`);return n++,[n,s]}readElementExp(e,n){n=P(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;if(!this.suppressValidationErr&&!ge(r))throw new Error(`Invalid element name: "${r}"`);n=P(e,n);let s="";if(e[n]==="E"&&$(e,"MPTY",n))n+=4;else if(e[n]==="A"&&$(e,"NY",n))n+=2;else if(e[n]==="("){for(n++;n<e.length&&e[n]!==")";)s+=e[n],n++;if(e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:r,contentModel:s.trim(),index:n}}readAttlistExp(e,n){n=P(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;D(r),n=P(e,n);let s="";for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;if(!D(s))throw new Error(`Invalid attribute name: "${s}"`);n=P(e,n);let o="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=P(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let c=[];for(;n<e.length&&e[n]!==")";){let l="";for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)l+=e[n],n++;if(l=l.trim(),!D(l))throw new Error(`Invalid notation name: "${l}"`);c.push(l),e[n]==="|"&&(n++,n=P(e,n))}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+c.join("|")+")"}else{for(;n<e.length&&!/\s/.test(e[n]);)o+=e[n],n++;const c=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!c.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=P(e,n);let i="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:r,attributeName:s,attributeType:o,defaultValue:i,index:n}}}const P=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function $(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return!1;return!0}function D(t){if(ge(t))return t;throw new Error(`Invalid entity name ${t}`)}const nn=/^[-+]?0x[a-fA-F0-9]+$/,rn=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,sn={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function on(t,e={}){if(e=Object.assign({},sn,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(t==="0")return 0;if(e.hex&&nn.test(n))return un(n,16);if(n.includes("e")||n.includes("E"))return cn(t,n,e);{const r=rn.exec(n);if(r){const s=r[1]||"",o=r[2];let i=ln(r[3]);const c=s?t[o.length+1]===".":t[o.length]===".";if(!e.leadingZeros&&(o.length>1||o.length===1&&!c))return t;{const l=Number(n),a=String(l);if(l===0)return l;if(a.search(/[eE]/)!==-1)return e.eNotation?l:t;if(n.indexOf(".")!==-1)return a==="0"||a===i||a===`${s}${i}`?l:t;let f=o?i:n;return o?f===a||s+f===a?l:t:f===a||f===s+a?l:t}}else return t}}const an=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function cn(t,e,n){if(!n.eNotation)return t;const r=e.match(an);if(r){let s=r[1]||"";const o=r[3].indexOf("e")===-1?"E":"e",i=r[2],c=s?t[i.length+1]===o:t[i.length]===o;return i.length>1&&c?t:i.length===1&&(r[3].startsWith(`.${o}`)||r[3][0]===o)?Number(e):n.leadingZeros&&!c?(e=(r[1]||"")+r[3],Number(e)):t}else return t}function ln(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function un(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function fn(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}class dn{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>Ke(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>Ke(r,16,"&#x")}},this.addExternalEntities=pn,this.parseXml=yn,this.parseTextData=hn,this.resolveNameSpace=gn,this.buildAttributesMap=mn,this.isItStopNode=An,this.replaceEntitiesValue=wn,this.readStopNodeData=Sn,this.saveTextToParentTag=Rn,this.addChild=bn,this.ignoreAttributesFn=fn(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function pn(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n],s=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+s+";","g"),val:t[r]}}}function hn(t,e,n,r,s,o,i){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,n));const c=this.options.tagValueProcessor(e,t,n,s,o);return c==null?t:typeof c!=typeof t||c!==t?c:this.options.trimValues?Ie(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Ie(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function gn(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const En=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function mn(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=dt(t,En),s=r.length,o={};for(let i=0;i<s;i++){const c=this.resolveNameSpace(r[i][1]);if(this.ignoreAttributesFn(c,e))continue;let l=r[i][4],a=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),a==="__proto__"&&(a="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l,n,e);const f=this.options.attributeValueProcessor(c,l,e);f==null?o[a]=l:typeof f!=typeof l||f!==l?o[a]=f:o[a]=Ie(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[a]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const yn=function(t){t=t.replace(/\r\n?/g,`
|
|
4
|
+
`);const e=new V("!xml");let n=e,r="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;const o=new tn(this.options.processEntities);for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){const l=q(t,">",i,"Closing Tag is not closed.");let a=t.substring(i+2,l).trim();if(this.options.removeNSPrefix){const m=a.indexOf(":");m!==-1&&(a=a.substr(m+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&(r=this.saveTextToParentTag(r,n,s));const f=s.substring(s.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let d=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(d=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=s.lastIndexOf("."),s=s.substring(0,d),n=this.tagsNodeStack.pop(),r="",i=l}else if(t[i+1]==="?"){let l=Oe(t,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const a=new V(l.tagName);a.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(a[":@"]=this.buildAttributesMap(l.tagExp,s,l.tagName)),this.addChild(n,a,s,i)}i=l.closeIndex+1}else if(t.substr(i+1,3)==="!--"){const l=q(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const a=t.substring(i+4,l-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=l}else if(t.substr(i+1,2)==="!D"){const l=o.readDocType(t,i);this.docTypeEntities=l.entities,i=l.i}else if(t.substr(i+1,2)==="!["){const l=q(t,"]]>",i,"CDATA is not closed.")-2,a=t.substring(i+9,l);r=this.saveTextToParentTag(r,n,s);let f=this.parseTextData(a,n.tagname,s,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):n.add(this.options.textNodeName,f),i=l+2}else{let l=Oe(t,i,this.options.removeNSPrefix),a=l.tagName;const f=l.rawTagName;let d=l.tagExp,m=l.attrExpPresent,A=l.closeIndex;if(this.options.transformTagName){const h=this.options.transformTagName(a);d===a&&(d=h),a=h}if(this.options.strictReservedNames&&(a===this.options.commentPropName||a===this.options.cdataPropName))throw new Error(`Invalid tag name: ${a}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));const p=n;p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==e.tagname&&(s+=s?"."+a:a);const g=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,s,a)){let h="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),d=a):d=d.substr(0,d.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=l.closeIndex;else{const N=this.readStopNodeData(t,f,A+1);if(!N)throw new Error(`Unexpected end of ${f}`);i=N.i,h=N.tagContent}const b=new V(a);a!==d&&m&&(b[":@"]=this.buildAttributesMap(d,s,a)),h&&(h=this.parseTextData(h,a,s,!0,m,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),b.add(this.options.textNodeName,h),this.addChild(n,b,s,g)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){if(a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),d=a):d=d.substr(0,d.length-1),this.options.transformTagName){const b=this.options.transformTagName(a);d===a&&(d=b),a=b}const h=new V(a);a!==d&&m&&(h[":@"]=this.buildAttributesMap(d,s,a)),this.addChild(n,h,s,g),s=s.substr(0,s.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(a)!==-1){const h=new V(a);a!==d&&m&&(h[":@"]=this.buildAttributesMap(d,s)),this.addChild(n,h,s,g),s=s.substr(0,s.lastIndexOf(".")),i=l.closeIndex;continue}else{const h=new V(a);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),a!==d&&m&&(h[":@"]=this.buildAttributesMap(d,s,a)),this.addChild(n,h,s,g),n=h}r="",i=A}}else r+=t[i];return e.child};function bn(t,e,n,r){this.options.captureMetaData||(r=void 0);const s=this.options.updateTag(e.tagname,n,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e,r))}const wn=function(t,e,n){if(t.indexOf("&")===-1)return t;const r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(e)||r.tagFilter&&!r.tagFilter(e,n))return t;for(let s in this.docTypeEntities){const o=this.docTypeEntities[s],i=t.match(o.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const c=t.length;if(t=t.replace(o.regx,o.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-c,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(let s in this.lastEntities){const o=this.lastEntities[s];t=t.replace(o.regex,o.val)}if(t.indexOf("&")===-1)return t;if(this.options.htmlEntities)for(let s in this.htmlEntities){const o=this.htmlEntities[s];t=t.replace(o.regex,o.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t};function Rn(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function An(t,e,n,r){return!!(e&&e.has(r)||t&&t.has(n))}function Tn(t,e,n=">"){let r,s="";for(let o=e;o<t.length;o++){let i=t[o];if(r)i===r&&(r="");else if(i==='"'||i==="'")r=i;else if(i===n[0])if(n[1]){if(t[o+1]===n[1])return{data:s,index:o}}else return{data:s,index:o};else i===" "&&(i=" ");s+=i}}function q(t,e,n,r){const s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s+e.length-1}function Oe(t,e,n,r=">"){const s=Tn(t,e+1,r);if(!s)return;let o=s.data;const i=s.index,c=o.search(/\s/);let l=o,a=!0;c!==-1&&(l=o.substring(0,c),o=o.substring(c+1).trimStart());const f=l;if(n){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1),a=l!==s.data.substr(d+1))}return{tagName:l,tagExp:o,closeIndex:i,attrExpPresent:a,rawTagName:f}}function Sn(t,e,n){const r=n;let s=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const o=q(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(s--,s===0))return{tagContent:t.substring(r,n),i:o};n=o}else if(t[n+1]==="?")n=q(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=q(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=q(t,"]]>",n,"StopNode is not closed.")-2;else{const o=Oe(t,n,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,n=o.closeIndex)}}function Ie(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:on(t,n)}else return zt(t)?t:""}function Ke(t,e,n){const r=Number.parseInt(t,e);return r>=0&&r<=1114111?String.fromCodePoint(r):n+t+";"}const Te=V.getMetaDataSymbol();function Nn(t,e){return ht(t,e)}function ht(t,e,n){let r;const s={};for(let o=0;o<t.length;o++){const i=t[o],c=Cn(i);let l="";if(n===void 0?l=c:l=n+"."+c,c===e.textNodeName)r===void 0?r=i[c]:r+=""+i[c];else{if(c===void 0)continue;if(i[c]){let a=ht(i[c],e,l);const f=In(a,e);i[":@"]?On(a,i[":@"],l,e):Object.keys(a).length===1&&a[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?a=a[e.textNodeName]:Object.keys(a).length===0&&(e.alwaysCreateTextNode?a[e.textNodeName]="":a=""),i[Te]!==void 0&&typeof a=="object"&&a!==null&&(a[Te]=i[Te]),s[c]!==void 0&&Object.prototype.hasOwnProperty.call(s,c)?(Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(a)):e.isArray(c,l,f)?s[c]=[a]:s[c]=a}}}return typeof r=="string"?r.length>0&&(s[e.textNodeName]=r):r!==void 0&&(s[e.textNodeName]=r),s}function Cn(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function On(t,e,n,r){if(e){const s=Object.keys(e),o=s.length;for(let i=0;i<o;i++){const c=s[i];r.isArray(c,n+"."+c,!0,!0)?t[c]=[e[c]]:t[c]=e[c]}}}function In(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}class gt{constructor(e){this.externalEntities={},this.options=en(e)}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=qt(e,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const r=new dn(this.options);r.addExternalEntities(this.externalEntities);const s=r.parseXml(e);return this.options.preserveOrder||s===void 0?s:Nn(s,this.options)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return V.getMetaDataSymbol()}}var y=(t=>(t.COMPANY_SUMMARY_FETCH_FAILED="COMPANY_SUMMARY_FETCH_FAILED",t.FINANCIALS_FETCH_FAILED="FINANCIALS_FETCH_FAILED",t.SHARES_FETCH_FAILED="SHARES_FETCH_FAILED",t.MISSING_CCIAA_OR_REA="MISSING_CCIAA_OR_REA",t.COMPANY_NOT_FOUND="COMPANY_NOT_FOUND",t.INSUFFICIENT_CREDIT="INSUFFICIENT_CREDIT",t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.HTTP_ERROR="HTTP_ERROR",t.XML_PARSE_ERROR="XML_PARSE_ERROR",t.XBRL_EMPTY="XBRL_EMPTY",t.XBRL_DECODE_ERROR="XBRL_DECODE_ERROR",t.XBRL_MAPPING_ERROR="XBRL_MAPPING_ERROR",t))(y||{});const B={COMPANY_SUMMARY_FETCH_FAILED:"Errore nel recupero anagrafica impresa",FINANCIALS_FETCH_FAILED:"Errore nel recupero dati finanziari",SHARES_FETCH_FAILED:"Errore nel recupero quote societarie",MISSING_CCIAA_OR_REA:"Impossibile recuperare soci: CCIAA o REA mancanti",COMPANY_NOT_FOUND:"Impresa non trovata",SERVICE_UNAVAILABLE:"Servizio temporaneamente non disponibile",HTTP_ERROR:"Errore HTTP del servizio",XML_PARSE_ERROR:"Errore nel parsing XML",XBRL_EMPTY:"Errore nel recupero del file XBRL",XBRL_DECODE_ERROR:"Errore nella decodifica del file XBRL",XBRL_MAPPING_ERROR:"Errore nella mappaggio del file XBRL",INSUFFICIENT_CREDIT:"Credito insufficiente per procedere"};function T(t,e,n,r){t.push({code:e,context:n,message:r})}class _n{async mapAnagraficaImpresaToCompanySummary(e,n=[]){return e?(e.Denominazione||T(n,y.COMPANY_SUMMARY_FETCH_FAILED,{field:"Denominazione"},y.COMPANY_SUMMARY_FETCH_FAILED),e.PIva||T(n,y.COMPANY_SUMMARY_FETCH_FAILED,{field:"PIva"},y.COMPANY_SUMMARY_FETCH_FAILED),e.Cciaa||T(n,y.COMPANY_SUMMARY_FETCH_FAILED,{field:"Cciaa"},y.COMPANY_SUMMARY_FETCH_FAILED),{companyName:e.Denominazione||"",companyFiscalCode:e.CodFisc||"",companyVatNumber:e.PIva||"",companyLegalFormCode:e.NatGiu||"",companyLegalFormDescription:e.DescNatGiu||"",companyCciaaCode:e.Cciaa||"",companyCciaaDescription:e.DescCciaa||"",companyReaNumber:e.NRea||0,companyStatusCode:e.StatoAttivita||"",companyStatusDescription:e.DescStatoAttivita||"",companyRegistryStatusCode:e.StatoAttivitaReg||"",companyRegistryStatusDescription:e.DescStatoAttivitaReg||"",companySourceCode:e.Fonte||"",companySourceDescription:e.DescFonte||"",companyDeclaredActivity:e.AttivitaDichiarata||"",companyAtecoCode:e.ClassificazioneAteco?.CodAttivita||"",companyAtecoDescription:e.ClassificazioneAteco?.DescAttivita||"",companyAtecoClassificationCode:e.ClassificazioneAteco?.CodCodifica||0,companyAtecoClassificationDescription:e.ClassificazioneAteco?.DescCodifica||"",companyProvinceCode:e.IndirizzoSede?.SglPrvSede||"",companyProvinceDescription:e.IndirizzoSede?.DescPrvSede||"",companyMunicipalityCode:e.IndirizzoSede?.CodComSede||"",companyMunicipalityDescription:e.IndirizzoSede?.DescComSede||"",companyToponymCode:e.IndirizzoSede?.CodToponSede||"",companyToponymDescription:e.IndirizzoSede?.DescToponSede||"",companyStreet:e.IndirizzoSede?.ViaSede||"",companyStreetNumber:String(e.IndirizzoSede?.NCivicoSede||""),companyPostalCode:e.IndirizzoSede?.CapSede||0,companyPec:e.IndirizzoPostaCertificata||"",companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:n}):(T(n,y.COMPANY_SUMMARY_FETCH_FAILED,{impresa:e},y.COMPANY_SUMMARY_FETCH_FAILED),{companyName:"",companyFiscalCode:"",companyVatNumber:"",companyLegalFormCode:"",companyLegalFormDescription:"",companyCciaaCode:"",companyCciaaDescription:"",companyReaNumber:0,companyStatusCode:"",companyStatusDescription:"",companyRegistryStatusCode:"",companyRegistryStatusDescription:"",companySourceCode:"",companySourceDescription:"",companyDeclaredActivity:"",companyAtecoCode:"",companyAtecoDescription:"",companyAtecoClassificationCode:0,companyAtecoClassificationDescription:"",companyProvinceCode:"",companyProvinceDescription:"",companyMunicipalityCode:"",companyMunicipalityDescription:"",companyToponymCode:"",companyToponymDescription:"",companyStreet:"",companyStreetNumber:"",companyPostalCode:0,companyPec:"",companyProfit:null,companyRevenue:null,companyIncorporationDate:null,companyShares:null,aiwsError:n})}}class Pn{async getFinancialValues(e,n){const r=e?.Risposta?.dati;if(!r)return T(n,y.XBRL_EMPTY,{},y.XBRL_EMPTY),null;let s;try{s=Buffer.from(r,"base64").toString("utf-8")}catch(f){return T(n,y.XBRL_DECODE_ERROR,{error:String(f)},y.XBRL_DECODE_ERROR),null}const o=new gt({ignoreAttributes:!1,attributeNamePrefix:""});let i;try{i=o.parse(s)}catch(f){return T(n,y.XML_PARSE_ERROR,{error:String(f)},y.XML_PARSE_ERROR),null}if(!i?.xbrl)return T(n,y.XBRL_MAPPING_ERROR,{},y.XBRL_MAPPING_ERROR),null;const c=i.xbrl,l=this.findByContext(c,"itcc-ci:UtilePerditaEsercizio","cntxCorr_d"),a=this.findByContext(c,"itcc-ci:ValoreProduzioneRicaviVenditePrestazioni","cntxCorr_d");return{companyProfit:l?Number(l["#text"]):0,companyRevenue:a?Number(a["#text"]):0}}findByContext(e,n,r){const s=e[n];return s?(Array.isArray(s)?s:[s]).find(i=>i.contextRef===r)??null:null}}class Fn{parseAddress(e){if(e)return{street:e.via,number:e["n-civico"],city:e.comune,province:e.provincia,cap:e.cap}}parseCapital(e){return parseFloat(e.replace(".","").replace(",","."))}async getShares(e,n){const r=[],s=Array.isArray(e)?e:[e];for(const o of s){const i=this.parseCapital(o["composizione-quote"]["valore-nominale"]),c=Array.isArray(o.titolari.titolare)?o.titolari.titolare:[o.titolari.titolare];for(const l of c){const a={type:l["anagrafica-titolare"].tipo,fiscalCode:l["anagrafica-titolare"]["c-fiscale"],firstName:l["anagrafica-titolare"].nome||l["anagrafica-titolare"].denominazione,lastName:l["anagrafica-titolare"].cognome,shareValue:i,sharePercentage:i/n*100,isRepresentative:l["f-rappresentante"]==="S",address:this.parseAddress(l.domicilio)};r.push(a)}}return r}}class Ln{constructor(e){this.client=e}parser=new gt({ignoreAttributes:!1,attributeNamePrefix:""});checkResponseStatus(e,n,r){switch(e){case 200:return!0;case 402:return T(r,y.INSUFFICIENT_CREDIT,{},B.INSUFFICIENT_CREDIT),!1;case 404:return T(r,y.COMPANY_NOT_FOUND,{},B.COMPANY_NOT_FOUND),!1;case 503:return T(r,y.SERVICE_UNAVAILABLE,{},B.SERVICE_UNAVAILABLE),!1;case 500:return T(r,y.HTTP_ERROR,{data:n},B.HTTP_ERROR),!1;default:return T(r,y.HTTP_ERROR,{status:e},B.HTTP_ERROR),!1}}parseXml(e,n){try{return this.parser.parse(e)}catch(r){return T(n,y.XML_PARSE_ERROR,{error:String(r)},B.XML_PARSE_ERROR),null}}async getCompanySummaryByVatNumber(e,n){try{const r=await this.client.get("/registroimprese/imprese/ricerca/partitaiva",{params:{partitaIva:e,fSoloSedi:"S"}});if(!this.checkResponseStatus(r.status,r.data,n))return null;const s=this.parseXml(r.data,n);if(!s)return null;const o=s.Risposta?.ListaImpreseRI?.Impresa?.AnagraficaImpresa;return o?new _n().mapAnagraficaImpresaToCompanySummary(o):(T(n,y.COMPANY_NOT_FOUND,{vatNumber:e},B.COMPANY_NOT_FOUND),null)}catch(r){return T(n,y.COMPANY_SUMMARY_FETCH_FAILED,{vatNumber:e,error:String(r)},B.COMPANY_SUMMARY_FETCH_FAILED),null}}async getFinancialsByVatNumber(e,n){try{const r=await this.client.get("/registroimprese/bilanci/xbrl/codicefiscale",{params:{codiceFiscale:e,allXbrl:"S"}});if(!this.checkResponseStatus(r.status,r.data,n))return null;const s=this.parseXml(r.data,n);return s?await new Pn().getFinancialValues(s,n):null}catch(r){return T(n,y.FINANCIALS_FETCH_FAILED,{vatNumber:e,error:String(r)},B.FINANCIALS_FETCH_FAILED),null}}async getSharesByRea(e,n,r){try{const s=await this.client.get("/registroimprese/output/impresa/soci/nrea/xml",{params:{cciaa:e,nRea:n}});if(!this.checkResponseStatus(s.status,s.data,r))return[];const o=this.parseXml(s.data,r);if(!o)return[];const i=new Fn,c=i.parseCapital(o.Risposta.dati["blocchi-impresa"]["sintesi-cifre-impresa"]["capitale-sociale"].sottoscritto.ammontare),l=o.Risposta.dati["blocchi-impresa"]["elenco-soci"].riquadri.riquadro;return i.getShares(l,c)}catch(s){return T(r,y.SHARES_FETCH_FAILED,{error:String(s)},B.SHARES_FETCH_FAILED),[]}}async getCompany(e){const n=[],r=await this.getCompanySummaryByVatNumber(e,n);if(!r)return null;const s=await this.getFinancialsByVatNumber(e,n)??{companyRevenue:0,companyProfit:0};let o=[];return r.companyCciaaCode&&r.companyReaNumber?o=await this.getSharesByRea(r.companyCciaaCode,r.companyReaNumber,n):T(n,y.MISSING_CCIAA_OR_REA,{},B.MISSING_CCIAA_OR_REA),{...r,...s,companyShares:o,aiwsError:n}}}function Et(t,e){return function(){return t.apply(e,arguments)}}const{toString:xn}=Object.prototype,{getPrototypeOf:xe}=Object,{iterator:Ee,toStringTag:mt}=Symbol,me=(t=>e=>{const n=xn.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),k=t=>(t=t.toLowerCase(),e=>me(e)===t),ye=t=>e=>typeof e===t,{isArray:G}=Array,W=ye("undefined");function te(t){return t!==null&&!W(t)&&t.constructor!==null&&!W(t.constructor)&&F(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const yt=k("ArrayBuffer");function Mn(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&yt(t.buffer),e}const Un=ye("string"),F=ye("function"),bt=ye("number"),ne=t=>t!==null&&typeof t=="object",Bn=t=>t===!0||t===!1,ue=t=>{if(me(t)!=="object")return!1;const e=xe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(mt in t)&&!(Ee in t)},kn=t=>{if(!ne(t)||te(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},vn=k("Date"),jn=k("File"),Vn=k("Blob"),Hn=k("FileList"),zn=t=>ne(t)&&F(t.pipe),$n=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||F(t.append)&&((e=me(t))==="formdata"||e==="object"&&F(t.toString)&&t.toString()==="[object FormData]"))},qn=k("URLSearchParams"),[Xn,Yn,Jn,Kn]=["ReadableStream","Request","Response","Headers"].map(k),Wn=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function re(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),G(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(te(t))return;const o=n?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(r=0;r<i;r++)c=o[r],e.call(null,t[c],c,t)}}function wt(t,e){if(te(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const X=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Rt=t=>!W(t)&&t!==X;function _e(){const{caseless:t,skipUndefined:e}=Rt(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&wt(n,o)||o;ue(n[i])&&ue(s)?n[i]=_e(n[i],s):ue(s)?n[i]=_e({},s):G(s)?n[i]=s.slice():(!e||!W(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&re(arguments[s],r);return n}const Gn=(t,e,n,{allOwnKeys:r}={})=>(re(e,(s,o)=>{n&&F(s)?Object.defineProperty(t,o,{value:Et(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),Zn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Qn=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Dn=(t,e,n,r)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!r||r(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=n!==!1&&xe(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},er=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},tr=t=>{if(!t)return null;if(G(t))return t;let e=t.length;if(!bt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},nr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&xe(Uint8Array)),rr=(t,e)=>{const r=(t&&t[Ee]).call(t);let s;for(;(s=r.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},sr=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},or=k("HTMLFormElement"),ir=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),We=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),ar=k("RegExp"),At=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};re(n,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(r[o]=i||s)}),Object.defineProperties(t,r)},cr=t=>{At(t,(e,n)=>{if(F(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(F(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},lr=(t,e)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return G(t)?r(t):r(String(t).split(e)),n},ur=()=>{},fr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function dr(t){return!!(t&&F(t.append)&&t[mt]==="FormData"&&t[Ee])}const pr=t=>{const e=new Array(10),n=(r,s)=>{if(ne(r)){if(e.indexOf(r)>=0)return;if(te(r))return r;if(!("toJSON"in r)){e[s]=r;const o=G(r)?[]:{};return re(r,(i,c)=>{const l=n(i,s+1);!W(l)&&(o[c]=l)}),e[s]=void 0,o}}return r};return n(t,0)},hr=k("AsyncFunction"),gr=t=>t&&(ne(t)||F(t))&&F(t.then)&&F(t.catch),Tt=((t,e)=>t?setImmediate:e?((n,r)=>(X.addEventListener("message",({source:s,data:o})=>{s===X&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),X.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",F(X.postMessage)),Er=typeof queueMicrotask<"u"?queueMicrotask.bind(X):typeof process<"u"&&process.nextTick||Tt,mr=t=>t!=null&&F(t[Ee]),u={isArray:G,isArrayBuffer:yt,isBuffer:te,isFormData:$n,isArrayBufferView:Mn,isString:Un,isNumber:bt,isBoolean:Bn,isObject:ne,isPlainObject:ue,isEmptyObject:kn,isReadableStream:Xn,isRequest:Yn,isResponse:Jn,isHeaders:Kn,isUndefined:W,isDate:vn,isFile:jn,isBlob:Vn,isRegExp:ar,isFunction:F,isStream:zn,isURLSearchParams:qn,isTypedArray:nr,isFileList:Hn,forEach:re,merge:_e,extend:Gn,trim:Wn,stripBOM:Zn,inherits:Qn,toFlatObject:Dn,kindOf:me,kindOfTest:k,endsWith:er,toArray:tr,forEachEntry:rr,matchAll:sr,isHTMLForm:or,hasOwnProperty:We,hasOwnProp:We,reduceDescriptors:At,freezeMethods:cr,toObjectSet:lr,toCamelCase:ir,noop:ur,toFiniteNumber:fr,findKey:wt,global:X,isContextDefined:Rt,isSpecCompliantForm:dr,toJSONObject:pr,isAsyncFn:hr,isThenable:gr,setImmediate:Tt,asap:Er,isIterable:mr};let E=class St extends Error{static from(e,n,r,s,o,i){const c=new St(e.message,n||e.code,r,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,n,r,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.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:u.toJSONObject(this.config),code:this.code,status:this.status}}};E.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";E.ERR_BAD_OPTION="ERR_BAD_OPTION";E.ECONNABORTED="ECONNABORTED";E.ETIMEDOUT="ETIMEDOUT";E.ERR_NETWORK="ERR_NETWORK";E.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";E.ERR_DEPRECATED="ERR_DEPRECATED";E.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";E.ERR_BAD_REQUEST="ERR_BAD_REQUEST";E.ERR_CANCELED="ERR_CANCELED";E.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";E.ERR_INVALID_URL="ERR_INVALID_URL";const yr=null;function Pe(t){return u.isPlainObject(t)||u.isArray(t)}function Nt(t){return u.endsWith(t,"[]")?t.slice(0,-2):t}function Ge(t,e,n){return t?t.concat(e).map(function(s,o){return s=Nt(s),!n&&o?"["+s+"]":s}).join(n?".":""):e}function br(t){return u.isArray(t)&&!t.some(Pe)}const wr=u.toFlatObject(u,{},null,function(e){return/^is[A-Z]/.test(e)});function be(t,e,n){if(!u.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=u.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,h){return!u.isUndefined(h[g])});const r=n.metaTokens,s=n.visitor||f,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(e);if(!u.isFunction(s))throw new TypeError("visitor must be a function");function a(p){if(p===null)return"";if(u.isDate(p))return p.toISOString();if(u.isBoolean(p))return p.toString();if(!l&&u.isBlob(p))throw new E("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(p)||u.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,g,h){let b=p;if(p&&!h&&typeof p=="object"){if(u.endsWith(g,"{}"))g=r?g:g.slice(0,-2),p=JSON.stringify(p);else if(u.isArray(p)&&br(p)||(u.isFileList(p)||u.endsWith(g,"[]"))&&(b=u.toArray(p)))return g=Nt(g),b.forEach(function(S,I){!(u.isUndefined(S)||S===null)&&e.append(i===!0?Ge([g],I,o):i===null?g:g+"[]",a(S))}),!1}return Pe(p)?!0:(e.append(Ge(h,g,o),a(p)),!1)}const d=[],m=Object.assign(wr,{defaultVisitor:f,convertValue:a,isVisitable:Pe});function A(p,g){if(!u.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(p),u.forEach(p,function(b,N){(!(u.isUndefined(b)||b===null)&&s.call(e,b,u.isString(N)?N.trim():N,g,m))===!0&&A(b,g?g.concat(N):[N])}),d.pop()}}if(!u.isObject(t))throw new TypeError("data must be an object");return A(t),e}function Ze(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Me(t,e){this._pairs=[],t&&be(t,this,e)}const Ct=Me.prototype;Ct.append=function(e,n){this._pairs.push([e,n])};Ct.toString=function(e){const n=e?function(r){return e.call(this,r,Ze)}:Ze;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Rr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ot(t,e,n){if(!e)return t;const r=n&&n.encode||Rr,s=u.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(e,s):i=u.isURLSearchParams(e)?e.toString():new Me(e,s).toString(r),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Qe{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){u.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Ue={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ar=typeof URLSearchParams<"u"?URLSearchParams:Me,Tr=typeof FormData<"u"?FormData:null,Sr=typeof Blob<"u"?Blob:null,Nr={isBrowser:!0,classes:{URLSearchParams:Ar,FormData:Tr,Blob:Sr},protocols:["http","https","file","blob","url","data"]},Be=typeof window<"u"&&typeof document<"u",Fe=typeof navigator=="object"&&navigator||void 0,Cr=Be&&(!Fe||["ReactNative","NativeScript","NS"].indexOf(Fe.product)<0),Or=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ir=Be&&window.location.href||"http://localhost",_r=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Be,hasStandardBrowserEnv:Cr,hasStandardBrowserWebWorkerEnv:Or,navigator:Fe,origin:Ir},Symbol.toStringTag,{value:"Module"})),C={..._r,...Nr};function Pr(t,e){return be(t,new C.classes.URLSearchParams,{visitor:function(n,r,s,o){return C.isNode&&u.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Fr(t){return u.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Lr(t){const e={},n=Object.keys(t);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],e[o]=t[o];return e}function It(t){function e(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=o>=n.length;return i=!i&&u.isArray(s)?s.length:i,l?(u.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!u.isObject(s[i]))&&(s[i]=[]),e(n,r,s[i],o)&&u.isArray(s[i])&&(s[i]=Lr(s[i])),!c)}if(u.isFormData(t)&&u.isFunction(t.entries)){const n={};return u.forEachEntry(t,(r,s)=>{e(Fr(r),s,n,0)}),n}return null}function xr(t,e,n){if(u.isString(t))try{return(e||JSON.parse)(t),u.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const se={transitional:Ue,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=u.isObject(e);if(o&&u.isHTMLForm(e)&&(e=new FormData(e)),u.isFormData(e))return s?JSON.stringify(It(e)):e;if(u.isArrayBuffer(e)||u.isBuffer(e)||u.isStream(e)||u.isFile(e)||u.isBlob(e)||u.isReadableStream(e))return e;if(u.isArrayBufferView(e))return e.buffer;if(u.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Pr(e,this.formSerializer).toString();if((c=u.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return be(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),xr(e)):e}],transformResponse:[function(e){const n=this.transitional||se.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(u.isResponse(e)||u.isReadableStream(e))return e;if(e&&u.isString(e)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?E.from(c,E.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:C.classes.FormData,Blob:C.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],t=>{se.headers[t]={}});const Mr=u.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"]),Ur=t=>{const e={};let n,r,s;return t&&t.split(`
|
|
5
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&Mr[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},De=Symbol("internals");function ee(t){return t&&String(t).trim().toLowerCase()}function fe(t){return t===!1||t==null?t:u.isArray(t)?t.map(fe):String(t)}function Br(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const kr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Se(t,e,n,r,s){if(u.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!u.isString(e)){if(u.isString(r))return e.indexOf(r)!==-1;if(u.isRegExp(r))return r.test(e)}}function vr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function jr(t,e){const n=u.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,o,i){return this[r].call(this,e,s,o,i)},configurable:!0})})}let L=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function o(c,l,a){const f=ee(l);if(!f)throw new Error("header name must be a non-empty string");const d=u.findKey(s,f);(!d||s[d]===void 0||a===!0||a===void 0&&s[d]!==!1)&&(s[d||l]=fe(c))}const i=(c,l)=>u.forEach(c,(a,f)=>o(a,f,l));if(u.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(u.isString(e)&&(e=e.trim())&&!kr(e))i(Ur(e),n);else if(u.isObject(e)&&u.isIterable(e)){let c={},l,a;for(const f of e){if(!u.isArray(f))throw TypeError("Object iterator must return a key-value pair");c[a=f[0]]=(l=c[a])?u.isArray(l)?[...l,f[1]]:[l,f[1]]:f[1]}i(c,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=ee(e),e){const r=u.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return Br(s);if(u.isFunction(n))return n.call(this,s,r);if(u.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ee(e),e){const r=u.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Se(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function o(i){if(i=ee(i),i){const c=u.findKey(r,i);c&&(!n||Se(r,r[c],c,n))&&(delete r[c],s=!0)}}return u.isArray(e)?e.forEach(o):o(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!e||Se(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const n=this,r={};return u.forEach(this,(s,o)=>{const i=u.findKey(r,o);if(i){n[i]=fe(s),delete n[o];return}const c=e?vr(o):String(o).trim();c!==o&&delete n[o],n[c]=fe(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return u.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&u.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
6
|
+
`)}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,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[De]=this[De]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ee(i);r[c]||(jr(s,i),r[c]=!0)}return u.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);u.reduceDescriptors(L.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});u.freezeMethods(L);function Ne(t,e){const n=this||se,r=e||n,s=L.from(r.headers);let o=r.data;return u.forEach(t,function(c){o=c.call(n,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function _t(t){return!!(t&&t.__CANCEL__)}let oe=class extends E{constructor(e,n,r){super(e??"canceled",E.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Pt(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new E("Request failed with status code "+n.status,[E.ERR_BAD_REQUEST,E.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Vr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Hr(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(l){const a=Date.now(),f=r[o];i||(i=a),n[s]=l,r[s]=a;let d=o,m=0;for(;d!==s;)m+=n[d++],d=d%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),a-i<e)return;const A=f&&a-f;return A?Math.round(m*1e3/A):void 0}}function zr(t,e){let n=0,r=1e3/e,s,o;const i=(a,f=Date.now())=>{n=f,s=null,o&&(clearTimeout(o),o=null),t(...a)};return[(...a)=>{const f=Date.now(),d=f-n;d>=r?i(a,f):(s=a,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const he=(t,e,n=3)=>{let r=0;const s=Hr(50,250);return zr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,l=i-r,a=s(l),f=i<=c;r=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:l,rate:a||void 0,estimated:a&&c&&f?(c-i)/a:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(d)},n)},et=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},tt=t=>(...e)=>u.asap(()=>t(...e)),$r=C.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,C.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(C.origin),C.navigator&&/(msie|trident)/i.test(C.navigator.userAgent)):()=>!0,qr=C.hasStandardBrowserEnv?{write(t,e,n,r,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];u.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),u.isString(r)&&c.push(`path=${r}`),u.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),u.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Xr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Yr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ft(t,e,n){let r=!Xr(e);return t&&(r||n==!1)?Yr(t,e):e}const nt=t=>t instanceof L?{...t}:t;function J(t,e){e=e||{};const n={};function r(a,f,d,m){return u.isPlainObject(a)&&u.isPlainObject(f)?u.merge.call({caseless:m},a,f):u.isPlainObject(f)?u.merge({},f):u.isArray(f)?f.slice():f}function s(a,f,d,m){if(u.isUndefined(f)){if(!u.isUndefined(a))return r(void 0,a,d,m)}else return r(a,f,d,m)}function o(a,f){if(!u.isUndefined(f))return r(void 0,f)}function i(a,f){if(u.isUndefined(f)){if(!u.isUndefined(a))return r(void 0,a)}else return r(void 0,f)}function c(a,f,d){if(d in e)return r(a,f);if(d in t)return r(void 0,a)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(a,f,d)=>s(nt(a),nt(f),d,!0)};return u.forEach(Object.keys({...t,...e}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const d=u.hasOwnProp(l,f)?l[f]:s,m=d(t[f],e[f],f);u.isUndefined(m)&&d!==c||(n[f]=m)}),n}const Lt=t=>{const e=J({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=Ot(Ft(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),u.isFormData(n)){if(C.hasStandardBrowserEnv||C.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(u.isFunction(n.getHeaders)){const l=n.getHeaders(),a=["content-type","content-length"];Object.entries(l).forEach(([f,d])=>{a.includes(f.toLowerCase())&&i.set(f,d)})}}if(C.hasStandardBrowserEnv&&(r&&u.isFunction(r)&&(r=r(e)),r||r!==!1&&$r(e.url))){const l=s&&o&&qr.read(o);l&&i.set(s,l)}return e},Jr=typeof XMLHttpRequest<"u",Kr=Jr&&function(t){return new Promise(function(n,r){const s=Lt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:a}=s,f,d,m,A,p;function g(){A&&A(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function b(){if(!h)return;const S=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),U={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:t,request:h};Pt(function(x){n(x),g()},function(x){r(x),g()},U),h=null}"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(b)},h.onabort=function(){h&&(r(new E("Request aborted",E.ECONNABORTED,t,h)),h=null)},h.onerror=function(I){const U=I&&I.message?I.message:"Network Error",H=new E(U,E.ERR_NETWORK,t,h);H.event=I||null,r(H),h=null},h.ontimeout=function(){let I=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const U=s.transitional||Ue;s.timeoutErrorMessage&&(I=s.timeoutErrorMessage),r(new E(I,U.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&u.forEach(i.toJSON(),function(I,U){h.setRequestHeader(U,I)}),u.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),a&&([m,p]=he(a,!0),h.addEventListener("progress",m)),l&&h.upload&&([d,A]=he(l),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",A)),(s.cancelToken||s.signal)&&(f=S=>{h&&(r(!S||S.type?new oe(null,t,h):S),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=Vr(s.url);if(N&&C.protocols.indexOf(N)===-1){r(new E("Unsupported protocol "+N+":",E.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Wr=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const o=function(a){if(!s){s=!0,c();const f=a instanceof Error?a:this.reason;r.abort(f instanceof E?f:new oe(f instanceof Error?f.message:f))}};let i=e&&setTimeout(()=>{i=null,o(new E(`timeout of ${e}ms exceeded`,E.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(a=>{a.unsubscribe?a.unsubscribe(o):a.removeEventListener("abort",o)}),t=null)};t.forEach(a=>a.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>u.asap(c),l}},Gr=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Zr=async function*(t,e){for await(const n of Qr(t))yield*Gr(n,e)},Qr=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},rt=(t,e,n,r)=>{const s=Zr(t,e);let o=0,i,c=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:a,value:f}=await s.next();if(a){c(),l.close();return}let d=f.byteLength;if(n){let m=o+=d;n(m)}l.enqueue(new Uint8Array(f))}catch(a){throw c(a),a}},cancel(l){return c(l),s.return()}},{highWaterMark:2})},st=64*1024,{isFunction:le}=u,Dr=(({Request:t,Response:e})=>({Request:t,Response:e}))(u.global),{ReadableStream:ot,TextEncoder:it}=u.global,at=(t,...e)=>{try{return!!t(...e)}catch{return!1}},es=t=>{t=u.merge.call({skipUndefined:!0},Dr,t);const{fetch:e,Request:n,Response:r}=t,s=e?le(e):typeof fetch=="function",o=le(n),i=le(r);if(!s)return!1;const c=s&&le(ot),l=s&&(typeof it=="function"?(p=>g=>p.encode(g))(new it):async p=>new Uint8Array(await new n(p).arrayBuffer())),a=o&&c&&at(()=>{let p=!1;const g=new n(C.origin,{body:new ot,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!g}),f=i&&c&&at(()=>u.isReadableStream(new r("").body)),d={stream:f&&(p=>p.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(g,h)=>{let b=g&&g[p];if(b)return b.call(g);throw new E(`Response type '${p}' is not supported`,E.ERR_NOT_SUPPORT,h)})});const m=async p=>{if(p==null)return 0;if(u.isBlob(p))return p.size;if(u.isSpecCompliantForm(p))return(await new n(C.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(u.isArrayBufferView(p)||u.isArrayBuffer(p))return p.byteLength;if(u.isURLSearchParams(p)&&(p=p+""),u.isString(p))return(await l(p)).byteLength},A=async(p,g)=>{const h=u.toFiniteNumber(p.getContentLength());return h??m(g)};return async p=>{let{url:g,method:h,data:b,signal:N,cancelToken:S,timeout:I,onDownloadProgress:U,onUploadProgress:H,responseType:x,headers:Re,withCredentials:ie="same-origin",fetchOptions:ve}=Lt(p),je=e||fetch;x=x?(x+"").toLowerCase():"text";let ae=Wr([N,S&&S.toAbortSignal()],I),Z=null;const z=ae&&ae.unsubscribe&&(()=>{ae.unsubscribe()});let Ve;try{if(H&&a&&h!=="get"&&h!=="head"&&(Ve=await A(Re,b))!==0){let j=new n(g,{method:"POST",body:b,duplex:"half"}),K;if(u.isFormData(b)&&(K=j.headers.get("content-type"))&&Re.setContentType(K),j.body){const[Ae,ce]=et(Ve,he(tt(H)));b=rt(j.body,st,Ae,ce)}}u.isString(ie)||(ie=ie?"include":"omit");const _=o&&"credentials"in n.prototype,He={...ve,signal:ae,method:h.toUpperCase(),headers:Re.normalize().toJSON(),body:b,duplex:"half",credentials:_?ie:void 0};Z=o&&new n(g,He);let v=await(o?je(Z,ve):je(g,He));const ze=f&&(x==="stream"||x==="response");if(f&&(U||ze&&z)){const j={};["status","statusText","headers"].forEach($e=>{j[$e]=v[$e]});const K=u.toFiniteNumber(v.headers.get("content-length")),[Ae,ce]=U&&et(K,he(tt(U),!0))||[];v=new r(rt(v.body,st,Ae,()=>{ce&&ce(),z&&z()}),j)}x=x||"text";let vt=await d[u.findKey(d,x)||"text"](v,p);return!ze&&z&&z(),await new Promise((j,K)=>{Pt(j,K,{data:vt,headers:L.from(v.headers),status:v.status,statusText:v.statusText,config:p,request:Z})})}catch(_){throw z&&z(),_&&_.name==="TypeError"&&/Load failed|fetch/i.test(_.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,p,Z,_&&_.response),{cause:_.cause||_}):E.from(_,_&&_.code,p,Z,_&&_.response)}}},ts=new Map,xt=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,o=[r,s,n];let i=o.length,c=i,l,a,f=ts;for(;c--;)l=o[c],a=f.get(l),a===void 0&&f.set(l,a=c?new Map:es(e)),f=a;return a};xt();const ke={http:yr,xhr:Kr,fetch:{get:xt}};u.forEach(ke,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ct=t=>`- ${t}`,ns=t=>u.isFunction(t)||t===null||t===!1;function rs(t,e){t=u.isArray(t)?t:[t];const{length:n}=t;let r,s;const o={};for(let i=0;i<n;i++){r=t[i];let c;if(s=r,!ns(r)&&(s=ke[(c=String(r)).toLowerCase()],s===void 0))throw new E(`Unknown adapter '${c}'`);if(s&&(u.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
|
|
7
|
+
`+i.map(ct).join(`
|
|
8
|
+
`):" "+ct(i[0]):"as no adapter specified";throw new E("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Mt={getAdapter:rs,adapters:ke};function Ce(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new oe(null,t)}function lt(t){return Ce(t),t.headers=L.from(t.headers),t.data=Ne.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Mt.getAdapter(t.adapter||se.adapter,t)(t).then(function(r){return Ce(t),r.data=Ne.call(t,t.transformResponse,r),r.headers=L.from(r.headers),r},function(r){return _t(r)||(Ce(t),r&&r.response&&(r.response.data=Ne.call(t,t.transformResponse,r.response),r.response.headers=L.from(r.response.headers))),Promise.reject(r)})}const Ut="1.13.5",we={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{we[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const ut={};we.transitional=function(e,n,r){function s(o,i){return"[Axios v"+Ut+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(e===!1)throw new E(s(i," has been removed"+(n?" in "+n:"")),E.ERR_DEPRECATED);return n&&!ut[i]&&(ut[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,i,c):!0}};we.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function ss(t,e,n){if(typeof t!="object")throw new E("options must be an object",E.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const o=r[s],i=e[o];if(i){const c=t[o],l=c===void 0||i(c,o,t);if(l!==!0)throw new E("option "+o+" must be "+l,E.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new E("Unknown option "+o,E.ERR_BAD_OPTION)}}const de={assertOptions:ss,validators:we},M=de.validators;let Y=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Qe,response:new Qe}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
9
|
+
`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=J(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&de.assertOptions(r,{silentJSONParsing:M.transitional(M.boolean),forcedJSONParsing:M.transitional(M.boolean),clarifyTimeoutError:M.transitional(M.boolean),legacyInterceptorReqResOrdering:M.transitional(M.boolean)},!1),s!=null&&(u.isFunction(s)?n.paramsSerializer={serialize:s}:de.assertOptions(s,{encode:M.function,serialize:M.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),de.assertOptions(n,{baseUrl:M.spelling("baseURL"),withXsrfToken:M.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&u.merge(o.common,o[n.method]);o&&u.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=L.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;l=l&&g.synchronous;const h=n.transitional||Ue;h&&h.legacyInterceptorReqResOrdering?c.unshift(g.fulfilled,g.rejected):c.push(g.fulfilled,g.rejected)});const a=[];this.interceptors.response.forEach(function(g){a.push(g.fulfilled,g.rejected)});let f,d=0,m;if(!l){const p=[lt.bind(this),void 0];for(p.unshift(...c),p.push(...a),m=p.length,f=Promise.resolve(n);d<m;)f=f.then(p[d++],p[d++]);return f}m=c.length;let A=n;for(;d<m;){const p=c[d++],g=c[d++];try{A=p(A)}catch(h){g.call(this,h);break}}try{f=lt.call(this,A)}catch(p){return Promise.reject(p)}for(d=0,m=a.length;d<m;)f=f.then(a[d++],a[d++]);return f}getUri(e){e=J(this.defaults,e);const n=Ft(e.baseURL,e.url,e.allowAbsoluteUrls);return Ot(n,e.params,e.paramsSerializer)}};u.forEach(["delete","get","head","options"],function(e){Y.prototype[e]=function(n,r){return this.request(J(r||{},{method:e,url:n,data:(r||{}).data}))}});u.forEach(["post","put","patch"],function(e){function n(r){return function(o,i,c){return this.request(J(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}Y.prototype[e]=n(),Y.prototype[e+"Form"]=n(!0)});let os=class Bt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},e(function(o,i,c){r.reason||(r.reason=new oe(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Bt(function(s){e=s}),cancel:e}}};function is(t){return function(n){return t.apply(null,n)}}function as(t){return u.isObject(t)&&t.isAxiosError===!0}const Le={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Le).forEach(([t,e])=>{Le[e]=t});function kt(t){const e=new Y(t),n=Et(Y.prototype.request,e);return u.extend(n,Y.prototype,e,{allOwnKeys:!0}),u.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return kt(J(t,s))},n}const R=kt(se);R.Axios=Y;R.CanceledError=oe;R.CancelToken=os;R.isCancel=_t;R.VERSION=Ut;R.toFormData=be;R.AxiosError=E;R.Cancel=R.CanceledError;R.all=function(e){return Promise.all(e)};R.spread=is;R.isAxiosError=as;R.mergeConfig=J;R.AxiosHeaders=L;R.formToJSON=t=>It(u.isHTMLForm(t)?new FormData(t):t);R.getAdapter=Mt.getAdapter;R.HttpStatusCode=Le;R.default=R;const{Axios:ds,AxiosError:ps,CanceledError:hs,isCancel:gs,CancelToken:Es,VERSION:ms,all:ys,Cancel:bs,isAxiosError:ws,spread:Rs,toFormData:As,AxiosHeaders:Ts,HttpStatusCode:Ss,formToJSON:Ns,getAdapter:Cs,mergeConfig:Os}=R;class cs{axiosInstance;companyService;constructor(e){const n=e.environment==="production"?"https://aiws.infocamere.it/aiws/rest":"https://aiwscl.infocamere.it/aiws/rest";this.axiosInstance=R.create({baseURL:n,headers:{username:e.username,password:e.password,Accept:"application/xml"},validateStatus:()=>!0}),this.companyService=new Ln(this.axiosInstance)}}exports.AIWSClient=cs;
|
|
10
10
|
//# sourceMappingURL=cciaa-service.cjs.map
|