@yanolja-next/ncp-bo-sdk 0.0.2 → 0.0.4
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/index.cjs +6 -1
- package/dist/index.js +2074 -17
- package/dist/src/index.d.ts +5 -0
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("axios"),i=require("path-to-regexp"),s="/services/:id/backoffice",u=i.match(s,{end:!1}),h=()=>{const e=u(window.location.pathname);return e?e.path:"/"},l=e=>`${e}-backoffice`,C=(e,t,r)=>{const n=c.create({baseURL:`${t}/services/${e}`,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}});return n.interceptors.request.use(a=>{a.headers["X-NCP-CLIENT-PROJECT-ID"]=d();const o=localStorage.getItem("session_token");return o&&(a.headers.Authorization=`Bearer ${o}`),a}),n},d=()=>{const t=new URLSearchParams(window.location.search).get("project-id");if(!t)throw new Error("Missing project ID");return t};exports.SERVICE_BACKOFFICE_ROUTE=s;exports.getApiClient=C;exports.getBasePath=h;exports.getComponentName=l;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function tt(e,t){return function(){return e.apply(t,arguments)}}const{toString:kt}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:ae,toStringTag:nt}=Symbol,ce=(e=>t=>{const n=kt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_=e=>(e=e.toLowerCase(),t=>ce(t)===e),ue=e=>t=>typeof t===e,{isArray:H}=Array,q=ue("undefined");function K(e){return e!==null&&!q(e)&&e.constructor!==null&&!q(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const rt=_("ArrayBuffer");function jt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&rt(e.buffer),t}const Bt=ue("string"),O=ue("function"),st=ue("number"),W=e=>e!==null&&typeof e=="object",$t=e=>e===!0||e===!1,ee=e=>{if(ce(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(nt in e)&&!(ae in e)},Mt=e=>{if(!W(e)||K(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},qt=_("Date"),Ht=_("File"),vt=_("Blob"),zt=_("FileList"),Jt=e=>W(e)&&O(e.pipe),Vt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||O(e.append)&&((t=ce(e))==="formdata"||t==="object"&&O(e.toString)&&e.toString()==="[object FormData]"))},Kt=_("URLSearchParams"),[Wt,Xt,Gt,Yt]=["ReadableStream","Request","Response","Headers"].map(_),Qt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function X(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),H(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(K(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(r=0;r<i;r++)a=o[r],t.call(null,e[a],a,e)}}function ot(e,t){if(K(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const B=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),it=e=>!q(e)&&e!==B;function Ee(){const{caseless:e,skipUndefined:t}=it(this)&&this||{},n={},r=(s,o)=>{const i=e&&ot(n,o)||o;ee(n[i])&&ee(s)?n[i]=Ee(n[i],s):ee(s)?n[i]=Ee({},s):H(s)?n[i]=s.slice():(!t||!q(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&X(arguments[s],r);return n}const Zt=(e,t,n,{allOwnKeys:r}={})=>(X(t,(s,o)=>{n&&O(s)?e[o]=tt(s,n):e[o]=s},{allOwnKeys:r}),e),en=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),tn=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},nn=(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&Re(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},rn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},sn=e=>{if(!e)return null;if(H(e))return e;let t=e.length;if(!st(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},on=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Re(Uint8Array)),an=(e,t)=>{const r=(e&&e[ae]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},cn=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},un=_("HTMLFormElement"),ln=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),$e=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),fn=_("RegExp"),at=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};X(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},dn=e=>{at(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(O(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},pn=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return H(e)?r(e):r(String(e).split(t)),n},hn=()=>{},mn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function yn(e){return!!(e&&O(e.append)&&e[nt]==="FormData"&&e[ae])}const wn=e=>{const t=new Array(10),n=(r,s)=>{if(W(r)){if(t.indexOf(r)>=0)return;if(K(r))return r;if(!("toJSON"in r)){t[s]=r;const o=H(r)?[]:{};return X(r,(i,a)=>{const d=n(i,s+1);!q(d)&&(o[a]=d)}),t[s]=void 0,o}}return r};return n(e,0)},En=_("AsyncFunction"),gn=e=>e&&(W(e)||O(e))&&O(e.then)&&O(e.catch),ct=((e,t)=>e?setImmediate:t?((n,r)=>(B.addEventListener("message",({source:s,data:o})=>{s===B&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),B.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",O(B.postMessage)),bn=typeof queueMicrotask<"u"?queueMicrotask.bind(B):typeof process<"u"&&process.nextTick||ct,Sn=e=>e!=null&&O(e[ae]),c={isArray:H,isArrayBuffer:rt,isBuffer:K,isFormData:Vt,isArrayBufferView:jt,isString:Bt,isNumber:st,isBoolean:$t,isObject:W,isPlainObject:ee,isEmptyObject:Mt,isReadableStream:Wt,isRequest:Xt,isResponse:Gt,isHeaders:Yt,isUndefined:q,isDate:qt,isFile:Ht,isBlob:vt,isRegExp:fn,isFunction:O,isStream:Jt,isURLSearchParams:Kt,isTypedArray:on,isFileList:zt,forEach:X,merge:Ee,extend:Zt,trim:Qt,stripBOM:en,inherits:tn,toFlatObject:nn,kindOf:ce,kindOfTest:_,endsWith:rn,toArray:sn,forEachEntry:an,matchAll:cn,isHTMLForm:un,hasOwnProperty:$e,hasOwnProp:$e,reduceDescriptors:at,freezeMethods:dn,toObjectSet:pn,toCamelCase:ln,noop:hn,toFiniteNumber:mn,findKey:ot,global:B,isContextDefined:it,isSpecCompliantForm:yn,toJSONObject:wn,isAsyncFn:En,isThenable:gn,setImmediate:ct,asap:bn,isIterable:Sn};function y(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}c.inherits(y,Error,{toJSON:function(){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:c.toJSONObject(this.config),code:this.code,status:this.status}}});const ut=y.prototype,lt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{lt[e]={value:e}});Object.defineProperties(y,lt);Object.defineProperty(ut,"isAxiosError",{value:!0});y.from=(e,t,n,r,s,o)=>{const i=Object.create(ut);c.toFlatObject(e,i,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return y.call(i,a,d,n,r,s),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const Rn=null;function ge(e){return c.isPlainObject(e)||c.isArray(e)}function ft(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function Me(e,t,n){return e?e.concat(t).map(function(s,o){return s=ft(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function Tn(e){return c.isArray(e)&&!e.some(ge)}const On=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function le(e,t,n){if(!c.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=c.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!c.isUndefined(h[m])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(c.isDate(f))return f.toISOString();if(c.isBoolean(f))return f.toString();if(!d&&c.isBlob(f))throw new y("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(f)||c.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,m,h){let b=f;if(f&&!h&&typeof f=="object"){if(c.endsWith(m,"{}"))m=r?m:m.slice(0,-2),f=JSON.stringify(f);else if(c.isArray(f)&&Tn(f)||(c.isFileList(f)||c.endsWith(m,"[]"))&&(b=c.toArray(f)))return m=ft(m),b.forEach(function(S,T){!(c.isUndefined(S)||S===null)&&t.append(i===!0?Me([m],T,o):i===null?m:m+"[]",u(S))}),!1}return ge(f)?!0:(t.append(Me(h,m,o),u(f)),!1)}const p=[],w=Object.assign(On,{defaultVisitor:l,convertValue:u,isVisitable:ge});function E(f,m){if(!c.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(f),c.forEach(f,function(b,A){(!(c.isUndefined(b)||b===null)&&s.call(t,b,c.isString(A)?A.trim():A,m,w))===!0&&E(b,m?m.concat(A):[A])}),p.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return E(e),t}function qe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Te(e,t){this._pairs=[],e&&le(e,this,t)}const dt=Te.prototype;dt.append=function(t,n){this._pairs.push([t,n])};dt.toString=function(t){const n=t?function(r){return t.call(this,r,qe)}:qe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function An(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function pt(e,t,n){if(!t)return e;const r=n&&n.encode||An;c.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=c.isURLSearchParams(t)?t.toString():new Te(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class xn{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(r){r!==null&&t(r)})}}const He=xn,ht={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Cn=typeof URLSearchParams<"u"?URLSearchParams:Te,Pn=typeof FormData<"u"?FormData:null,_n=typeof Blob<"u"?Blob:null,Nn={isBrowser:!0,classes:{URLSearchParams:Cn,FormData:Pn,Blob:_n},protocols:["http","https","file","blob","url","data"]},Oe=typeof window<"u"&&typeof document<"u",be=typeof navigator=="object"&&navigator||void 0,Fn=Oe&&(!be||["ReactNative","NativeScript","NS"].indexOf(be.product)<0),Un=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Ln=Oe&&window.location.href||"http://localhost",Dn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oe,hasStandardBrowserEnv:Fn,hasStandardBrowserWebWorkerEnv:Un,navigator:be,origin:Ln},Symbol.toStringTag,{value:"Module"})),R={...Dn,...Nn};function In(e,t){return le(e,new R.classes.URLSearchParams,{visitor:function(n,r,s,o){return R.isNode&&c.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function kn(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function jn(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function mt(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),d=o>=n.length;return i=!i&&c.isArray(s)?s.length:i,d?(c.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!c.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&c.isArray(s[i])&&(s[i]=jn(s[i])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const n={};return c.forEachEntry(e,(r,s)=>{t(kn(r),s,n,0)}),n}return null}function Bn(e,t,n){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ae={transitional:ht,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=c.isObject(t);if(o&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return s?JSON.stringify(mt(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return In(t,this.formSerializer).toString();if((a=c.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return le(a?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Bn(t)):t}],transformResponse:[function(t){const n=this.transitional||Ae.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?y.from(a,y.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:R.classes.FormData,Blob:R.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],e=>{Ae.headers[e]={}});const xe=Ae,$n=c.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"]),Mn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&$n[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},ve=Symbol("internals");function J(e){return e&&String(e).trim().toLowerCase()}function te(e){return e===!1||e==null?e:c.isArray(e)?e.map(te):String(e)}function qn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Hn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function me(e,t,n,r,s){if(c.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!c.isString(t)){if(c.isString(r))return t.indexOf(r)!==-1;if(c.isRegExp(r))return r.test(t)}}function vn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function zn(e,t){const n=c.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}class fe{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(a,d,u){const l=J(d);if(!l)throw new Error("header name must be a non-empty string");const p=c.findKey(s,l);(!p||s[p]===void 0||u===!0||u===void 0&&s[p]!==!1)&&(s[p||d]=te(a))}const i=(a,d)=>c.forEach(a,(u,l)=>o(u,l,d));if(c.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(c.isString(t)&&(t=t.trim())&&!Hn(t))i(Mn(t),n);else if(c.isObject(t)&&c.isIterable(t)){let a={},d,u;for(const l of t){if(!c.isArray(l))throw TypeError("Object iterator must return a key-value pair");a[u=l[0]]=(d=a[u])?c.isArray(d)?[...d,l[1]]:[d,l[1]]:l[1]}i(a,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=J(t),t){const r=c.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return qn(s);if(c.isFunction(n))return n.call(this,s,r);if(c.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=J(t),t){const r=c.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||me(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=J(i),i){const a=c.findKey(r,i);a&&(!n||me(r,r[a],a,n))&&(delete r[a],s=!0)}}return c.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||me(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return c.forEach(this,(s,o)=>{const i=c.findKey(r,o);if(i){n[i]=te(s),delete n[o];return}const a=t?vn(o):String(o).trim();a!==o&&delete n[o],n[a]=te(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return c.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&c.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[ve]=this[ve]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=J(i);r[a]||(zn(s,i),r[a]=!0)}return c.isArray(t)?t.forEach(o):o(t),this}}fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(fe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});c.freezeMethods(fe);const P=fe;function ye(e,t){const n=this||xe,r=t||n,s=P.from(r.headers);let o=r.data;return c.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function yt(e){return!!(e&&e.__CANCEL__)}function v(e,t,n){y.call(this,e??"canceled",y.ERR_CANCELED,t,n),this.name="CanceledError"}c.inherits(v,y,{__CANCEL__:!0});function wt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Jn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Vn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=r[o];i||(i=u),n[s]=d,r[s]=u;let p=o,w=0;for(;p!==s;)w+=n[p++],p=p%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const E=l&&u-l;return E?Math.round(w*1e3/E):void 0}}function Kn(e,t){let n=0,r=1e3/t,s,o;const i=(u,l=Date.now())=>{n=l,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),p=l-n;p>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-p)))},()=>s&&i(s)]}const oe=(e,t,n=3)=>{let r=0;const s=Vn(50,250);return Kn(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,d=i-r,u=s(d),l=i<=a;r=i;const p={loaded:i,total:a,progress:a?i/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(p)},n)},ze=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Je=e=>(...t)=>c.asap(()=>e(...t)),Wn=R.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,R.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(R.origin),R.navigator&&/(msie|trident)/i.test(R.navigator.userAgent)):()=>!0,Xn=R.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];c.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),c.isString(r)&&a.push(`path=${r}`),c.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),c.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Gn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Et(e,t,n){let r=!Gn(t);return e&&(r||n==!1)?Yn(e,t):t}const Ve=e=>e instanceof P?{...e}:e;function $(e,t){t=t||{};const n={};function r(u,l,p,w){return c.isPlainObject(u)&&c.isPlainObject(l)?c.merge.call({caseless:w},u,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function s(u,l,p,w){if(c.isUndefined(l)){if(!c.isUndefined(u))return r(void 0,u,p,w)}else return r(u,l,p,w)}function o(u,l){if(!c.isUndefined(l))return r(void 0,l)}function i(u,l){if(c.isUndefined(l)){if(!c.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function a(u,l,p){if(p in t)return r(u,l);if(p in e)return r(void 0,u)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,l,p)=>s(Ve(u),Ve(l),p,!0)};return c.forEach(Object.keys({...e,...t}),function(l){const p=d[l]||s,w=p(e[l],t[l],l);c.isUndefined(w)&&p!==a||(n[l]=w)}),n}const gt=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=P.from(i),t.url=pt(Et(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(n)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(c.isFunction(n.getHeaders)){const d=n.getHeaders(),u=["content-type","content-length"];Object.entries(d).forEach(([l,p])=>{u.includes(l.toLowerCase())&&i.set(l,p)})}}if(R.hasStandardBrowserEnv&&(r&&c.isFunction(r)&&(r=r(t)),r||r!==!1&&Wn(t.url))){const d=s&&o&&Xn.read(o);d&&i.set(s,d)}return t},Qn=typeof XMLHttpRequest<"u",Zn=Qn&&function(e){return new Promise(function(n,r){const s=gt(e);let o=s.data;const i=P.from(s.headers).normalize();let{responseType:a,onUploadProgress:d,onDownloadProgress:u}=s,l,p,w,E,f;function m(){E&&E(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function b(){if(!h)return;const S=P.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:e,request:h};wt(function(x){n(x),m()},function(x){r(x),m()},C),h=null}"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(b)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const C=T&&T.message?T.message:"Network Error",k=new y(C,y.ERR_NETWORK,e,h);k.event=T||null,r(k),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||ht;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new y(T,C.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&c.forEach(i.toJSON(),function(T,C){h.setRequestHeader(C,T)}),c.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),u&&([w,f]=oe(u,!0),h.addEventListener("progress",w)),d&&h.upload&&([p,E]=oe(d),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(l=S=>{h&&(r(!S||S.type?new v(null,e,h):S),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const A=Jn(s.url);if(A&&R.protocols.indexOf(A)===-1){r(new y("Unsupported protocol "+A+":",y.ERR_BAD_REQUEST,e));return}h.send(o||null)})},er=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,a();const l=u instanceof Error?u:this.reason;r.abort(l instanceof y?l:new v(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new y(`timeout ${t} of ms exceeded`,y.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:d}=r;return d.unsubscribe=()=>c.asap(a),d}},tr=er,nr=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},rr=async function*(e,t){for await(const n of sr(e))yield*nr(n,t)},sr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ke=(e,t,n,r)=>{const s=rr(e,t);let o=0,i,a=d=>{i||(i=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:u,value:l}=await s.next();if(u){a(),d.close();return}let p=l.byteLength;if(n){let w=o+=p;n(w)}d.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(d){return a(d),s.return()}},{highWaterMark:2})},We=64*1024,{isFunction:Z}=c,or=(({Request:e,Response:t})=>({Request:e,Response:t}))(c.global),{ReadableStream:Xe,TextEncoder:Ge}=c.global,Ye=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ir=e=>{e=c.merge.call({skipUndefined:!0},or,e);const{fetch:t,Request:n,Response:r}=e,s=t?Z(t):typeof fetch=="function",o=Z(n),i=Z(r);if(!s)return!1;const a=s&&Z(Xe),d=s&&(typeof Ge=="function"?(f=>m=>f.encode(m))(new Ge):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&a&&Ye(()=>{let f=!1;const m=new n(R.origin,{body:new Xe,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!m}),l=i&&a&&Ye(()=>c.isReadableStream(new r("").body)),p={stream:l&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!p[f]&&(p[f]=(m,h)=>{let b=m&&m[f];if(b)return b.call(m);throw new y(`Response type '${f}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const w=async f=>{if(f==null)return 0;if(c.isBlob(f))return f.size;if(c.isSpecCompliantForm(f))return(await new n(R.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(c.isArrayBufferView(f)||c.isArrayBuffer(f))return f.byteLength;if(c.isURLSearchParams(f)&&(f=f+""),c.isString(f))return(await d(f)).byteLength},E=async(f,m)=>{const h=c.toFiniteNumber(f.getContentLength());return h??w(m)};return async f=>{let{url:m,method:h,data:b,signal:A,cancelToken:S,timeout:T,onDownloadProgress:C,onUploadProgress:k,responseType:x,headers:pe,withCredentials:G="same-origin",fetchOptions:Le}=gt(f),De=t||fetch;x=x?(x+"").toLowerCase():"text";let Y=tr([A,S&&S.toAbortSignal()],T),z=null;const j=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let Ie;try{if(k&&u&&h!=="get"&&h!=="head"&&(Ie=await E(pe,b))!==0){let I=new n(m,{method:"POST",body:b,duplex:"half"}),M;if(c.isFormData(b)&&(M=I.headers.get("content-type"))&&pe.setContentType(M),I.body){const[he,Q]=ze(Ie,oe(Je(k)));b=Ke(I.body,We,he,Q)}}c.isString(G)||(G=G?"include":"omit");const N=o&&"credentials"in n.prototype,ke={...Le,signal:Y,method:h.toUpperCase(),headers:pe.normalize().toJSON(),body:b,duplex:"half",credentials:N?G:void 0};z=o&&new n(m,ke);let D=await(o?De(z,Le):De(m,ke));const je=l&&(x==="stream"||x==="response");if(l&&(C||je&&j)){const I={};["status","statusText","headers"].forEach(Be=>{I[Be]=D[Be]});const M=c.toFiniteNumber(D.headers.get("content-length")),[he,Q]=C&&ze(M,oe(Je(C),!0))||[];D=new r(Ke(D.body,We,he,()=>{Q&&Q(),j&&j()}),I)}x=x||"text";let It=await p[c.findKey(p,x)||"text"](D,f);return!je&&j&&j(),await new Promise((I,M)=>{wt(I,M,{data:It,headers:P.from(D.headers),status:D.status,statusText:D.statusText,config:f,request:z})})}catch(N){throw j&&j(),N&&N.name==="TypeError"&&/Load failed|fetch/i.test(N.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,f,z),{cause:N.cause||N}):y.from(N,N&&N.code,f,z)}}},ar=new Map,bt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,a=i,d,u,l=ar;for(;a--;)d=o[a],u=l.get(d),u===void 0&&l.set(d,u=a?new Map:ir(t)),l=u;return u};bt();const Ce={http:Rn,xhr:Zn,fetch:{get:bt}};c.forEach(Ce,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Qe=e=>`- ${e}`,cr=e=>c.isFunction(e)||e===null||e===!1;function ur(e,t){e=c.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let a;if(s=r,!cr(r)&&(s=Ce[(a=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${a}'`);if(s&&(c.isFunction(s)||(s=s.get(t))))break;o[a||"#"+i]=s}if(!s){const i=Object.entries(o).map(([d,u])=>`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
|
|
4
|
+
`+i.map(Qe).join(`
|
|
5
|
+
`):" "+Qe(i[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const St={getAdapter:ur,adapters:Ce};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new v(null,e)}function Ze(e){return we(e),e.headers=P.from(e.headers),e.data=ye.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),St.getAdapter(e.adapter||xe.adapter,e)(e).then(function(r){return we(e),r.data=ye.call(e,e.transformResponse,r),r.headers=P.from(r.headers),r},function(r){return yt(r)||(we(e),r&&r.response&&(r.response.data=ye.call(e,e.transformResponse,r.response),r.response.headers=P.from(r.response.headers))),Promise.reject(r)})}const Rt="1.13.1",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const et={};de.transitional=function(t,n,r){function s(o,i){return"[Axios v"+Rt+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(t===!1)throw new y(s(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!et[i]&&(et[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}};de.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function lr(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const a=e[o],d=a===void 0||i(a,o,e);if(d!==!0)throw new y("option "+o+" must be "+d,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+o,y.ERR_BAD_OPTION)}}const ne={assertOptions:lr,validators:de},F=ne.validators;class ie{constructor(t){this.defaults=t||{},this.interceptors={request:new He,response:new He}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ne.assertOptions(r,{silentJSONParsing:F.transitional(F.boolean),forcedJSONParsing:F.transitional(F.boolean),clarifyTimeoutError:F.transitional(F.boolean)},!1),s!=null&&(c.isFunction(s)?n.paramsSerializer={serialize:s}:ne.assertOptions(s,{encode:F.function,serialize:F.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ne.assertOptions(n,{baseUrl:F.spelling("baseURL"),withXsrfToken:F.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[n.method]);o&&c.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=P.concat(i,o);const a=[];let d=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(d=d&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,p=0,w;if(!d){const f=[Ze.bind(this),void 0];for(f.unshift(...a),f.push(...u),w=f.length,l=Promise.resolve(n);p<w;)l=l.then(f[p++],f[p++]);return l}w=a.length;let E=n;for(;p<w;){const f=a[p++],m=a[p++];try{E=f(E)}catch(h){m.call(this,h);break}}try{l=Ze.call(this,E)}catch(f){return Promise.reject(f)}for(p=0,w=u.length;p<w;)l=l.then(u[p++],u[p++]);return l}getUri(t){t=$(this.defaults,t);const n=Et(t.baseURL,t.url,t.allowAbsoluteUrls);return pt(n,t.params,t.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(t){ie.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}});c.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,a){return this.request($(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ie.prototype[t]=n(),ie.prototype[t+"Form"]=n(!0)});const re=ie;class Pe{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new v(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Pe(function(s){t=s}),cancel:t}}}const fr=Pe;function dr(e){return function(n){return e.apply(null,n)}}function pr(e){return c.isObject(e)&&e.isAxiosError===!0}const Se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Se).forEach(([e,t])=>{Se[t]=e});const hr=Se;function Tt(e){const t=new re(e),n=tt(re.prototype.request,t);return c.extend(n,re.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Tt($(e,s))},n}const g=Tt(xe);g.Axios=re;g.CanceledError=v;g.CancelToken=fr;g.isCancel=yt;g.VERSION=Rt;g.toFormData=le;g.AxiosError=y;g.Cancel=g.CanceledError;g.all=function(t){return Promise.all(t)};g.spread=dr;g.isAxiosError=pr;g.mergeConfig=$;g.AxiosHeaders=P;g.formToJSON=e=>mt(c.isHTMLForm(e)?new FormData(e):e);g.getAdapter=St.getAdapter;g.HttpStatusCode=hr;g.default=g;const mr=g;var L={};Object.defineProperty(L,"__esModule",{value:!0});L.PathError=L.TokenData=void 0;L.parse=Ue;L.compile=gr;var yr=L.match=Sr;L.pathToRegexp=Ct;L.stringify=Or;const _e="/",Ne=e=>e,Ot=/^[$_\p{ID_Start}]$/u,Fe=/^[$\u200c\u200d\p{ID_Continue}]$/u,wr={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function Er(e){return e.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}function U(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class At{constructor(t,n){this.tokens=t,this.originalPath=n}}L.TokenData=At;class V extends TypeError{constructor(t,n){let r=t;n&&(r+=`: ${n}`),r+="; visit https://git.new/pathToRegexpError for info",super(r),this.originalPath=n}}L.PathError=V;function Ue(e,t={}){const{encodePath:n=Ne}=t,r=[...e],s=[];let o=0,i=0;function a(){let u="";if(Ot.test(r[o]))do u+=r[o++];while(Fe.test(r[o]));else if(r[o]==='"'){let l=o;for(;o++<r.length;){if(r[o]==='"'){o++,l=0;break}r[o]==="\\"&&o++,u+=r[o]}if(l)throw new V(`Unterminated quote at index ${l}`,e)}if(!u)throw new V(`Missing parameter name at index ${o}`,e);return u}for(;o<r.length;){const u=r[o],l=wr[u];l?s.push({type:l,index:o++,value:u}):u==="\\"?s.push({type:"escape",index:o++,value:r[o++]}):u===":"?s.push({type:"param",index:o++,value:a()}):u==="*"?s.push({type:"wildcard",index:o++,value:a()}):s.push({type:"char",index:o++,value:u})}s.push({type:"end",index:o,value:""});function d(u){const l=[];for(;;){const p=s[i++];if(p.type===u)break;if(p.type==="char"||p.type==="escape"){let w=p.value,E=s[i];for(;E.type==="char"||E.type==="escape";)w+=E.value,E=s[++i];l.push({type:"text",value:n(w)});continue}if(p.type==="param"||p.type==="wildcard"){l.push({type:p.type,name:p.value});continue}if(p.type==="{"){l.push({type:"group",tokens:d("}")});continue}throw new V(`Unexpected ${p.type} at index ${p.index}, expected ${u}`,e)}return l}return new At(d("end"),e)}function gr(e,t={}){const{encode:n=encodeURIComponent,delimiter:r=_e}=t,s=typeof e=="object"?e:Ue(e,t),o=xt(s.tokens,r,n);return function(a={}){const[d,...u]=o(a);if(u.length)throw new TypeError(`Missing parameters: ${u.join(", ")}`);return d}}function xt(e,t,n){const r=e.map(s=>br(s,t,n));return s=>{const o=[""];for(const i of r){const[a,...d]=i(s);o[0]+=a,o.push(...d)}return o}}function br(e,t,n){if(e.type==="text")return()=>[e.value];if(e.type==="group"){const s=xt(e.tokens,t,n);return o=>{const[i,...a]=s(o);return a.length?[""]:[i]}}const r=n||Ne;return e.type==="wildcard"&&n!==!1?s=>{const o=s[e.name];if(o==null)return["",e.name];if(!Array.isArray(o)||o.length===0)throw new TypeError(`Expected "${e.name}" to be a non-empty array`);return[o.map((i,a)=>{if(typeof i!="string")throw new TypeError(`Expected "${e.name}/${a}" to be a string`);return r(i)}).join(t)]}:s=>{const o=s[e.name];if(o==null)return["",e.name];if(typeof o!="string")throw new TypeError(`Expected "${e.name}" to be a string`);return[r(o)]}}function Sr(e,t={}){const{decode:n=decodeURIComponent,delimiter:r=_e}=t,{regexp:s,keys:o}=Ct(e,t),i=o.map(a=>n===!1?Ne:a.type==="param"?n:d=>d.split(r).map(n));return function(d){const u=s.exec(d);if(!u)return!1;const l=u[0],p=Object.create(null);for(let w=1;w<u.length;w++){if(u[w]===void 0)continue;const E=o[w-1],f=i[w-1];p[E.name]=f(u[w])}return{path:l,params:p}}}function Ct(e,t={}){const{delimiter:n=_e,end:r=!0,sensitive:s=!1,trailing:o=!0}=t,i=[],a=s?"":"i",d=[];for(const p of Pt(e,[])){const w=typeof p=="object"?p:Ue(p,t);for(const E of se(w.tokens,0,[]))d.push(Rr(E,n,i,w.originalPath))}let u=`^(?:${d.join("|")})`;return o&&(u+=`(?:${U(n)}$)?`),u+=r?"$":`(?=${U(n)}|$)`,{regexp:new RegExp(u,a),keys:i}}function Pt(e,t){if(Array.isArray(e))for(const n of e)Pt(n,t);else t.push(e);return t}function*se(e,t,n){if(t===e.length)return yield n;const r=e[t];if(r.type==="group")for(const s of se(r.tokens,0,n.slice()))yield*se(e,t+1,s);else n.push(r);yield*se(e,t+1,n)}function Rr(e,t,n,r){let s="",o="",i=!0;for(const a of e){if(a.type==="text"){s+=U(a.value),o+=a.value,i||(i=a.value.includes(t));continue}if(a.type==="param"||a.type==="wildcard"){if(!i&&!o)throw new V(`Missing text before "${a.name}" ${a.type}`,r);a.type==="param"?s+=`(${Tr(t,i?"":o)}+)`:s+="([\\s\\S]+)",n.push(a),o="",i=!1;continue}}return s}function Tr(e,t){return t.length<2?e.length<2?`[^${U(e+t)}]`:`(?:(?!${U(e)})[^${U(t)}])`:e.length<2?`(?:(?!${U(t)})[^${U(e)}])`:`(?:(?!${U(t)}|${U(e)})[\\s\\S])`}function _t(e){let t="",n=0;function r(s){return Ar(s)&&xr(e[n])?s:JSON.stringify(s)}for(;n<e.length;){const s=e[n++];if(s.type==="text"){t+=Er(s.value);continue}if(s.type==="group"){t+=`{${_t(s.tokens)}}`;continue}if(s.type==="param"){t+=`:${r(s.name)}`;continue}if(s.type==="wildcard"){t+=`*${r(s.name)}`;continue}throw new TypeError(`Unknown token type: ${s.type}`)}return t}function Or(e){return _t(e.tokens)}function Ar(e){const[t,...n]=e;return Ot.test(t)&&n.every(r=>Fe.test(r))}function xr(e){return e&&e.type==="text"?!Fe.test(e.value[0]):!0}const Nt="/services/:id/backoffice",Ft="READY",Ut="INIT",Lt="INIT_ERROR";class Cr{constructor(){this.context=null}set(t){this.context=t}get(){return this.context}}const Dt=new Cr,Pr=(e,t=1e4)=>new Promise((n,r)=>{const s=setTimeout(()=>{window.removeEventListener("message",o),r(new Error("Timeout waiting for context"))},t),o=i=>{var a;!e.includes(i.origin)||((a=i.data)==null?void 0:a.type)!==Ut||typeof i.data.token!="string"||typeof i.data.projectId!="string"||(clearTimeout(s),window.removeEventListener("message",o),Dt.set({token:i.data.token,projectId:i.data.projectId}),n())};window.addEventListener("message",o);for(const i of e)window.parent.postMessage({type:Ft},i)}),_r=(e,t)=>{for(const n of t)window.parent.postMessage({type:Lt,message:e},n)},Nr=yr(Nt,{end:!1}),Fr=()=>{const e=Nr(window.location.pathname);return e?e.path:"/"},Ur=e=>`${e}-backoffice`,Lr="X-NCP-CLIENT-PROJECT-ID",Dr=(e,t,n)=>{const r=mr.create({baseURL:`${t}/services/${e}`,headers:{"Content-Type":"application/json",...n==null?void 0:n.headers}});return r.interceptors.request.use(s=>{const o=Dt.get(),i=(o==null?void 0:o.projectId)??Ir(),a=(o==null?void 0:o.token)??localStorage.getItem("session_token");return s.headers[Lr]=i,a&&(s.headers.Authorization=`Bearer ${a}`),s}),r},Ir=()=>{const t=new URLSearchParams(window.location.search).get("project-id");if(!t)throw new Error("Missing project ID");return t};exports.INIT_ERROR_MESSAGE_TYPE=Lt;exports.INIT_MESSAGE_TYPE=Ut;exports.READY_MESSAGE_TYPE=Ft;exports.SERVICE_BACKOFFICE_ROUTE=Nt;exports.getApiClient=Dr;exports.getBasePath=Fr;exports.getComponentName=Ur;exports.notifyInitError=_r;exports.waitForContext=Pr;
|