@enviabybus/react-utility-belt 2.3.1 → 2.4.1
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/chunks/{services.helper.D025rU8I.js → services.helper.BhBSTY1M.js} +149 -148
- package/dist/chunks/services.helper.DolZWkEs.js +47 -0
- package/dist/errors.cjs.js +2 -2
- package/dist/errors.es.js +45 -25
- package/dist/helpers.cjs.js +1 -1
- package/dist/helpers.es.js +5 -4
- package/dist/services.cjs.js +7 -7
- package/dist/services.es.js +1214 -1123
- package/dist/src/errors/graphql.error.d.ts +24 -0
- package/dist/src/errors/graphql.error.d.ts.map +1 -0
- package/dist/src/errors/index.d.ts +1 -0
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/helpers/http.helper.d.ts +1 -0
- package/dist/src/helpers/http.helper.d.ts.map +1 -1
- package/dist/src/services/graphql.service.d.ts +19 -0
- package/dist/src/services/graphql.service.d.ts.map +1 -0
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/services.d.ts +9 -9
- package/dist/src/services/services.d.ts.map +1 -1
- package/dist/src/types/helpers.d.ts +3 -0
- package/dist/src/types/helpers.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunks/services.helper.DlU_zXxQ.js +0 -47
package/dist/services.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./chunks/services.helper.DlU_zXxQ.js"),$=require("react"),Xe=require("react/jsx-runtime"),Ze=require("@tanstack/react-query"),N=require("./errors.cjs.js"),Nt=e=>({...t})=>e(t),Ft=({useAdapter:e,LoggerService:t})=>ee("ERROR_SERVICE",Nt(e),[t.ServiceProvider]),Ut=()=>({LoggerService:e})=>{const t=G(e),r=$.useRef({}),n=(c,f)=>{const l=r.current;r.current={...l,[c]:[...l[c]||[],f]}},s=(c,f)=>{const l=r.current;r.current={...l,[c]:l[c].filter(a=>a!==f)}};return{raiseError:c=>{var f;t.error(c),(f=r.current[c.code])==null||f.forEach(l=>l(c))},useErrorHandler:(c,f)=>{const l=L.compilerRuntimeExports.c(4);let a,p;l[0]!==f||l[1]!==c?(a=()=>(n(c,f),()=>{s(c,f)}),p=[c,f],l[0]=f,l[1]=c,l[2]=a,l[3]=p):(a=l[2],p=l[3]),$.useEffect(a,p)}}},kt=e=>({ErrorService:t,LoggerService:r})=>{const n=e(),s=G(r),o=G(t),i=E=>{const b=L.lodashExports.omitBy(E,L.lodashExports.isNil);s.info(`HTTP request: ${JSON.stringify(b)}`)},c=E=>{const{body:b,status:S}=E;s.info(`HTTP response: ${JSON.stringify({body:b,status:S})}`)},f=E=>E>=400&&E<600,l=E=>{const{details:b,message:S}=E;return o.raiseError(new N.HttpServiceError({code:N.HttpServiceErrorCode.Unauthorized,details:b,message:S}))},a=E=>{const{status:b}=E.details||{};if(!b||b>=500){const S=JSON.stringify(E);s.error(S)}else{if(b===401)return l(E);s.warn(E)}return o.raiseError(E)},p=async(E,b,S={})=>{i({method:E,...b});let T,O;const P=A=>{if(A instanceof N.HttpServiceError){O=A;return}T=A};switch(E){case"GET":{P(await n.get(b,S));break}case"DELETE":{P(await n.delete(b,S));break}case"PATCH":{P(await n.patch(b,S));break}case"POST":{P(await n.post(b,S));break}case"PUT":{P(await n.put(b,S));break}default:throw Error(`Unknown method HTTP method '${E}'`)}if(O)throw a(O),O;return T?(c(T),f(T.status)&&a(new N.HttpServiceError({details:{body:JSON.stringify(T.body),method:E,status:T.status,url:b.url}})),T):void 0};return{delete:(E,b={})=>p("DELETE",E,b),get:(E,b={})=>p("GET",E,b),patch:(E,b={})=>p("PATCH",E,b),post:async(E,b={})=>await p("POST",E,b),put:(E,b={})=>p("PUT",E,b)}},Bt=({useAdapter:e,ErrorService:t,LoggerService:r})=>ee("HTTP_SERVICE",kt(e),[t.ServiceProvider,r.ServiceProvider]);function Ye(e,t){return function(){return e.apply(t,arguments)}}const{toString:Dt}=Object.prototype,{getPrototypeOf:Te}=Object,{iterator:ue,toStringTag:et}=Symbol,le=(e=>t=>{const r=Dt.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),F=e=>(e=e.toLowerCase(),t=>le(t)===e),fe=e=>t=>typeof t===e,{isArray:J}=Array,z=fe("undefined");function Q(e){return e!==null&&!z(e)&&e.constructor!==null&&!z(e.constructor)&&x(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tt=F("ArrayBuffer");function _t(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tt(e.buffer),t}const Mt=fe("string"),x=fe("function"),rt=fe("number"),X=e=>e!==null&&typeof e=="object",Ht=e=>e===!0||e===!1,oe=e=>{if(le(e)!=="object")return!1;const t=Te(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(et in e)&&!(ue in e)},qt=e=>{if(!X(e)||Q(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jt=F("Date"),It=F("File"),$t=F("Blob"),zt=F("FileList"),Jt=e=>X(e)&&x(e.pipe),Kt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||x(e.append)&&((t=le(e))==="formdata"||t==="object"&&x(e.toString)&&e.toString()==="[object FormData]"))},Wt=F("URLSearchParams"),[Vt,Gt,Qt,Xt]=["ReadableStream","Request","Response","Headers"].map(F),Zt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),J(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Q(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(n=0;n<i;n++)c=o[n],t.call(null,e[c],c,e)}}function nt(e,t){if(Q(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const M=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,st=e=>!z(e)&&e!==M;function be(){const{caseless:e,skipUndefined:t}=st(this)&&this||{},r={},n=(s,o)=>{const i=e&&nt(r,o)||o;oe(r[i])&&oe(s)?r[i]=be(r[i],s):oe(s)?r[i]=be({},s):J(s)?r[i]=s.slice():(!t||!z(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Z(arguments[s],n);return r}const Yt=(e,t,r,{allOwnKeys:n}={})=>(Z(t,(s,o)=>{r&&x(s)?e[o]=Ye(s,r):e[o]=s},{allOwnKeys:n}),e),er=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),tr=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},rr=(e,t,r,n)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!n||n(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&Te(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},nr=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},sr=e=>{if(!e)return null;if(J(e))return e;let t=e.length;if(!rt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},or=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Te(Uint8Array)),ir=(e,t)=>{const n=(e&&e[ue]).call(e);let s;for(;(s=n.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},ar=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},cr=F("HTMLFormElement"),ur=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),Be=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),lr=F("RegExp"),ot=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Z(r,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(n[o]=i||s)}),Object.defineProperties(e,n)},fr=e=>{ot(e,(t,r)=>{if(x(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(x(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},dr=(e,t)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return J(e)?n(e):n(String(e).split(t)),r},pr=()=>{},hr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function mr(e){return!!(e&&x(e.append)&&e[et]==="FormData"&&e[ue])}const yr=e=>{const t=new Array(10),r=(n,s)=>{if(X(n)){if(t.indexOf(n)>=0)return;if(Q(n))return n;if(!("toJSON"in n)){t[s]=n;const o=J(n)?[]:{};return Z(n,(i,c)=>{const f=r(i,s+1);!z(f)&&(o[c]=f)}),t[s]=void 0,o}}return n};return r(e,0)},Er=F("AsyncFunction"),gr=e=>e&&(X(e)||x(e))&&x(e.then)&&x(e.catch),it=((e,t)=>e?setImmediate:t?((r,n)=>(M.addEventListener("message",({source:s,data:o})=>{s===M&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),M.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",x(M.postMessage)),br=typeof queueMicrotask<"u"?queueMicrotask.bind(M):typeof process<"u"&&process.nextTick||it,wr=e=>e!=null&&x(e[ue]),u={isArray:J,isArrayBuffer:tt,isBuffer:Q,isFormData:Kt,isArrayBufferView:_t,isString:Mt,isNumber:rt,isBoolean:Ht,isObject:X,isPlainObject:oe,isEmptyObject:qt,isReadableStream:Vt,isRequest:Gt,isResponse:Qt,isHeaders:Xt,isUndefined:z,isDate:jt,isFile:It,isBlob:$t,isRegExp:lr,isFunction:x,isStream:Jt,isURLSearchParams:Wt,isTypedArray:or,isFileList:zt,forEach:Z,merge:be,extend:Yt,trim:Zt,stripBOM:er,inherits:tr,toFlatObject:rr,kindOf:le,kindOfTest:F,endsWith:nr,toArray:sr,forEachEntry:ir,matchAll:ar,isHTMLForm:cr,hasOwnProperty:Be,hasOwnProp:Be,reduceDescriptors:ot,freezeMethods:fr,toObjectSet:dr,toCamelCase:ur,noop:pr,toFiniteNumber:hr,findKey:nt,global:M,isContextDefined:st,isSpecCompliantForm:mr,toJSONObject:yr,isAsyncFn:Er,isThenable:gr,setImmediate:it,asap:br,isIterable:wr};function g(e,t,r,n,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),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}u.inherits(g,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:u.toJSONObject(this.config),code:this.code,status:this.status}}});const at=g.prototype,ct={};["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=>{ct[e]={value:e}});Object.defineProperties(g,ct);Object.defineProperty(at,"isAxiosError",{value:!0});g.from=(e,t,r,n,s,o)=>{const i=Object.create(at);u.toFlatObject(e,i,function(a){return a!==Error.prototype},l=>l!=="isAxiosError");const c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return g.call(i,c,f,r,n,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 Sr=null;function we(e){return u.isPlainObject(e)||u.isArray(e)}function ut(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function De(e,t,r){return e?e.concat(t).map(function(s,o){return s=ut(s),!r&&o?"["+s+"]":s}).join(r?".":""):t}function Rr(e){return u.isArray(e)&&!e.some(we)}const Tr=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function de(e,t,r){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=u.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!u.isUndefined(h[m])});const n=r.metaTokens,s=r.visitor||a,o=r.dots,i=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(u.isDate(d))return d.toISOString();if(u.isBoolean(d))return d.toString();if(!f&&u.isBlob(d))throw new g("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(d)||u.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function a(d,m,h){let E=d;if(d&&!h&&typeof d=="object"){if(u.endsWith(m,"{}"))m=n?m:m.slice(0,-2),d=JSON.stringify(d);else if(u.isArray(d)&&Rr(d)||(u.isFileList(d)||u.endsWith(m,"[]"))&&(E=u.toArray(d)))return m=ut(m),E.forEach(function(S,T){!(u.isUndefined(S)||S===null)&&t.append(i===!0?De([m],T,o):i===null?m:m+"[]",l(S))}),!1}return we(d)?!0:(t.append(De(h,m,o),l(d)),!1)}const p=[],y=Object.assign(Tr,{defaultVisitor:a,convertValue:l,isVisitable:we});function w(d,m){if(!u.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(d),u.forEach(d,function(E,b){(!(u.isUndefined(E)||E===null)&&s.call(t,E,u.isString(b)?b.trim():b,m,y))===!0&&w(E,m?m.concat(b):[b])}),p.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return w(e),t}function _e(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Oe(e,t){this._pairs=[],e&&de(e,this,t)}const lt=Oe.prototype;lt.append=function(t,r){this._pairs.push([t,r])};lt.toString=function(t){const r=t?function(n){return t.call(this,n,_e)}:_e;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Or(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(e,t,r){if(!t)return e;const n=r&&r.encode||Or;u.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let o;if(s?o=s(t,r):o=u.isURLSearchParams(t)?t.toString():new Oe(t,r).toString(n),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Me{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){u.forEach(this.handlers,function(n){n!==null&&t(n)})}}const dt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ar=typeof URLSearchParams<"u"?URLSearchParams:Oe,vr=typeof FormData<"u"?FormData:null,xr=typeof Blob<"u"?Blob:null,Cr={isBrowser:!0,classes:{URLSearchParams:Ar,FormData:vr,Blob:xr},protocols:["http","https","file","blob","url","data"]},Ae=typeof window<"u"&&typeof document<"u",Se=typeof navigator=="object"&&navigator||void 0,Pr=Ae&&(!Se||["ReactNative","NativeScript","NS"].indexOf(Se.product)<0),Lr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Nr=Ae&&window.location.href||"http://localhost",Fr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ae,hasStandardBrowserEnv:Pr,hasStandardBrowserWebWorkerEnv:Lr,navigator:Se,origin:Nr},Symbol.toStringTag,{value:"Module"})),v={...Fr,...Cr};function Ur(e,t){return de(e,new v.classes.URLSearchParams,{visitor:function(r,n,s,o){return v.isNode&&u.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function kr(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Br(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}function pt(e){function t(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=o>=r.length;return i=!i&&u.isArray(s)?s.length:i,f?(u.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!u.isObject(s[i]))&&(s[i]=[]),t(r,n,s[i],o)&&u.isArray(s[i])&&(s[i]=Br(s[i])),!c)}if(u.isFormData(e)&&u.isFunction(e.entries)){const r={};return u.forEachEntry(e,(n,s)=>{t(kr(n),s,r,0)}),r}return null}function Dr(e,t,r){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Y={transitional:dt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=u.isObject(t);if(o&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return s?JSON.stringify(pt(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Ur(t,this.formSerializer).toString();if((c=u.isFileList(t))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return de(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Dr(t)):t}],transformResponse:[function(t){const r=this.transitional||Y.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.isString(t)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:v.classes.FormData,Blob:v.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],e=>{Y.headers[e]={}});const _r=u.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Mr=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
2
|
-
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||t[r]&&
|
|
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,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[He]=this[He]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=V(i);n[c]||(Ir(s,i),n[c]=!0)}return u.isArray(t)?t.forEach(o):o(t),this}};C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);u.reduceDescriptors(C.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});u.freezeMethods(C);function Ee(e,t){const r=this||Y,n=t||r,s=C.from(n.headers);let o=n.data;return u.forEach(e,function(c){o=c.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function ht(e){return!!(e&&e.__CANCEL__)}function K(e,t,r){g.call(this,e??"canceled",g.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(K,g,{__CANCEL__:!0});function mt(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function $r(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zr(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),a=n[o];i||(i=l),r[s]=f,n[s]=l;let p=o,y=0;for(;p!==s;)y+=r[p++],p=p%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),l-i<t)return;const w=a&&l-a;return w?Math.round(y*1e3/w):void 0}}function Jr(e,t){let r=0,n=1e3/t,s,o;const i=(l,a=Date.now())=>{r=a,s=null,o&&(clearTimeout(o),o=null),e(...l)};return[(...l)=>{const a=Date.now(),p=a-r;p>=n?i(l,a):(s=l,o||(o=setTimeout(()=>{o=null,i(s)},n-p)))},()=>s&&i(s)]}const ce=(e,t,r=3)=>{let n=0;const s=zr(50,250);return Jr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,f=i-n,l=s(f),a=i<=c;n=i;const p={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&a?(c-i)/l:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},r)},qe=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},je=e=>(...t)=>u.asap(()=>e(...t)),Kr=v.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,v.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(v.origin),v.navigator&&/(msie|trident)/i.test(v.navigator.userAgent)):()=>!0,Wr=v.hasStandardBrowserEnv?{write(e,t,r,n,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];u.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),u.isString(n)&&c.push(`path=${n}`),u.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),u.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.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 Vr(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Gr(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function yt(e,t,r){let n=!Vr(t);return e&&(n||r==!1)?Gr(e,t):t}const Ie=e=>e instanceof C?{...e}:e;function q(e,t){t=t||{};const r={};function n(l,a,p,y){return u.isPlainObject(l)&&u.isPlainObject(a)?u.merge.call({caseless:y},l,a):u.isPlainObject(a)?u.merge({},a):u.isArray(a)?a.slice():a}function s(l,a,p,y){if(u.isUndefined(a)){if(!u.isUndefined(l))return n(void 0,l,p,y)}else return n(l,a,p,y)}function o(l,a){if(!u.isUndefined(a))return n(void 0,a)}function i(l,a){if(u.isUndefined(a)){if(!u.isUndefined(l))return n(void 0,l)}else return n(void 0,a)}function c(l,a,p){if(p in t)return n(l,a);if(p in e)return n(void 0,l)}const f={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:(l,a,p)=>s(Ie(l),Ie(a),p,!0)};return u.forEach(Object.keys({...e,...t}),function(a){const p=f[a]||s,y=p(e[a],t[a],a);u.isUndefined(y)&&p!==c||(r[a]=y)}),r}const Et=e=>{const t=q({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=C.from(i),t.url=ft(yt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),u.isFormData(r)){if(v.hasStandardBrowserEnv||v.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(u.isFunction(r.getHeaders)){const f=r.getHeaders(),l=["content-type","content-length"];Object.entries(f).forEach(([a,p])=>{l.includes(a.toLowerCase())&&i.set(a,p)})}}if(v.hasStandardBrowserEnv&&(n&&u.isFunction(n)&&(n=n(t)),n||n!==!1&&Kr(t.url))){const f=s&&o&&Wr.read(o);f&&i.set(s,f)}return t},Qr=typeof XMLHttpRequest<"u",Xr=Qr&&function(e){return new Promise(function(r,n){const s=Et(e);let o=s.data;const i=C.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=s,a,p,y,w,d;function m(){w&&w(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(a),s.signal&&s.signal.removeEventListener("abort",a)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function E(){if(!h)return;const S=C.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),O={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:e,request:h};mt(function(A){r(A),m()},function(A){n(A),m()},O),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const O=T&&T.message?T.message:"Network Error",P=new g(O,g.ERR_NETWORK,e,h);P.event=T||null,n(P),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||dt;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),n(new g(T,O.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&u.forEach(i.toJSON(),function(T,O){h.setRequestHeader(O,T)}),u.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),l&&([y,d]=ce(l,!0),h.addEventListener("progress",y)),f&&h.upload&&([p,w]=ce(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(a=S=>{h&&(n(!S||S.type?new K(null,e,h):S),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(a),s.signal&&(s.signal.aborted?a():s.signal.addEventListener("abort",a)));const b=$r(s.url);if(b&&v.protocols.indexOf(b)===-1){n(new g("Unsupported protocol "+b+":",g.ERR_BAD_REQUEST,e));return}h.send(o||null)})},Zr=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,s;const o=function(l){if(!s){s=!0,c();const a=l instanceof Error?l:this.reason;n.abort(a instanceof g?a:new K(a instanceof Error?a.message:a))}};let i=t&&setTimeout(()=>{i=null,o(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));const{signal:f}=n;return f.unsubscribe=()=>u.asap(c),f}},Yr=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},en=async function*(e,t){for await(const r of tn(e))yield*Yr(r,t)},tn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},$e=(e,t,r,n)=>{const s=en(e,t);let o=0,i,c=f=>{i||(i=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:l,value:a}=await s.next();if(l){c(),f.close();return}let p=a.byteLength;if(r){let y=o+=p;r(y)}f.enqueue(new Uint8Array(a))}catch(l){throw c(l),l}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},ze=64*1024,{isFunction:se}=u,rn=(({Request:e,Response:t})=>({Request:e,Response:t}))(u.global),{ReadableStream:Je,TextEncoder:Ke}=u.global,We=(e,...t)=>{try{return!!e(...t)}catch{return!1}},nn=e=>{e=u.merge.call({skipUndefined:!0},rn,e);const{fetch:t,Request:r,Response:n}=e,s=t?se(t):typeof fetch=="function",o=se(r),i=se(n);if(!s)return!1;const c=s&&se(Je),f=s&&(typeof Ke=="function"?(d=>m=>d.encode(m))(new Ke):async d=>new Uint8Array(await new r(d).arrayBuffer())),l=o&&c&&We(()=>{let d=!1;const m=new r(v.origin,{body:new Je,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!m}),a=i&&c&&We(()=>u.isReadableStream(new n("").body)),p={stream:a&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(m,h)=>{let E=m&&m[d];if(E)return E.call(m);throw new g(`Response type '${d}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const y=async d=>{if(d==null)return 0;if(u.isBlob(d))return d.size;if(u.isSpecCompliantForm(d))return(await new r(v.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(u.isArrayBufferView(d)||u.isArrayBuffer(d))return d.byteLength;if(u.isURLSearchParams(d)&&(d=d+""),u.isString(d))return(await f(d)).byteLength},w=async(d,m)=>{const h=u.toFiniteNumber(d.getContentLength());return h??y(m)};return async d=>{let{url:m,method:h,data:E,signal:b,cancelToken:S,timeout:T,onDownloadProgress:O,onUploadProgress:P,responseType:A,headers:he,withCredentials:te="same-origin",fetchOptions:Pe}=Et(d),Le=t||fetch;A=A?(A+"").toLowerCase():"text";let re=Zr([b,S&&S.toAbortSignal()],T),W=null;const _=re&&re.unsubscribe&&(()=>{re.unsubscribe()});let Ne;try{if(P&&l&&h!=="get"&&h!=="head"&&(Ne=await w(he,E))!==0){let D=new r(m,{method:"POST",body:E,duplex:"half"}),I;if(u.isFormData(E)&&(I=D.headers.get("content-type"))&&he.setContentType(I),D.body){const[me,ne]=qe(Ne,ce(je(P)));E=$e(D.body,ze,me,ne)}}u.isString(te)||(te=te?"include":"omit");const U=o&&"credentials"in r.prototype,Fe={...Pe,signal:re,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:E,duplex:"half",credentials:U?te:void 0};W=o&&new r(m,Fe);let B=await(o?Le(W,Pe):Le(m,Fe));const Ue=a&&(A==="stream"||A==="response");if(a&&(O||Ue&&_)){const D={};["status","statusText","headers"].forEach(ke=>{D[ke]=B[ke]});const I=u.toFiniteNumber(B.headers.get("content-length")),[me,ne]=O&&qe(I,ce(je(O),!0))||[];B=new n($e(B.body,ze,me,()=>{ne&&ne(),_&&_()}),D)}A=A||"text";let Lt=await p[u.findKey(p,A)||"text"](B,d);return!Ue&&_&&_(),await new Promise((D,I)=>{mt(D,I,{data:Lt,headers:C.from(B.headers),status:B.status,statusText:B.statusText,config:d,request:W})})}catch(U){throw _&&_(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,d,W),{cause:U.cause||U}):g.from(U,U&&U.code,d,W)}}},sn=new Map,gt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,o=[n,s,r];let i=o.length,c=i,f,l,a=sn;for(;c--;)f=o[c],l=a.get(f),l===void 0&&a.set(f,l=c?new Map:nn(t)),a=l;return l};gt();const ve={http:Sr,xhr:Xr,fetch:{get:gt}};u.forEach(ve,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ve=e=>`- ${e}`,on=e=>u.isFunction(e)||e===null||e===!1;function an(e,t){e=u.isArray(e)?e:[e];const{length:r}=e;let n,s;const o={};for(let i=0;i<r;i++){n=e[i];let c;if(s=n,!on(n)&&(s=ve[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(u.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
4
|
-
`+i.map(
|
|
5
|
-
`):" "+
|
|
6
|
-
`+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=q(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&ae.assertOptions(n,{silentJSONParsing:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./chunks/services.helper.DolZWkEs.js"),z=require("react"),Xe=require("react/jsx-runtime"),Ze=require("@tanstack/react-query"),R=require("./errors.cjs.js"),Nt=e=>({...t})=>e(t),Ft=({useAdapter:e,LoggerService:t})=>W("ERROR_SERVICE",Nt(e),[t.ServiceProvider]),Ut=()=>({LoggerService:e})=>{const t=I(e),r=z.useRef({}),n=(c,h)=>{const u=r.current;r.current={...u,[c]:[...u[c]||[],h]}},s=(c,h)=>{const u=r.current;r.current={...u,[c]:u[c].filter(a=>a!==h)}};return{raiseError:c=>{var h;t.error(c),(h=r.current[c.code])==null||h.forEach(u=>u(c))},useErrorHandler:(c,h)=>{const u=P.compilerRuntimeExports.c(4);let a,f;u[0]!==h||u[1]!==c?(a=()=>(n(c,h),()=>{s(c,h)}),f=[c,h],u[0]=h,u[1]=c,u[2]=a,u[3]=f):(a=u[2],f=u[3]),z.useEffect(a,f)}}},Bt=({HttpService:e,ErrorService:t})=>()=>{const r=I(t),n=I(e),s=u=>{const{details:a,message:f}=u,m=a!=null&&a.body&&typeof a.body=="object"&&"errors"in a.body&&a.body.errors instanceof Array?a.body.errors:[];if(m.length===0)return r.raiseError(u),u;if(m.find(p=>{var y;return((y=p.extensions)==null?void 0:y.code)===R.GraphQLErrors.AuthenticationError||p.message.toLowerCase().includes("authorization")})){const p=new R.HttpServiceError({code:R.HttpServiceErrorCode.Unauthorized,details:a,message:f});return r.raiseError(p),p}const d=typeof m[0]=="string"?m[0]:null,E=new R.HttpServiceError({code:R.HttpServiceErrorCode.Generic,details:a,message:f+(d?` (${d})`:"")});return r.raiseError(E),E},o=u=>{const{details:a,message:f}=u,m=new R.HttpServiceError({code:R.HttpServiceErrorCode.Unauthorized,details:a,message:f});return r.raiseError(m),m},i=u=>{const a=u.find(g=>{var d;return((d=g==null?void 0:g.extensions)==null?void 0:d.code)===R.GraphQLErrors.AuthenticationError});if(a)return o(a);const f=typeof u[0]=="string"?u[0]:"Unknown error.",m=new R.GraphQLServiceError({code:R.GraphQLServiceErrorCode.Generic,message:f});return r.raiseError(m),m},c=u=>{if("errors"in u&&u.errors instanceof Array&&u.errors.length>0)return i(u.errors);if(!u.data){const f=new R.GraphQLServiceError({code:R.GraphQLServiceErrorCode.Generic,message:"Response is missing 'data' attribute."});return r.raiseError(f),f}return u.data};return{execute:async u=>{const a=Array.isArray(u.url)?P.buildUrl(u.url):u.url;try{const f=await n.post({body:{query:u.query,variables:u.variables},headers:u.headers,url:a});if(!f)return{};const m=c(f.body);if(m instanceof R.BaseError)throw m;return m}catch(f){throw f instanceof R.HttpServiceError?s(f):f instanceof R.BaseError?f:new Error("Could not handle error")}}}},kt=({HttpService:e,ErrorService:t})=>W("GRAPHQL_SERVICE",Bt({ErrorService:t,HttpService:e}),[e.ServiceProvider,t.ServiceProvider]),Dt=e=>({ErrorService:t,LoggerService:r})=>{const n=e(),s=I(r),o=I(t),i=y=>{const w=P.lodashExports.omitBy(y,P.lodashExports.isNil);s.info(`HTTP request: ${JSON.stringify(w)}`)},c=y=>{const{body:w,status:S}=y;s.info(`HTTP response: ${JSON.stringify({body:w,status:S})}`)},h=y=>y>=400&&y<600,u=y=>{const{details:w,message:S}=y;return o.raiseError(new R.HttpServiceError({code:R.HttpServiceErrorCode.Unauthorized,details:w,message:S}))},a=y=>{const{status:w}=y.details||{};if(!w||w>=500){const S=JSON.stringify(y);s.error(S)}else{if(w===401)return u(y);s.warn(y)}return o.raiseError(y)},f=async(y,w,S={})=>{i({method:y,...w});let O,A;const N=v=>{if(v instanceof R.HttpServiceError){A=v;return}O=v};switch(y){case"GET":{N(await n.get(w,S));break}case"DELETE":{N(await n.delete(w,S));break}case"PATCH":{N(await n.patch(w,S));break}case"POST":{N(await n.post(w,S));break}case"PUT":{N(await n.put(w,S));break}default:throw Error(`Unknown method HTTP method '${y}'`)}if(A)throw a(A),A;return O?(c(O),h(O.status)&&a(new R.HttpServiceError({details:{body:JSON.stringify(O.body),method:y,status:O.status,url:w.url}})),O):void 0};return{delete:(y,w={})=>f("DELETE",y,w),get:(y,w={})=>f("GET",y,w),patch:(y,w={})=>f("PATCH",y,w),post:async(y,w={})=>await f("POST",y,w),put:(y,w={})=>f("PUT",y,w)}},_t=({useAdapter:e,ErrorService:t,LoggerService:r})=>W("HTTP_SERVICE",Dt(e),[t.ServiceProvider,r.ServiceProvider]);function Ye(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ht}=Object.prototype,{getPrototypeOf:Te}=Object,{iterator:ue,toStringTag:et}=Symbol,le=(e=>t=>{const r=Ht.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),F=e=>(e=e.toLowerCase(),t=>le(t)===e),fe=e=>t=>typeof t===e,{isArray:V}=Array,J=fe("undefined");function X(e){return e!==null&&!J(e)&&e.constructor!==null&&!J(e.constructor)&&x(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tt=F("ArrayBuffer");function Mt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tt(e.buffer),t}const qt=fe("string"),x=fe("function"),rt=fe("number"),Z=e=>e!==null&&typeof e=="object",jt=e=>e===!0||e===!1,oe=e=>{if(le(e)!=="object")return!1;const t=Te(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(et in e)&&!(ue in e)},It=e=>{if(!Z(e)||X(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},$t=F("Date"),zt=F("File"),Jt=F("Blob"),Vt=F("FileList"),Kt=e=>Z(e)&&x(e.pipe),Wt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||x(e.append)&&((t=le(e))==="formdata"||t==="object"&&x(e.toString)&&e.toString()==="[object FormData]"))},Gt=F("URLSearchParams"),[Qt,Xt,Zt,Yt]=["ReadableStream","Request","Response","Headers"].map(F),er=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Y(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),V(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(X(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(n=0;n<i;n++)c=o[n],t.call(null,e[c],c,e)}}function nt(e,t){if(X(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,st=e=>!J(e)&&e!==H;function be(){const{caseless:e,skipUndefined:t}=st(this)&&this||{},r={},n=(s,o)=>{const i=e&&nt(r,o)||o;oe(r[i])&&oe(s)?r[i]=be(r[i],s):oe(s)?r[i]=be({},s):V(s)?r[i]=s.slice():(!t||!J(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Y(arguments[s],n);return r}const tr=(e,t,r,{allOwnKeys:n}={})=>(Y(t,(s,o)=>{r&&x(s)?e[o]=Ye(s,r):e[o]=s},{allOwnKeys:n}),e),rr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nr=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},sr=(e,t,r,n)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!n||n(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&Te(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},or=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},ir=e=>{if(!e)return null;if(V(e))return e;let t=e.length;if(!rt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},ar=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Te(Uint8Array)),cr=(e,t)=>{const n=(e&&e[ue]).call(e);let s;for(;(s=n.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},ur=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},lr=F("HTMLFormElement"),fr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),ke=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),dr=F("RegExp"),ot=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Y(r,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(n[o]=i||s)}),Object.defineProperties(e,n)},hr=e=>{ot(e,(t,r)=>{if(x(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(x(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},pr=(e,t)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return V(e)?n(e):n(String(e).split(t)),r},mr=()=>{},Er=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function yr(e){return!!(e&&x(e.append)&&e[et]==="FormData"&&e[ue])}const gr=e=>{const t=new Array(10),r=(n,s)=>{if(Z(n)){if(t.indexOf(n)>=0)return;if(X(n))return n;if(!("toJSON"in n)){t[s]=n;const o=V(n)?[]:{};return Y(n,(i,c)=>{const h=r(i,s+1);!J(h)&&(o[c]=h)}),t[s]=void 0,o}}return n};return r(e,0)},br=F("AsyncFunction"),wr=e=>e&&(Z(e)||x(e))&&x(e.then)&&x(e.catch),it=((e,t)=>e?setImmediate:t?((r,n)=>(H.addEventListener("message",({source:s,data:o})=>{s===H&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),H.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",x(H.postMessage)),Sr=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||it,Rr=e=>e!=null&&x(e[ue]),l={isArray:V,isArrayBuffer:tt,isBuffer:X,isFormData:Wt,isArrayBufferView:Mt,isString:qt,isNumber:rt,isBoolean:jt,isObject:Z,isPlainObject:oe,isEmptyObject:It,isReadableStream:Qt,isRequest:Xt,isResponse:Zt,isHeaders:Yt,isUndefined:J,isDate:$t,isFile:zt,isBlob:Jt,isRegExp:dr,isFunction:x,isStream:Kt,isURLSearchParams:Gt,isTypedArray:ar,isFileList:Vt,forEach:Y,merge:be,extend:tr,trim:er,stripBOM:rr,inherits:nr,toFlatObject:sr,kindOf:le,kindOfTest:F,endsWith:or,toArray:ir,forEachEntry:cr,matchAll:ur,isHTMLForm:lr,hasOwnProperty:ke,hasOwnProp:ke,reduceDescriptors:ot,freezeMethods:hr,toObjectSet:pr,toCamelCase:fr,noop:mr,toFiniteNumber:Er,findKey:nt,global:H,isContextDefined:st,isSpecCompliantForm:yr,toJSONObject:gr,isAsyncFn:br,isThenable:wr,setImmediate:it,asap:Sr,isIterable:Rr};function b(e,t,r,n,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),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}l.inherits(b,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:l.toJSONObject(this.config),code:this.code,status:this.status}}});const at=b.prototype,ct={};["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=>{ct[e]={value:e}});Object.defineProperties(b,ct);Object.defineProperty(at,"isAxiosError",{value:!0});b.from=(e,t,r,n,s,o)=>{const i=Object.create(at);l.toFlatObject(e,i,function(a){return a!==Error.prototype},u=>u!=="isAxiosError");const c=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return b.call(i,c,h,r,n,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 Tr=null;function we(e){return l.isPlainObject(e)||l.isArray(e)}function ut(e){return l.endsWith(e,"[]")?e.slice(0,-2):e}function De(e,t,r){return e?e.concat(t).map(function(s,o){return s=ut(s),!r&&o?"["+s+"]":s}).join(r?".":""):t}function Or(e){return l.isArray(e)&&!e.some(we)}const Ar=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function de(e,t,r){if(!l.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=l.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,p){return!l.isUndefined(p[E])});const n=r.metaTokens,s=r.visitor||a,o=r.dots,i=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&l.isSpecCompliantForm(t);if(!l.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(l.isDate(d))return d.toISOString();if(l.isBoolean(d))return d.toString();if(!h&&l.isBlob(d))throw new b("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(d)||l.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function a(d,E,p){let y=d;if(d&&!p&&typeof d=="object"){if(l.endsWith(E,"{}"))E=n?E:E.slice(0,-2),d=JSON.stringify(d);else if(l.isArray(d)&&Or(d)||(l.isFileList(d)||l.endsWith(E,"[]"))&&(y=l.toArray(d)))return E=ut(E),y.forEach(function(S,O){!(l.isUndefined(S)||S===null)&&t.append(i===!0?De([E],O,o):i===null?E:E+"[]",u(S))}),!1}return we(d)?!0:(t.append(De(p,E,o),u(d)),!1)}const f=[],m=Object.assign(Ar,{defaultVisitor:a,convertValue:u,isVisitable:we});function g(d,E){if(!l.isUndefined(d)){if(f.indexOf(d)!==-1)throw Error("Circular reference detected in "+E.join("."));f.push(d),l.forEach(d,function(y,w){(!(l.isUndefined(y)||y===null)&&s.call(t,y,l.isString(w)?w.trim():w,E,m))===!0&&g(y,E?E.concat(w):[w])}),f.pop()}}if(!l.isObject(e))throw new TypeError("data must be an object");return g(e),t}function _e(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Oe(e,t){this._pairs=[],e&&de(e,this,t)}const lt=Oe.prototype;lt.append=function(t,r){this._pairs.push([t,r])};lt.toString=function(t){const r=t?function(n){return t.call(this,n,_e)}:_e;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function vr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(e,t,r){if(!t)return e;const n=r&&r.encode||vr;l.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let o;if(s?o=s(t,r):o=l.isURLSearchParams(t)?t.toString():new Oe(t,r).toString(n),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class He{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){l.forEach(this.handlers,function(n){n!==null&&t(n)})}}const dt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Cr=typeof URLSearchParams<"u"?URLSearchParams:Oe,xr=typeof FormData<"u"?FormData:null,Lr=typeof Blob<"u"?Blob:null,Pr={isBrowser:!0,classes:{URLSearchParams:Cr,FormData:xr,Blob:Lr},protocols:["http","https","file","blob","url","data"]},Ae=typeof window<"u"&&typeof document<"u",Se=typeof navigator=="object"&&navigator||void 0,Nr=Ae&&(!Se||["ReactNative","NativeScript","NS"].indexOf(Se.product)<0),Fr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ur=Ae&&window.location.href||"http://localhost",Br=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ae,hasStandardBrowserEnv:Nr,hasStandardBrowserWebWorkerEnv:Fr,navigator:Se,origin:Ur},Symbol.toStringTag,{value:"Module"})),C={...Br,...Pr};function kr(e,t){return de(e,new C.classes.URLSearchParams,{visitor:function(r,n,s,o){return C.isNode&&l.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Dr(e){return l.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function _r(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}function ht(e){function t(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),h=o>=r.length;return i=!i&&l.isArray(s)?s.length:i,h?(l.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!l.isObject(s[i]))&&(s[i]=[]),t(r,n,s[i],o)&&l.isArray(s[i])&&(s[i]=_r(s[i])),!c)}if(l.isFormData(e)&&l.isFunction(e.entries)){const r={};return l.forEachEntry(e,(n,s)=>{t(Dr(n),s,r,0)}),r}return null}function Hr(e,t,r){if(l.isString(e))try{return(t||JSON.parse)(e),l.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const ee={transitional:dt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=l.isObject(t);if(o&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return s?JSON.stringify(ht(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t)||l.isReadableStream(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return kr(t,this.formSerializer).toString();if((c=l.isFileList(t))||n.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return de(c?{"files[]":t}:t,h&&new h,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Hr(t)):t}],transformResponse:[function(t){const r=this.transitional||ee.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(l.isResponse(t)||l.isReadableStream(t))return t;if(t&&l.isString(t)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?b.from(c,b.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:C.classes.FormData,Blob:C.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],e=>{ee.headers[e]={}});const Mr=l.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"]),qr=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||t[r]&&Mr[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},Me=Symbol("internals");function Q(e){return e&&String(e).trim().toLowerCase()}function ie(e){return e===!1||e==null?e:l.isArray(e)?e.map(ie):String(e)}function jr(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Ir=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ee(e,t,r,n,s){if(l.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!l.isString(t)){if(l.isString(n))return t.indexOf(n)!==-1;if(l.isRegExp(n))return n.test(t)}}function $r(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function zr(e,t){const r=l.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(s,o,i){return this[n].call(this,t,s,o,i)},configurable:!0})})}let L=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function o(c,h,u){const a=Q(h);if(!a)throw new Error("header name must be a non-empty string");const f=l.findKey(s,a);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||h]=ie(c))}const i=(c,h)=>l.forEach(c,(u,a)=>o(u,a,h));if(l.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(l.isString(t)&&(t=t.trim())&&!Ir(t))i(qr(t),r);else if(l.isObject(t)&&l.isIterable(t)){let c={},h,u;for(const a of t){if(!l.isArray(a))throw TypeError("Object iterator must return a key-value pair");c[u=a[0]]=(h=c[u])?l.isArray(h)?[...h,a[1]]:[h,a[1]]:a[1]}i(c,r)}else t!=null&&o(r,t,n);return this}get(t,r){if(t=Q(t),t){const n=l.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return jr(s);if(l.isFunction(r))return r.call(this,s,n);if(l.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Q(t),t){const n=l.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ee(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function o(i){if(i=Q(i),i){const c=l.findKey(n,i);c&&(!r||Ee(n,n[c],c,r))&&(delete n[c],s=!0)}}return l.isArray(t)?t.forEach(o):o(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!t||Ee(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const r=this,n={};return l.forEach(this,(s,o)=>{const i=l.findKey(n,o);if(i){r[i]=ie(s),delete r[o];return}const c=t?$r(o):String(o).trim();c!==o&&delete r[o],r[c]=ie(s),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return l.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&l.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).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,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[Me]=this[Me]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=Q(i);n[c]||(zr(s,i),n[c]=!0)}return l.isArray(t)?t.forEach(o):o(t),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);l.reduceDescriptors(L.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});l.freezeMethods(L);function ye(e,t){const r=this||ee,n=t||r,s=L.from(n.headers);let o=n.data;return l.forEach(e,function(c){o=c.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function pt(e){return!!(e&&e.__CANCEL__)}function K(e,t,r){b.call(this,e??"canceled",b.ERR_CANCELED,t,r),this.name="CanceledError"}l.inherits(K,b,{__CANCEL__:!0});function mt(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new b("Request failed with status code "+r.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Jr(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Vr(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(h){const u=Date.now(),a=n[o];i||(i=u),r[s]=h,n[s]=u;let f=o,m=0;for(;f!==s;)m+=r[f++],f=f%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const g=a&&u-a;return g?Math.round(m*1e3/g):void 0}}function Kr(e,t){let r=0,n=1e3/t,s,o;const i=(u,a=Date.now())=>{r=a,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const a=Date.now(),f=a-r;f>=n?i(u,a):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},n-f)))},()=>s&&i(s)]}const ce=(e,t,r=3)=>{let n=0;const s=Vr(50,250);return Kr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,h=i-n,u=s(h),a=i<=c;n=i;const f={loaded:i,total:c,progress:c?i/c:void 0,bytes:h,rate:u||void 0,estimated:u&&c&&a?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(f)},r)},qe=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},je=e=>(...t)=>l.asap(()=>e(...t)),Wr=C.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,C.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(C.origin),C.navigator&&/(msie|trident)/i.test(C.navigator.userAgent)):()=>!0,Gr=C.hasStandardBrowserEnv?{write(e,t,r,n,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];l.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),l.isString(n)&&c.push(`path=${n}`),l.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),l.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.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 Qr(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Xr(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Et(e,t,r){let n=!Qr(t);return e&&(n||r==!1)?Xr(e,t):t}const Ie=e=>e instanceof L?{...e}:e;function q(e,t){t=t||{};const r={};function n(u,a,f,m){return l.isPlainObject(u)&&l.isPlainObject(a)?l.merge.call({caseless:m},u,a):l.isPlainObject(a)?l.merge({},a):l.isArray(a)?a.slice():a}function s(u,a,f,m){if(l.isUndefined(a)){if(!l.isUndefined(u))return n(void 0,u,f,m)}else return n(u,a,f,m)}function o(u,a){if(!l.isUndefined(a))return n(void 0,a)}function i(u,a){if(l.isUndefined(a)){if(!l.isUndefined(u))return n(void 0,u)}else return n(void 0,a)}function c(u,a,f){if(f in t)return n(u,a);if(f in e)return n(void 0,u)}const h={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:(u,a,f)=>s(Ie(u),Ie(a),f,!0)};return l.forEach(Object.keys({...e,...t}),function(a){const f=h[a]||s,m=f(e[a],t[a],a);l.isUndefined(m)&&f!==c||(r[a]=m)}),r}const yt=e=>{const t=q({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=L.from(i),t.url=ft(Et(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),l.isFormData(r)){if(C.hasStandardBrowserEnv||C.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(l.isFunction(r.getHeaders)){const h=r.getHeaders(),u=["content-type","content-length"];Object.entries(h).forEach(([a,f])=>{u.includes(a.toLowerCase())&&i.set(a,f)})}}if(C.hasStandardBrowserEnv&&(n&&l.isFunction(n)&&(n=n(t)),n||n!==!1&&Wr(t.url))){const h=s&&o&&Gr.read(o);h&&i.set(s,h)}return t},Zr=typeof XMLHttpRequest<"u",Yr=Zr&&function(e){return new Promise(function(r,n){const s=yt(e);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:h,onDownloadProgress:u}=s,a,f,m,g,d;function E(){g&&g(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(a),s.signal&&s.signal.removeEventListener("abort",a)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function y(){if(!p)return;const S=L.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),A={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:S,config:e,request:p};mt(function(v){r(v),E()},function(v){n(v),E()},A),p=null}"onloadend"in p?p.onloadend=y:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(y)},p.onabort=function(){p&&(n(new b("Request aborted",b.ECONNABORTED,e,p)),p=null)},p.onerror=function(O){const A=O&&O.message?O.message:"Network Error",N=new b(A,b.ERR_NETWORK,e,p);N.event=O||null,n(N),p=null},p.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const A=s.transitional||dt;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),n(new b(O,A.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,p)),p=null},o===void 0&&i.setContentType(null),"setRequestHeader"in p&&l.forEach(i.toJSON(),function(O,A){p.setRequestHeader(A,O)}),l.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),c&&c!=="json"&&(p.responseType=s.responseType),u&&([m,d]=ce(u,!0),p.addEventListener("progress",m)),h&&p.upload&&([f,g]=ce(h),p.upload.addEventListener("progress",f),p.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(a=S=>{p&&(n(!S||S.type?new K(null,e,p):S),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(a),s.signal&&(s.signal.aborted?a():s.signal.addEventListener("abort",a)));const w=Jr(s.url);if(w&&C.protocols.indexOf(w)===-1){n(new b("Unsupported protocol "+w+":",b.ERR_BAD_REQUEST,e));return}p.send(o||null)})},en=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,s;const o=function(u){if(!s){s=!0,c();const a=u instanceof Error?u:this.reason;n.abort(a instanceof b?a:new K(a instanceof Error?a.message:a))}};let i=t&&setTimeout(()=>{i=null,o(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const c=()=>{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:h}=n;return h.unsubscribe=()=>l.asap(c),h}},tn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},rn=async function*(e,t){for await(const r of nn(e))yield*tn(r,t)},nn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},$e=(e,t,r,n)=>{const s=rn(e,t);let o=0,i,c=h=>{i||(i=!0,n&&n(h))};return new ReadableStream({async pull(h){try{const{done:u,value:a}=await s.next();if(u){c(),h.close();return}let f=a.byteLength;if(r){let m=o+=f;r(m)}h.enqueue(new Uint8Array(a))}catch(u){throw c(u),u}},cancel(h){return c(h),s.return()}},{highWaterMark:2})},ze=64*1024,{isFunction:se}=l,sn=(({Request:e,Response:t})=>({Request:e,Response:t}))(l.global),{ReadableStream:Je,TextEncoder:Ve}=l.global,Ke=(e,...t)=>{try{return!!e(...t)}catch{return!1}},on=e=>{e=l.merge.call({skipUndefined:!0},sn,e);const{fetch:t,Request:r,Response:n}=e,s=t?se(t):typeof fetch=="function",o=se(r),i=se(n);if(!s)return!1;const c=s&&se(Je),h=s&&(typeof Ve=="function"?(d=>E=>d.encode(E))(new Ve):async d=>new Uint8Array(await new r(d).arrayBuffer())),u=o&&c&&Ke(()=>{let d=!1;const E=new r(C.origin,{body:new Je,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!E}),a=i&&c&&Ke(()=>l.isReadableStream(new n("").body)),f={stream:a&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!f[d]&&(f[d]=(E,p)=>{let y=E&&E[d];if(y)return y.call(E);throw new b(`Response type '${d}' is not supported`,b.ERR_NOT_SUPPORT,p)})});const m=async d=>{if(d==null)return 0;if(l.isBlob(d))return d.size;if(l.isSpecCompliantForm(d))return(await new r(C.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(l.isArrayBufferView(d)||l.isArrayBuffer(d))return d.byteLength;if(l.isURLSearchParams(d)&&(d=d+""),l.isString(d))return(await h(d)).byteLength},g=async(d,E)=>{const p=l.toFiniteNumber(d.getContentLength());return p??m(E)};return async d=>{let{url:E,method:p,data:y,signal:w,cancelToken:S,timeout:O,onDownloadProgress:A,onUploadProgress:N,responseType:v,headers:pe,withCredentials:te="same-origin",fetchOptions:Le}=yt(d),Pe=t||fetch;v=v?(v+"").toLowerCase():"text";let re=en([w,S&&S.toAbortSignal()],O),G=null;const _=re&&re.unsubscribe&&(()=>{re.unsubscribe()});let Ne;try{if(N&&u&&p!=="get"&&p!=="head"&&(Ne=await g(pe,y))!==0){let D=new r(E,{method:"POST",body:y,duplex:"half"}),$;if(l.isFormData(y)&&($=D.headers.get("content-type"))&&pe.setContentType($),D.body){const[me,ne]=qe(Ne,ce(je(N)));y=$e(D.body,ze,me,ne)}}l.isString(te)||(te=te?"include":"omit");const U=o&&"credentials"in r.prototype,Fe={...Le,signal:re,method:p.toUpperCase(),headers:pe.normalize().toJSON(),body:y,duplex:"half",credentials:U?te:void 0};G=o&&new r(E,Fe);let k=await(o?Pe(G,Le):Pe(E,Fe));const Ue=a&&(v==="stream"||v==="response");if(a&&(A||Ue&&_)){const D={};["status","statusText","headers"].forEach(Be=>{D[Be]=k[Be]});const $=l.toFiniteNumber(k.headers.get("content-length")),[me,ne]=A&&qe($,ce(je(A),!0))||[];k=new n($e(k.body,ze,me,()=>{ne&&ne(),_&&_()}),D)}v=v||"text";let Pt=await f[l.findKey(f,v)||"text"](k,d);return!Ue&&_&&_(),await new Promise((D,$)=>{mt(D,$,{data:Pt,headers:L.from(k.headers),status:k.status,statusText:k.statusText,config:d,request:G})})}catch(U){throw _&&_(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,d,G),{cause:U.cause||U}):b.from(U,U&&U.code,d,G)}}},an=new Map,gt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,o=[n,s,r];let i=o.length,c=i,h,u,a=an;for(;c--;)h=o[c],u=a.get(h),u===void 0&&a.set(h,u=c?new Map:on(t)),a=u;return u};gt();const ve={http:Tr,xhr:Yr,fetch:{get:gt}};l.forEach(ve,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const We=e=>`- ${e}`,cn=e=>l.isFunction(e)||e===null||e===!1;function un(e,t){e=l.isArray(e)?e:[e];const{length:r}=e;let n,s;const o={};for(let i=0;i<r;i++){n=e[i];let c;if(s=n,!cn(n)&&(s=ve[(c=String(n)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${c}'`);if(s&&(l.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([h,u])=>`adapter ${h} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
4
|
+
`+i.map(We).join(`
|
|
5
|
+
`):" "+We(i[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const bt={getAdapter:un,adapters:ve};function ge(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new K(null,e)}function Ge(e){return ge(e),e.headers=L.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),bt.getAdapter(e.adapter||ee.adapter,e)(e).then(function(n){return ge(e),n.data=ye.call(e,e.transformResponse,n),n.headers=L.from(n.headers),n},function(n){return pt(n)||(ge(e),n&&n.response&&(n.response.data=ye.call(e,e.transformResponse,n.response),n.response.headers=L.from(n.response.headers))),Promise.reject(n)})}const wt="1.13.2",he={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{he[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Qe={};he.transitional=function(t,r,n){function s(o,i){return"[Axios v"+wt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(t===!1)throw new b(s(i," has been removed"+(r?" in "+r:"")),b.ERR_DEPRECATED);return r&&!Qe[i]&&(Qe[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,i,c):!0}};he.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function ln(e,t,r){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const c=e[o],h=c===void 0||i(c,o,e);if(h!==!0)throw new b("option "+o+" must be "+h,b.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new b("Unknown option "+o,b.ERR_BAD_OPTION)}}const ae={assertOptions:ln,validators:he},B=ae.validators;let M=class{constructor(t){this.defaults=t||{},this.interceptors={request:new He,response:new He}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
6
|
+
`+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=q(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&ae.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(l.isFunction(s)?r.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ae.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&l.merge(o.common,o[r.method]);o&&l.forEach(["delete","get","head","post","put","patch","common"],d=>{delete o[d]}),r.headers=L.concat(i,o);const c=[];let h=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(r)===!1||(h=h&&E.synchronous,c.unshift(E.fulfilled,E.rejected))});const u=[];this.interceptors.response.forEach(function(E){u.push(E.fulfilled,E.rejected)});let a,f=0,m;if(!h){const d=[Ge.bind(this),void 0];for(d.unshift(...c),d.push(...u),m=d.length,a=Promise.resolve(r);f<m;)a=a.then(d[f++],d[f++]);return a}m=c.length;let g=r;for(;f<m;){const d=c[f++],E=c[f++];try{g=d(g)}catch(p){E.call(this,p);break}}try{a=Ge.call(this,g)}catch(d){return Promise.reject(d)}for(f=0,m=u.length;f<m;)a=a.then(u[f++],u[f++]);return a}getUri(t){t=q(this.defaults,t);const r=Et(t.baseURL,t.url,t.allowAbsoluteUrls);return ft(r,t.params,t.paramsSerializer)}};l.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(r,n){return this.request(q(n||{},{method:t,url:r,data:(n||{}).data}))}});l.forEach(["post","put","patch"],function(t){function r(n){return function(o,i,c){return this.request(q(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}M.prototype[t]=r(),M.prototype[t+"Form"]=r(!0)});let fn=class St{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},t(function(o,i,c){n.reason||(n.reason=new K(o,i,c),r(n.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 r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new St(function(s){t=s}),cancel:t}}};function dn(e){return function(r){return e.apply(null,r)}}function hn(e){return l.isObject(e)&&e.isAxiosError===!0}const Re={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(Re).forEach(([e,t])=>{Re[t]=e});function Rt(e){const t=new M(e),r=Ye(M.prototype.request,t);return l.extend(r,M.prototype,t,{allOwnKeys:!0}),l.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Rt(q(e,s))},r}const T=Rt(ee);T.Axios=M;T.CanceledError=K;T.CancelToken=fn;T.isCancel=pt;T.VERSION=wt;T.toFormData=de;T.AxiosError=b;T.Cancel=T.CanceledError;T.all=function(t){return Promise.all(t)};T.spread=dn;T.isAxiosError=hn;T.mergeConfig=q;T.AxiosHeaders=L;T.formToJSON=e=>ht(l.isHTMLForm(e)?new FormData(e):e);T.getAdapter=bt.getAdapter;T.HttpStatusCode=Re;T.default=T;const{Axios:$n,AxiosError:pn,CanceledError:zn,isCancel:Jn,CancelToken:Vn,VERSION:Kn,all:Wn,Cancel:Gn,isAxiosError:mn,spread:Qn,toFormData:Xn,AxiosHeaders:Zn,HttpStatusCode:Yn,formToJSON:es,getAdapter:ts,mergeConfig:rs}=T,En=e=>({PATCH:T.patch,POST:T.post,PUT:T.put})[e],yn=e=>({DELETE:T.delete,GET:T.get})[e],gn=e=>{const{data:t,headers:r,status:n}=e;return{body:t,header:r,status:n}},bn=e=>{if(!mn(e))return new R.HttpServiceError({message:"An unknown error occurred"});const{message:t,response:r}=e;if(!r)return new R.HttpServiceError({message:t});const{config:{url:n,method:s},status:o,data:i}=r,c={method:s,status:o,url:n};if(!i)return new R.HttpServiceError({details:c,message:t});try{return new R.HttpServiceError({details:{...c,body:i},message:t})}catch{return new R.HttpServiceError({details:c,message:t})}},Tt=async e=>{try{const t=await e;return gn(t)}catch(t){return t instanceof pn?bn(t):new R.HttpServiceError({code:R.HttpServiceErrorCode.Generic,message:"An unknown error occurred"})}},Ot=(e,{headers:t={},query:r={},timeout:n,url:s},o)=>{const i=yn(e),c={headers:t},h=P.addQueryParams(s,r);return o.buffer&&(c.responseType="arraybuffer"),n&&(c.timeout=n),Tt(i(h,c))},Ce=(e,{headers:t={},body:r=null,query:n={},timeout:s,url:o,attachments:i},c)=>{const h=En(e),u=i&&i.length>0,a=new FormData,f=u?a:r,m={headers:t},g=P.addQueryParams(o,n);return u&&i.forEach(d=>{a.append(d.name,d.filePath)}),c.buffer&&(m.responseType="arraybuffer"),s&&(m.timeout=s),Tt(h(g,f,m))},wn=(e,t)=>Ot("DELETE",e,t),Sn=(e,t)=>Ot("GET",e,t),Rn=(e,t)=>Ce("PATCH",e,t),Tn=(e,t)=>Ce("POST",e,t),On=(e,t)=>Ce("PUT",e,t),An=()=>()=>({delete:wn,get:Sn,patch:Rn,post:Tn,put:On}),At=e=>()=>e(),vn=({useAdapter:e})=>W("LOGGER_SERVICE",At(e),[]);var vt={exports:{}};/*!
|
|
7
7
|
* js-logger - http://github.com/jonnyreeves/js-logger
|
|
8
8
|
* Jonny Reeves, http://jonnyreeves.co.uk/
|
|
9
9
|
* js-logger may be freely distributed under the MIT license.
|
|
10
|
-
*/(function(e){(function(t){var r={};r.VERSION="1.6.1";var n,s={},o=function(a,
|
|
10
|
+
*/(function(e){(function(t){var r={};r.VERSION="1.6.1";var n,s={},o=function(a,f){return function(){return f.apply(a,arguments)}},i=function(){var a=arguments,f=a[0],m,g;for(g=1;g<a.length;g++)for(m in a[g])!(m in f)&&a[g].hasOwnProperty(m)&&(f[m]=a[g][m]);return f},c=function(a,f){return{value:a,name:f}};r.TRACE=c(1,"TRACE"),r.DEBUG=c(2,"DEBUG"),r.INFO=c(3,"INFO"),r.TIME=c(4,"TIME"),r.WARN=c(5,"WARN"),r.ERROR=c(8,"ERROR"),r.OFF=c(99,"OFF");var h=function(a){this.context=a,this.setLevel(a.filterLevel),this.log=this.info};h.prototype={setLevel:function(a){a&&"value"in a&&(this.context.filterLevel=a)},getLevel:function(){return this.context.filterLevel},enabledFor:function(a){var f=this.context.filterLevel;return a.value>=f.value},trace:function(){this.invoke(r.TRACE,arguments)},debug:function(){this.invoke(r.DEBUG,arguments)},info:function(){this.invoke(r.INFO,arguments)},warn:function(){this.invoke(r.WARN,arguments)},error:function(){this.invoke(r.ERROR,arguments)},time:function(a){typeof a=="string"&&a.length>0&&this.invoke(r.TIME,[a,"start"])},timeEnd:function(a){typeof a=="string"&&a.length>0&&this.invoke(r.TIME,[a,"end"])},invoke:function(a,f){n&&this.enabledFor(a)&&n(f,i({level:a},this.context))}};var u=new h({filterLevel:r.OFF});(function(){var a=r;a.enabledFor=o(u,u.enabledFor),a.trace=o(u,u.trace),a.debug=o(u,u.debug),a.time=o(u,u.time),a.timeEnd=o(u,u.timeEnd),a.info=o(u,u.info),a.warn=o(u,u.warn),a.error=o(u,u.error),a.log=a.info})(),r.setHandler=function(a){n=a},r.setLevel=function(a){u.setLevel(a);for(var f in s)s.hasOwnProperty(f)&&s[f].setLevel(a)},r.getLevel=function(){return u.getLevel()},r.get=function(a){return s[a]||(s[a]=new h(i({name:a},u.context)))},r.createDefaultHandler=function(a){a=a||{},a.formatter=a.formatter||function(d,E){E.name&&d.unshift("["+E.name+"]")};var f={},m=function(g,d){Function.prototype.apply.call(g,console,d)};return typeof console>"u"?function(){}:function(g,d){g=Array.prototype.slice.call(g);var E=console.log,p;d.level===r.TIME?(p=(d.name?"["+d.name+"] ":"")+g[0],g[1]==="start"?console.time?console.time(p):f[p]=new Date().getTime():console.timeEnd?console.timeEnd(p):m(E,[p+": "+(new Date().getTime()-f[p])+"ms"])):(d.level===r.WARN&&console.warn?E=console.warn:d.level===r.ERROR&&console.error?E=console.error:d.level===r.INFO&&console.info?E=console.info:d.level===r.DEBUG&&console.debug?E=console.debug:d.level===r.TRACE&&console.trace&&(E=console.trace),a.formatter(g,d),m(E,g))}},r.useDefaults=function(a){r.setLevel(a&&a.defaultLevel||r.DEBUG),r.setHandler(r.createDefaultHandler(a))},r.setDefaults=r.useDefaults,e.exports?e.exports=r:(r._prevLogger=t.Logger,r.noConflict=function(){return t.Logger=r._prevLogger,r},t.Logger=r)})(P.commonjsGlobal)})(vt);var Cn=vt.exports;const j=P.getDefaultExportFromCjs(Cn),xe=e=>typeof e=="string"?e:e.stack||e.toString(),xn=e=>{j.debug("💡",e)},Ln=e=>{j.error("❌",xe(e))},Pn=e=>{j.error("❌",xe(e))},Nn=e=>{j.info("✅",xe(e))},Fn=e=>{j.warn("⚠️",e.toString())},Un=()=>()=>(z.useEffect(()=>{j.useDefaults({defaultLevel:j.INFO})},[]),{debug:xn,error:Ln,fatal:Pn,info:Nn,warn:Fn}),Bn=e=>({...t})=>({captureEvent:e(t).captureEvent}),kn=({useAdapter:e,HttpService:t})=>W("TRACKER_SERVICE",Bn(e),[t.ServiceProvider]),Dn=({getDistinctId:e,getTimestamp:t,getHeaders:r,transformProperties:n,config:s})=>({HttpService:o})=>{const i=I(o),c=()=>({Authorization:`Bearer ${s.apiKey}`,...r==null?void 0:r()}),h=f=>[s.host,f].filter(Boolean).join("/"),u=(f,m)=>i.post({body:m,headers:c(),url:h(f)});return{captureEvent:Lt("posthog-capture-event",async({event:f,properties:m})=>{const g=s.paths.event,d=e(f,m),E=t==null?void 0:t(f,m),p=n(f,m);await u(g,{api_key:s.apiKey,distinct_id:d,event:f,properties:p,timestamp:E})})}};var Ct=(e=>(e.MUTATION="mutation",e.QUERY="query",e))(Ct||{});const _n=()=>{const e=z.createContext(void 0);return{Provider:n=>{const s=P.compilerRuntimeExports.c(3),{children:o,value:i}=n;let c;return s[0]!==o||s[1]!==i?(c=Xe.jsx(e.Provider,{value:i,children:o}),s[0]=o,s[1]=i,s[2]=c):c=s[2],c},useContext:()=>{const n=z.useContext(e);if(n===void 0)throw new Error("Context is missing a provider");return n}}},xt=(e,t,r)=>{const n=r;return n.serviceMethodKey=t,n.serviceMethodType=e,n},Lt=(e,t)=>xt("mutation",e,t),Hn=(e,t)=>xt("query",e,t),W=(e,t,r)=>{const{useContext:n,Provider:s}=_n(),o=c=>{const h=P.compilerRuntimeExports.c(6);let u,a;h[0]!==c?({children:u,...a}=c,h[0]=c,h[1]=u,h[2]=a):(u=h[1],a=h[2]);const f=t(a);let m;return h[3]!==u||h[4]!==f?(m=Xe.jsx(s,{value:f,children:u}),h[3]=u,h[4]=f,h[5]=m):m=h[5],m};return o.serviceName=Symbol(e),o.serviceDependencies=r,{ServiceProvider:o,useService:n}},I=e=>e.useService(),Mn=(e,t)=>{const r=P.compilerRuntimeExports.c(7);let n;r[0]!==e||r[1]!==t.mutationKey?(n=P.buildSafeQueryKeys([e.serviceMethodKey,e,...t.mutationKey??[]]),r[0]=e,r[1]=t.mutationKey,r[2]=n):n=r[2];let s;return r[3]!==e||r[4]!==t||r[5]!==n?(s={...t,mutationFn:e,mutationKey:n},r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],Ze.useMutation(s)},qn=(e,t)=>{const r=P.compilerRuntimeExports.c(14),[n,s]=z.useState("initialVariables"in t?t.initialVariables:void 0);let o;r[0]!==e||r[1]!==n?(o=()=>e(n),r[0]=e,r[1]=n,r[2]=o):o=r[2];let i;r[3]!==e||r[4]!==t||r[5]!==n?(i=P.buildSafeQueryKeys([e.serviceMethodKey,e,..."initialVariables"in t?[n]:[],...t.queryKey??[]]),r[3]=e,r[4]=t,r[5]=n,r[6]=i):i=r[6];let c;r[7]!==t||r[8]!==o||r[9]!==i?(c={...t,queryFn:o,queryKey:i},r[7]=t,r[8]=o,r[9]=i,r[10]=c):c=r[10];const h=Ze.useQuery(c);if("initialVariables"in t){let u;return r[11]!==h||r[12]!==n?(u={...h,setVariables:s,variables:n},r[11]=h,r[12]=n,r[13]=u):u=r[13],u}return h};exports.ServiceMethodType=Ct;exports.createAxiosHttpAdapter=An;exports.createErrorService=Ft;exports.createEventBasedErrorAdapter=Ut;exports.createGraphQLService=kt;exports.createHttpService=_t;exports.createJsLogLoggerAdapter=Un;exports.createLoggerBuilder=At;exports.createLoggerService=vn;exports.createPosthogTrackerAdapter=Dn;exports.createService=W;exports.createTrackerService=kn;exports.useBuildMutation=Lt;exports.useBuildQuery=Hn;exports.useService=I;exports.useServiceMutation=Mn;exports.useServiceQuery=qn;
|