@likable-hair/cciaa-service 0.0.7 → 0.0.8
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=":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",kt=ct+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Mt="["+ct+"]["+kt+"]*",vt=new RegExp("^"+Mt+"$");function lt(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 de=function(t){const e=vt.exec(t);return!(e===null||typeof e>"u")};function jt(t){return typeof t<"u"}const $t={allowBooleanAttributes:!1,unpairedTags:[]};function Vt(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=ze(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=qe(t,o);continue}else{let a=!1;t[o]==="/"&&(a=!0,o++);let l="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
|
|
2
2
|
`&&t[o]!=="\r";o++)l+=t[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!Yt(l)){let d;return l.trim().length===0?d="Invalid space after '<'.":d="Tag '"+l+"' is an invalid name.",b("InvalidTag",d,A(t,o))}const c=Ht(t,o);if(c===!1)return b("InvalidAttr","Attributes for '"+l+"' have open quote.",A(t,o));let f=c.value;if(o=c.index,f[f.length-1]==="/"){const d=o-f.length;f=f.substring(0,f.length-1);const y=He(f,e);if(y===!0)r=!0;else return b(y.err.code,y.err.msg,A(t,d+y.err.line))}else if(a)if(c.tagClosed){if(f.trim().length>0)return b("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",A(t,i));if(n.length===0)return b("InvalidTag","Closing tag '"+l+"' has not been opened.",A(t,i));{const d=n.pop();if(l!==d.tagName){let y=A(t,d.tagStartPos);return b("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+y.line+", col "+y.col+") instead of closing tag '"+l+"'.",A(t,i))}n.length==0&&(s=!0)}}else return b("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",A(t,o));else{const d=He(f,e);if(d!==!0)return b(d.err.code,d.err.msg,A(t,o-f.length+d.err.line));if(s===!0)return b("InvalidXml","Multiple possible root nodes found.",A(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=qe(t,o);continue}else if(t[o+1]==="?"){if(o=ze(t,++o),o.err)return o}else break;else if(t[o]==="&"){const d=Wt(t,o);if(d==-1)return b("InvalidChar","char '&' is not expected.",A(t,o));o=d}else if(s===!0&&!Ve(t[o]))return b("InvalidXml","Extra text at the end",A(t,o));t[o]==="<"&&o--}}else{if(Ve(t[o]))continue;return b("InvalidChar","char '"+t[o]+"' is not expected.",A(t,o))}if(r){if(n.length==1)return b("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",A(t,n[0].tagStartPos));if(n.length>0)return b("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return b("InvalidXml","Start tag expected.",1);return!0}function Ve(t){return t===" "||t===" "||t===`
|
|
3
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(`
|
|
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=[];const 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
5
|
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&_r[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Ze=Symbol("internals");function G(t){return t&&String(t).trim().toLowerCase()}function ce(t){return t===!1||t==null?t:u.isArray(t)?t.map(ce):String(t)}function Lr(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 Br=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 Ur(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function kr(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 x=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function o(a,l,c){const f=G(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||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=ce(a))}const i=(a,l)=>u.forEach(a,(c,f)=>o(c,f,l));if(u.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(u.isString(e)&&(e=e.trim())&&!Br(e))i(Fr(e),n);else if(u.isObject(e)&&u.isIterable(e)){let a={},l,c;for(const f of e){if(!u.isArray(f))throw TypeError("Object iterator must return a key-value pair");a[c=f[0]]=(l=a[c])?u.isArray(l)?[...l,f[1]]:[l,f[1]]:f[1]}i(a,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=G(e),e){const r=u.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return Lr(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=G(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=G(i),i){const a=u.findKey(r,i);a&&(!n||Se(r,r[a],a,n))&&(delete r[a],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]=ce(s),delete n[o];return}const a=e?Ur(o):String(o).trim();a!==o&&delete n[o],n[a]=ce(s),r[a]=!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
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
7
|
`+i.map(ot).join(`
|