@likable-hair/cciaa-service 0.0.13 → 0.0.15
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 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
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.",b("InvalidTag",d,I(t,o))}const a=Jt(t,o);if(a===!1)return b("InvalidAttr","Attributes for '"+l+"' have open quote.",I(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 E=Je(f,e);if(E===!0)r=!0;else return b(E.err.code,E.err.msg,I(t,d+E.err.line))}else if(c)if(a.tagClosed){if(f.trim().length>0)return b("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",I(t,i));if(n.length===0)return b("InvalidTag","Closing tag '"+l+"' has not been opened.",I(t,i));{const d=n.pop();if(l!==d.tagName){let E=I(t,d.tagStartPos);return b("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+E.line+", col "+E.col+") instead of closing tag '"+l+"'.",I(t,i))}n.length==0&&(s=!0)}}else return b("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",I(t,o));else{const d=Je(f,e);if(d!==!0)return b(d.err.code,d.err.msg,I(t,o-f.length+d.err.line));if(s===!0)return b("InvalidXml","Multiple possible root nodes found.",I(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 b("InvalidChar","char '&' is not expected.",I(t,o));o=d}else if(s===!0&&!qe(t[o]))return b("InvalidXml","Extra text at the end",I(t,o));t[o]==="<"&&o--}}else{if(qe(t[o]))continue;return b("InvalidChar","char '"+t[o]+"' is not expected.",I(t,o))}if(r){if(n.length==1)return b("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",I(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 qe(t){return t===" "||t===" "||t===`
|
|
3
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 b("InvalidXml","XML declaration allowed only at the start of the document.",I(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 b("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 b("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Q(n[s]));if(n[s][3]===void 0&&!e.allowBooleanAttributes)return b("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Q(n[s]));const o=n[s][2];if(!Zt(o))return b("InvalidAttr","Attribute '"+o+"' is an invalid name.",Q(n[s]));if(!Object.prototype.hasOwnProperty.call(r,o))r[o]=1;else return b("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 b(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 I(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=F(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)r+=e[n],n++;if(D(r),n=F(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=F(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;!this.suppressValidationErr&&D(r),n=F(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=F(e,n);let o=null,i=null;if(s==="PUBLIC")[n,o]=this.readIdentifierVal(e,n,"publicIdentifier"),n=F(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=F(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=F(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=F(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;D(r),n=F(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=F(e,n);let o="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=F(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=F(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=F(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 F=(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=En,this.isItStopNode=An,this.replaceEntitiesValue=Rn,this.readStopNodeData=Tn,this.saveTextToParentTag=wn,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 mn=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function En(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=dt(t,mn),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 E=a.indexOf(":");E!==-1&&(a=a.substr(E+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,E=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 C=this.readStopNodeData(t,f,A+1);if(!C)throw new Error(`Unexpected end of ${f}`);i=C.i,h=C.tagContent}const y=new V(a);a!==d&&E&&(y[":@"]=this.buildAttributesMap(d,s,a)),h&&(h=this.parseTextData(h,a,s,!0,E,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),y.add(this.options.textNodeName,h),this.addChild(n,y,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 y=this.options.transformTagName(a);d===a&&(d=y),a=y}const h=new V(a);a!==d&&E&&(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&&E&&(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&&E&&(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 Rn=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 wn(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 Nn(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=Nn(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 Tn(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 Ne=V.getMetaDataSymbol();function Sn(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[Ne]!==void 0&&typeof a=="object"&&a!==null&&(a[Ne]=i[Ne]),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:Sn(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 w=(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))(w||{});const N={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 quote societarie: 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:"Impossibile recuperare i dati finanziari. Errore nel recupero del file XBRL.",XBRL_DECODE_ERROR:"Impossibile recuperare i dati finanziari. Errore nella decodifica del file XBRL.",XBRL_MAPPING_ERROR:"Impossibile recuperare i dati finanziari. Errore nella mappaggio del file XBRL.",INSUFFICIENT_CREDIT:"Credito insufficiente per procedere"};function T(t,e,n,r){t.push({code:e,fields:n,message:r})}class _n{async mapAnagraficaImpresaToCompanySummary(e,n=[]){return e?(e.Denominazione||T(n,w.COMPANY_SUMMARY_FETCH_FAILED,["companyName"],N.COMPANY_SUMMARY_FETCH_FAILED),e.PIva||T(n,w.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],N.COMPANY_SUMMARY_FETCH_FAILED),e.Cciaa||T(n,w.COMPANY_SUMMARY_FETCH_FAILED,[],N.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,w.COMPANY_SUMMARY_FETCH_FAILED,[],N.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,w.XBRL_EMPTY,["companyProfit","companyRevenue"],N.XBRL_EMPTY),null;let s;try{s=Buffer.from(r,"base64").toString("utf-8")}catch(f){return console.log(f),T(n,w.XBRL_DECODE_ERROR,["companyProfit","companyRevenue"],N.XBRL_DECODE_ERROR),null}const o=new gt({ignoreAttributes:!1,attributeNamePrefix:""});let i;try{i=o.parse(s)}catch(f){return console.log(f),T(n,w.XML_PARSE_ERROR,["companyProfit","companyRevenue"],N.XML_PARSE_ERROR),null}if(!i?.xbrl)return T(n,w.XBRL_MAPPING_ERROR,["companyProfit","companyRevenue"],N.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}}const Fn={PERSONA:"person",AZIENDA:"company",ALTRO:"other"};class Ln{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:Fn[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 xn{constructor(e){this.client=e}parser=new gt({ignoreAttributes:!1,attributeNamePrefix:""});checkResponseStatus(e,n){switch(e){case 200:return!0;case 402:return T(n,w.INSUFFICIENT_CREDIT,[],N.INSUFFICIENT_CREDIT),!1;case 404:return T(n,w.COMPANY_NOT_FOUND,[],N.COMPANY_NOT_FOUND),!1;case 503:return T(n,w.SERVICE_UNAVAILABLE,[],N.SERVICE_UNAVAILABLE),!1;case 500:return T(n,w.HTTP_ERROR,[],N.HTTP_ERROR),!1;default:return T(n,w.HTTP_ERROR,[],N.HTTP_ERROR),!1}}parseXml(e,n){try{return this.parser.parse(e)}catch(r){return console.log(r),T(n,w.XML_PARSE_ERROR,[],N.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,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,w.COMPANY_NOT_FOUND,["vatNumber"],N.COMPANY_NOT_FOUND),null)}catch(r){return console.log(r),T(n,w.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],N.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,n))return null;const s=this.parseXml(r.data,n);return s?await new Pn().getFinancialValues(s,n):null}catch(r){return console.log(r),T(n,w.FINANCIALS_FETCH_FAILED,["vatNumber"],N.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,r))return[];const o=this.parseXml(s.data,r);if(!o)return[];const i=new Ln,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 console.log(s),T(r,w.SHARES_FETCH_FAILED,["companyShares"],N.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,w.MISSING_CCIAA_OR_REA,[],N.MISSING_CCIAA_OR_REA),{...r,...s,companyShares:o,aiwsError:n}}}function mt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Mn}=Object.prototype,{getPrototypeOf:xe}=Object,{iterator:me,toStringTag:Et}=Symbol,Ee=(t=>e=>{const n=Mn.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),v=t=>(t=t.toLowerCase(),e=>Ee(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)&&L(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const yt=v("ArrayBuffer");function Un(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&yt(t.buffer),e}const Bn=ye("string"),L=ye("function"),bt=ye("number"),ne=t=>t!==null&&typeof t=="object",vn=t=>t===!0||t===!1,ue=t=>{if(Ee(t)!=="object")return!1;const e=xe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Et in t)&&!(me 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}},jn=v("Date"),Vn=v("File"),Hn=v("Blob"),zn=v("FileList"),$n=t=>ne(t)&&L(t.pipe),qn=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||L(t.append)&&((e=Ee(t))==="formdata"||e==="object"&&L(t.toString)&&t.toString()==="[object FormData]"))},Xn=v("URLSearchParams"),[Yn,Jn,Kn,Wn]=["ReadableStream","Request","Response","Headers"].map(v),Gn=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 Rt(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,wt=t=>!W(t)&&t!==X;function _e(){const{caseless:t,skipUndefined:e}=wt(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Rt(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 Zn=(t,e,n,{allOwnKeys:r}={})=>(re(e,(s,o)=>{n&&L(s)?Object.defineProperty(t,o,{value:mt(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),Qn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Dn=(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)},er=(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},tr=(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},nr=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},rr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&xe(Uint8Array)),sr=(t,e)=>{const r=(t&&t[me]).call(t);let s;for(;(s=r.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},or=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},ir=v("HTMLFormElement"),ar=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),cr=v("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)},lr=t=>{At(t,(e,n)=>{if(L(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(L(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+"'")})}})},ur=(t,e)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return G(t)?r(t):r(String(t).split(e)),n},fr=()=>{},dr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function pr(t){return!!(t&&L(t.append)&&t[Et]==="FormData"&&t[me])}const hr=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)},gr=v("AsyncFunction"),mr=t=>t&&(ne(t)||L(t))&&L(t.then)&&L(t.catch),Nt=((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",L(X.postMessage)),Er=typeof queueMicrotask<"u"?queueMicrotask.bind(X):typeof process<"u"&&process.nextTick||Nt,yr=t=>t!=null&&L(t[me]),u={isArray:G,isArrayBuffer:yt,isBuffer:te,isFormData:qn,isArrayBufferView:Un,isString:Bn,isNumber:bt,isBoolean:vn,isObject:ne,isPlainObject:ue,isEmptyObject:kn,isReadableStream:Yn,isRequest:Jn,isResponse:Kn,isHeaders:Wn,isUndefined:W,isDate:jn,isFile:Vn,isBlob:Hn,isRegExp:cr,isFunction:L,isStream:$n,isURLSearchParams:Xn,isTypedArray:rr,isFileList:zn,forEach:re,merge:_e,extend:Zn,trim:Gn,stripBOM:Qn,inherits:Dn,toFlatObject:er,kindOf:Ee,kindOfTest:v,endsWith:tr,toArray:nr,forEachEntry:sr,matchAll:or,isHTMLForm:ir,hasOwnProperty:We,hasOwnProp:We,reduceDescriptors:At,freezeMethods:lr,toObjectSet:ur,toCamelCase:ar,noop:fr,toFiniteNumber:dr,findKey:Rt,global:X,isContextDefined:wt,isSpecCompliantForm:pr,toJSONObject:hr,isAsyncFn:gr,isThenable:mr,setImmediate:Nt,asap:Er,isIterable:yr};let m=class Tt extends Error{static from(e,n,r,s,o,i){const c=new Tt(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}}};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 br=null;function Pe(t){return u.isPlainObject(t)||u.isArray(t)}function St(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=St(s),!n&&o?"["+s+"]":s}).join(n?".":""):e}function Rr(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 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 y=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)&&Rr(p)||(u.isFileList(p)||u.endsWith(g,"[]"))&&(y=u.toArray(p)))return g=St(g),y.forEach(function(S,_){!(u.isUndefined(S)||S===null)&&e.append(i===!0?Ge([g],_,o):i===null?g:g+"[]",a(S))}),!1}return Pe(p)?!0:(e.append(Ge(h,g,o),a(p)),!1)}const d=[],E=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(y,C){(!(u.isUndefined(y)||y===null)&&s.call(e,y,u.isString(C)?C.trim():C,g,E))===!0&&A(y,g?g.concat(C):[C])}),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 Ar(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||Ar,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},Nr=typeof URLSearchParams<"u"?URLSearchParams:Me,Tr=typeof FormData<"u"?FormData:null,Sr=typeof Blob<"u"?Blob:null,Cr={isBrowser:!0,classes:{URLSearchParams:Nr,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,Or=Be&&(!Fe||["ReactNative","NativeScript","NS"].indexOf(Fe.product)<0),Ir=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_r=Be&&window.location.href||"http://localhost",Pr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Be,hasStandardBrowserEnv:Or,hasStandardBrowserWebWorkerEnv:Ir,navigator:Fe,origin:_r},Symbol.toStringTag,{value:"Module"})),O={...Pr,...Cr};function Fr(t,e){return be(t,new O.classes.URLSearchParams,{visitor:function(n,r,s,o){return O.isNode&&u.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Lr(t){return u.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function xr(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]=xr(s[i])),!c)}if(u.isFormData(t)&&u.isFunction(t.entries)){const n={};return u.forEachEntry(t,(r,s)=>{e(Lr(r),s,n,0)}),n}return null}function Mr(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 Fr(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),Mr(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"?m.from(c,m.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:O.classes.FormData,Blob:O.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 Ur=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"]),Br=t=>{const e={};let n,r,s;return t&&t.split(`
|
|
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 E=a.indexOf(":");E!==-1&&(a=a.substr(E+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,E=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 C=this.readStopNodeData(t,f,A+1);if(!C)throw new Error(`Unexpected end of ${f}`);i=C.i,h=C.tagContent}const y=new V(a);a!==d&&E&&(y[":@"]=this.buildAttributesMap(d,s,a)),h&&(h=this.parseTextData(h,a,s,!0,E,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),y.add(this.options.textNodeName,h),this.addChild(n,y,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 y=this.options.transformTagName(a);d===a&&(d=y),a=y}const h=new V(a);a!==d&&E&&(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&&E&&(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&&E&&(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 Rn=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 wn(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 Nn(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=Nn(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 Tn(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 Ne=V.getMetaDataSymbol();function Sn(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[Ne]!==void 0&&typeof a=="object"&&a!==null&&(a[Ne]=i[Ne]),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:Sn(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 w=(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))(w||{});const N={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 quote societarie: 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:"Impossibile recuperare i dati finanziari. Errore nel recupero del file XBRL.",XBRL_DECODE_ERROR:"Impossibile recuperare i dati finanziari. Errore nella decodifica del file XBRL.",XBRL_MAPPING_ERROR:"Impossibile recuperare i dati finanziari. Errore nella mappaggio del file XBRL.",INSUFFICIENT_CREDIT:"Credito insufficiente per procedere"};function T(t,e,n,r){t.push({code:e,fields:n,message:r})}class _n{async mapAnagraficaImpresaToCompanySummary(e,n=[]){return e?(e.Denominazione||T(n,w.COMPANY_SUMMARY_FETCH_FAILED,["companyName"],N.COMPANY_SUMMARY_FETCH_FAILED),e.PIva||T(n,w.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],N.COMPANY_SUMMARY_FETCH_FAILED),e.Cciaa||T(n,w.COMPANY_SUMMARY_FETCH_FAILED,[],N.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,w.COMPANY_SUMMARY_FETCH_FAILED,[],N.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,w.XBRL_EMPTY,["companyProfit","companyRevenue"],N.XBRL_EMPTY),null;let s;try{s=Buffer.from(r,"base64").toString("utf-8")}catch(f){return console.log(f),T(n,w.XBRL_DECODE_ERROR,["companyProfit","companyRevenue"],N.XBRL_DECODE_ERROR),null}const o=new gt({ignoreAttributes:!1,attributeNamePrefix:""});let i;try{i=o.parse(s)}catch(f){return console.log(f),T(n,w.XML_PARSE_ERROR,["companyProfit","companyRevenue"],N.XML_PARSE_ERROR),null}if(!i?.xbrl)return T(n,w.XBRL_MAPPING_ERROR,["companyProfit","companyRevenue"],N.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}}const Fn={PERSONA:"person",IMPRESA:"company",ALTRO:"other"};class Ln{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:Fn[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 xn{constructor(e){this.client=e}parser=new gt({ignoreAttributes:!1,attributeNamePrefix:""});checkResponseStatus(e,n){switch(e){case 200:return!0;case 402:return T(n,w.INSUFFICIENT_CREDIT,[],N.INSUFFICIENT_CREDIT),!1;case 404:return T(n,w.COMPANY_NOT_FOUND,[],N.COMPANY_NOT_FOUND),!1;case 503:return T(n,w.SERVICE_UNAVAILABLE,[],N.SERVICE_UNAVAILABLE),!1;case 500:return T(n,w.HTTP_ERROR,[],N.HTTP_ERROR),!1;default:return T(n,w.HTTP_ERROR,[],N.HTTP_ERROR),!1}}parseXml(e,n){try{return this.parser.parse(e)}catch(r){return console.log(r),T(n,w.XML_PARSE_ERROR,[],N.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,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,w.COMPANY_NOT_FOUND,["vatNumber"],N.COMPANY_NOT_FOUND),null)}catch(r){return console.log(r),T(n,w.COMPANY_SUMMARY_FETCH_FAILED,["vatNumber"],N.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,n))return null;const s=this.parseXml(r.data,n);return s?await new Pn().getFinancialValues(s,n):null}catch(r){return console.log(r),T(n,w.FINANCIALS_FETCH_FAILED,["vatNumber"],N.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,r))return[];const o=this.parseXml(s.data,r);if(!o)return[];const i=new Ln,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 console.log(s),T(r,w.SHARES_FETCH_FAILED,["companyShares"],N.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,w.MISSING_CCIAA_OR_REA,[],N.MISSING_CCIAA_OR_REA),{...r,...s,companyShares:o,aiwsError:n}}}function mt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Mn}=Object.prototype,{getPrototypeOf:xe}=Object,{iterator:me,toStringTag:Et}=Symbol,Ee=(t=>e=>{const n=Mn.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),v=t=>(t=t.toLowerCase(),e=>Ee(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)&&L(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const yt=v("ArrayBuffer");function Un(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&yt(t.buffer),e}const Bn=ye("string"),L=ye("function"),bt=ye("number"),ne=t=>t!==null&&typeof t=="object",vn=t=>t===!0||t===!1,ue=t=>{if(Ee(t)!=="object")return!1;const e=xe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Et in t)&&!(me 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}},jn=v("Date"),Vn=v("File"),Hn=v("Blob"),zn=v("FileList"),$n=t=>ne(t)&&L(t.pipe),qn=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||L(t.append)&&((e=Ee(t))==="formdata"||e==="object"&&L(t.toString)&&t.toString()==="[object FormData]"))},Xn=v("URLSearchParams"),[Yn,Jn,Kn,Wn]=["ReadableStream","Request","Response","Headers"].map(v),Gn=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 Rt(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,wt=t=>!W(t)&&t!==X;function _e(){const{caseless:t,skipUndefined:e}=wt(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Rt(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 Zn=(t,e,n,{allOwnKeys:r}={})=>(re(e,(s,o)=>{n&&L(s)?Object.defineProperty(t,o,{value:mt(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),Qn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Dn=(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)},er=(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},tr=(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},nr=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},rr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&xe(Uint8Array)),sr=(t,e)=>{const r=(t&&t[me]).call(t);let s;for(;(s=r.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},or=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},ir=v("HTMLFormElement"),ar=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),cr=v("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)},lr=t=>{At(t,(e,n)=>{if(L(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(L(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+"'")})}})},ur=(t,e)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return G(t)?r(t):r(String(t).split(e)),n},fr=()=>{},dr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function pr(t){return!!(t&&L(t.append)&&t[Et]==="FormData"&&t[me])}const hr=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)},gr=v("AsyncFunction"),mr=t=>t&&(ne(t)||L(t))&&L(t.then)&&L(t.catch),Nt=((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",L(X.postMessage)),Er=typeof queueMicrotask<"u"?queueMicrotask.bind(X):typeof process<"u"&&process.nextTick||Nt,yr=t=>t!=null&&L(t[me]),u={isArray:G,isArrayBuffer:yt,isBuffer:te,isFormData:qn,isArrayBufferView:Un,isString:Bn,isNumber:bt,isBoolean:vn,isObject:ne,isPlainObject:ue,isEmptyObject:kn,isReadableStream:Yn,isRequest:Jn,isResponse:Kn,isHeaders:Wn,isUndefined:W,isDate:jn,isFile:Vn,isBlob:Hn,isRegExp:cr,isFunction:L,isStream:$n,isURLSearchParams:Xn,isTypedArray:rr,isFileList:zn,forEach:re,merge:_e,extend:Zn,trim:Gn,stripBOM:Qn,inherits:Dn,toFlatObject:er,kindOf:Ee,kindOfTest:v,endsWith:tr,toArray:nr,forEachEntry:sr,matchAll:or,isHTMLForm:ir,hasOwnProperty:We,hasOwnProp:We,reduceDescriptors:At,freezeMethods:lr,toObjectSet:ur,toCamelCase:ar,noop:fr,toFiniteNumber:dr,findKey:Rt,global:X,isContextDefined:wt,isSpecCompliantForm:pr,toJSONObject:hr,isAsyncFn:gr,isThenable:mr,setImmediate:Nt,asap:Er,isIterable:yr};let m=class Tt extends Error{static from(e,n,r,s,o,i){const c=new Tt(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}}};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 br=null;function Pe(t){return u.isPlainObject(t)||u.isArray(t)}function St(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=St(s),!n&&o?"["+s+"]":s}).join(n?".":""):e}function Rr(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 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 y=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)&&Rr(p)||(u.isFileList(p)||u.endsWith(g,"[]"))&&(y=u.toArray(p)))return g=St(g),y.forEach(function(S,_){!(u.isUndefined(S)||S===null)&&e.append(i===!0?Ge([g],_,o):i===null?g:g+"[]",a(S))}),!1}return Pe(p)?!0:(e.append(Ge(h,g,o),a(p)),!1)}const d=[],E=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(y,C){(!(u.isUndefined(y)||y===null)&&s.call(e,y,u.isString(C)?C.trim():C,g,E))===!0&&A(y,g?g.concat(C):[C])}),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 Ar(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||Ar,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},Nr=typeof URLSearchParams<"u"?URLSearchParams:Me,Tr=typeof FormData<"u"?FormData:null,Sr=typeof Blob<"u"?Blob:null,Cr={isBrowser:!0,classes:{URLSearchParams:Nr,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,Or=Be&&(!Fe||["ReactNative","NativeScript","NS"].indexOf(Fe.product)<0),Ir=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_r=Be&&window.location.href||"http://localhost",Pr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Be,hasStandardBrowserEnv:Or,hasStandardBrowserWebWorkerEnv:Ir,navigator:Fe,origin:_r},Symbol.toStringTag,{value:"Module"})),O={...Pr,...Cr};function Fr(t,e){return be(t,new O.classes.URLSearchParams,{visitor:function(n,r,s,o){return O.isNode&&u.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Lr(t){return u.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function xr(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]=xr(s[i])),!c)}if(u.isFormData(t)&&u.isFunction(t.entries)){const n={};return u.forEachEntry(t,(r,s)=>{e(Lr(r),s,n,0)}),n}return null}function Mr(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 Fr(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),Mr(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"?m.from(c,m.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:O.classes.FormData,Blob:O.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 Ur=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"]),Br=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]&&Ur[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 vr(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 Te(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 jr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Vr(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(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(Br(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 vr(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||Te(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||Te(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||Te(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?jr(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
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]||(Vr(s,i),r[c]=!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 Se(t,e){const n=this||se,r=e||n,s=x.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 m{constructor(e,n,r){super(e??"canceled",m.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 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 Hr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function zr(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,E=0;for(;d!==s;)E+=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(E*1e3/A):void 0}}function $r(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=zr(50,250);return $r(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)),qr=O.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,O.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(O.origin),O.navigator&&/(msie|trident)/i.test(O.navigator.userAgent)):()=>!0,Xr=O.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 Yr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Jr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ft(t,e,n){let r=!Yr(e);return t&&(r||n==!1)?Jr(t,e):e}const nt=t=>t instanceof x?{...t}:t;function J(t,e){e=e||{};const n={};function r(a,f,d,E){return u.isPlainObject(a)&&u.isPlainObject(f)?u.merge.call({caseless:E},a,f):u.isPlainObject(f)?u.merge({},f):u.isArray(f)?f.slice():f}function s(a,f,d,E){if(u.isUndefined(f)){if(!u.isUndefined(a))return r(void 0,a,d,E)}else return r(a,f,d,E)}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,E=d(t[f],e[f],f);u.isUndefined(E)&&d!==c||(n[f]=E)}),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=x.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(O.hasStandardBrowserEnv||O.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(O.hasStandardBrowserEnv&&(r&&u.isFunction(r)&&(r=r(e)),r||r!==!1&&qr(e.url))){const l=s&&o&&Xr.read(o);l&&i.set(s,l)}return e},Kr=typeof XMLHttpRequest<"u",Wr=Kr&&function(t){return new Promise(function(n,r){const s=Lt(t);let o=s.data;const i=x.from(s.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:a}=s,f,d,E,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 y(){if(!h)return;const S=x.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),B={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:t,request:h};Pt(function(M){n(M),g()},function(M){r(M),g()},B),h=null}"onloadend"in h?h.onloadend=y:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(y)},h.onabort=function(){h&&(r(new m("Request aborted",m.ECONNABORTED,t,h)),h=null)},h.onerror=function(_){const B=_&&_.message?_.message:"Network Error",H=new m(B,m.ERR_NETWORK,t,h);H.event=_||null,r(H),h=null},h.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const B=s.transitional||Ue;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new m(_,B.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&u.forEach(i.toJSON(),function(_,B){h.setRequestHeader(B,_)}),u.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),a&&([E,p]=he(a,!0),h.addEventListener("progress",E)),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 C=Hr(s.url);if(C&&O.protocols.indexOf(C)===-1){r(new m("Unsupported protocol "+C+":",m.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Gr=(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 m?f:new oe(f instanceof Error?f.message:f))}};let i=e&&setTimeout(()=>{i=null,o(new m(`timeout of ${e}ms exceeded`,m.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}},Zr=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},Qr=async function*(t,e){for await(const n of Dr(t))yield*Zr(n,e)},Dr=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=Qr(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 E=o+=d;n(E)}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,es=(({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}},ts=t=>{t=u.merge.call({skipUndefined:!0},es,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(O.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 y=g&&g[p];if(y)return y.call(g);throw new m(`Response type '${p}' is not supported`,m.ERR_NOT_SUPPORT,h)})});const E=async p=>{if(p==null)return 0;if(u.isBlob(p))return p.size;if(u.isSpecCompliantForm(p))return(await new n(O.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??E(g)};return async p=>{let{url:g,method:h,data:y,signal:C,cancelToken:S,timeout:_,onDownloadProgress:B,onUploadProgress:H,responseType:M,headers:we,withCredentials:ie="same-origin",fetchOptions:ke}=Lt(p),je=e||fetch;M=M?(M+"").toLowerCase():"text";let ae=Gr([C,S&&S.toAbortSignal()],_),Z=null;const z=ae&&ae.unsubscribe&&(()=>{ae.unsubscribe()});let Ve;try{if(H&&a&&h!=="get"&&h!=="head"&&(Ve=await A(we,y))!==0){let j=new n(g,{method:"POST",body:y,duplex:"half"}),K;if(u.isFormData(y)&&(K=j.headers.get("content-type"))&&we.setContentType(K),j.body){const[Ae,ce]=et(Ve,he(tt(H)));y=rt(j.body,st,Ae,ce)}}u.isString(ie)||(ie=ie?"include":"omit");const P=o&&"credentials"in n.prototype,He={...ke,signal:ae,method:h.toUpperCase(),headers:we.normalize().toJSON(),body:y,duplex:"half",credentials:P?ie:void 0};Z=o&&new n(g,He);let k=await(o?je(Z,ke):je(g,He));const ze=f&&(M==="stream"||M==="response");if(f&&(B||ze&&z)){const j={};["status","statusText","headers"].forEach($e=>{j[$e]=k[$e]});const K=u.toFiniteNumber(k.headers.get("content-length")),[Ae,ce]=B&&et(K,he(tt(B),!0))||[];k=new r(rt(k.body,st,Ae,()=>{ce&&ce(),z&&z()}),j)}M=M||"text";let kt=await d[u.findKey(d,M)||"text"](k,p);return!ze&&z&&z(),await new Promise((j,K)=>{Pt(j,K,{data:kt,headers:x.from(k.headers),status:k.status,statusText:k.statusText,config:p,request:Z})})}catch(P){throw z&&z(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,p,Z,P&&P.response),{cause:P.cause||P}):m.from(P,P&&P.code,p,Z,P&&P.response)}}},ns=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=ns;for(;c--;)l=o[c],a=f.get(l),a===void 0&&f.set(l,a=c?new Map:ts(e)),f=a;return a};xt();const ve={http:br,xhr:Wr,fetch:{get:xt}};u.forEach(ve,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ct=t=>`- ${t}`,rs=t=>u.isFunction(t)||t===null||t===!1;function ss(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,!rs(r)&&(s=ve[(c=String(r)).toLowerCase()],s===void 0))throw new m(`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
7
|
`+i.map(ct).join(`
|