@nhost/nhost-js 1.1.2 → 1.1.5

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.es.js CHANGED
@@ -1,35 +1,35 @@
1
- var Yu=Object.create;var Pr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var rc=t=>Pr(t,"__esModule",{value:!0});var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var nc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zu(e))!tc.call(t,i)&&(r||i!=="default")&&Pr(t,i,{get:()=>e[i],enumerable:!(n=Qu(e,i))||n.enumerable});return t},nt=(t,e)=>nc(rc(Pr(t!=null?Yu(ec(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Hr=p((dp,$i)=>{"use strict";$i.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var K=p((hp,Yi)=>{"use strict";var yc=Hr(),Se=Object.prototype.toString;function zr(t){return Array.isArray(t)}function Gr(t){return typeof t=="undefined"}function gc(t){return t!==null&&!Gr(t)&&t.constructor!==null&&!Gr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Wi(t){return Se.call(t)==="[object ArrayBuffer]"}function Ec(t){return Se.call(t)==="[object FormData]"}function Sc(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Wi(t.buffer),e}function wc(t){return typeof t=="string"}function xc(t){return typeof t=="number"}function Ki(t){return t!==null&&typeof t=="object"}function Xt(t){if(Se.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Tc(t){return Se.call(t)==="[object Date]"}function bc(t){return Se.call(t)==="[object File]"}function Ac(t){return Se.call(t)==="[object Blob]"}function Xi(t){return Se.call(t)==="[object Function]"}function Rc(t){return Ki(t)&&Xi(t.pipe)}function Oc(t){return Se.call(t)==="[object URLSearchParams]"}function Cc(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Pc(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function $r(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),zr(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Jr(){var t={};function e(i,s){Xt(t[s])&&Xt(i)?t[s]=Jr(t[s],i):Xt(i)?t[s]=Jr({},i):zr(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)$r(arguments[r],e);return t}function Nc(t,e,r){return $r(e,function(i,s){r&&typeof i=="function"?t[s]=yc(i,r):t[s]=i}),t}function Ic(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Yi.exports={isArray:zr,isArrayBuffer:Wi,isBuffer:gc,isFormData:Ec,isArrayBufferView:Sc,isString:wc,isNumber:xc,isObject:Ki,isPlainObject:Xt,isUndefined:Gr,isDate:Tc,isFile:bc,isBlob:Ac,isFunction:Xi,isStream:Rc,isURLSearchParams:Oc,isStandardBrowserEnv:Pc,forEach:$r,merge:Jr,extend:Nc,trim:Cc,stripBOM:Ic}});var Wr=p((pp,Zi)=>{"use strict";var ze=K();function Qi(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Zi.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ze.isURLSearchParams(r))i=r.toString();else{var s=[];ze.forEach(r,function(c,l){c===null||typeof c=="undefined"||(ze.isArray(c)?l=l+"[]":c=[c],ze.forEach(c,function(f){ze.isDate(f)?f=f.toISOString():ze.isObject(f)&&(f=JSON.stringify(f)),s.push(Qi(l)+"="+Qi(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var ts=p((vp,es)=>{"use strict";var kc=K();function Yt(){this.handlers=[]}Yt.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Yt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Yt.prototype.forEach=function(e){kc.forEach(this.handlers,function(n){n!==null&&e(n)})};es.exports=Yt});var ns=p((mp,rs)=>{"use strict";var _c=K();rs.exports=function(e,r){_c.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Kr=p((yp,is)=>{"use strict";is.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var Xr=p((gp,ss)=>{"use strict";var qc=Kr();ss.exports=function(e,r,n,i,s){var a=new Error(e);return qc(a,r,n,i,s)}});var os=p((Ep,as)=>{"use strict";var Dc=Xr();as.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Dc("Request failed with status code "+n.status,n.config,null,n.request,n))}});var cs=p((Sp,us)=>{"use strict";var Qt=K();us.exports=Qt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Qt.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Qt.isString(s)&&c.push("path="+s),Qt.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var fs=p((wp,ls)=>{"use strict";ls.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var hs=p((xp,ds)=>{"use strict";ds.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var vs=p((Tp,ps)=>{"use strict";var Uc=fs(),Mc=hs();ps.exports=function(e,r){return e&&!Uc(r)?Mc(e,r):r}});var ys=p((bp,ms)=>{"use strict";var Yr=K(),jc=["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"];ms.exports=function(e){var r={},n,i,s;return e&&Yr.forEach(e.split(`
2
- `),function(u){if(s=u.indexOf(":"),n=Yr.trim(u.substr(0,s)).toLowerCase(),i=Yr.trim(u.substr(s+1)),n){if(r[n]&&jc.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Ss=p((Ap,Es)=>{"use strict";var gs=K();Es.exports=gs.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=gs.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Tt=p((Rp,ws)=>{"use strict";function Qr(t){this.message=t}Qr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Qr.prototype.__CANCEL__=!0;ws.exports=Qr});var en=p((Op,xs)=>{"use strict";var Zt=K(),Lc=os(),Bc=cs(),Fc=Wr(),Vc=vs(),Hc=ys(),Gc=Ss(),Zr=Xr(),Jc=bt(),zc=Tt();xs.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Zt.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=Vc(e.baseURL,e.url);o.open(e.method.toUpperCase(),Fc(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function y(){if(!!o){var v="getAllResponseHeaders"in o?Hc(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};Lc(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=y:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(y)},o.onabort=function(){!o||(i(Zr("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Zr("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Jc.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Zr(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Zt.isStandardBrowserEnv()){var E=(e.withCredentials||Gc(h))&&e.xsrfCookieName?Bc.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Zt.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Zt.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new zc("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var bt=p((Cp,As)=>{"use strict";var H=K(),Ts=ns(),$c=Kr(),Wc={"Content-Type":"application/x-www-form-urlencoded"};function bs(t,e){!H.isUndefined(t)&&H.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Kc(){var t;return typeof XMLHttpRequest!="undefined"?t=en():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=en()),t}function Xc(t,e,r){if(H.isString(t))try{return(e||JSON.parse)(t),H.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var er={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Kc(),transformRequest:[function(e,r){return Ts(r,"Accept"),Ts(r,"Content-Type"),H.isFormData(e)||H.isArrayBuffer(e)||H.isBuffer(e)||H.isStream(e)||H.isFile(e)||H.isBlob(e)?e:H.isArrayBufferView(e)?e.buffer:H.isURLSearchParams(e)?(bs(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):H.isObject(e)||r&&r["Content-Type"]==="application/json"?(bs(r,"application/json"),Xc(e)):e}],transformResponse:[function(e){var r=this.transitional||er.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&H.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?$c(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};H.forEach(["delete","get","head"],function(e){er.headers[e]={}});H.forEach(["post","put","patch"],function(e){er.headers[e]=H.merge(Wc)});As.exports=er});var Os=p((Pp,Rs)=>{"use strict";var Yc=K(),Qc=bt();Rs.exports=function(e,r,n){var i=this||Qc;return Yc.forEach(n,function(a){e=a.call(i,e,r)}),e}});var tn=p((Np,Cs)=>{"use strict";Cs.exports=function(e){return!!(e&&e.__CANCEL__)}});var Is=p((Ip,Ns)=>{"use strict";var Ps=K(),rn=Os(),Zc=tn(),el=bt(),tl=Tt();function nn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new tl("canceled")}Ns.exports=function(e){nn(e),e.headers=e.headers||{},e.data=rn.call(e,e.data,e.headers,e.transformRequest),e.headers=Ps.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Ps.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||el.adapter;return r(e).then(function(i){return nn(e),i.data=rn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Zc(i)||(nn(e),i&&i.response&&(i.response.data=rn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var sn=p((kp,ks)=>{"use strict";var re=K();ks.exports=function(e,r){r=r||{};var n={};function i(o,f){return re.isPlainObject(o)&&re.isPlainObject(f)?re.merge(o,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function s(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!re.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return re.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);re.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var an=p((_p,_s)=>{_s.exports={version:"0.25.0"}});var Us=p((qp,Ds)=>{"use strict";var rl=an().version,on={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){on[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var qs={};on.transitional=function(e,r,n){function i(s,a){return"[Axios v"+rl+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!qs[a]&&(qs[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function nl(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Ds.exports={assertOptions:nl,validators:on}});var Vs=p((Dp,Fs)=>{"use strict";var Ls=K(),il=Wr(),Ms=ts(),js=Is(),tr=sn(),Bs=Us(),$e=Bs.validators;function At(t){this.defaults=t,this.interceptors={request:new Ms,response:new Ms}}At.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=tr(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&Bs.assertOptions(n,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(s=s&&h.synchronous,i.unshift(h.fulfilled,h.rejected))});var a=[];this.interceptors.response.forEach(function(h){a.push(h.fulfilled,h.rejected)});var u;if(!s){var c=[js,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(a),u=Promise.resolve(r);c.length;)u=u.then(c.shift(),c.shift());return u}for(var l=r;i.length;){var o=i.shift(),f=i.shift();try{l=o(l)}catch(d){f(d);break}}try{u=js(l)}catch(d){return Promise.reject(d)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};At.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=tr(this.defaults,e),il(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Ls.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(r,n){return this.request(tr(n||{},{method:e,url:r,data:(n||{}).data}))}});Ls.forEach(["post","put","patch"],function(e){At.prototype[e]=function(r,n,i){return this.request(tr(i||{},{method:e,url:r,data:n}))}});Fs.exports=At});var Gs=p((Up,Hs)=>{"use strict";var sl=Tt();function We(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new sl(i),e(r.reason))})}We.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};We.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};We.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};We.source=function(){var e,r=new We(function(i){e=i});return{token:r,cancel:e}};Hs.exports=We});var zs=p((Mp,Js)=>{"use strict";Js.exports=function(e){return function(n){return e.apply(null,n)}}});var Ws=p((jp,$s)=>{"use strict";var al=K();$s.exports=function(e){return al.isObject(e)&&e.isAxiosError===!0}});var Ys=p((Lp,un)=>{"use strict";var Ks=K(),ol=Hr(),rr=Vs(),ul=sn(),cl=bt();function Xs(t){var e=new rr(t),r=ol(rr.prototype.request,e);return Ks.extend(r,rr.prototype,e),Ks.extend(r,e),r.create=function(i){return Xs(ul(t,i))},r}var he=Xs(cl);he.Axios=rr;he.Cancel=Tt();he.CancelToken=Gs();he.isCancel=tn();he.VERSION=an().version;he.all=function(e){return Promise.all(e)};he.spread=zs();he.isAxiosError=Ws();un.exports=he;un.exports.default=he});var Zs=p((Bp,Qs)=>{Qs.exports=Ys()});var dn=p((bm,ha)=>{"use strict";ha.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var X=p((Am,ma)=>{"use strict";var gl=dn(),_e=Object.prototype.toString;function vn(t){return _e.call(t)==="[object Array]"}function hn(t){return typeof t=="undefined"}function El(t){return t!==null&&!hn(t)&&t.constructor!==null&&!hn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Sl(t){return _e.call(t)==="[object ArrayBuffer]"}function wl(t){return typeof FormData!="undefined"&&t instanceof FormData}function xl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Tl(t){return typeof t=="string"}function bl(t){return typeof t=="number"}function pa(t){return t!==null&&typeof t=="object"}function ur(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Al(t){return _e.call(t)==="[object Date]"}function Rl(t){return _e.call(t)==="[object File]"}function Ol(t){return _e.call(t)==="[object Blob]"}function va(t){return _e.call(t)==="[object Function]"}function Cl(t){return pa(t)&&va(t.pipe)}function Pl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Nl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Il(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function mn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),vn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function pn(){var t={};function e(i,s){ur(t[s])&&ur(i)?t[s]=pn(t[s],i):ur(i)?t[s]=pn({},i):vn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)mn(arguments[r],e);return t}function kl(t,e,r){return mn(e,function(i,s){r&&typeof i=="function"?t[s]=gl(i,r):t[s]=i}),t}function _l(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ma.exports={isArray:vn,isArrayBuffer:Sl,isBuffer:El,isFormData:wl,isArrayBufferView:xl,isString:Tl,isNumber:bl,isObject:pa,isPlainObject:ur,isUndefined:hn,isDate:Al,isFile:Rl,isBlob:Ol,isFunction:va,isStream:Cl,isURLSearchParams:Pl,isStandardBrowserEnv:Il,forEach:mn,merge:pn,extend:kl,trim:Nl,stripBOM:_l}});var yn=p((Rm,ga)=>{"use strict";var Ye=X();function ya(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ga.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ye.isURLSearchParams(r))i=r.toString();else{var s=[];Ye.forEach(r,function(c,l){c===null||typeof c=="undefined"||(Ye.isArray(c)?l=l+"[]":c=[c],Ye.forEach(c,function(f){Ye.isDate(f)?f=f.toISOString():Ye.isObject(f)&&(f=JSON.stringify(f)),s.push(ya(l)+"="+ya(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Sa=p((Om,Ea)=>{"use strict";var ql=X();function cr(){this.handlers=[]}cr.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};cr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};cr.prototype.forEach=function(e){ql.forEach(this.handlers,function(n){n!==null&&e(n)})};Ea.exports=cr});var xa=p((Cm,wa)=>{"use strict";var Dl=X();wa.exports=function(e,r){Dl.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var gn=p((Pm,Ta)=>{"use strict";Ta.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code}},e}});var En=p((Nm,ba)=>{"use strict";var Ul=gn();ba.exports=function(e,r,n,i,s){var a=new Error(e);return Ul(a,r,n,i,s)}});var Ra=p((Im,Aa)=>{"use strict";var Ml=En();Aa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ml("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ca=p((km,Oa)=>{"use strict";var lr=X();Oa.exports=lr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),lr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),lr.isString(s)&&c.push("path="+s),lr.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Na=p((_m,Pa)=>{"use strict";Pa.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var ka=p((qm,Ia)=>{"use strict";Ia.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var qa=p((Dm,_a)=>{"use strict";var jl=Na(),Ll=ka();_a.exports=function(e,r){return e&&!jl(r)?Ll(e,r):r}});var Ua=p((Um,Da)=>{"use strict";var Sn=X(),Bl=["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"];Da.exports=function(e){var r={},n,i,s;return e&&Sn.forEach(e.split(`
3
- `),function(u){if(s=u.indexOf(":"),n=Sn.trim(u.substr(0,s)).toLowerCase(),i=Sn.trim(u.substr(s+1)),n){if(r[n]&&Bl.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var La=p((Mm,ja)=>{"use strict";var Ma=X();ja.exports=Ma.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=Ma.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var xn=p((jm,Ba)=>{"use strict";var fr=X(),Fl=Ra(),Vl=Ca(),Hl=yn(),Gl=qa(),Jl=Ua(),zl=La(),wn=En();Ba.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType;fr.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",o=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(l+":"+o)}var f=Gl(e.baseURL,e.url);c.open(e.method.toUpperCase(),Hl(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var y="getAllResponseHeaders"in c?Jl(c.getAllResponseHeaders()):null,E=!u||u==="text"||u==="json"?c.responseText:c.response,v={data:E,status:c.status,statusText:c.statusText,headers:y,config:e,request:c};Fl(n,i,v),c=null}}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){!c||(i(wn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(wn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(wn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},fr.isStandardBrowserEnv()){var h=(e.withCredentials||zl(f))&&e.xsrfCookieName?Vl.read(e.xsrfCookieName):void 0;h&&(a[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&fr.forEach(a,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete a[v]:c.setRequestHeader(v,E)}),fr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),u&&u!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(E){!c||(c.abort(),i(E),c=null)}),s||(s=null),c.send(s)})}});var hr=p((Lm,Ha)=>{"use strict";var G=X(),Fa=xa(),$l=gn(),Wl={"Content-Type":"application/x-www-form-urlencoded"};function Va(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Kl(){var t;return typeof XMLHttpRequest!="undefined"?t=xn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=xn()),t}function Xl(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var dr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Kl(),transformRequest:[function(e,r){return Fa(r,"Accept"),Fa(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Va(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(Va(r,"application/json"),Xl(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?$l(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};dr.headers={common:{Accept:"application/json, text/plain, */*"}};G.forEach(["delete","get","head"],function(e){dr.headers[e]={}});G.forEach(["post","put","patch"],function(e){dr.headers[e]=G.merge(Wl)});Ha.exports=dr});var Ja=p((Bm,Ga)=>{"use strict";var Yl=X(),Ql=hr();Ga.exports=function(e,r,n){var i=this||Ql;return Yl.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Tn=p((Fm,za)=>{"use strict";za.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ka=p((Vm,Wa)=>{"use strict";var $a=X(),bn=Ja(),Zl=Tn(),ef=hr();function An(t){t.cancelToken&&t.cancelToken.throwIfRequested()}Wa.exports=function(e){An(e),e.headers=e.headers||{},e.data=bn.call(e,e.data,e.headers,e.transformRequest),e.headers=$a.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),$a.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ef.adapter;return r(e).then(function(i){return An(e),i.data=bn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Zl(i)||(An(e),i&&i.response&&(i.response.data=bn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Rn=p((Hm,Xa)=>{"use strict";var W=X();Xa.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function c(d,h){return W.isPlainObject(d)&&W.isPlainObject(h)?W.merge(d,h):W.isPlainObject(h)?W.merge({},h):W.isArray(h)?h.slice():h}function l(d){W.isUndefined(r[d])?W.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}W.forEach(i,function(h){W.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),W.forEach(s,l),W.forEach(a,function(h){W.isUndefined(r[h])?W.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),W.forEach(u,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var o=i.concat(s).concat(a).concat(u),f=Object.keys(e).concat(Object.keys(r)).filter(function(h){return o.indexOf(h)===-1});return W.forEach(f,l),n}});var Ya=p((Gm,tf)=>{tf.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]}});var ro=p((Jm,to)=>{"use strict";var Za=Ya(),On={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){On[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Qa={},rf=Za.version.split(".");function eo(t,e){for(var r=e?e.split("."):rf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}On.transitional=function(e,r,n){var i=r&&eo(r);function s(a,u){return"[Axios v"+Za.version+"] Transitional option '"+a+"'"+u+(n?". "+n:"")}return function(a,u,c){if(e===!1)throw new Error(s(u," has been removed in "+r));return i&&!Qa[u]&&(Qa[u]=!0,console.warn(s(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,u,c):!0}};function nf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}to.exports={isOlderVersion:eo,assertOptions:nf,validators:On}});var uo=p((zm,oo)=>{"use strict";var so=X(),sf=yn(),no=Sa(),io=Ka(),pr=Rn(),ao=ro(),Qe=ao.validators;function Ot(t){this.defaults=t,this.interceptors={request:new no,response:new no}}Ot.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=pr(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&ao.assertOptions(r,{silentJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),forcedJSONParsing:Qe.transitional(Qe.boolean,"1.0.0"),clarifyTimeoutError:Qe.transitional(Qe.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[io,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=io(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Ot.prototype.getUri=function(e){return e=pr(this.defaults,e),sf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};so.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(r,n){return this.request(pr(n||{},{method:e,url:r,data:(n||{}).data}))}});so.forEach(["post","put","patch"],function(e){Ot.prototype[e]=function(r,n,i){return this.request(pr(i||{},{method:e,url:r,data:n}))}});oo.exports=Ot});var Pn=p(($m,co)=>{"use strict";function Cn(t){this.message=t}Cn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Cn.prototype.__CANCEL__=!0;co.exports=Cn});var fo=p((Wm,lo)=>{"use strict";var af=Pn();function vr(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;t(function(i){r.reason||(r.reason=new af(i),e(r.reason))})}vr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};vr.source=function(){var e,r=new vr(function(i){e=i});return{token:r,cancel:e}};lo.exports=vr});var po=p((Km,ho)=>{"use strict";ho.exports=function(e){return function(n){return e.apply(null,n)}}});var mo=p((Xm,vo)=>{"use strict";vo.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Eo=p((Ym,Nn)=>{"use strict";var yo=X(),of=dn(),mr=uo(),uf=Rn(),cf=hr();function go(t){var e=new mr(t),r=of(mr.prototype.request,e);return yo.extend(r,mr.prototype,e),yo.extend(r,e),r}var ue=go(cf);ue.Axios=mr;ue.create=function(e){return go(uf(ue.defaults,e))};ue.Cancel=Pn();ue.CancelToken=fo();ue.isCancel=Tn();ue.all=function(e){return Promise.all(e)};ue.spread=po();ue.isAxiosError=mo();Nn.exports=ue;Nn.exports.default=ue});var wo=p((Qm,So)=>{So.exports=Eo()});var _n=p((oy,To)=>{"use strict";To.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var Y=p((uy,Ro)=>{"use strict";var lf=_n(),qe=Object.prototype.toString;function Un(t){return qe.call(t)==="[object Array]"}function qn(t){return typeof t=="undefined"}function ff(t){return t!==null&&!qn(t)&&t.constructor!==null&&!qn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function df(t){return qe.call(t)==="[object ArrayBuffer]"}function hf(t){return typeof FormData!="undefined"&&t instanceof FormData}function pf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function vf(t){return typeof t=="string"}function mf(t){return typeof t=="number"}function bo(t){return t!==null&&typeof t=="object"}function yr(t){if(qe.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function yf(t){return qe.call(t)==="[object Date]"}function gf(t){return qe.call(t)==="[object File]"}function Ef(t){return qe.call(t)==="[object Blob]"}function Ao(t){return qe.call(t)==="[object Function]"}function Sf(t){return bo(t)&&Ao(t.pipe)}function wf(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function xf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Tf(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Mn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Un(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Dn(){var t={};function e(i,s){yr(t[s])&&yr(i)?t[s]=Dn(t[s],i):yr(i)?t[s]=Dn({},i):Un(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Mn(arguments[r],e);return t}function bf(t,e,r){return Mn(e,function(i,s){r&&typeof i=="function"?t[s]=lf(i,r):t[s]=i}),t}function Af(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Ro.exports={isArray:Un,isArrayBuffer:df,isBuffer:ff,isFormData:hf,isArrayBufferView:pf,isString:vf,isNumber:mf,isObject:bo,isPlainObject:yr,isUndefined:qn,isDate:yf,isFile:gf,isBlob:Ef,isFunction:Ao,isStream:Sf,isURLSearchParams:wf,isStandardBrowserEnv:Tf,forEach:Mn,merge:Dn,extend:bf,trim:xf,stripBOM:Af}});var jn=p((cy,Co)=>{"use strict";var Ze=Y();function Oo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Co.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Ze.isURLSearchParams(r))i=r.toString();else{var s=[];Ze.forEach(r,function(c,l){c===null||typeof c=="undefined"||(Ze.isArray(c)?l=l+"[]":c=[c],Ze.forEach(c,function(f){Ze.isDate(f)?f=f.toISOString():Ze.isObject(f)&&(f=JSON.stringify(f)),s.push(Oo(l)+"="+Oo(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var No=p((ly,Po)=>{"use strict";var Rf=Y();function gr(){this.handlers=[]}gr.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};gr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};gr.prototype.forEach=function(e){Rf.forEach(this.handlers,function(n){n!==null&&e(n)})};Po.exports=gr});var ko=p((fy,Io)=>{"use strict";var Of=Y();Io.exports=function(e,r){Of.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Ln=p((dy,_o)=>{"use strict";_o.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var Bn=p((hy,qo)=>{"use strict";var Cf=Ln();qo.exports=function(e,r,n,i,s){var a=new Error(e);return Cf(a,r,n,i,s)}});var Uo=p((py,Do)=>{"use strict";var Pf=Bn();Do.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Pf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var jo=p((vy,Mo)=>{"use strict";var Er=Y();Mo.exports=Er.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Er.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Er.isString(s)&&c.push("path="+s),Er.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Bo=p((my,Lo)=>{"use strict";Lo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Vo=p((yy,Fo)=>{"use strict";Fo.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Go=p((gy,Ho)=>{"use strict";var Nf=Bo(),If=Vo();Ho.exports=function(e,r){return e&&!Nf(r)?If(e,r):r}});var zo=p((Ey,Jo)=>{"use strict";var Fn=Y(),kf=["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"];Jo.exports=function(e){var r={},n,i,s;return e&&Fn.forEach(e.split(`
4
- `),function(u){if(s=u.indexOf(":"),n=Fn.trim(u.substr(0,s)).toLowerCase(),i=Fn.trim(u.substr(s+1)),n){if(r[n]&&kf.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Ko=p((Sy,Wo)=>{"use strict";var $o=Y();Wo.exports=$o.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=$o.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Ct=p((wy,Xo)=>{"use strict";function Vn(t){this.message=t}Vn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Vn.prototype.__CANCEL__=!0;Xo.exports=Vn});var Gn=p((xy,Yo)=>{"use strict";var Sr=Y(),_f=Uo(),qf=jo(),Df=jn(),Uf=Go(),Mf=zo(),jf=Ko(),Hn=Bn(),Lf=Pt(),Bf=Ct();Yo.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Sr.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=Uf(e.baseURL,e.url);o.open(e.method.toUpperCase(),Df(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function y(){if(!!o){var v="getAllResponseHeaders"in o?Mf(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};_f(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=y:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(y)},o.onabort=function(){!o||(i(Hn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Hn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Lf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Hn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Sr.isStandardBrowserEnv()){var E=(e.withCredentials||jf(h))&&e.xsrfCookieName?qf.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Sr.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Sr.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new Bf("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var Pt=p((Ty,eu)=>{"use strict";var J=Y(),Qo=ko(),Ff=Ln(),Vf={"Content-Type":"application/x-www-form-urlencoded"};function Zo(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Hf(){var t;return typeof XMLHttpRequest!="undefined"?t=Gn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Gn()),t}function Gf(t,e,r){if(J.isString(t))try{return(e||JSON.parse)(t),J.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var wr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Hf(),transformRequest:[function(e,r){return Qo(r,"Accept"),Qo(r,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(Zo(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Zo(r,"application/json"),Gf(e)):e}],transformResponse:[function(e){var r=this.transitional||wr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Ff(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};J.forEach(["delete","get","head"],function(e){wr.headers[e]={}});J.forEach(["post","put","patch"],function(e){wr.headers[e]=J.merge(Vf)});eu.exports=wr});var ru=p((by,tu)=>{"use strict";var Jf=Y(),zf=Pt();tu.exports=function(e,r,n){var i=this||zf;return Jf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Jn=p((Ay,nu)=>{"use strict";nu.exports=function(e){return!!(e&&e.__CANCEL__)}});var au=p((Ry,su)=>{"use strict";var iu=Y(),zn=ru(),$f=Jn(),Wf=Pt(),Kf=Ct();function $n(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Kf("canceled")}su.exports=function(e){$n(e),e.headers=e.headers||{},e.data=zn.call(e,e.data,e.headers,e.transformRequest),e.headers=iu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),iu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Wf.adapter;return r(e).then(function(i){return $n(e),i.data=zn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return $f(i)||($n(e),i&&i.response&&(i.response.data=zn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Wn=p((Oy,ou)=>{"use strict";var ne=Y();ou.exports=function(e,r){r=r||{};var n={};function i(o,f){return ne.isPlainObject(o)&&ne.isPlainObject(f)?ne.merge(o,f):ne.isPlainObject(f)?ne.merge({},f):ne.isArray(f)?f.slice():f}function s(o){if(ne.isUndefined(r[o])){if(!ne.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!ne.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(ne.isUndefined(r[o])){if(!ne.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return ne.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);ne.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var Kn=p((Cy,uu)=>{uu.exports={version:"0.23.0"}});var fu=p((Py,lu)=>{"use strict";var Xf=Kn().version,Xn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Xn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var cu={};Xn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+Xf+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!cu[a]&&(cu[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function Yf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}lu.exports={assertOptions:Yf,validators:Xn}});var yu=p((Ny,mu)=>{"use strict";var pu=Y(),Qf=jn(),du=No(),hu=au(),xr=Wn(),vu=fu(),et=vu.validators;function Nt(t){this.defaults=t,this.interceptors={request:new du,response:new du}}Nt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=xr(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&vu.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[hu,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=hu(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Nt.prototype.getUri=function(e){return e=xr(this.defaults,e),Qf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};pu.forEach(["delete","get","head","options"],function(e){Nt.prototype[e]=function(r,n){return this.request(xr(n||{},{method:e,url:r,data:(n||{}).data}))}});pu.forEach(["post","put","patch"],function(e){Nt.prototype[e]=function(r,n,i){return this.request(xr(i||{},{method:e,url:r,data:n}))}});mu.exports=Nt});var Eu=p((Iy,gu)=>{"use strict";var Zf=Ct();function tt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Zf(i),e(r.reason))})}tt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};tt.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};tt.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};tt.source=function(){var e,r=new tt(function(i){e=i});return{token:r,cancel:e}};gu.exports=tt});var wu=p((ky,Su)=>{"use strict";Su.exports=function(e){return function(n){return e.apply(null,n)}}});var Tu=p((_y,xu)=>{"use strict";xu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Ru=p((qy,Yn)=>{"use strict";var bu=Y(),ed=_n(),Tr=yu(),td=Wn(),rd=Pt();function Au(t){var e=new Tr(t),r=ed(Tr.prototype.request,e);return bu.extend(r,Tr.prototype,e),bu.extend(r,e),r.create=function(i){return Au(td(t,i))},r}var pe=Au(rd);pe.Axios=Tr;pe.Cancel=Ct();pe.CancelToken=Eu();pe.isCancel=Jn();pe.VERSION=Kn().version;pe.all=function(e){return Promise.all(e)};pe.spread=wu();pe.isAxiosError=Tu();Yn.exports=pe;Yn.exports.default=pe});var Qn=p((Dy,Ou)=>{Ou.exports=Ru()});var ei=p(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.default=void 0;var nd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,id=nd;br.default=id});var Nu=p(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.default=ud;var sd=ad(ei());function ad(t){return t&&t.__esModule?t:{default:t}}function Ar(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ar=function(r){return typeof r}:Ar=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ar(t)}var od=10,Pu=2;function ud(t){return Rr(t,[])}function Rr(t,e){switch(Ar(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":cd(t,e);default:return String(t)}}function cd(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=dd(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Rr(i,r)}else if(Array.isArray(t))return fd(t,r);return ld(t,r)}function ld(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Pu)return"["+hd(t)+"]";var n=r.map(function(i){var s=Rr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function fd(t,e){if(t.length===0)return"[]";if(e.length>Pu)return"[Array]";for(var r=Math.min(od,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(Rr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function dd(t){var e=t[String(sd.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function hd(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}});var Iu=p(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.default=pd;function pd(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var qu=p(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.default=md;var vd=_u(Iu()),ku=_u(ei());function _u(t){return t&&t.__esModule?t:{default:t}}function md(t){var e=t.prototype.toJSON;typeof e=="function"||(0,vd.default)(0),t.prototype.inspect=e,ku.default&&(t.prototype[ku.default]=e)}});var ju=p(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.isNode=gd;De.Token=De.Location=void 0;var Du=yd(qu());function yd(t){return t&&t.__esModule?t:{default:t}}var Uu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();De.Location=Uu;(0,Du.default)(Uu);var Mu=function(){function t(r,n,i,s,a,u,c){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=a,this.value=c,this.prev=u,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();De.Token=Mu;(0,Du.default)(Mu);function gd(t){return t!=null&&typeof t.kind=="string"}});var Fu=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=wd;ye.visitInParallel=xd;ye.getVisitFn=Or;ye.BREAK=ye.QueryDocumentKeys=void 0;var Ed=Sd(Nu()),Lu=ju();function Sd(t){return t&&t.__esModule?t:{default:t}}var Bu={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};ye.QueryDocumentKeys=Bu;var rt=Object.freeze({});ye.BREAK=rt;function wd(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bu,n=void 0,i=Array.isArray(t),s=[t],a=-1,u=[],c=void 0,l=void 0,o=void 0,f=[],d=[],h=t;do{a++;var y=a===s.length,E=y&&u.length!==0;if(y){if(l=d.length===0?void 0:f[f.length-1],c=o,o=d.pop(),E){if(i)c=c.slice();else{for(var v={},x=0,g=Object.keys(c);x<g.length;x++){var T=g[x];v[T]=c[T]}c=v}for(var O=0,N=0;N<u.length;N++){var j=u[N][0],b=u[N][1];i&&(j-=O),i&&b===null?(c.splice(j,1),O++):c[j]=b}}a=n.index,s=n.keys,u=n.edits,i=n.inArray,n=n.prev}else{if(l=o?i?a:s[a]:void 0,c=o?o[l]:h,c==null)continue;o&&f.push(l)}var w=void 0;if(!Array.isArray(c)){if(!(0,Lu.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,Ed.default)(c),"."));var A=Or(e,c.kind,y);if(A){if(w=A.call(e,c,l,o,f,d),w===rt)break;if(w===!1){if(!y){f.pop();continue}}else if(w!==void 0&&(u.push([l,w]),!y))if((0,Lu.isNode)(w))c=w;else{f.pop();continue}}}if(w===void 0&&E&&u.push([l,c]),y)f.pop();else{var D;n={inArray:i,index:a,keys:s,edits:u,prev:n},i=Array.isArray(c),s=i?c:(D=r[c.kind])!==null&&D!==void 0?D:[],a=-1,u=[],o&&d.push(o),o=c}}while(n!==void 0);return u.length!==0&&(h=u[u.length-1][1]),h}function xd(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Or(t[i],n.kind,!1);if(s){var a=s.apply(t[i],arguments);if(a===!1)e[i]=n;else if(a===rt)e[i]=rt;else if(a!==void 0)return a}}},leave:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=Or(t[i],n.kind,!0);if(s){var a=s.apply(t[i],arguments);if(a===rt)e[i]=rt;else if(a!==void 0&&a!==!1)return a}}else e[i]===n&&(e[i]=null)}}}function Or(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var a=s[e];if(typeof a=="function")return a}}}});var Gu=p(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.dedentBlockStringValue=Td;It.getBlockStringIndentation=Hu;It.printBlockString=bd;function Td(t){var e=t.split(/\r\n|[\n\r]/g),r=Hu(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Vu(e[i]);)++i;for(var s=e.length;s>i&&Vu(e[s-1]);)--s;return e.slice(i,s).join(`
5
- `)}function Vu(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Hu(t){for(var e,r=!0,n=!0,i=0,s=null,a=0;a<t.length;++a)switch(t.charCodeAt(a)){case 13:t.charCodeAt(a+1)===10&&++a;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(s===null||i<s)&&(s=i),n=!1}return(e=s)!==null&&e!==void 0?e:0}function bd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
1
+ var sc=Object.create;var ci=Object.defineProperty;var ac=Object.getOwnPropertyDescriptor;var oc=Object.getOwnPropertyNames;var uc=Object.getPrototypeOf,cc=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oc(e))!cc.call(t,i)&&i!==r&&ci(t,i,{get:()=>e[i],enumerable:!(n=ac(e,i))||n.enumerable});return t};var it=(t,e,r)=>(r=t!=null?sc(uc(t)):{},lc(e||!t||!t.__esModule?ci(r,"default",{value:t,enumerable:!0}):r,t));var Yr=p((Tp,es)=>{"use strict";es.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var K=p((bp,is)=>{"use strict";var Rc=Yr(),Se=Object.prototype.toString;function en(t){return Array.isArray(t)}function Qr(t){return typeof t=="undefined"}function Oc(t){return t!==null&&!Qr(t)&&t.constructor!==null&&!Qr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ts(t){return Se.call(t)==="[object ArrayBuffer]"}function Cc(t){return Se.call(t)==="[object FormData]"}function Pc(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ts(t.buffer),e}function Nc(t){return typeof t=="string"}function Ic(t){return typeof t=="number"}function rs(t){return t!==null&&typeof t=="object"}function Yt(t){if(Se.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function kc(t){return Se.call(t)==="[object Date]"}function _c(t){return Se.call(t)==="[object File]"}function Dc(t){return Se.call(t)==="[object Blob]"}function ns(t){return Se.call(t)==="[object Function]"}function qc(t){return rs(t)&&ns(t.pipe)}function Uc(t){return Se.call(t)==="[object URLSearchParams]"}function jc(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Mc(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function tn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),en(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Zr(){var t={};function e(i,s){Yt(t[s])&&Yt(i)?t[s]=Zr(t[s],i):Yt(i)?t[s]=Zr({},i):en(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)tn(arguments[r],e);return t}function Lc(t,e,r){return tn(e,function(i,s){r&&typeof i=="function"?t[s]=Rc(i,r):t[s]=i}),t}function Bc(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}is.exports={isArray:en,isArrayBuffer:ts,isBuffer:Oc,isFormData:Cc,isArrayBufferView:Pc,isString:Nc,isNumber:Ic,isObject:rs,isPlainObject:Yt,isUndefined:Qr,isDate:kc,isFile:_c,isBlob:Dc,isFunction:ns,isStream:qc,isURLSearchParams:Uc,isStandardBrowserEnv:Mc,forEach:tn,merge:Zr,extend:Lc,trim:jc,stripBOM:Bc}});var rn=p((Ap,as)=>{"use strict";var ze=K();function ss(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}as.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ze.isURLSearchParams(r))i=r.toString();else{var s=[];ze.forEach(r,function(c,l){c===null||typeof c=="undefined"||(ze.isArray(c)?l=l+"[]":c=[c],ze.forEach(c,function(f){ze.isDate(f)?f=f.toISOString():ze.isObject(f)&&(f=JSON.stringify(f)),s.push(ss(l)+"="+ss(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var us=p((Rp,os)=>{"use strict";var Fc=K();function Qt(){this.handlers=[]}Qt.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Qt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Qt.prototype.forEach=function(e){Fc.forEach(this.handlers,function(n){n!==null&&e(n)})};os.exports=Qt});var ls=p((Op,cs)=>{"use strict";var Vc=K();cs.exports=function(e,r){Vc.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var nn=p((Cp,fs)=>{"use strict";fs.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var sn=p((Pp,ds)=>{"use strict";var Hc=nn();ds.exports=function(e,r,n,i,s){var a=new Error(e);return Hc(a,r,n,i,s)}});var ps=p((Np,hs)=>{"use strict";var Gc=sn();hs.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Gc("Request failed with status code "+n.status,n.config,null,n.request,n))}});var ms=p((Ip,vs)=>{"use strict";var Zt=K();vs.exports=Zt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Zt.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Zt.isString(s)&&c.push("path="+s),Zt.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var gs=p((kp,ys)=>{"use strict";ys.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Ss=p((_p,Es)=>{"use strict";Es.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var xs=p((Dp,ws)=>{"use strict";var Jc=gs(),zc=Ss();ws.exports=function(e,r){return e&&!Jc(r)?zc(e,r):r}});var bs=p((qp,Ts)=>{"use strict";var an=K(),$c=["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"];Ts.exports=function(e){var r={},n,i,s;return e&&an.forEach(e.split(`
2
+ `),function(u){if(s=u.indexOf(":"),n=an.trim(u.substr(0,s)).toLowerCase(),i=an.trim(u.substr(s+1)),n){if(r[n]&&$c.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var Os=p((Up,Rs)=>{"use strict";var As=K();Rs.exports=As.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=As.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var bt=p((jp,Cs)=>{"use strict";function on(t){this.message=t}on.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};on.prototype.__CANCEL__=!0;Cs.exports=on});var cn=p((Mp,Ps)=>{"use strict";var er=K(),Wc=ps(),Kc=ms(),Xc=rn(),Yc=xs(),Qc=bs(),Zc=Os(),un=sn(),el=At(),tl=bt();Ps.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}er.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=Yc(e.baseURL,e.url);o.open(e.method.toUpperCase(),Xc(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?Qc(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};Wc(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=m:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(m)},o.onabort=function(){!o||(i(un("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(un("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||el.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(un(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},er.isStandardBrowserEnv()){var E=(e.withCredentials||Zc(h))&&e.xsrfCookieName?Kc.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&er.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),er.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new tl("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var At=p((Lp,ks)=>{"use strict";var G=K(),Ns=ls(),rl=nn(),nl={"Content-Type":"application/x-www-form-urlencoded"};function Is(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function il(){var t;return typeof XMLHttpRequest!="undefined"?t=cn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=cn()),t}function sl(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var tr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:il(),transformRequest:[function(e,r){return Ns(r,"Accept"),Ns(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Is(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(Is(r,"application/json"),sl(e)):e}],transformResponse:[function(e){var r=this.transitional||tr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?rl(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};G.forEach(["delete","get","head"],function(e){tr.headers[e]={}});G.forEach(["post","put","patch"],function(e){tr.headers[e]=G.merge(nl)});ks.exports=tr});var Ds=p((Bp,_s)=>{"use strict";var al=K(),ol=At();_s.exports=function(e,r,n){var i=this||ol;return al.forEach(n,function(a){e=a.call(i,e,r)}),e}});var ln=p((Fp,qs)=>{"use strict";qs.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ms=p((Vp,js)=>{"use strict";var Us=K(),fn=Ds(),ul=ln(),cl=At(),ll=bt();function dn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ll("canceled")}js.exports=function(e){dn(e),e.headers=e.headers||{},e.data=fn.call(e,e.data,e.headers,e.transformRequest),e.headers=Us.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Us.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||cl.adapter;return r(e).then(function(i){return dn(e),i.data=fn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ul(i)||(dn(e),i&&i.response&&(i.response.data=fn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var hn=p((Hp,Ls)=>{"use strict";var te=K();Ls.exports=function(e,r){r=r||{};var n={};function i(o,f){return te.isPlainObject(o)&&te.isPlainObject(f)?te.merge(o,f):te.isPlainObject(f)?te.merge({},f):te.isArray(f)?f.slice():f}function s(o){if(te.isUndefined(r[o])){if(!te.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!te.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(te.isUndefined(r[o])){if(!te.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return te.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);te.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var pn=p((Gp,Bs)=>{Bs.exports={version:"0.25.0"}});var Hs=p((Jp,Vs)=>{"use strict";var fl=pn().version,vn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){vn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Fs={};vn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+fl+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!Fs[a]&&(Fs[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function dl(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Vs.exports={assertOptions:dl,validators:vn}});var Ks=p((zp,Ws)=>{"use strict";var zs=K(),hl=rn(),Gs=us(),Js=Ms(),rr=hn(),$s=Hs(),$e=$s.validators;function Rt(t){this.defaults=t,this.interceptors={request:new Gs,response:new Gs}}Rt.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=rr(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&$s.assertOptions(n,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(s=s&&h.synchronous,i.unshift(h.fulfilled,h.rejected))});var a=[];this.interceptors.response.forEach(function(h){a.push(h.fulfilled,h.rejected)});var u;if(!s){var c=[Js,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(a),u=Promise.resolve(r);c.length;)u=u.then(c.shift(),c.shift());return u}for(var l=r;i.length;){var o=i.shift(),f=i.shift();try{l=o(l)}catch(d){f(d);break}}try{u=Js(l)}catch(d){return Promise.reject(d)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};Rt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=rr(this.defaults,e),hl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};zs.forEach(["delete","get","head","options"],function(e){Rt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});zs.forEach(["post","put","patch"],function(e){Rt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});Ws.exports=Rt});var Ys=p(($p,Xs)=>{"use strict";var pl=bt();function We(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new pl(i),e(r.reason))})}We.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};We.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};We.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};We.source=function(){var e,r=new We(function(i){e=i});return{token:r,cancel:e}};Xs.exports=We});var Zs=p((Wp,Qs)=>{"use strict";Qs.exports=function(e){return function(n){return e.apply(null,n)}}});var ta=p((Kp,ea)=>{"use strict";var vl=K();ea.exports=function(e){return vl.isObject(e)&&e.isAxiosError===!0}});var ia=p((Xp,mn)=>{"use strict";var ra=K(),ml=Yr(),nr=Ks(),yl=hn(),gl=At();function na(t){var e=new nr(t),r=ml(nr.prototype.request,e);return ra.extend(r,nr.prototype,e),ra.extend(r,e),r.create=function(i){return na(yl(t,i))},r}var he=na(gl);he.Axios=nr;he.Cancel=bt();he.CancelToken=Ys();he.isCancel=ln();he.VERSION=pn().version;he.all=function(e){return Promise.all(e)};he.spread=Zs();he.isAxiosError=ta();mn.exports=he;mn.exports.default=he});var aa=p((Yp,sa)=>{sa.exports=ia()});var En=p((Lm,wa)=>{"use strict";wa.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var X=p((Bm,ba)=>{"use strict";var Cl=En(),_e=Object.prototype.toString;function xn(t){return _e.call(t)==="[object Array]"}function Sn(t){return typeof t=="undefined"}function Pl(t){return t!==null&&!Sn(t)&&t.constructor!==null&&!Sn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Nl(t){return _e.call(t)==="[object ArrayBuffer]"}function Il(t){return typeof FormData!="undefined"&&t instanceof FormData}function kl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function _l(t){return typeof t=="string"}function Dl(t){return typeof t=="number"}function xa(t){return t!==null&&typeof t=="object"}function fr(t){if(_e.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ql(t){return _e.call(t)==="[object Date]"}function Ul(t){return _e.call(t)==="[object File]"}function jl(t){return _e.call(t)==="[object Blob]"}function Ta(t){return _e.call(t)==="[object Function]"}function Ml(t){return xa(t)&&Ta(t.pipe)}function Ll(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Bl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Fl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Tn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),xn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function wn(){var t={};function e(i,s){fr(t[s])&&fr(i)?t[s]=wn(t[s],i):fr(i)?t[s]=wn({},i):xn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Tn(arguments[r],e);return t}function Vl(t,e,r){return Tn(e,function(i,s){r&&typeof i=="function"?t[s]=Cl(i,r):t[s]=i}),t}function Hl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ba.exports={isArray:xn,isArrayBuffer:Nl,isBuffer:Pl,isFormData:Il,isArrayBufferView:kl,isString:_l,isNumber:Dl,isObject:xa,isPlainObject:fr,isUndefined:Sn,isDate:ql,isFile:Ul,isBlob:jl,isFunction:Ta,isStream:Ml,isURLSearchParams:Ll,isStandardBrowserEnv:Fl,forEach:Tn,merge:wn,extend:Vl,trim:Bl,stripBOM:Hl}});var bn=p((Fm,Ra)=>{"use strict";var Qe=X();function Aa(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ra.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(Qe.isURLSearchParams(r))i=r.toString();else{var s=[];Qe.forEach(r,function(c,l){c===null||typeof c=="undefined"||(Qe.isArray(c)?l=l+"[]":c=[c],Qe.forEach(c,function(f){Qe.isDate(f)?f=f.toISOString():Qe.isObject(f)&&(f=JSON.stringify(f)),s.push(Aa(l)+"="+Aa(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ca=p((Vm,Oa)=>{"use strict";var Gl=X();function dr(){this.handlers=[]}dr.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};dr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};dr.prototype.forEach=function(e){Gl.forEach(this.handlers,function(n){n!==null&&e(n)})};Oa.exports=dr});var Na=p((Hm,Pa)=>{"use strict";var Jl=X();Pa.exports=function(e,r){Jl.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var An=p((Gm,Ia)=>{"use strict";Ia.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code}},e}});var Rn=p((Jm,ka)=>{"use strict";var zl=An();ka.exports=function(e,r,n,i,s){var a=new Error(e);return zl(a,r,n,i,s)}});var Da=p((zm,_a)=>{"use strict";var $l=Rn();_a.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r($l("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ua=p(($m,qa)=>{"use strict";var hr=X();qa.exports=hr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),hr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),hr.isString(s)&&c.push("path="+s),hr.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Ma=p((Wm,ja)=>{"use strict";ja.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ba=p((Km,La)=>{"use strict";La.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Va=p((Xm,Fa)=>{"use strict";var Wl=Ma(),Kl=Ba();Fa.exports=function(e,r){return e&&!Wl(r)?Kl(e,r):r}});var Ga=p((Ym,Ha)=>{"use strict";var On=X(),Xl=["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"];Ha.exports=function(e){var r={},n,i,s;return e&&On.forEach(e.split(`
3
+ `),function(u){if(s=u.indexOf(":"),n=On.trim(u.substr(0,s)).toLowerCase(),i=On.trim(u.substr(s+1)),n){if(r[n]&&Xl.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var $a=p((Qm,za)=>{"use strict";var Ja=X();za.exports=Ja.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=Ja.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Pn=p((Zm,Wa)=>{"use strict";var pr=X(),Yl=Da(),Ql=Ua(),Zl=bn(),ef=Va(),tf=Ga(),rf=$a(),Cn=Rn();Wa.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType;pr.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",o=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(l+":"+o)}var f=ef(e.baseURL,e.url);c.open(e.method.toUpperCase(),Zl(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var m="getAllResponseHeaders"in c?tf(c.getAllResponseHeaders()):null,E=!u||u==="text"||u==="json"?c.responseText:c.response,v={data:E,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};Yl(n,i,v),c=null}}if("onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(d)},c.onabort=function(){!c||(i(Cn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Cn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(Cn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},pr.isStandardBrowserEnv()){var h=(e.withCredentials||rf(f))&&e.xsrfCookieName?Ql.read(e.xsrfCookieName):void 0;h&&(a[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&pr.forEach(a,function(E,v){typeof s=="undefined"&&v.toLowerCase()==="content-type"?delete a[v]:c.setRequestHeader(v,E)}),pr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),u&&u!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(E){!c||(c.abort(),i(E),c=null)}),s||(s=null),c.send(s)})}});var mr=p((ey,Ya)=>{"use strict";var J=X(),Ka=Na(),nf=An(),sf={"Content-Type":"application/x-www-form-urlencoded"};function Xa(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function af(){var t;return typeof XMLHttpRequest!="undefined"?t=Pn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Pn()),t}function of(t,e,r){if(J.isString(t))try{return(e||JSON.parse)(t),J.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var vr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:af(),transformRequest:[function(e,r){return Ka(r,"Accept"),Ka(r,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(Xa(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Xa(r,"application/json"),of(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?nf(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};vr.headers={common:{Accept:"application/json, text/plain, */*"}};J.forEach(["delete","get","head"],function(e){vr.headers[e]={}});J.forEach(["post","put","patch"],function(e){vr.headers[e]=J.merge(sf)});Ya.exports=vr});var Za=p((ty,Qa)=>{"use strict";var uf=X(),cf=mr();Qa.exports=function(e,r,n){var i=this||cf;return uf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Nn=p((ry,eo)=>{"use strict";eo.exports=function(e){return!!(e&&e.__CANCEL__)}});var no=p((ny,ro)=>{"use strict";var to=X(),In=Za(),lf=Nn(),ff=mr();function kn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}ro.exports=function(e){kn(e),e.headers=e.headers||{},e.data=In.call(e,e.data,e.headers,e.transformRequest),e.headers=to.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),to.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ff.adapter;return r(e).then(function(i){return kn(e),i.data=In.call(e,i.data,i.headers,e.transformResponse),i},function(i){return lf(i)||(kn(e),i&&i.response&&(i.response.data=In.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var _n=p((iy,io)=>{"use strict";var W=X();io.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function c(d,h){return W.isPlainObject(d)&&W.isPlainObject(h)?W.merge(d,h):W.isPlainObject(h)?W.merge({},h):W.isArray(h)?h.slice():h}function l(d){W.isUndefined(r[d])?W.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}W.forEach(i,function(h){W.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),W.forEach(s,l),W.forEach(a,function(h){W.isUndefined(r[h])?W.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),W.forEach(u,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var o=i.concat(s).concat(a).concat(u),f=Object.keys(e).concat(Object.keys(r)).filter(function(h){return o.indexOf(h)===-1});return W.forEach(f,l),n}});var so=p((sy,df)=>{df.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]}});var lo=p((ay,co)=>{"use strict";var oo=so(),Dn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Dn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var ao={},hf=oo.version.split(".");function uo(t,e){for(var r=e?e.split("."):hf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}Dn.transitional=function(e,r,n){var i=r&&uo(r);function s(a,u){return"[Axios v"+oo.version+"] Transitional option '"+a+"'"+u+(n?". "+n:"")}return function(a,u,c){if(e===!1)throw new Error(s(u," has been removed in "+r));return i&&!ao[u]&&(ao[u]=!0,console.warn(s(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,u,c):!0}};function pf(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}co.exports={isOlderVersion:uo,assertOptions:pf,validators:Dn}});var yo=p((oy,mo)=>{"use strict";var po=X(),vf=bn(),fo=Ca(),ho=no(),yr=_n(),vo=lo(),Ze=vo.validators;function Ot(t){this.defaults=t,this.interceptors={request:new fo,response:new fo}}Ot.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=yr(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&vo.assertOptions(r,{silentJSONParsing:Ze.transitional(Ze.boolean,"1.0.0"),forcedJSONParsing:Ze.transitional(Ze.boolean,"1.0.0"),clarifyTimeoutError:Ze.transitional(Ze.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[ho,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=ho(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Ot.prototype.getUri=function(e){return e=yr(this.defaults,e),vf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};po.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(r,n){return this.request(yr(n||{},{method:e,url:r,data:(n||{}).data}))}});po.forEach(["post","put","patch"],function(e){Ot.prototype[e]=function(r,n,i){return this.request(yr(i||{},{method:e,url:r,data:n}))}});mo.exports=Ot});var Un=p((uy,go)=>{"use strict";function qn(t){this.message=t}qn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};qn.prototype.__CANCEL__=!0;go.exports=qn});var So=p((cy,Eo)=>{"use strict";var mf=Un();function gr(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;t(function(i){r.reason||(r.reason=new mf(i),e(r.reason))})}gr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};gr.source=function(){var e,r=new gr(function(i){e=i});return{token:r,cancel:e}};Eo.exports=gr});var xo=p((ly,wo)=>{"use strict";wo.exports=function(e){return function(n){return e.apply(null,n)}}});var bo=p((fy,To)=>{"use strict";To.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Oo=p((dy,jn)=>{"use strict";var Ao=X(),yf=En(),Er=yo(),gf=_n(),Ef=mr();function Ro(t){var e=new Er(t),r=yf(Er.prototype.request,e);return Ao.extend(r,Er.prototype,e),Ao.extend(r,e),r}var ue=Ro(Ef);ue.Axios=Er;ue.create=function(e){return Ro(gf(ue.defaults,e))};ue.Cancel=Un();ue.CancelToken=So();ue.isCancel=Nn();ue.all=function(e){return Promise.all(e)};ue.spread=xo();ue.isAxiosError=bo();jn.exports=ue;jn.exports.default=ue});var Po=p((hy,Co)=>{Co.exports=Oo()});var Mn=p((xy,Io)=>{"use strict";Io.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(r,i)}}});var Y=p((Ty,Do)=>{"use strict";var Sf=Mn(),De=Object.prototype.toString;function Fn(t){return De.call(t)==="[object Array]"}function Ln(t){return typeof t=="undefined"}function wf(t){return t!==null&&!Ln(t)&&t.constructor!==null&&!Ln(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function xf(t){return De.call(t)==="[object ArrayBuffer]"}function Tf(t){return typeof FormData!="undefined"&&t instanceof FormData}function bf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Af(t){return typeof t=="string"}function Rf(t){return typeof t=="number"}function ko(t){return t!==null&&typeof t=="object"}function xr(t){if(De.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Of(t){return De.call(t)==="[object Date]"}function Cf(t){return De.call(t)==="[object File]"}function Pf(t){return De.call(t)==="[object Blob]"}function _o(t){return De.call(t)==="[object Function]"}function Nf(t){return ko(t)&&_o(t.pipe)}function If(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function kf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function _f(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Vn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Fn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Bn(){var t={};function e(i,s){xr(t[s])&&xr(i)?t[s]=Bn(t[s],i):xr(i)?t[s]=Bn({},i):Fn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Vn(arguments[r],e);return t}function Df(t,e,r){return Vn(e,function(i,s){r&&typeof i=="function"?t[s]=Sf(i,r):t[s]=i}),t}function qf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Do.exports={isArray:Fn,isArrayBuffer:xf,isBuffer:wf,isFormData:Tf,isArrayBufferView:bf,isString:Af,isNumber:Rf,isObject:ko,isPlainObject:xr,isUndefined:Ln,isDate:Of,isFile:Cf,isBlob:Pf,isFunction:_o,isStream:Nf,isURLSearchParams:If,isStandardBrowserEnv:_f,forEach:Vn,merge:Bn,extend:Df,trim:kf,stripBOM:qf}});var Hn=p((by,Uo)=>{"use strict";var et=Y();function qo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Uo.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(et.isURLSearchParams(r))i=r.toString();else{var s=[];et.forEach(r,function(c,l){c===null||typeof c=="undefined"||(et.isArray(c)?l=l+"[]":c=[c],et.forEach(c,function(f){et.isDate(f)?f=f.toISOString():et.isObject(f)&&(f=JSON.stringify(f)),s.push(qo(l)+"="+qo(f))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Mo=p((Ay,jo)=>{"use strict";var Uf=Y();function Tr(){this.handlers=[]}Tr.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Tr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Tr.prototype.forEach=function(e){Uf.forEach(this.handlers,function(n){n!==null&&e(n)})};jo.exports=Tr});var Bo=p((Ry,Lo)=>{"use strict";var jf=Y();Lo.exports=function(e,r){jf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Gn=p((Oy,Fo)=>{"use strict";Fo.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var Jn=p((Cy,Vo)=>{"use strict";var Mf=Gn();Vo.exports=function(e,r,n,i,s){var a=new Error(e);return Mf(a,r,n,i,s)}});var Go=p((Py,Ho)=>{"use strict";var Lf=Jn();Ho.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Lf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var zo=p((Ny,Jo)=>{"use strict";var br=Y();Jo.exports=br.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,u){var c=[];c.push(r+"="+encodeURIComponent(n)),br.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),br.isString(s)&&c.push("path="+s),br.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Wo=p((Iy,$o)=>{"use strict";$o.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Xo=p((ky,Ko)=>{"use strict";Ko.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Qo=p((_y,Yo)=>{"use strict";var Bf=Wo(),Ff=Xo();Yo.exports=function(e,r){return e&&!Bf(r)?Ff(e,r):r}});var eu=p((Dy,Zo)=>{"use strict";var zn=Y(),Vf=["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"];Zo.exports=function(e){var r={},n,i,s;return e&&zn.forEach(e.split(`
4
+ `),function(u){if(s=u.indexOf(":"),n=zn.trim(u.substr(0,s)).toLowerCase(),i=zn.trim(u.substr(s+1)),n){if(r[n]&&Vf.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var nu=p((qy,ru)=>{"use strict";var tu=Y();ru.exports=tu.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var u=tu.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Ct=p((Uy,iu)=>{"use strict";function $n(t){this.message=t}$n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};$n.prototype.__CANCEL__=!0;iu.exports=$n});var Kn=p((jy,su)=>{"use strict";var Ar=Y(),Hf=Go(),Gf=zo(),Jf=Hn(),zf=Qo(),$f=eu(),Wf=nu(),Wn=Jn(),Kf=Pt(),Xf=Ct();su.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,u=e.responseType,c;function l(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Ar.isFormData(s)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+d)}var h=zf(e.baseURL,e.url);o.open(e.method.toUpperCase(),Jf(h,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function m(){if(!!o){var v="getAllResponseHeaders"in o?$f(o.getAllResponseHeaders()):null,x=!u||u==="text"||u==="json"?o.responseText:o.response,g={data:x,status:o.status,statusText:o.statusText,headers:v,config:e,request:o};Hf(function(O){n(O),l()},function(O){i(O),l()},g),o=null}}if("onloadend"in o?o.onloadend=m:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(m)},o.onabort=function(){!o||(i(Wn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){i(Wn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||Kf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Wn(x,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Ar.isStandardBrowserEnv()){var E=(e.withCredentials||Wf(h))&&e.xsrfCookieName?Gf.read(e.xsrfCookieName):void 0;E&&(a[e.xsrfHeaderName]=E)}"setRequestHeader"in o&&Ar.forEach(a,function(x,g){typeof s=="undefined"&&g.toLowerCase()==="content-type"?delete a[g]:o.setRequestHeader(g,x)}),Ar.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(v){!o||(i(!v||v&&v.type?new Xf("canceled"):v),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),o.send(s)})}});var Pt=p((My,uu)=>{"use strict";var z=Y(),au=Bo(),Yf=Gn(),Qf={"Content-Type":"application/x-www-form-urlencoded"};function ou(t,e){!z.isUndefined(t)&&z.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Zf(){var t;return typeof XMLHttpRequest!="undefined"?t=Kn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Kn()),t}function ed(t,e,r){if(z.isString(t))try{return(e||JSON.parse)(t),z.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Rr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Zf(),transformRequest:[function(e,r){return au(r,"Accept"),au(r,"Content-Type"),z.isFormData(e)||z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)?e:z.isArrayBufferView(e)?e.buffer:z.isURLSearchParams(e)?(ou(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):z.isObject(e)||r&&r["Content-Type"]==="application/json"?(ou(r,"application/json"),ed(e)):e}],transformResponse:[function(e){var r=this.transitional||Rr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&z.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Yf(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};z.forEach(["delete","get","head"],function(e){Rr.headers[e]={}});z.forEach(["post","put","patch"],function(e){Rr.headers[e]=z.merge(Qf)});uu.exports=Rr});var lu=p((Ly,cu)=>{"use strict";var td=Y(),rd=Pt();cu.exports=function(e,r,n){var i=this||rd;return td.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Xn=p((By,fu)=>{"use strict";fu.exports=function(e){return!!(e&&e.__CANCEL__)}});var pu=p((Fy,hu)=>{"use strict";var du=Y(),Yn=lu(),nd=Xn(),id=Pt(),sd=Ct();function Qn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new sd("canceled")}hu.exports=function(e){Qn(e),e.headers=e.headers||{},e.data=Yn.call(e,e.data,e.headers,e.transformRequest),e.headers=du.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),du.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||id.adapter;return r(e).then(function(i){return Qn(e),i.data=Yn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return nd(i)||(Qn(e),i&&i.response&&(i.response.data=Yn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Zn=p((Vy,vu)=>{"use strict";var re=Y();vu.exports=function(e,r){r=r||{};var n={};function i(o,f){return re.isPlainObject(o)&&re.isPlainObject(f)?re.merge(o,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function s(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(e[o],r[o])}function a(o){if(!re.isUndefined(r[o]))return i(void 0,r[o])}function u(o){if(re.isUndefined(r[o])){if(!re.isUndefined(e[o]))return i(void 0,e[o])}else return i(void 0,r[o])}function c(o){if(o in r)return i(e[o],r[o]);if(o in e)return i(void 0,e[o])}var l={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return re.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var d=l[f]||s,h=d(f);re.isUndefined(h)&&d!==c||(n[f]=h)}),n}});var ei=p((Hy,mu)=>{mu.exports={version:"0.23.0"}});var Eu=p((Gy,gu)=>{"use strict";var ad=ei().version,ti={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ti[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var yu={};ti.transitional=function(e,r,n){function i(s,a){return"[Axios v"+ad+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!yu[a]&&(yu[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,u):!0}};function od(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],a=e[s];if(a){var u=t[s],c=u===void 0||a(u,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}gu.exports={assertOptions:od,validators:ti}});var Au=p((Jy,bu)=>{"use strict";var xu=Y(),ud=Hn(),Su=Mo(),wu=pu(),Or=Zn(),Tu=Eu(),tt=Tu.validators;function Nt(t){this.defaults=t,this.interceptors={request:new Su,response:new Su}}Nt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Or(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&Tu.assertOptions(r,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var a;if(!i){var u=[wu,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),a=Promise.resolve(e);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=e;n.length;){var l=n.shift(),o=n.shift();try{c=l(c)}catch(f){o(f);break}}try{a=wu(c)}catch(f){return Promise.reject(f)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Nt.prototype.getUri=function(e){return e=Or(this.defaults,e),ud(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};xu.forEach(["delete","get","head","options"],function(e){Nt.prototype[e]=function(r,n){return this.request(Or(n||{},{method:e,url:r,data:(n||{}).data}))}});xu.forEach(["post","put","patch"],function(e){Nt.prototype[e]=function(r,n,i){return this.request(Or(i||{},{method:e,url:r,data:n}))}});bu.exports=Nt});var Ou=p((zy,Ru)=>{"use strict";var cd=Ct();function rt(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(!!r._listeners){var i,s=r._listeners.length;for(i=0;i<s;i++)r._listeners[i](n);r._listeners=null}}),this.promise.then=function(n){var i,s=new Promise(function(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new cd(i),e(r.reason))})}rt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};rt.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};rt.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};rt.source=function(){var e,r=new rt(function(i){e=i});return{token:r,cancel:e}};Ru.exports=rt});var Pu=p(($y,Cu)=>{"use strict";Cu.exports=function(e){return function(n){return e.apply(null,n)}}});var Iu=p((Wy,Nu)=>{"use strict";Nu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Du=p((Ky,ri)=>{"use strict";var ku=Y(),ld=Mn(),Cr=Au(),fd=Zn(),dd=Pt();function _u(t){var e=new Cr(t),r=ld(Cr.prototype.request,e);return ku.extend(r,Cr.prototype,e),ku.extend(r,e),r.create=function(i){return _u(fd(t,i))},r}var pe=_u(dd);pe.Axios=Cr;pe.Cancel=Ct();pe.CancelToken=Ou();pe.isCancel=Xn();pe.VERSION=ei().version;pe.all=function(e){return Promise.all(e)};pe.spread=Pu();pe.isAxiosError=Iu();ri.exports=pe;ri.exports.default=pe});var ni=p((Xy,qu)=>{qu.exports=Du()});var ii=p(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.default=void 0;var hd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,pd=hd;Nr.default=pd});var Mu=p(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.default=gd;var vd=md(ii());function md(t){return t&&t.__esModule?t:{default:t}}function Ir(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ir=function(r){return typeof r}:Ir=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ir(t)}var yd=10,ju=2;function gd(t){return kr(t,[])}function kr(t,e){switch(Ir(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Ed(t,e);default:return String(t)}}function Ed(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=xd(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:kr(i,r)}else if(Array.isArray(t))return wd(t,r);return Sd(t,r)}function Sd(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>ju)return"["+Td(t)+"]";var n=r.map(function(i){var s=kr(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function wd(t,e){if(t.length===0)return"[]";if(e.length>ju)return"[Array]";for(var r=Math.min(yd,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(kr(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function xd(t){var e=t[String(vd.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Td(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}});var Lu=p(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.default=bd;function bd(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var Vu=p(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.default=Rd;var Ad=Fu(Lu()),Bu=Fu(ii());function Fu(t){return t&&t.__esModule?t:{default:t}}function Rd(t){var e=t.prototype.toJSON;typeof e=="function"||(0,Ad.default)(0),t.prototype.inspect=e,Bu.default&&(t.prototype[Bu.default]=e)}});var zu=p(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.isNode=Cd;qe.Token=qe.Location=void 0;var Hu=Od(Vu());function Od(t){return t&&t.__esModule?t:{default:t}}var Gu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();qe.Location=Gu;(0,Hu.default)(Gu);var Ju=function(){function t(r,n,i,s,a,u,c){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=a,this.value=c,this.prev=u,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();qe.Token=Ju;(0,Hu.default)(Ju);function Cd(t){return t!=null&&typeof t.kind=="string"}});var Ku=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=Id;ye.visitInParallel=kd;ye.getVisitFn=_r;ye.BREAK=ye.QueryDocumentKeys=void 0;var Pd=Nd(Mu()),$u=zu();function Nd(t){return t&&t.__esModule?t:{default:t}}var Wu={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};ye.QueryDocumentKeys=Wu;var nt=Object.freeze({});ye.BREAK=nt;function Id(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wu,n=void 0,i=Array.isArray(t),s=[t],a=-1,u=[],c=void 0,l=void 0,o=void 0,f=[],d=[],h=t;do{a++;var m=a===s.length,E=m&&u.length!==0;if(m){if(l=d.length===0?void 0:f[f.length-1],c=o,o=d.pop(),E){if(i)c=c.slice();else{for(var v={},x=0,g=Object.keys(c);x<g.length;x++){var T=g[x];v[T]=c[T]}c=v}for(var O=0,N=0;N<u.length;N++){var M=u[N][0],b=u[N][1];i&&(M-=O),i&&b===null?(c.splice(M,1),O++):c[M]=b}}a=n.index,s=n.keys,u=n.edits,i=n.inArray,n=n.prev}else{if(l=o?i?a:s[a]:void 0,c=o?o[l]:h,c==null)continue;o&&f.push(l)}var w=void 0;if(!Array.isArray(c)){if(!(0,$u.isNode)(c))throw new Error("Invalid AST Node: ".concat((0,Pd.default)(c),"."));var A=_r(e,c.kind,m);if(A){if(w=A.call(e,c,l,o,f,d),w===nt)break;if(w===!1){if(!m){f.pop();continue}}else if(w!==void 0&&(u.push([l,w]),!m))if((0,$u.isNode)(w))c=w;else{f.pop();continue}}}if(w===void 0&&E&&u.push([l,c]),m)f.pop();else{var q;n={inArray:i,index:a,keys:s,edits:u,prev:n},i=Array.isArray(c),s=i?c:(q=r[c.kind])!==null&&q!==void 0?q:[],a=-1,u=[],o&&d.push(o),o=c}}while(n!==void 0);return u.length!==0&&(h=u[u.length-1][1]),h}function kd(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=_r(t[i],n.kind,!1);if(s){var a=s.apply(t[i],arguments);if(a===!1)e[i]=n;else if(a===nt)e[i]=nt;else if(a!==void 0)return a}}},leave:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=_r(t[i],n.kind,!0);if(s){var a=s.apply(t[i],arguments);if(a===nt)e[i]=nt;else if(a!==void 0&&a!==!1)return a}}else e[i]===n&&(e[i]=null)}}}function _r(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var a=s[e];if(typeof a=="function")return a}}}});var Qu=p(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.dedentBlockStringValue=_d;It.getBlockStringIndentation=Yu;It.printBlockString=Dd;function _d(t){var e=t.split(/\r\n|[\n\r]/g),r=Yu(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Xu(e[i]);)++i;for(var s=e.length;s>i&&Xu(e[s-1]);)--s;return e.slice(i,s).join(`
5
+ `)}function Xu(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Yu(t){for(var e,r=!0,n=!0,i=0,s=null,a=0;a<t.length;++a)switch(t.charCodeAt(a)){case 13:t.charCodeAt(a+1)===10&&++a;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(s===null||i<s)&&(s=i),n=!1}return(e=s)!==null&&e!==void 0?e:0}function Dd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
6
6
  `)===-1,i=t[0]===" "||t[0]===" ",s=t[t.length-1]==='"',a=t[t.length-1]==="\\",u=!n||s||a||r,c="";return u&&!(n&&i)&&(c+=`
7
7
  `+e),c+=e?t.replace(/\n/g,`
8
8
  `+e):t,u&&(c+=`
9
- `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}});var zu=p(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.print=Od;var Ad=Fu(),Rd=Gu();function Od(t){return(0,Ad.visit)(t,{leave:Pd})}var Cd=80,Pd={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return S(e.definitions,`
9
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}});var ec=p(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.print=jd;var qd=Ku(),Ud=Qu();function jd(t){return(0,qd.visit)(t,{leave:Ld})}var Md=80,Ld={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return S(e.definitions,`
10
10
 
11
11
  `)+`
12
- `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=L("(",S(e.variableDefinitions,", "),")"),s=S(e.directives," "),a=e.selectionSet;return!n&&!s&&!i&&r==="query"?a:S([r,S([n,i]),s,a]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,s=e.directives;return r+": "+n+L(" = ",i)+L(" ",S(s," "))},SelectionSet:function(e){var r=e.selections;return le(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,s=e.directives,a=e.selectionSet,u=L("",r,": ")+n,c=u+L("(",S(i,", "),")");return c.length>Cd&&(c=u+L(`(
13
- `,Cr(S(i,`
12
+ `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=L("(",S(e.variableDefinitions,", "),")"),s=S(e.directives," "),a=e.selectionSet;return!n&&!s&&!i&&r==="query"?a:S([r,S([n,i]),s,a]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,s=e.directives;return r+": "+n+L(" = ",i)+L(" ",S(s," "))},SelectionSet:function(e){var r=e.selections;return le(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,s=e.directives,a=e.selectionSet,u=L("",r,": ")+n,c=u+L("(",S(i,", "),")");return c.length>Md&&(c=u+L(`(
13
+ `,Dr(S(i,`
14
14
  `)),`
15
- )`)),S([c,S(s," "),a]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+L(" ",S(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return S(["...",L("on ",r),S(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,s=e.directives,a=e.selectionSet;return"fragment ".concat(r).concat(L("(",S(i,", "),")")," ")+"on ".concat(n," ").concat(L("",S(s," ")," "))+a},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?(0,Rd.printBlockString)(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+S(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+S(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+L("(",S(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:ce(function(t){var e=t.directives,r=t.operationTypes;return S(["schema",S(e," "),le(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:ce(function(t){var e=t.name,r=t.directives;return S(["scalar",e,S(r," ")]," ")}),ObjectTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["type",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),FieldDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(Ju(r)?L(`(
16
- `,Cr(S(r,`
15
+ )`)),S([c,S(s," "),a]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+L(" ",S(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return S(["...",L("on ",r),S(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,s=e.directives,a=e.selectionSet;return"fragment ".concat(r).concat(L("(",S(i,", "),")")," ")+"on ".concat(n," ").concat(L("",S(s," ")," "))+a},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?(0,Ud.printBlockString)(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+S(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+S(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+L("(",S(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:ce(function(t){var e=t.directives,r=t.operationTypes;return S(["schema",S(e," "),le(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:ce(function(t){var e=t.name,r=t.directives;return S(["scalar",e,S(r," ")]," ")}),ObjectTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["type",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),FieldDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(Zu(r)?L(`(
16
+ `,Dr(S(r,`
17
17
  `)),`
18
- )`):L("(",S(r,", "),")"))+": "+n+L(" ",S(i," "))}),InputValueDefinition:ce(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return S([e+": "+r,L("= ",n),S(i," ")]," ")}),InterfaceTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["interface",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),UnionTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.types;return S(["union",e,S(r," "),n&&n.length!==0?"= "+S(n," | "):""]," ")}),EnumTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.values;return S(["enum",e,S(r," "),le(n)]," ")}),EnumValueDefinition:ce(function(t){var e=t.name,r=t.directives;return S([e,S(r," ")]," ")}),InputObjectTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.fields;return S(["input",e,S(r," "),le(n)]," ")}),DirectiveDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(Ju(r)?L(`(
19
- `,Cr(S(r,`
18
+ )`):L("(",S(r,", "),")"))+": "+n+L(" ",S(i," "))}),InputValueDefinition:ce(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return S([e+": "+r,L("= ",n),S(i," ")]," ")}),InterfaceTypeDefinition:ce(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return S(["interface",e,L("implements ",S(r," & ")),S(n," "),le(i)]," ")}),UnionTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.types;return S(["union",e,S(r," "),n&&n.length!==0?"= "+S(n," | "):""]," ")}),EnumTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.values;return S(["enum",e,S(r," "),le(n)]," ")}),EnumValueDefinition:ce(function(t){var e=t.name,r=t.directives;return S([e,S(r," ")]," ")}),InputObjectTypeDefinition:ce(function(t){var e=t.name,r=t.directives,n=t.fields;return S(["input",e,S(r," "),le(n)]," ")}),DirectiveDefinition:ce(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(Zu(r)?L(`(
19
+ `,Dr(S(r,`
20
20
  `)),`
21
21
  )`):L("(",S(r,", "),")"))+(n?" repeatable":"")+" on "+S(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return S(["extend schema",S(r," "),le(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return S(["extend scalar",r,S(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,s=e.fields;return S(["extend type",r,L("implements ",S(n," & ")),S(i," "),le(s)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,s=e.fields;return S(["extend interface",r,L("implements ",S(n," & ")),S(i," "),le(s)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return S(["extend union",r,S(n," "),i&&i.length!==0?"= "+S(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return S(["extend enum",r,S(n," "),le(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return S(["extend input",r,S(n," "),le(i)]," ")}};function ce(t){return function(e){return S([e.description,t(e)],`
22
22
  `)}}function S(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t==null?void 0:t.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function le(t){return L(`{
23
- `,Cr(S(t,`
23
+ `,Dr(S(t,`
24
24
  `)),`
25
- }`)}function L(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Cr(t){return L(" ",t.replace(/\n/g,`
26
- `))}function Nd(t){return t.indexOf(`
27
- `)!==-1}function Ju(t){return t!=null&&t.some(Nd)}});var m=function(){return m=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},m.apply(this,arguments)};function Me(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function _(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var I;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(I||(I={}));var Ee;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ee||(Ee={}));var it=I.Start,je=I.Stop,Le=I.Raise,we=I.Send,_t=I.Cancel,oi=I.NullEvent,qt=I.Assign,Dd=I.After,Ud=I.DoneState,Dt=I.Log,ui=I.Init,st=I.Invoke,Md=I.ErrorExecution,Nr=I.ErrorPlatform,Ir=I.ErrorCustom,at=I.Update,ci=I.Choose,li=I.Pure;var Ut=".",kr={},Mt="xstate.guard",fi="";var M=!0;var jt;function ut(t,e,r){r===void 0&&(r=Ut);var n=Be(t,r),i=Be(e,r);return P(i)?P(n)?i===n:!1:P(n)?n in i:Object.keys(n).every(function(s){return s in i?ut(n[s],i[s]):!1})}function Lt(t){try{return P(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Bt(t,e){try{return ve(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function ic(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(ic(t))return t.value;if(ve(t))return ot(t);if(typeof t!="string")return t;var r=Bt(t,e);return ot(r)}function ot(t){if(t.length===1)return t[0];for(var e={},r=e,n=0;n<t.length-1;n++)n===t.length-2?r[t[n]]=t[n+1]:(r[t[n]]={},r=r[t[n]]);return e}function Fe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;i++){var s=n[i];r[s]=e(t[s],s,t,i)}return r}function _r(t,e,r){var n,i,s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];!r(l)||(s[c]=e(l,c,t))}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}var di=function(t){return function(e){var r,n,i=e;try{for(var s=R(t),a=s.next();!a.done;a=s.next()){var u=a.value;i=i[u]}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function hi(t,e){return function(r){var n,i,s=r;try{for(var a=R(t),u=a.next();!u.done;u=a.next()){var c=u.value;s=s[e][c]}}catch(l){n={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}}function ct(t){if(!t)return[[]];if(P(t))return[[t]];var e=U(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:ct(t[r]).map(function(i){return[r].concat(i)})}));return e}function U(t){var e;return(e=[]).concat.apply(e,_([],C(t),!1))}function pi(t){return ve(t)?t:[t]}function te(t){return t===void 0?[]:pi(t)}function xe(t,e,r){var n,i;if(k(t))return t(e,r.data);var s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];k(l)?s[c]=l(e,r.data):s[c]=l}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}function vi(t){return/^(done|error)\./.test(t)}function qr(t){return!!(t instanceof Promise||t!==null&&(k(t)||typeof t=="object")&&k(t.then))}function mi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Ft(t,e){var r,n,i=C([[],[]],2),s=i[0],a=i[1];try{for(var u=R(t),c=u.next();!c.done;c=u.next()){var l=c.value;e(l)?s.push(l):a.push(l)}}catch(o){r={error:o}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return[s,a]}function yi(t,e){return Fe(t.states,function(r,n){if(!!r){var i=(P(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:yi(r,i)}}})}function gi(t,e){return{current:e,states:yi(t,e)}}function Dr(t,e,r,n){M||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,a){var u,c,l=a.assignment,o={state:n,action:a,_event:e},f={};if(k(l))f=l(s,e.data,o);else try{for(var d=R(Object.keys(l)),h=d.next();!h.done;h=d.next()){var y=h.value,E=l[y];f[y]=k(E)?E(s,e.data,o):E}}catch(v){u={error:v}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(u)throw u.error}}return Object.assign({},s,f)},t);return i}var B=function(){};M||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function ve(t){return Array.isArray(t)}function k(t){return typeof t=="function"}function P(t){return typeof t=="string"}function Vt(t,e){if(!!t)return P(t)?{type:Mt,name:t,predicate:e?e[t]:void 0}:k(t)?{type:Mt,name:t.name,predicate:t}:t}function Ei(t){try{return"subscribe"in t&&k(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Gd=(jt={},jt[fe]=function(){return this},jt[Symbol.observable]=function(){return this},jt);function de(t){return!!t&&"__xstatenode"in t}function Si(t){return!!t&&typeof t.send=="function"}function lt(t,e){return P(t)||typeof t=="number"?m({type:t},e):t}function F(t,e){if(!P(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=lt(t);return m({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function Te(t,e){var r=pi(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:m(m({},n),{event:t})});return r}function wi(t){if(!(t===void 0||t===fi))return te(t)}function xi(t,e,r){if(!M){var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(t,"'.").concat(n));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(t,"'. ").concat(n," Current error is '").concat(e,"'.").concat(i))}}}function Ht(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===Mt)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,a);var u=s==null?void 0:s[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(r,n.data,a)}function Gt(t){return typeof t=="string"?{type:t}:t}function ft(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function dt(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=F({type:ui});function Jt(t,e){return e&&e[t]||void 0}function Ve(t,e){var r;if(P(t)||typeof t=="number"){var n=Jt(t,e);k(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(k(t))r={type:t.name||t.toString(),exec:t};else{var n=Jt(t.type,e);if(k(n))r=m(m({},t),{exec:n});else if(n){var i=n.type||t.type;r=m(m(m({},n),t),{type:i})}else r=t}return r}var ht=function(t,e){if(!t)return[];var r=ve(t)?t:[t];return r.map(function(n){return Ve(n,e)})};function $t(t){var e=Ve(t);return m(m({id:P(t)?t:e.id},e),{type:e.type})}function Ti(t){return P(t)?{type:Le,event:t}:pt(t,{to:Ee.Internal})}function sc(t){return{type:Le,_event:F(t.event)}}function pt(t,e){return{to:e?e.to:void 0,type:we,event:k(t)?t:lt(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:k(t)?t.name:Lt(t)}}function ac(t,e,r,n){var i={_event:r},s=F(k(t.event)?t.event(e,r.data,i):t.event),a;if(P(t.delay)){var u=n&&n[t.delay];a=k(u)?u(e,r.data,i):u}else a=k(t.delay)?t.delay(e,r.data,i):t.delay;var c=k(t.to)?t.to(e,r.data,i):t.to;return m(m({},t),{to:c,_event:s,event:s.data,delay:a})}var oc=function(t,e,r){return m(m({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},bi=function(t){return{type:_t,sendId:t}};function Ai(t){var e=$t(t);return{type:I.Start,activity:e,exec:void 0}}function Ri(t){var e=k(t)?t:$t(t);return{type:I.Stop,activity:e,exec:void 0}}function uc(t,e,r){var n=k(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:I.Stop,activity:i};return s}var Oi=function(t){return{type:qt,assignment:t}};function Ci(t,e){var r=e?"#".concat(e):"";return"".concat(I.After,"(").concat(t,")").concat(r)}function vt(t,e){var r="".concat(I.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Ae(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function zt(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Ft(i,function(d){return d.type===qt}),2),u=a[0],c=a[1],l=u.length?Dr(r,n,u,e):r,o=s?[r]:void 0,f=U(c.map(function(d){var h;switch(d.type){case Le:return sc(d);case we:var y=ac(d,l,n,t.options.delays);return M||B(!P(d.delay)||typeof y.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),y;case Dt:return oc(d,l,n);case ci:{var E=d,v=(h=E.conds.find(function(D){var V=Vt(D.cond,t.options.guards);return!V||Ht(t,V,l,n,e)}))===null||h===void 0?void 0:h.actions;if(!v)return[];var x=C(zt(t,e,l,n,ht(te(v),t.options.actions),s),2),g=x[0],T=x[1];return l=T,o==null||o.push(l),g}case li:{var v=d.get(l,n.data);if(!v)return[];var O=C(zt(t,e,l,n,ht(te(v),t.options.actions),s),2),N=O[0],j=O[1];return l=j,o==null||o.push(l),N}case je:return uc(d,l,n);case qt:{l=Dr(l,n,[d],e),o==null||o.push(l);break}default:var b=Ve(d,t.options.actions),w=b.exec;if(w&&o){var A=o.length-1;b=m(m({},b),{exec:function(D){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,_([o[A]],C(V),!1))}})}return b}}).filter(function(d){return!!d}));return[f,l]}var Pi=[],Oe=function(t,e){Pi.push(t);var r=e(t);return Pi.pop(),r};function Ni(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Ii(t,e,r,n){var i,s=Gt(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],u=t.data?xe(t.data,r,n):void 0,c=a?ki(a,t.id,u):Ni(t.id);return c.meta=t,c}function ki(t,e,r){var n=Ni(e);if(n.deferred=!0,de(t)){var i=n.state=Oe(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function cc(t){try{return typeof t.send=="function"}catch{return!1}}function _i(t){return cc(t)&&"id"in t}function qi(t){var e;return m((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[fe]=function(){return this},e),t)}var mt=function(t){return t.type==="atomic"||t.type==="final"};function Ce(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function Mr(t){var e=[t];return mt(t)?e:e.concat(U(Ce(t).map(Mr)))}function Pe(t,e){var r,n,i,s,a,u,c,l,o=new Set(t),f=Ur(o),d=new Set(e);try{for(var h=R(d),y=h.next();!y.done;y=h.next())for(var E=y.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){r={error:A}}finally{try{y&&!y.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var x=Ur(d);try{for(var g=R(d),T=g.next();!T.done;T=g.next()){var E=T.value;if(E.type==="compound"&&(!x.get(E)||!x.get(E).length))f.get(E)?f.get(E).forEach(function(D){return d.add(D)}):E.initialStateNodes.forEach(function(D){return d.add(D)});else if(E.type==="parallel")try{for(var O=(a=void 0,R(Ce(E))),N=O.next();!N.done;N=O.next()){var j=N.value;j.type!=="history"&&(d.has(j)||(d.add(j),f.get(j)?f.get(j).forEach(function(D){return d.add(D)}):j.initialStateNodes.forEach(function(D){return d.add(D)})))}}catch(D){a={error:D}}finally{try{N&&!N.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var b=R(d),w=b.next();!w.done;w=b.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){c={error:A}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(c)throw c.error}}return d}function Di(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(mt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Di(s,e)}),i}function Ur(t){var e,r,n=new Map;try{for(var i=R(t),s=i.next();!s.done;s=i.next()){var a=s.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Ui(t,e){var r=Pe([t],e);return Di(t,Ur(r))}function yt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Mi(t){return _([],C(new Set(U(_([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Ne(t,e){return e.type==="compound"?Ce(e).some(function(r){return r.type==="final"&&yt(t,r)}):e.type==="parallel"?Ce(e).every(function(r){return Ne(t,r)}):!1}function ji(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function jr(t){return new Set(U(t.map(function(e){return e.tags})))}function Lr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(P(t)||P(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Lr(t[i],e[i])})}function Li(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Bi(t,e){var r=t.exec,n=m(m({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var se=function(){function t(e){var r=this,n;this.actions=[],this.activities=kr,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||kr,this.meta=ji(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return Mi(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=be;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=be;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),P(e))return[e];var i=Object.keys(e);return i.concat.apply(i,_([],C(i.map(function(s){return n.toStrings(e[s],r).map(function(a){return s+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=Me(e,["configuration","transitions","tags","machine"]);return m(m({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ut(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;M&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var lc={deferEvents:!1},Br=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=m(m({},lc),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(r){throw this.clear(),r}finally{this.processingEvent=!1}},t}();var Fr=new Map,fc=0,gt={bookId:function(){return"x:".concat(fc++)},register:function(t,e){return Fr.set(t,e),t},get:function(t){return Fr.get(t)},free:function(t){Fr.delete(t)}};function Wt(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;M||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function dc(){var t=Wt();if(t&&"__xstate__"in t)return t.__xstate__}function Fi(t){if(!!Wt()){var e=dc();e&&e.register(t)}}function Vi(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,a=function(){if(!s){for(s=!0;i.length>0;){var l=i.shift();r=t.transition(r,l,c),n.forEach(function(o){return o.next(r)})}s=!1}},u=qi({id:e.id,send:function(l){i.push(l),a()},getSnapshot:function(){return r},subscribe:function(l,o,f){var d=ft(l,o,f);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:u,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,u}var hc={sync:!1,autoForward:!1},z;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(z||(z={}));var Hi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.scheduler=new Br,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=z.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(o,f){if(ve(o))return n.batch(o),n.state;var d=F(lt(o,f));if(n.status===z.Stopped)return M||B(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
28
- Event: `).concat(JSON.stringify(d.data))),n.state;if(n.status!==z.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(d.name,'" was sent to uninitialized service "').concat(n.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
29
- Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var h=n.nextState(d);n.update(h,d)}),n._state},this.sendTo=function(o,f){var d=n.parent&&(f===Ee.Parent||n.parent.id===f),h=d?n.parent:P(f)?n.children.get(f)||gt.get(f):Si(f)?f:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(n.id,"'."));M||B(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(o.type));return}"machine"in h?h.send(m(m({},o),{name:o.name===Ir?"".concat(Re(n.id)):o.name,origin:n.sessionId})):h.send(o.data)};var i=m(m({},t.defaultOptions),r),s=i.clock,a=i.logger,u=i.parent,c=i.id,l=c!==void 0?c:e.id;this.id=l,this.logger=a,this.clock=s,this.parent=u,this.options=i,this.scheduler=new Br({deferEvents:this.options.deferEvents}),this.sessionId=gt.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Oe(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return M||B(this.status!==z.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,r){var n,i;try{for(var s=R(e.actions),a=s.next();!a.done;a=s.next()){var u=a.value;this.exec(u,e,r)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,i,s,a,u,c,l,o,f=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(A){f.state.children[A.id]=A}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=R(this.eventListeners),h=d.next();!h.done;h=d.next()){var y=h.value;y(e.event)}}catch(A){n={error:A}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=R(this.listeners),v=E.next();!v.done;v=E.next()){var y=v.value;y(e,e.event)}}catch(A){s={error:A}}finally{try{v&&!v.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var T=g.value;T(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{g&&!g.done&&(c=x.return)&&c.call(x)}finally{if(u)throw u.error}}var O=Ne(e.configuration||[],this.machine);if(this.state.configuration&&O){var N=e.configuration.find(function(A){return A.type==="final"&&A.parent===f.machine}),j=N&&N.doneData?xe(N.doneData,e.context,r):void 0;try{for(var b=R(this.doneListeners),w=b.next();!w.done;w=b.next()){var y=w.value;y(Ae(this.id,j))}}catch(A){l={error:A}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(l)throw l.error}}this.stop()}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===z.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,r,n){var i=this;if(!e)return{unsubscribe:function(){}};var s,a=n;return typeof e=="function"?s=e:(s=e.next.bind(e),a=e.complete.bind(e)),this.listeners.add(s),this.status===z.Running&&s(this.state),a&&this.onDone(a),{unsubscribe:function(){s&&i.listeners.delete(s),a&&i.doneListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var r=this;if(this.status===z.Running)return this;this.machine._init(),gt.register(this.sessionId,this),this.initialized=!0,this.status=z.Running;var n=e===void 0?this.initialState:Oe(this,function(){return Li(e)?r.machine.resolveState(e):r.machine.resolveState(se.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(n,be)}),this},t.prototype.stop=function(){var e,r,n,i,s,a,u,c,l,o,f=this;try{for(var d=R(this.listeners),h=d.next();!h.done;h=d.next()){var y=h.value;this.listeners.delete(y)}}catch(w){e={error:w}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=R(this.stopListeners),v=E.next();!v.done;v=E.next()){var y=v.value;y(),this.stopListeners.delete(y)}}catch(w){n={error:w}}finally{try{v&&!v.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var y=g.value;this.contextListeners.delete(y)}}catch(w){s={error:w}}finally{try{g&&!g.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}try{for(var T=R(this.doneListeners),O=T.next();!O.done;O=T.next()){var y=O.value;this.doneListeners.delete(y)}}catch(w){u={error:w}}finally{try{O&&!O.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}if(!this.initialized)return this;_([],C(this.state.configuration),!1).sort(function(w,A){return A.order-w.order}).forEach(function(w){var A,D;try{for(var V=R(w.definition.exit),Q=V.next();!Q.done;Q=V.next()){var ge=Q.value;f.exec(ge,f.state)}}catch(kt){A={error:kt}}finally{try{Q&&!Q.done&&(D=V.return)&&D.call(V)}finally{if(A)throw A.error}}}),this.children.forEach(function(w){k(w.stop)&&w.stop()});try{for(var N=R(Object.keys(this.delayedEventsMap)),j=N.next();!j.done;j=N.next()){var b=j.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(w){l={error:w}}finally{try{j&&!j.done&&(o=N.return)&&o.call(N)}finally{if(l)throw l.error}}return this.scheduler.clear(),this.initialized=!1,this.status=z.Stopped,gt.free(this.sessionId),this},t.prototype.batch=function(e){var r=this;if(this.status===z.NotStarted&&this.options.deferEvents)M||B(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
30
- Event: `).concat(JSON.stringify(event)));else if(this.status!==z.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule(function(){var n,i,s=r.state,a=!1,u=[],c=function(d){var h=F(d);r.forward(h),s=Oe(r,function(){return r.machine.transition(s,h)}),u.push.apply(u,_([],C(s.actions.map(function(y){return Bi(y,s)})),!1)),a=a||!!s.changed};try{for(var l=R(e),o=l.next();!o.done;o=l.next()){var f=o.value;c(f)}}catch(d){n={error:d}}finally{try{o&&!o.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}s.changed=a,s.actions=u,r.update(s,F(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=F(e);if(n.name.indexOf(Nr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Nr)===0}))throw n.data.data;var i=Oe(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var a=s.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.defer=function(e){var r=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?r.sendTo(e._event,e.to):r.send(e._event)},e.delay)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,r,n){n===void 0&&(n=this.machine.options.actions);var i=r.context,s=r._event,a=e.exec||Jt(e.type,n),u=k(a)?a:a?a.exec:e.exec;if(u)try{return u(i,s.data,{action:e,state:this.state,_event:s})}catch(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case we:var c=e;if(typeof c.delay=="number"){this.defer(c);return}else c.to?this.sendTo(c._event,c.to):this.send(c._event);break;case _t:this.cancel(e.sendId);break;case it:{if(this.status!==z.Running)return;var l=e.activity;if(!this.state.activities[l.id||l.type])break;if(l.type===I.Invoke){var o=Gt(l.src),f=this.machine.options.services?this.machine.options.services[o.type]:void 0,d=l.id,h=l.data;M||B(!("forward"in l),"`forward` property is deprecated (found in invocation of '".concat(l.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var y="autoForward"in l?l.autoForward:!!l.forward;if(!f){M||B(!1,"No service found for invocation '".concat(l.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?xe(h,i,s):void 0;if(typeof f=="string")return;var v=k(f)?f(i,s.data,{data:E,src:o,meta:l.meta}):f;if(!v)return;var x=void 0;de(v)&&(v=E?v.withContext(E):v,x={autoForward:y}),this.spawn(v,d,x)}else this.spawnActivity(l);break}case je:{this.stopChild(e.activity.id);break}case Dt:var g=e.label,T=e.value;g?this.logger(g,T):this.logger(T);break;default:M||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),k(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(qr(e))return this.spawnPromise(Promise.resolve(e),r);if(k(e))return this.spawnCallback(e,r);if(_i(e))return this.spawnActor(e,r);if(Ei(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,m(m({},n),{id:r}));if(mi(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var i=new t(e,m(m({},this.options),{parent:this,id:r.id||e.id})),s=m(m({},hc),r);s.sync&&i.onTransition(function(u){n.send(at,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){n.removeChild(i.id),n.send(F(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=Vi(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,a;e.then(function(c){s||(a=c,i.removeChild(r),i.send(F(Ae(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var l=Re(r,c);try{i.send(F(l,{origin:r}))}catch(o){xi(c,o,r),i.devTools&&i.devTools.send(l,i.state),i.machine.strict&&i.stop()}}});var u=(n={id:r,send:function(){},subscribe:function(c,l,o){var f=ft(c,l,o),d=!1;return e.then(function(h){d||(f.next(h),!d&&f.complete())},function(h){d||f.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return a}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,a=new Set,u=new Set,c,l=function(d){c=d,u.forEach(function(h){return h(d)}),!s&&i.send(F(d,{origin:r}))},o;try{o=e(l,function(d){a.add(d)})}catch(d){this.send(Re(r,d))}if(qr(o))return this.spawnPromise(o,r);var f=(n={id:r,send:function(d){return a.forEach(function(h){return h(d)})},subscribe:function(d){var h=ft(d);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){s=!0,k(o)&&o()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[fe]=function(){return this},n);return this.children.set(r,f),f},t.prototype.spawnObservable=function(e,r){var n,i=this,s,a=e.subscribe(function(c){s=c,i.send(F(c,{origin:r}))},function(c){i.removeChild(r),i.send(F(Re(r,c),{origin:r}))},function(){i.removeChild(r),i.send(F(Ae(r),{origin:r}))}),u=(n={id:r,send:function(){},subscribe:function(c,l,o){return e.subscribe(c,l,o)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){M||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=Wt();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(m(m({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:m({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Fi(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===z.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=me,t}();function me(t,e){var r=new Hi(t,e);return r}function pc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function Et(t){return m(m({type:st},t),{toJSON:function(){t.onDone,t.onError;var e=Me(t,["onDone","onError"]);return m(m({},e),{type:st,src:pc(t.src)})}})}var Je="",Vr="#",St="*",He={},Ge=function(t){return t[0]===Vr},vc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},mc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(P(s.target)||de(s.target))}),i=e===Je?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Gi=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(vc(),r),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Ut),this.id=this.config.id||_([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,M||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Fe(this.config.states,function(l,o){var f,d=new t(l,{},void 0,{parent:s,key:o});return Object.assign(s.idMap,m((f={},f[d.id]=d,f),d.idMap)),d}):He;var u=0;function c(l){var o,f;l.order=u++;try{for(var d=R(Ce(l)),h=d.next();!h.done;h=d.next()){var y=h.value;c(y)}}catch(E){o={error:E}}finally{try{h&&!h.done&&(f=d.return)&&f.call(d)}finally{if(o)throw o.error}}}c(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(l){var o=l.event;return o===Je}):Je in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=te(this.config.entry||this.config.onEntry).map(function(l){return Ve(l)}),this.onExit=te(this.config.exit||this.config.onExit).map(function(l){return Ve(l)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=te(this.config.invoke).map(function(l,o){var f,d;if(de(l)){var h=dt(s.id,o);return s.machine.options.services=m((f={},f[h]=l,f),s.machine.options.services),Et({src:h,id:h})}else if(P(l.src)){var h=l.id||dt(s.id,o);return Et(m(m({},l),{id:h,src:l.src}))}else if(de(l.src)||k(l.src)){var h=l.id||dt(s.id,o);return s.machine.options.services=m((d={},d[h]=l.src,d),s.machine.options.services),Et(m(m({id:h},l),{src:h}))}else{var y=l.src;return Et(m(m({id:dt(s.id,o)},l),{src:y}))}}),this.activities=te(this.config.activities).concat(this.invoke).map(function(l){return $t(l)}),this.transition=this.transition.bind(this),this.tags=te(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Mr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,a=n.guards,u=n.services,c=n.delays;return new t(this.config,{actions:m(m({},i),e.actions),activities:m(m({},s),e.activities),guards:m(m({},a),e.guards),services:m(m({},u),e.services),delays:m(m({},c),e.delays)},r!=null?r:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return k(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Fe(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,n){return r[n.eventType]=r[n.eventType]||[],r[n.eventType].push(n),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===Je,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===St});return this.__cache.candidates[e]=n,n},t.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var n=function(s,a){var u=k(s)?"".concat(e.id,":delay[").concat(a,"]"):s,c=Ci(u,e.id);return e.onEntry.push(pt(c,{delay:s})),e.onExit.push(bi(c)),c},i=ve(r)?r.map(function(s,a){var u=n(s.delay,a);return m(m({},s),{event:u})}):U(Object.keys(r).map(function(s,a){var u=r[s],c=P(u)?{target:u}:u,l=isNaN(+s)?s:+s,o=n(l,a);return te(c).map(function(f){return m(m({},f),{event:o,delay:l})})}));return i.map(function(s){var a=s.delay;return m(m({},e.formatTransition(s)),{delay:a})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof se?e.value:Be(e,this.delimiter);if(P(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,_([],C(U(a.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),u},t.prototype.handles=function(e){var r=Lt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof se?e:se.create(e),n=Array.from(Pe([],this.getStateNodes(r.value)));return new se(m(m({},r),{value:this.resolve(r.value),configuration:n,done:Ne(n,this),tags:jr(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,r,n){var i=this.getStateNode(e),s=i.next(r,n);return!s||!s.transitions.length?this.next(r,n):s},t.prototype.transitionCompoundNode=function(e,r,n){var i=Object.keys(e),s=this.getStateNode(i[0]),a=s._transition(e[i[0]],r,n);return!a||!a.transitions.length?this.next(r,n):a},t.prototype.transitionParallelNode=function(e,r,n){var i,s,a={};try{for(var u=R(Object.keys(e)),c=u.next();!c.done;c=u.next()){var l=c.value,o=e[l];if(!!o){var f=this.getStateNode(l),d=f._transition(o,r,n);d&&(a[l]=d)}}}catch(g){i={error:g}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(g){return a[g]}),y=U(h.map(function(g){return g.transitions})),E=h.some(function(g){return g.transitions.length>0});if(!E)return this.next(r,n);var v=U(h.map(function(g){return g.entrySet})),x=U(Object.keys(a).map(function(g){return a[g].configuration}));return{transitions:y,entrySet:v,exitSet:U(h.map(function(g){return g.exitSet})),configuration:x,source:r,actions:U(Object.keys(a).map(function(g){return a[g].actions}))}},t.prototype._transition=function(e,r,n){return P(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,F(r))},t.prototype.next=function(e,r){var n,i,s=this,a=r.name,u=[],c=[],l;try{for(var o=R(this.getCandidates(a)),f=o.next();!f.done;f=o.next()){var d=f.value,h=d.cond,y=d.in,E=e.context,v=y?P(y)&&Ge(y)?e.matches(Be(this.getStateNodeById(y).path,this.delimiter)):ut(Be(y,this.delimiter),di(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!h||Ht(this.machine,h,E,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
31
- `).concat(N.message))}if(x&&v){d.target!==void 0&&(c=d.target),u.push.apply(u,_([],C(d.actions),!1)),l=d;break}}}catch(N){n={error:N}}finally{try{f&&!f.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}if(!!l){if(!c.length)return{transitions:[l],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var g=U(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));return{transitions:[l],entrySet:O,exitSet:T?[]:[this],configuration:g,source:e,actions:u}}},t.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var r=[],n=e;n&&n!==this;)r.push(n),n=n.parent;return r.push(this),r},t.prototype.escapes=function(e){if(this===e)return!1;for(var r=this.parent;r;){if(r===e)return!1;r=r.parent}return!0},t.prototype.getActions=function(e,r,n,i){var s,a,u,c,l=Pe([],i?this.getStateNodes(i.value):[this]),o=e.configuration.length?Pe(l,e.configuration):l;try{for(var f=R(o),d=f.next();!d.done;d=f.next()){var h=d.value;yt(l,h)||e.entrySet.push(h)}}catch(b){s={error:b}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}try{for(var y=R(l),E=y.next();!E.done;E=y.next()){var h=E.value;(!yt(o,h)||yt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(b){u={error:b}}finally{try{E&&!E.done&&(c=y.return)&&c.call(y)}finally{if(u)throw u.error}}var v=U(e.entrySet.map(function(b){var w=[];if(b.type!=="final")return w;var A=b.parent;if(!A.parent)return w;w.push(vt(b.id,b.doneData),vt(A.id,b.doneData?xe(b.doneData,r,n):void 0));var D=A.parent;return D.type==="parallel"&&Ce(D).every(function(V){return Ne(e.configuration,V)})&&w.push(vt(D.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return _(_([],C(b.activities.map(function(w){return Ai(w)})),!1),C(b.onEntry),!1)})).concat(v.map(Ti)),U(Array.from(g).map(function(b){return _(_([],C(b.onExit),!1),C(b.activities.map(function(w){return Ri(w)})),!1)}))],2),O=T[0],N=T[1],j=ht(N.concat(e.actions).concat(O),this.machine.options.actions);return j},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var a=P(e)?this.resolve(ot(this.getResolvedPath(e))):this.resolve(e),u=n!=null?n:this.machine.context;s=this.resolveState(se.from(a,u))}if(!M&&i.name===St)throw new Error("An event cannot have the wildcard type ('".concat(St,"')"));if(this.strict&&!this.events.includes(i.name)&&!vi(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var c=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},l=Pe([],this.getStateNodes(s.value)),o=c.configuration.length?Pe(l,c.configuration):l;return c.configuration=_([],C(o),!1),this.resolveTransition(c,s,s.context,i)},t.prototype.resolveRaisedTransition=function(e,r,n){var i,s=e.actions;return e=this.transition(e,r),e._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,_([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,a,u=this;i===void 0&&(i=be);var c=e.configuration,l=!r||e.transitions.length>0,o=l?Ui(this.machine,c):void 0,f=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,d=this.getActions(e,n,i,r),h=r?m({},r.activities):{};try{for(var y=R(d),E=y.next();!E.done;E=y.next()){var v=E.value;v.type===it?h[v.activity.id||v.activity.type]=v:v.type===je&&(h[v.activity.id||v.activity.type]=!1)}}catch(ee){s={error:ee}}finally{try{E&&!E.done&&(a=y.return)&&a.call(y)}finally{if(s)throw s.error}}var x=C(zt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[1],O=C(Ft(g,function(ee){return ee.type===Le||ee.type===we&&ee.to===Ee.Internal}),2),N=O[0],j=O[1],b=g.filter(function(ee){var Ue;return ee.type===it&&((Ue=ee.activity)===null||Ue===void 0?void 0:Ue.type)===st}),w=b.reduce(function(ee,Ue){return ee[Ue.activity.id]=Ii(Ue.activity,u.machine,T,i),ee},r?m({},r.children):{}),A=l?e.configuration:r?r.configuration:[],D=Ne(A,this),V=new se({value:o||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:o?f?gi(f,o):void 0:r?r.historyValue:void 0,history:!o||e.source?r:void 0,actions:o?j:[],activities:o?h:r?r.activities:{},events:[],configuration:A,transitions:e.transitions,children:w,done:D,tags:r==null?void 0:r.tags,machine:this}),Q=n!==T;V.changed=i.name===at||Q;var ge=V.history;ge&&delete ge.history;var kt=!D&&(this._transient||c.some(function(ee){return ee._transient}));if(!l&&(!kt||i.name===Je))return V;var Z=V;if(!D)for(kt&&(Z=this.resolveRaisedTransition(Z,{type:oi},i));N.length;){var Ku=N.shift();Z=this.resolveRaisedTransition(Z,Ku._event,i)}var Xu=Z.changed||(ge?!!Z.actions.length||Q||typeof ge.value!=typeof Z.value||!Lr(Z.value,ge.value):void 0);return Z.changed=Xu,Z.history=ge,Z.tags=jr(Z.configuration),Z},t.prototype.getStateNode=function(e){if(Ge(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Ge(e)?e.slice(Vr.length):e;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Ge(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=Bt(e,this.delimiter).slice(),n=this;r.length;){var i=r.shift();if(!i.length)break;n=n.getStateNode(i)}return n},t.prototype.resolve=function(e){var r,n=this;if(!e)return this.initialStateValue||He;switch(this.type){case"parallel":return Fe(this.initialStateValue,function(s,a){return s?n.getStateNode(a).resolve(e[a]||s):He});case"compound":if(P(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(r={},r[e]=i.initialStateValue,r):e}return Object.keys(e).length?Fe(e,function(s,a){return s?n.getStateNode(a).resolve(s):He}):this.initialStateValue||{};default:return e||He}},t.prototype.getResolvedPath=function(e){if(Ge(e)){var r=this.machine.idMap[e.slice(Vr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return Bt(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=_r(this.states,function(n){return n.initialStateValue||He},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=mt(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;P(r.target)?e=Ge(r.target)?ot(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,r,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(mt(this))return[this];if(this.type==="compound"&&!this.initial)return M||B(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=ct(this.initialStateValue);return U(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=C(e),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:_r(this.states,function(r,n){if(!e)return r.historyValue();var i=P(e)?void 0:e[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var i=this.target;return i?U(ct(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var s=hi(n.path,"states")(e).current;return P(s)?[n.getStateNode(s)]:U(ct(s).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=U(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,i;if(this.__cache.events)return this.__cache.events;var s=this.states,a=new Set(this.ownEvents);if(s)try{for(var u=R(Object.keys(s)),c=u.next();!c.done;c=u.next()){var l=c.value,o=s[l];if(o.states)try{for(var f=(n=void 0,R(o.events)),d=f.next();!d.done;d=f.next()){var h=d.value;a.add("".concat(h))}}catch(y){n={error:y}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}}catch(y){e={error:y}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(n){if(!P(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var s=i?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(s);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
32
- `).concat(u.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=wi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return P(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,a=this.resolveTarget(n),u=m(m({},e),{actions:ht(te(e.actions)),cond:Vt(e.cond,s),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return m(m({},u),{target:u.target?u.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return u},t.prototype.formatTransitions=function(){var e,r,n=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var s=this.config.on,a=St,u=s[a],c=u===void 0?[]:u,l=Me(s,[typeof a=="symbol"?a:a+""]);i=U(Object.keys(l).map(function(g){!M&&g===Je&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=Te(g,l[g]);return M||mc(n,g,T),T}).concat(Te(St,c)))}var o=this.config.always?Te("",this.config.always):[],f=this.config.onDone?Te(String(vt(this.id)),this.config.onDone):[];M||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=U(this.invoke.map(function(g){var T=[];return g.onDone&&T.push.apply(T,_([],C(Te(String(Ae(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,_([],C(Te(String(Re(g.id)),g.onError)),!1)),T})),h=this.after,y=U(_(_(_(_([],C(f),!1),C(d),!1),C(i),!1),C(o),!1).map(function(g){return te(g).map(function(T){return n.formatTransition(T)})}));try{for(var E=R(h),v=E.next();!v.done;v=E.next()){var x=v.value;y.push(x)}}catch(g){e={error:g}}finally{try{v&&!v.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return y},t}();function ae(t,e){return new Gi(t,e)}var q=Oi,$=pt;var Kt="nhostRefreshToken",wt="nhostRefreshTokenExpiresAt";var Ie={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var xt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},Ji={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},zi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"};var ea=nt(Zs());var oe=t=>{let e=ea.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,a,u,c,l,o,f,d;return Promise.reject({error:{message:(u=(a=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?a:r.request.responseText)!=null?u:JSON.stringify(r),status:(f=(o=(c=r.response)==null?void 0:c.status)!=null?o:(l=r.response)==null?void 0:l.data.statusCode)!=null?f:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var ta=(t,e)=>{let r=e&&Object.entries(e).map(([n,i])=>{let s=Array.isArray(i)?i.join(","):typeof i=="object"?JSON.stringify(i):i;return`${n}=${encodeURIComponent(s)}`}).join("&");return r?`${t}?${r}`:t},ie=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),nr=t=>!!t&&typeof t=="string"&&t.length>=3,ra=t=>!!t&&typeof t=="string";var cn={user:null,mfa:null,accessToken:{value:null,expiresAt:new Date},refreshTimer:{elapsed:0,attempts:0},refreshToken:{value:null},errors:{}};var na=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changeEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:q({error:i=>Ie}),saveRequestError:q({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:a})=>(await n.post("/user/email/change",{newEmail:s,options:ie(e,a)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var ia=({backendUrl:t,interpreter:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidPassword",actions:"saveInvalidPasswordError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidPasswordError:q({error:n=>xt}),saveRequestError:q({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!nr(i)},services:{requestChange:(n,{password:i})=>r.post("/user/password",{newPassword:i},{headers:{authorization:`Bearer ${e==null?void 0:e.state.context.accessToken.value}`}})}})};var sa=({backendUrl:t,clientUrl:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:"requesting"},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveRequestError:q({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ie(e,s)})}})};var aa=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"sendVerificationEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"request",id:"request",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:q({error:i=>Ie}),saveRequestError:q({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:a})=>(await n.post("/user/email/send-verification-email",{email:s,options:ie(e,a)})).data}})};var oa=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:a=!0})=>{let u=oe(t),c=async(l,o,f)=>(await u.post(l,o,f)).data;return ae({schema:{context:{},events:{}},tsTypes:{},context:cn,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"checkAutoSignIn",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{checkAutoSignIn:{always:[{cond:"isAutoSignInDisabled",target:"importingRefreshToken"}],invoke:{id:"autoSignIn",src:"autoSignIn",onDone:{target:"signedIn",actions:["saveSession","persist","reportTokenChanged"]},onError:"importingRefreshToken"}},importingRefreshToken:{invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:"saveRefreshToken",target:"starting"}}},starting:{always:[{cond:"isSignedIn",target:"signedIn"},{cond:"hasRefreshTokenWithoutSession",target:["authenticating.token","#nhost.token.running"]},"signedOut"]},signedOut:{tags:["ready"],initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:"destroyToken",exit:"clearContext",invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},token:{},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed.server"}}}}}}},registering:{entry:"resetSignUpError",invoke:{src:"registerUser",id:"registerUser",onDone:[{cond:"hasSession",target:"#nhost.authentication.signedIn",actions:["saveSession","persist","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{tags:["ready"],type:"parallel",entry:"reportSignedIn",on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{actions:"tickRefreshTimer",internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:"pending"},onError:[]}}}}}},deanonymizing:{initial:"error",states:{error:{},success:{}}}}}}},token:{initial:"idle",states:{idle:{on:{TRY_TOKEN:"running"},initial:"noErrors",states:{noErrors:{},error:{}}},running:{invoke:{src:"refreshToken",id:"authenticateWithToken",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:["#nhost.authentication.signedIn","idle.noErrors"]},onError:[{cond:"isSignedIn",target:"idle.error"},{target:["#nhost.authentication.signedOut","idle.error"]}]}}}}}},{actions:{reportSignedIn:$("SIGNED_IN"),reportSignedOut:$("SIGNED_OUT"),reportTokenChanged:$("TOKEN_CHANGED"),clearContext:q(()=>cn),saveSession:q({user:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.user},accessToken:(l,o)=>{var f,d,h,y;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((y=(h=o.data)==null?void 0:h.session)==null?void 0:y.accessTokenExpiresIn)*1e3)}},refreshToken:(l,o)=>{var f,d;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:q({mfa:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.mfa)!=null?d:null}}),resetTimer:q({refreshTimer:(l,o)=>({elapsed:0,attempts:0})}),tickRefreshTimer:q({refreshTimer:(l,o)=>({elapsed:l.refreshTimer.elapsed+1,attempts:l.refreshTimer.attempts})}),saveAuthenticationError:q({errors:({errors:l},{data:{error:o}})=>({...l,authentication:o})}),resetAuthenticationError:q({errors:({errors:{authentication:l,...o}})=>o}),saveInvalidEmail:q({errors:({errors:l})=>({...l,authentication:Ie})}),saveInvalidPassword:q({errors:({errors:l})=>({...l,authentication:xt})}),saveInvalidPhoneNumber:q({errors:({errors:l})=>({...l,authentication:Ji})}),saveRegisrationError:q({errors:({errors:l},{data:{error:o}})=>({...l,registration:o})}),resetSignUpError:q({errors:({errors:{registration:l,...o}})=>o}),saveInvalidSignUpPassword:q({errors:({errors:l})=>({...l,registration:xt})}),saveInvalidSignUpEmail:q({errors:({errors:l})=>({...l,registration:Ie})}),saveNoMfaTicketError:q({errors:({errors:l})=>({...l,registration:zi})}),saveRefreshToken:q({accessToken:(l,o)=>({...l.accessToken,expiresAt:o.data.expiresAt}),refreshToken:(l,o)=>({...l.refreshToken,value:o.data.refreshToken})}),persist:(l,{data:o})=>{if(n(Kt,o.session.refreshToken),o.session.accessTokenExpiresIn){let f=new Date(Date.now()+o.session.accessTokenExpiresIn*1e3).toISOString();n(wt,f)}else n(wt,null)},destroyToken:()=>{n(Kt,null),n(wt,null)}},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,hasRefreshTokenWithoutSession:l=>!!l.refreshToken.value&&!l.user&&!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:o})=>{var f;return!o&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!a,refreshTimerShouldRefresh:l=>l.refreshTimer.elapsed>Math.max((Date.now()-l.accessToken.expiresAt.getTime())/1e3-900,i),unverified:(l,{data:{error:o}})=>o.status===401&&o.message==="Email is not verified",hasSession:(l,o)=>{var f;return!!((f=o.data)!=null&&f.session)},hasMfaTicket:(l,o)=>{var f;return!!((f=o.data)!=null&&f.mfa)},invalidEmail:(l,{email:o})=>!Ke(o),invalidPassword:(l,{password:o})=>!nr(o),invalidPhoneNumber:(l,{phoneNumber:o})=>!ra(o)},services:{signInPassword:(l,{email:o,password:f})=>c("/signin/email-password",{email:o,password:f}),signInPasswordlessSms:(l,{phoneNumber:o,options:f})=>c("/signin/passwordless/sms",{phoneNumber:o,options:ie(e,f)}),signInPasswordlessSmsOtp:(l,{phoneNumber:o,otp:f})=>c("/signin/passwordless/sms/otp",{phoneNumber:o,otp:f}),signInPasswordlessEmail:(l,{email:o,options:f})=>c("/signin/passwordless/email",{email:o,options:ie(e,f)}),signInAnonymous:l=>c("/signin/anonymous"),signInMfaTotp:(l,{ticket:o,otp:f})=>{var d;return c("/signin/mfa/totp",{ticket:o||((d=l.mfa)==null?void 0:d.ticket),otp:f})},refreshToken:async(l,o)=>{let f=o.type==="TRY_TOKEN"?o.token:l.refreshToken.value;return{session:await c("/token",{refreshToken:f})}},signout:(l,o)=>c("/signout",{refreshToken:l.refreshToken.value,all:!!o.all}),registerUser:(l,{email:o,password:f,options:d})=>c("/signup/email-password",{email:o,password:f,options:ie(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:l}=window.location;if(!l)throw Error("No hash in window.location");let f=new URLSearchParams(l.slice(1)).get("refreshToken");if(!f)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:f});try{new BroadcastChannel("nhost").postMessage(f)}catch{}return{session:d}},importRefreshToken:async()=>{let l=await r(wt),o=l?new Date(l):null;return{refreshToken:await r(Kt),expiresAt:o}}}})};function ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}var hl={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ln(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ir({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var c in a)!a[c]||(u+="; "+c,a[c]!==!0&&(u+="="+a[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+u}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],a={},u=0;u<s.length;u++){var c=s[u].split("="),l=c.slice(1).join("=");try{var o=decodeURIComponent(c[0]);if(a[o]=t.read(l,o),i===o)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",ir({},s,{expires:-1}))},withAttributes:function(i){return ln(this.converter,ir({},this.attributes,i))},withConverter:function(i){return ln(ir({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Mv=ln(hl,{path:"/"});var ua=typeof window!="undefined",sr=new Map,ar=t=>{var e;return ua&&localStorage?localStorage.getItem(t):(e=sr.get(t))!=null?e:null},or=(t,e)=>{ua&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?sr.set(t,e):sr.has(t)&&sr.delete(t)};var Rt=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=ar,clientStorageSetter:i=or,refreshIntervalTime:s=60,autoSignIn:a=!0,autoRefreshToken:u=!0,start:c=!0}){this._subscriptions=new Set;if(this.backendUrl=e,this.clientUrl=r,this.machine=oa({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:a,autoRefreshToken:u}),c&&(this.interpreter=me(this.machine),this.interpreter.start()),typeof window!="undefined"&&a)try{this._channel=new BroadcastChannel("nhost"),this._channel.addEventListener("message",o=>{var d;let f=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&o.data!==f&&this.interpreter.send({type:"TRY_TOKEN",token:o.data})})}catch{}}get interpreter(){return this._interpreter}set interpreter(e){this._interpreter=e,e&&this._subscriptions.forEach(r=>r(this))}onStart(e){this.interpreter?e(this):this._subscriptions.add(e)}};var ca=()=>typeof window!="undefined",ke=t=>!t||!t.accessToken.value||!t.refreshToken.value?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user},Xe=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},la=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Xe(e,["getItem"]),r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return Xe(e,["get"]),r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return Xe(e,["getItemAsync"]),r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)}}return ar},fa=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Xe(e,["setItem","removeItem"]),(r,n)=>{var i,s;n?(i=e.setItem)==null||i.call(e,r,n):(s=e.removeItem)==null||s.call(e,r)};if(t==="capacitor")return Xe(e,["set","remove"]),(r,n)=>{var i,s;n?(i=e.set)==null||i.call(e,{key:r,value:n}):(s=e.remove)==null||s.call(e,{key:r})};if(t==="expo-secure-storage")return Xe(e,["setItemAsync","deleteItemAsync"]),async(r,n)=>{var i,s;n?await((i=e.setItemAsync)==null?void 0:i.call(e,r,n)):(s=e.deleteItemAsync)==null||s.call(e,r)}}return or};var da={message:"User is already signed in",status:100},vl={message:"User is not authenticated",status:101},ml={message:"User is not anonymous",status:101},yl={message:"Email needs verification",status:102},fn=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:a,clientStorageSetter:u,refreshIntervalTime:c,start:l=!0,Client:o=Rt}){this._client=new o({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:l,clientStorageGetter:a||la(s,i),clientStorageSetter:u||fa(s,i),refreshIntervalTime:c})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:da}:new Promise(a=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(u=>{if(u.matches({authentication:{signedOut:"needsEmailVerification"}}))return a({session:null,error:null});if(u.matches({authentication:{signedOut:"failed"}}))return a({session:null,error:u.context.errors.registration||null});if(u.matches({authentication:"signedIn"}))return a({session:ke(u.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:da};if("provider"in e){let{provider:n,options:i}=e,s=ta(`${this._client.backendUrl}/signin/provider/${n}`,ie(this._client.clientUrl,i));return ca()&&(window.location.href=s),{providerUrl:s,provider:n,session:null,mfa:null,error:null}}return"email"in e&&"password"in e?new Promise(n=>{r.send({type:"SIGNIN_PASSWORD",...e}),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:ke(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:yl}):i.matches({authentication:{signedOut:"needsMfa"}})?n({session:null,mfa:i.context.mfa,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):"email"in e&&!("otp"in e)?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_EMAIL",...e})}):"phoneNumber"in e&&!("otp"in e)?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:{signedOut:"needsSmsOtp"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_SMS",...e})}):"otp"in e?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:ke(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_SMS_OTP",...e})}):{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(e){let r=await this.waitUntilReady();return this.isAuthenticated()?new Promise(n=>{r.send({type:"SIGNOUT",all:e==null?void 0:e.all}),r.onTransition(i=>{i.matches({authentication:{signedOut:"success"}})?n({error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({error:i.context.errors.signout||null})})}):{error:vl}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(sa(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async changePassword(e){return new Promise(r=>{let n=me(ia(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",password:e.newPassword})})}async sendVerificationEmail(e){return new Promise(r=>{let n=me(aa(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",email:e.email,options:e.options})})}async changeEmail({newEmail:e,options:r}){return new Promise(n=>{let i=me(na(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async deanonymize(e){let r=await this.waitUntilReady();return new Promise(n=>{var u;if(!this.isAuthenticated()||!((u=r.state.context.user)!=null&&u.isAnonymous))return{error:ml};r.onTransition(c=>{c.matches({authentication:{signedIn:{deanonymizing:"success"}}})?n({error:null}):c.matches({authentication:{signedIn:{deanonymizing:"error"}}})&&n({error:c.context.errors.authentication||null})}),r.start();let{signInMethod:i,connection:s,...a}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:a})})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(ke(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onTokenChanged was added before the interpreter started. Cannot unsubscribe listener.")}}onAuthStateChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{(i.type==="SIGNED_IN"||i.type==="SIGNED_OUT")&&e(i.type,ke(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onAuthStateChanged was added before the interpreter started. Cannot unsubscribe listener.")}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?void 0:new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n();r==null||r.onTransition(s=>{(s.matches({token:{idle:"error"}})||s.event.type==="TOKEN_CHANGED")&&n()}),r.send({type:"TRY_TOKEN",token:i})})}catch{return}}getSession(){var e,r;return ke((r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){let r=this._client.interpreter;if(!r)throw Error("Auth interpreter not set");return r.state.hasTag("ready")?Promise.resolve(r):new Promise((n,i)=>{let s=setTimeout(()=>i(`The state machine is not yet ready after ${15} seconds.`),15e3);r.onTransition(a=>{if(a.hasTag("ready"))return clearTimeout(s),n(r)})})}isReady(){var e,r;return!!((r=(e=this._client.interpreter)==null?void 0:e.state)!=null&&r.hasTag("ready"))}get client(){return this._client}};var xo=nt(wo()),In=class{constructor({url:e}){this.url=e,this.httpClient=xo.default.create({baseURL:this.url})}async upload(e){try{return{fileMetadata:(await this.httpClient.post("/files",e.file,{headers:{...this.generateUploadHeaders(e),...this.generateAuthHeaders()}})).data,error:null}}catch(r){return{fileMetadata:null,error:r}}}async getPresignedUrl(e){try{let{fileId:r}=e;return{presignedUrl:(await this.httpClient.get(`/files/${r}/presignedurl`,{headers:{...this.generateAuthHeaders()}})).data,error:null}}catch(r){return{presignedUrl:null,error:r}}}async delete(e){try{let{fileId:r}=e;return await this.httpClient.delete(`/files/${r}`,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(r){return{error:r}}}setAccessToken(e){return this.accessToken=e,this}setAdminSecret(e){return this.adminSecret=e,this}generateUploadHeaders(e){let{bucketId:r,name:n,id:i}=e,s={};return r&&(s["x-nhost-bucket-id"]=r),i&&(s["x-nhost-file-id"]=i),n&&(s["x-nhost-file-name"]=n),s}generateAuthHeaders(){return!this.adminSecret&&!this.accessToken?null:this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:{Authorization:`Bearer ${this.accessToken}`}}};var kn=class{constructor({url:e}){this.url=e,this.api=new In({url:e})}async upload(e){let r=new FormData;r.append("file",e.file);let{fileMetadata:n,error:i}=await this.api.upload({...e,file:r});return i?{fileMetadata:null,error:i}:n?{fileMetadata:n,error:null}:{fileMetadata:null,error:new Error("Invalid file returned")}}getUrl(e){return this.getPublicUrl(e)}getPublicUrl(e){let{fileId:r}=e;return`${this.url}/files/${r}`}async getPresignedUrl(e){let{presignedUrl:r,error:n}=await this.api.getPresignedUrl(e);return n?{presignedUrl:null,error:n}:r?{presignedUrl:r,error:null}:{presignedUrl:null,error:new Error("Invalid file id")}}async delete(e){let{error:r}=await this.api.delete(e);return r?{error:r}:{error:null}}setAccessToken(e){return this.api.setAccessToken(e),this}setAdminSecret(e){return this.api.setAdminSecret(e),this}};var Cu=nt(Qn()),Zn=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Cu.default.create({baseURL:r})}async call(e,r,n){let i={...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers},s;try{s=await this.instance.post(e,r,{...n,headers:i})}catch(a){if(a instanceof Error)return{res:null,error:a}}return s?{res:s,error:null}:{res:null,error:new Error("Unable to make post request to funtion")}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var $u=nt(Qn()),Wu=nt(zu()),si=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=$u.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",u=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,Wu.print)(e),variables:r},{...n,headers:i})).data,{data:c}=u;return u.errors?{data:null,error:u.errors}:typeof c!="object"||Array.isArray(c)||c===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:c,error:null}}catch(s){return s instanceof Error?{data:null,error:s}:(console.error(s),{data:null,error:new Error("Unable to get do GraphQL request")})}}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var ai=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoLogin:c,start:l=!0,Client:o}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new fn({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoLogin:c,start:l,Client:o}),this.storage=new kn({url:`${e}/v1/storage`}),this.functions=new Zn({url:`${e}/v1/functions`}),this.graphql=new si({url:`${e}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.client.onStart(()=>{this.auth.onAuthStateChanged((f,d)=>{f==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(f=>{this.storage.setAccessToken(f==null?void 0:f.accessToken),this.functions.setAccessToken(f==null?void 0:f.accessToken),this.graphql.setAccessToken(f==null?void 0:f.accessToken)})})}};var og=t=>new ai(t);export{ai as NhostClient,og as createClient};
25
+ }`)}function L(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Dr(t){return L(" ",t.replace(/\n/g,`
26
+ `))}function Bd(t){return t.indexOf(`
27
+ `)!==-1}function Zu(t){return t!=null&&t.some(Bd)}});function jr(t){this.message=t}jr.prototype=new Error,jr.prototype.name="InvalidCharacterError";var li=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new jr("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=e.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function fc(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(li(r).replace(/(.)/g,function(n,i){var s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch{return li(e)}}function _t(t){this.message=t}function dc(t,e){if(typeof t!="string")throw new _t("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(fc(t.split(".")[r]))}catch(n){throw new _t("Invalid token specified: "+n.message)}}_t.prototype=new Error,_t.prototype.name="InvalidTokenError";var fi=dc;var y=function(){return y=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},y.apply(this,arguments)};function je(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function D(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var I;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(I||(I={}));var Ee;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ee||(Ee={}));var st=I.Start,Me=I.Stop,Le=I.Raise,xe=I.Send,Dt=I.Cancel,di=I.NullEvent,qt=I.Assign,zd=I.After,$d=I.DoneState,Ut=I.Log,hi=I.Init,at=I.Invoke,Wd=I.ErrorExecution,Mr=I.ErrorPlatform,Lr=I.ErrorCustom,ot=I.Update,pi=I.Choose,vi=I.Pure;var jt=".",Br={},Mt="xstate.guard",mi="";var j=!0;var Lt;function ct(t,e,r){r===void 0&&(r=jt);var n=Be(t,r),i=Be(e,r);return P(i)?P(n)?i===n:!1:P(n)?n in i:Object.keys(n).every(function(s){return s in i?ct(n[s],i[s]):!1})}function Bt(t){try{return P(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function Ft(t,e){try{return ve(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function hc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(hc(t))return t.value;if(ve(t))return ut(t);if(typeof t!="string")return t;var r=Ft(t,e);return ut(r)}function ut(t){if(t.length===1)return t[0];for(var e={},r=e,n=0;n<t.length-1;n++)n===t.length-2?r[t[n]]=t[n+1]:(r[t[n]]={},r=r[t[n]]);return e}function Fe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;i++){var s=n[i];r[s]=e(t[s],s,t,i)}return r}function Fr(t,e,r){var n,i,s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];!r(l)||(s[c]=e(l,c,t))}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}var yi=function(t){return function(e){var r,n,i=e;try{for(var s=R(t),a=s.next();!a.done;a=s.next()){var u=a.value;i=i[u]}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function gi(t,e){return function(r){var n,i,s=r;try{for(var a=R(t),u=a.next();!u.done;u=a.next()){var c=u.value;s=s[e][c]}}catch(l){n={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}}function lt(t){if(!t)return[[]];if(P(t))return[[t]];var e=U(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:lt(t[r]).map(function(i){return[r].concat(i)})}));return e}function U(t){var e;return(e=[]).concat.apply(e,D([],C(t),!1))}function Ei(t){return ve(t)?t:[t]}function ee(t){return t===void 0?[]:Ei(t)}function Te(t,e,r){var n,i;if(k(t))return t(e,r.data);var s={};try{for(var a=R(Object.keys(t)),u=a.next();!u.done;u=a.next()){var c=u.value,l=t[c];k(l)?s[c]=l(e,r.data):s[c]=l}}catch(o){n={error:o}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}function Si(t){return/^(done|error)\./.test(t)}function Vr(t){return!!(t instanceof Promise||t!==null&&(k(t)||typeof t=="object")&&k(t.then))}function wi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Vt(t,e){var r,n,i=C([[],[]],2),s=i[0],a=i[1];try{for(var u=R(t),c=u.next();!c.done;c=u.next()){var l=c.value;e(l)?s.push(l):a.push(l)}}catch(o){r={error:o}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return[s,a]}function xi(t,e){return Fe(t.states,function(r,n){if(!!r){var i=(P(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:xi(r,i)}}})}function Ti(t,e){return{current:e,states:xi(t,e)}}function Hr(t,e,r,n){j||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,a){var u,c,l=a.assignment,o={state:n,action:a,_event:e},f={};if(k(l))f=l(s,e.data,o);else try{for(var d=R(Object.keys(l)),h=d.next();!h.done;h=d.next()){var m=h.value,E=l[m];f[m]=k(E)?E(s,e.data,o):E}}catch(v){u={error:v}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(u)throw u.error}}return Object.assign({},s,f)},t);return i}var B=function(){};j||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function ve(t){return Array.isArray(t)}function k(t){return typeof t=="function"}function P(t){return typeof t=="string"}function Ht(t,e){if(!!t)return P(t)?{type:Mt,name:t,predicate:e?e[t]:void 0}:k(t)?{type:Mt,name:t.name,predicate:t}:t}function bi(t){try{return"subscribe"in t&&k(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),th=(Lt={},Lt[fe]=function(){return this},Lt[Symbol.observable]=function(){return this},Lt);function de(t){return!!t&&"__xstatenode"in t}function Ai(t){return!!t&&typeof t.send=="function"}function ft(t,e){return P(t)||typeof t=="number"?y({type:t},e):t}function F(t,e){if(!P(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=ft(t);return y({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function be(t,e){var r=Ei(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:y(y({},n),{event:t})});return r}function Ri(t){if(!(t===void 0||t===mi))return ee(t)}function Oi(t,e,r){if(!j){var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(t,"'.").concat(n));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(t,"'. ").concat(n," Current error is '").concat(e,"'.").concat(i))}}}function Gt(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===Mt)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,a);var u=s==null?void 0:s[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(r,n.data,a)}function Jt(t){return typeof t=="string"?{type:t}:t}function dt(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function ht(t,e){return"".concat(t,":invocation[").concat(e,"]")}var Ae=F({type:hi});function zt(t,e){return e&&e[t]||void 0}function Ve(t,e){var r;if(P(t)||typeof t=="number"){var n=zt(t,e);k(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(k(t))r={type:t.name||t.toString(),exec:t};else{var n=zt(t.type,e);if(k(n))r=y(y({},t),{exec:n});else if(n){var i=n.type||t.type;r=y(y(y({},n),t),{type:i})}else r=t}return r}var pt=function(t,e){if(!t)return[];var r=ve(t)?t:[t];return r.map(function(n){return Ve(n,e)})};function Wt(t){var e=Ve(t);return y(y({id:P(t)?t:e.id},e),{type:e.type})}function Ci(t){return P(t)?{type:Le,event:t}:vt(t,{to:Ee.Internal})}function pc(t){return{type:Le,_event:F(t.event)}}function vt(t,e){return{to:e?e.to:void 0,type:xe,event:k(t)?t:ft(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:k(t)?t.name:Bt(t)}}function vc(t,e,r,n){var i={_event:r},s=F(k(t.event)?t.event(e,r.data,i):t.event),a;if(P(t.delay)){var u=n&&n[t.delay];a=k(u)?u(e,r.data,i):u}else a=k(t.delay)?t.delay(e,r.data,i):t.delay;var c=k(t.to)?t.to(e,r.data,i):t.to;return y(y({},t),{to:c,_event:s,event:s.data,delay:a})}var mc=function(t,e,r){return y(y({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},Pi=function(t){return{type:Dt,sendId:t}};function Ni(t){var e=Wt(t);return{type:I.Start,activity:e,exec:void 0}}function Ii(t){var e=k(t)?t:Wt(t);return{type:I.Stop,activity:e,exec:void 0}}function yc(t,e,r){var n=k(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:I.Stop,activity:i};return s}var ki=function(t){return{type:qt,assignment:t}};function _i(t,e){var r=e?"#".concat(e):"";return"".concat(I.After,"(").concat(t,")").concat(r)}function mt(t,e){var r="".concat(I.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Oe(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function $t(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Vt(i,function(d){return d.type===qt}),2),u=a[0],c=a[1],l=u.length?Hr(r,n,u,e):r,o=s?[r]:void 0,f=U(c.map(function(d){var h;switch(d.type){case Le:return pc(d);case xe:var m=vc(d,l,n,t.options.delays);return j||B(!P(d.delay)||typeof m.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),m;case Ut:return mc(d,l,n);case pi:{var E=d,v=(h=E.conds.find(function(q){var V=Ht(q.cond,t.options.guards);return!V||Gt(t,V,l,n,e)}))===null||h===void 0?void 0:h.actions;if(!v)return[];var x=C($t(t,e,l,n,pt(ee(v),t.options.actions),s),2),g=x[0],T=x[1];return l=T,o==null||o.push(l),g}case vi:{var v=d.get(l,n.data);if(!v)return[];var O=C($t(t,e,l,n,pt(ee(v),t.options.actions),s),2),N=O[0],M=O[1];return l=M,o==null||o.push(l),N}case Me:return yc(d,l,n);case qt:{l=Hr(l,n,[d],e),o==null||o.push(l);break}default:var b=Ve(d,t.options.actions),w=b.exec;if(w&&o){var A=o.length-1;b=y(y({},b),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,D([o[A]],C(V),!1))}})}return b}}).filter(function(d){return!!d}));return[f,l]}var Di=[],Ce=function(t,e){Di.push(t);var r=e(t);return Di.pop(),r};function qi(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Ui(t,e,r,n){var i,s=Jt(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],u=t.data?Te(t.data,r,n):void 0,c=a?ji(a,t.id,u):qi(t.id);return c.meta=t,c}function ji(t,e,r){var n=qi(e);if(n.deferred=!0,de(t)){var i=n.state=Ce(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function gc(t){try{return typeof t.send=="function"}catch{return!1}}function Mi(t){return gc(t)&&"id"in t}function Li(t){var e;return y((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[fe]=function(){return this},e),t)}var yt=function(t){return t.type==="atomic"||t.type==="final"};function Pe(t){return Object.keys(t.states).map(function(e){return t.states[e]}).filter(function(e){return e.type!=="history"})}function Jr(t){var e=[t];return yt(t)?e:e.concat(U(Pe(t).map(Jr)))}function Ne(t,e){var r,n,i,s,a,u,c,l,o=new Set(t),f=Gr(o),d=new Set(e);try{for(var h=R(d),m=h.next();!m.done;m=h.next())for(var E=m.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){r={error:A}}finally{try{m&&!m.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var x=Gr(d);try{for(var g=R(d),T=g.next();!T.done;T=g.next()){var E=T.value;if(E.type==="compound"&&(!x.get(E)||!x.get(E).length))f.get(E)?f.get(E).forEach(function(q){return d.add(q)}):E.initialStateNodes.forEach(function(q){return d.add(q)});else if(E.type==="parallel")try{for(var O=(a=void 0,R(Pe(E))),N=O.next();!N.done;N=O.next()){var M=N.value;d.has(M)||(d.add(M),f.get(M)?f.get(M).forEach(function(q){return d.add(q)}):M.initialStateNodes.forEach(function(q){return d.add(q)}))}}catch(q){a={error:q}}finally{try{N&&!N.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}try{for(var b=R(d),w=b.next();!w.done;w=b.next())for(var E=w.value,v=E.parent;v&&!d.has(v);)d.add(v),v=v.parent}catch(A){c={error:A}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(c)throw c.error}}return d}function Bi(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(yt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Bi(s,e)}),i}function Gr(t){var e,r,n=new Map;try{for(var i=R(t),s=i.next();!s.done;s=i.next()){var a=s.value;n.has(a)||n.set(a,[]),a.parent&&(n.has(a.parent)||n.set(a.parent,[]),n.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Fi(t,e){var r=Ne([t],e);return Bi(t,Gr(r))}function gt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Vi(t){return D([],C(new Set(U(D([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Ie(t,e){return e.type==="compound"?Pe(e).some(function(r){return r.type==="final"&&gt(t,r)}):e.type==="parallel"?Pe(e).every(function(r){return Ie(t,r)}):!1}function Hi(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function zr(t){return new Set(U(t.map(function(e){return e.tags})))}function $r(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(P(t)||P(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return $r(t[i],e[i])})}function Gi(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Ji(t,e){var r=t.exec,n=y(y({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var se=function(){function t(e){var r=this,n;this.actions=[],this.activities=Br,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||Br,this.meta=Hi(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return Vi(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=Ae;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=Ae;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),P(e))return[e];var i=Object.keys(e);return i.concat.apply(i,D([],C(i.map(function(s){return n.toStrings(e[s],r).map(function(a){return s+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=je(e,["configuration","transitions","tags","machine"]);return y(y({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ct(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;j&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var Ec={deferEvents:!1},Wr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=y(y({},Ec),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(r){throw this.clear(),r}finally{this.processingEvent=!1}},t}();var Kr=new Map,Sc=0,Et={bookId:function(){return"x:".concat(Sc++)},register:function(t,e){return Kr.set(t,e),t},get:function(t){return Kr.get(t)},free:function(t){Kr.delete(t)}};function Kt(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;j||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function wc(){var t=Kt();if(t&&"__xstate__"in t)return t.__xstate__}function zi(t){if(!!Kt()){var e=wc();e&&e.register(t)}}function $i(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,a=function(){if(!s){for(s=!0;i.length>0;){var l=i.shift();r=t.transition(r,l,c),n.forEach(function(o){return o.next(r)})}s=!1}},u=Li({id:e.id,send:function(l){i.push(l),a()},getSnapshot:function(){return r},subscribe:function(l,o,f){var d=dt(l,o,f);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:u,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,u}var xc={sync:!1,autoForward:!1},H;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(H||(H={}));var Wi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=H.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(o,f){if(ve(o))return n.batch(o),n.state;var d=F(ft(o,f));if(n.status===H.Stopped)return j||B(!1,'Event "'.concat(d.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
28
+ Event: `).concat(JSON.stringify(d.data))),n.state;if(n.status!==H.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(d.name,'" was sent to uninitialized service "').concat(n.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
29
+ Event: `).concat(JSON.stringify(d.data)));return n.scheduler.schedule(function(){n.forward(d);var h=n.nextState(d);n.update(h,d)}),n._state},this.sendTo=function(o,f){var d=n.parent&&(f===Ee.Parent||n.parent.id===f),h=d?n.parent:P(f)?n.children.get(f)||Et.get(f):Ai(f)?f:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(f,"' from service '").concat(n.id,"'."));j||B(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(o.type));return}"machine"in h?h.send(y(y({},o),{name:o.name===Lr?"".concat(Oe(n.id)):o.name,origin:n.sessionId})):h.send(o.data)};var i=y(y({},t.defaultOptions),r),s=i.clock,a=i.logger,u=i.parent,c=i.id,l=c!==void 0?c:e.id;this.id=l,this.logger=a,this.clock=s,this.parent=u,this.options=i,this.scheduler=new Wr({deferEvents:this.options.deferEvents}),this.sessionId=Et.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Ce(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return j||B(this.status!==H.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,r){var n,i;try{for(var s=R(e.actions),a=s.next();!a.done;a=s.next()){var u=a.value;this.exec(u,e,r)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,i,s,a,u,c,l,o,f=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(A){f.state.children[A.id]=A}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=R(this.eventListeners),h=d.next();!h.done;h=d.next()){var m=h.value;m(e.event)}}catch(A){n={error:A}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=R(this.listeners),v=E.next();!v.done;v=E.next()){var m=v.value;m(e,e.event)}}catch(A){s={error:A}}finally{try{v&&!v.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var T=g.value;T(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{g&&!g.done&&(c=x.return)&&c.call(x)}finally{if(u)throw u.error}}var O=Ie(e.configuration||[],this.machine);if(this.state.configuration&&O){var N=e.configuration.find(function(A){return A.type==="final"&&A.parent===f.machine}),M=N&&N.doneData?Te(N.doneData,e.context,r):void 0;try{for(var b=R(this.doneListeners),w=b.next();!w.done;w=b.next()){var m=w.value;m(Re(this.id,M))}}catch(A){l={error:A}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(l)throw l.error}}this.stop()}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===H.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,r,n){var i=this;if(!e)return{unsubscribe:function(){}};var s,a=n;return typeof e=="function"?s=e:(s=e.next.bind(e),a=e.complete.bind(e)),this.listeners.add(s),this.status!==H.NotStarted&&s(this.state),a&&(this.status===H.Stopped?a():this.onDone(a)),{unsubscribe:function(){s&&i.listeners.delete(s),a&&i.doneListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var r=this;if(this.status===H.Running)return this;this.machine._init(),Et.register(this.sessionId,this),this.initialized=!0,this.status=H.Running;var n=e===void 0?this.initialState:Ce(this,function(){return Gi(e)?r.machine.resolveState(e):r.machine.resolveState(se.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(n,Ae)}),this},t.prototype.stop=function(){var e,r,n,i,s,a,u,c,l,o,f=this;try{for(var d=R(this.listeners),h=d.next();!h.done;h=d.next()){var m=h.value;this.listeners.delete(m)}}catch(w){e={error:w}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=R(this.stopListeners),v=E.next();!v.done;v=E.next()){var m=v.value;m(),this.stopListeners.delete(m)}}catch(w){n={error:w}}finally{try{v&&!v.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var x=R(this.contextListeners),g=x.next();!g.done;g=x.next()){var m=g.value;this.contextListeners.delete(m)}}catch(w){s={error:w}}finally{try{g&&!g.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}try{for(var T=R(this.doneListeners),O=T.next();!O.done;O=T.next()){var m=O.value;this.doneListeners.delete(m)}}catch(w){u={error:w}}finally{try{O&&!O.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}if(!this.initialized)return this;D([],C(this.state.configuration),!1).sort(function(w,A){return A.order-w.order}).forEach(function(w){var A,q;try{for(var V=R(w.definition.exit),Q=V.next();!Q.done;Q=V.next()){var ge=Q.value;f.exec(ge,f.state)}}catch(kt){A={error:kt}}finally{try{Q&&!Q.done&&(q=V.return)&&q.call(V)}finally{if(A)throw A.error}}}),this.children.forEach(function(w){k(w.stop)&&w.stop()}),this.children.clear();try{for(var N=R(Object.keys(this.delayedEventsMap)),M=N.next();!M.done;M=N.next()){var b=M.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(w){l={error:w}}finally{try{M&&!M.done&&(o=N.return)&&o.call(N)}finally{if(l)throw l.error}}return this.scheduler.clear(),this.scheduler=new Wr({deferEvents:this.options.deferEvents}),this.initialized=!1,this.status=H.Stopped,this._initialState=void 0,Et.free(this.sessionId),this},t.prototype.batch=function(e){var r=this;if(this.status===H.NotStarted&&this.options.deferEvents)j||B(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
30
+ Event: `).concat(JSON.stringify(event)));else if(this.status!==H.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule(function(){var n,i,s=r.state,a=!1,u=[],c=function(d){var h=F(d);r.forward(h),s=Ce(r,function(){return r.machine.transition(s,h)}),u.push.apply(u,D([],C(s.actions.map(function(m){return Ji(m,s)})),!1)),a=a||!!s.changed};try{for(var l=R(e),o=l.next();!o.done;o=l.next()){var f=o.value;c(f)}}catch(d){n={error:d}}finally{try{o&&!o.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}s.changed=a,s.actions=u,r.update(s,F(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=F(e);if(n.name.indexOf(Mr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Mr)===0}))throw n.data.data;var i=Ce(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var a=s.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.defer=function(e){var r=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?r.sendTo(e._event,e.to):r.send(e._event)},e.delay)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,r,n){n===void 0&&(n=this.machine.options.actions);var i=r.context,s=r._event,a=e.exec||zt(e.type,n),u=k(a)?a:a?a.exec:e.exec;if(u)try{return u(i,s.data,{action:e,state:this.state,_event:s})}catch(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case xe:var c=e;if(typeof c.delay=="number"){this.defer(c);return}else c.to?this.sendTo(c._event,c.to):this.send(c._event);break;case Dt:this.cancel(e.sendId);break;case st:{if(this.status!==H.Running)return;var l=e.activity;if(!this.state.activities[l.id||l.type])break;if(l.type===I.Invoke){var o=Jt(l.src),f=this.machine.options.services?this.machine.options.services[o.type]:void 0,d=l.id,h=l.data;j||B(!("forward"in l),"`forward` property is deprecated (found in invocation of '".concat(l.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var m="autoForward"in l?l.autoForward:!!l.forward;if(!f){j||B(!1,"No service found for invocation '".concat(l.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?Te(h,i,s):void 0;if(typeof f=="string")return;var v=k(f)?f(i,s.data,{data:E,src:o,meta:l.meta}):f;if(!v)return;var x=void 0;de(v)&&(v=E?v.withContext(E):v,x={autoForward:m}),this.spawn(v,d,x)}else this.spawnActivity(l);break}case Me:{this.stopChild(e.activity.id);break}case Ut:var g=e.label,T=e.value;g?this.logger(g,T):this.logger(T);break;default:j||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),k(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(Vr(e))return this.spawnPromise(Promise.resolve(e),r);if(k(e))return this.spawnCallback(e,r);if(Mi(e))return this.spawnActor(e,r);if(bi(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,y(y({},n),{id:r}));if(wi(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var i=new t(e,y(y({},this.options),{parent:this,id:r.id||e.id})),s=y(y({},xc),r);s.sync&&i.onTransition(function(u){n.send(ot,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){n.removeChild(i.id),n.send(F(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=$i(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,a;e.then(function(c){s||(a=c,i.removeChild(r),i.send(F(Re(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var l=Oe(r,c);try{i.send(F(l,{origin:r}))}catch(o){Oi(c,o,r),i.devTools&&i.devTools.send(l,i.state),i.machine.strict&&i.stop()}}});var u=(n={id:r,send:function(){},subscribe:function(c,l,o){var f=dt(c,l,o),d=!1;return e.then(function(h){d||(f.next(h),!d&&f.complete())},function(h){d||f.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return a}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,a=new Set,u=new Set,c,l=function(d){c=d,u.forEach(function(h){return h(d)}),!s&&i.send(F(d,{origin:r}))},o;try{o=e(l,function(d){a.add(d)})}catch(d){this.send(Oe(r,d))}if(Vr(o))return this.spawnPromise(o,r);var f=(n={id:r,send:function(d){return a.forEach(function(h){return h(d)})},subscribe:function(d){var h=dt(d);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){s=!0,k(o)&&o()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[fe]=function(){return this},n);return this.children.set(r,f),f},t.prototype.spawnObservable=function(e,r){var n,i=this,s,a=e.subscribe(function(c){s=c,i.send(F(c,{origin:r}))},function(c){i.removeChild(r),i.send(F(Oe(r,c),{origin:r}))},function(){i.removeChild(r),i.send(F(Re(r),{origin:r}))}),u=(n={id:r,send:function(){},subscribe:function(c,l,o){return e.subscribe(c,l,o)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[fe]=function(){return this},n);return this.children.set(r,u),u},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){j||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=Kt();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(y(y({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:y({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}zi(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===H.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=me,t}();function me(t,e){var r=new Wi(t,e);return r}function Tc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function St(t){return y(y({type:at},t),{toJSON:function(){t.onDone,t.onError;var e=je(t,["onDone","onError"]);return y(y({},e),{type:at,src:Tc(t.src)})}})}var Je="",Xr="#",wt="*",He={},Ge=function(t){return t[0]===Xr},bc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Ac=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(P(s.target)||de(s.target))}),i=e===Je?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Ki=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(bc(),r),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:jt),this.id=this.config.id||D([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,j||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Fe(this.config.states,function(l,o){var f,d=new t(l,{},void 0,{parent:s,key:o});return Object.assign(s.idMap,y((f={},f[d.id]=d,f),d.idMap)),d}):He;var u=0;function c(l){var o,f;l.order=u++;try{for(var d=R(Pe(l)),h=d.next();!h.done;h=d.next()){var m=h.value;c(m)}}catch(E){o={error:E}}finally{try{h&&!h.done&&(f=d.return)&&f.call(d)}finally{if(o)throw o.error}}}c(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(l){var o=l.event;return o===Je}):Je in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=ee(this.config.entry||this.config.onEntry).map(function(l){return Ve(l)}),this.onExit=ee(this.config.exit||this.config.onExit).map(function(l){return Ve(l)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=ee(this.config.invoke).map(function(l,o){var f,d;if(de(l)){var h=ht(s.id,o);return s.machine.options.services=y((f={},f[h]=l,f),s.machine.options.services),St({src:h,id:h})}else if(P(l.src)){var h=l.id||ht(s.id,o);return St(y(y({},l),{id:h,src:l.src}))}else if(de(l.src)||k(l.src)){var h=l.id||ht(s.id,o);return s.machine.options.services=y((d={},d[h]=l.src,d),s.machine.options.services),St(y(y({id:h},l),{src:h}))}else{var m=l.src;return St(y(y({id:ht(s.id,o)},l),{src:m}))}}),this.activities=ee(this.config.activities).concat(this.invoke).map(function(l){return Wt(l)}),this.transition=this.transition.bind(this),this.tags=ee(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Jr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,a=n.guards,u=n.services,c=n.delays;return new t(this.config,{actions:y(y({},i),e.actions),activities:y(y({},s),e.activities),guards:y(y({},a),e.guards),services:y(y({},u),e.services),delays:y(y({},c),e.delays)},r!=null?r:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return k(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Fe(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,n){return r[n.eventType]=r[n.eventType]||[],r[n.eventType].push(n),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===Je,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===wt});return this.__cache.candidates[e]=n,n},t.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var n=function(s,a){var u=k(s)?"".concat(e.id,":delay[").concat(a,"]"):s,c=_i(u,e.id);return e.onEntry.push(vt(c,{delay:s})),e.onExit.push(Pi(c)),c},i=ve(r)?r.map(function(s,a){var u=n(s.delay,a);return y(y({},s),{event:u})}):U(Object.keys(r).map(function(s,a){var u=r[s],c=P(u)?{target:u}:u,l=isNaN(+s)?s:+s,o=n(l,a);return ee(c).map(function(f){return y(y({},f),{event:o,delay:l})})}));return i.map(function(s){var a=s.delay;return y(y({},e.formatTransition(s)),{delay:a})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof se?e.value:Be(e,this.delimiter);if(P(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,D([],C(U(a.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),u},t.prototype.handles=function(e){var r=Bt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof se?e:se.create(e),n=Array.from(Ne([],this.getStateNodes(r.value)));return new se(y(y({},r),{value:this.resolve(r.value),configuration:n,done:Ie(n,this),tags:zr(n),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,r,n){var i=this.getStateNode(e),s=i.next(r,n);return!s||!s.transitions.length?this.next(r,n):s},t.prototype.transitionCompoundNode=function(e,r,n){var i=Object.keys(e),s=this.getStateNode(i[0]),a=s._transition(e[i[0]],r,n);return!a||!a.transitions.length?this.next(r,n):a},t.prototype.transitionParallelNode=function(e,r,n){var i,s,a={};try{for(var u=R(Object.keys(e)),c=u.next();!c.done;c=u.next()){var l=c.value,o=e[l];if(!!o){var f=this.getStateNode(l),d=f._transition(o,r,n);d&&(a[l]=d)}}}catch(g){i={error:g}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(g){return a[g]}),m=U(h.map(function(g){return g.transitions})),E=h.some(function(g){return g.transitions.length>0});if(!E)return this.next(r,n);var v=U(h.map(function(g){return g.entrySet})),x=U(Object.keys(a).map(function(g){return a[g].configuration}));return{transitions:m,entrySet:v,exitSet:U(h.map(function(g){return g.exitSet})),configuration:x,source:r,actions:U(Object.keys(a).map(function(g){return a[g].actions}))}},t.prototype._transition=function(e,r,n){return P(e)?this.transitionLeafNode(e,r,n):Object.keys(e).length===1?this.transitionCompoundNode(e,r,n):this.transitionParallelNode(e,r,n)},t.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,F(r))},t.prototype.next=function(e,r){var n,i,s=this,a=r.name,u=[],c=[],l;try{for(var o=R(this.getCandidates(a)),f=o.next();!f.done;f=o.next()){var d=f.value,h=d.cond,m=d.in,E=e.context,v=m?P(m)&&Ge(m)?e.matches(Be(this.getStateNodeById(m).path,this.delimiter)):ct(Be(m,this.delimiter),yi(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!h||Gt(this.machine,h,E,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
31
+ `).concat(N.message))}if(x&&v){d.target!==void 0&&(c=d.target),u.push.apply(u,D([],C(d.actions),!1)),l=d;break}}}catch(N){n={error:N}}finally{try{f&&!f.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}if(!!l){if(!c.length)return{transitions:[l],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var g=U(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!l.internal,O=T?[]:U(g.map(function(N){return s.nodesFromChild(N)}));return{transitions:[l],entrySet:O,exitSet:T?[]:[this],configuration:g,source:e,actions:u}}},t.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var r=[],n=e;n&&n!==this;)r.push(n),n=n.parent;return r.push(this),r},t.prototype.escapes=function(e){if(this===e)return!1;for(var r=this.parent;r;){if(r===e)return!1;r=r.parent}return!0},t.prototype.getActions=function(e,r,n,i){var s,a,u,c,l=Ne([],i?this.getStateNodes(i.value):[this]),o=e.configuration.length?Ne(l,e.configuration):l;try{for(var f=R(o),d=f.next();!d.done;d=f.next()){var h=d.value;gt(l,h)||e.entrySet.push(h)}}catch(b){s={error:b}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}try{for(var m=R(l),E=m.next();!E.done;E=m.next()){var h=E.value;(!gt(o,h)||gt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(b){u={error:b}}finally{try{E&&!E.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}var v=U(e.entrySet.map(function(b){var w=[];if(b.type!=="final")return w;var A=b.parent;if(!A.parent)return w;w.push(mt(b.id,b.doneData),mt(A.id,b.doneData?Te(b.doneData,r,n):void 0));var q=A.parent;return q.type==="parallel"&&Pe(q).every(function(V){return Ie(e.configuration,V)})&&w.push(mt(q.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),g=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return D(D([],C(b.activities.map(function(w){return Ni(w)})),!1),C(b.onEntry),!1)})).concat(v.map(Ci)),U(Array.from(g).map(function(b){return D(D([],C(b.onExit),!1),C(b.activities.map(function(w){return Ii(w)})),!1)}))],2),O=T[0],N=T[1],M=pt(N.concat(e.actions).concat(O),this.machine.options.actions);return M},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var a=P(e)?this.resolve(ut(this.getResolvedPath(e))):this.resolve(e),u=n!=null?n:this.machine.context;s=this.resolveState(se.from(a,u))}if(!j&&i.name===wt)throw new Error("An event cannot have the wildcard type ('".concat(wt,"')"));if(this.strict&&!this.events.includes(i.name)&&!Si(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var c=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},l=Ne([],this.getStateNodes(s.value)),o=c.configuration.length?Ne(l,c.configuration):l;return c.configuration=D([],C(o),!1),this.resolveTransition(c,s,s.context,i)},t.prototype.resolveRaisedTransition=function(e,r,n){var i,s=e.actions;return e=this.transition(e,r),e._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,D([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,a,u=this;i===void 0&&(i=Ae);var c=e.configuration,l=!r||e.transitions.length>0,o=l?Fi(this.machine,c):void 0,f=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,d=this.getActions(e,n,i,r),h=r?y({},r.activities):{};try{for(var m=R(d),E=m.next();!E.done;E=m.next()){var v=E.value;v.type===st?h[v.activity.id||v.activity.type]=v:v.type===Me&&(h[v.activity.id||v.activity.type]=!1)}}catch(Z){s={error:Z}}finally{try{E&&!E.done&&(a=m.return)&&a.call(m)}finally{if(s)throw s.error}}var x=C($t(this,r,n,i,d,this.machine.config.preserveActionOrder),2),g=x[0],T=x[1],O=C(Vt(g,function(Z){return Z.type===Le||Z.type===xe&&Z.to===Ee.Internal}),2),N=O[0],M=O[1],b=g.filter(function(Z){var Ue;return Z.type===st&&((Ue=Z.activity)===null||Ue===void 0?void 0:Ue.type)===at}),w=b.reduce(function(Z,Ue){return Z[Ue.activity.id]=Ui(Ue.activity,u.machine,T,i),Z},r?y({},r.children):{}),A=l?e.configuration:r?r.configuration:[],q=Ie(A,this),V=new se({value:o||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:o?f?Ti(f,o):void 0:r?r.historyValue:void 0,history:!o||e.source?r:void 0,actions:o?M:[],activities:o?h:r?r.activities:{},events:[],configuration:A,transitions:e.transitions,children:w,done:q,tags:zr(A),machine:this}),Q=n!==T;V.changed=i.name===ot||Q;var ge=V.history;ge&&delete ge.history;var kt=!q&&(this._transient||c.some(function(Z){return Z._transient}));if(!l&&(!kt||i.name===Je))return V;var ie=V;if(!q)for(kt&&(ie=this.resolveRaisedTransition(ie,{type:di},i));N.length;){var nc=N.shift();ie=this.resolveRaisedTransition(ie,nc._event,i)}var ic=ie.changed||(ge?!!ie.actions.length||Q||typeof ge.value!=typeof ie.value||!$r(ie.value,ge.value):void 0);return ie.changed=ic,ie.history=ge,ie},t.prototype.getStateNode=function(e){if(Ge(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Ge(e)?e.slice(Xr.length):e;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Ge(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=Ft(e,this.delimiter).slice(),n=this;r.length;){var i=r.shift();if(!i.length)break;n=n.getStateNode(i)}return n},t.prototype.resolve=function(e){var r,n=this;if(!e)return this.initialStateValue||He;switch(this.type){case"parallel":return Fe(this.initialStateValue,function(s,a){return s?n.getStateNode(a).resolve(e[a]||s):He});case"compound":if(P(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(r={},r[e]=i.initialStateValue,r):e}return Object.keys(e).length?Fe(e,function(s,a){return s?n.getStateNode(a).resolve(s):He}):this.initialStateValue||{};default:return e||He}},t.prototype.getResolvedPath=function(e){if(Ge(e)){var r=this.machine.idMap[e.slice(Xr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return Ft(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=Fr(this.states,function(n){return n.initialStateValue||He},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=yt(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,r){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;P(r.target)?e=Ge(r.target)?ut(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,r,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(yt(this))return[this];if(this.type==="compound"&&!this.initial)return j||B(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=lt(this.initialStateValue);return U(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=C(e),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:Fr(this.states,function(r,n){if(!e)return r.historyValue();var i=P(e)?void 0:e[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},t.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var i=this.target;return i?U(lt(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var s=gi(n.path,"states")(e).current;return P(s)?[n.getStateNode(s)]:U(lt(s).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=U(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,r,n,i;if(this.__cache.events)return this.__cache.events;var s=this.states,a=new Set(this.ownEvents);if(s)try{for(var u=R(Object.keys(s)),c=u.next();!c.done;c=u.next()){var l=c.value,o=s[l];if(o.states)try{for(var f=(n=void 0,R(o.events)),d=f.next();!d.done;d=f.next()){var h=d.value;a.add("".concat(h))}}catch(m){n={error:m}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}}catch(m){e={error:m}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(n){if(!P(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var s=i?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(s);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
32
+ `).concat(u.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=Ri(e.target),i="internal"in e?e.internal:n?n.some(function(c){return P(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,a=this.resolveTarget(n),u=y(y({},e),{actions:pt(ee(e.actions)),cond:Ht(e.cond,s),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return y(y({},u),{target:u.target?u.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return u},t.prototype.formatTransitions=function(){var e,r,n=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var s=this.config.on,a=wt,u=s[a],c=u===void 0?[]:u,l=je(s,[typeof a=="symbol"?a:a+""]);i=U(Object.keys(l).map(function(g){!j&&g===Je&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=be(g,l[g]);return j||Ac(n,g,T),T}).concat(be(wt,c)))}var o=this.config.always?be("",this.config.always):[],f=this.config.onDone?be(String(mt(this.id)),this.config.onDone):[];j||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=U(this.invoke.map(function(g){var T=[];return g.onDone&&T.push.apply(T,D([],C(be(String(Re(g.id)),g.onDone)),!1)),g.onError&&T.push.apply(T,D([],C(be(String(Oe(g.id)),g.onError)),!1)),T})),h=this.after,m=U(D(D(D(D([],C(f),!1),C(d),!1),C(i),!1),C(o),!1).map(function(g){return ee(g).map(function(T){return n.formatTransition(T)})}));try{for(var E=R(h),v=E.next();!v.done;v=E.next()){var x=v.value;m.push(x)}}catch(g){e={error:g}}finally{try{v&&!v.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return m},t}();function ae(t,e){return new Ki(t,e)}var _=ki,$=vt;var Xt="nhostRefreshToken",xt="nhostRefreshTokenExpiresAt";var ke={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var Tt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},Xi={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},Yi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"},Qi={status:10,error:"no-refresh-token",message:"No refresh token has been provided"},Zi={status:20,error:"refresher-already-running",message:"The token refresher is already running. You must wait until is has finished before submitting a new token."};var oa=it(aa());var oe=t=>{let e=oa.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,a,u,c,l,o,f,d;return Promise.reject({error:{message:(u=(a=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?a:r.request.responseText)!=null?u:JSON.stringify(r),status:(f=(o=(c=r.response)==null?void 0:c.status)!=null?o:(l=r.response)==null?void 0:l.data.statusCode)!=null?f:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var ua=(t,e)=>{let r=e&&Object.entries(e).map(([n,i])=>{let s=Array.isArray(i)?i.join(","):typeof i=="object"?JSON.stringify(i):i;return`${n}=${encodeURIComponent(s)}`}).join("&");return r?`${t}?${r}`:t},ne=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};function ir(t,e){var i;if(!e){if(typeof window=="undefined")return;e=((i=window.location)==null?void 0:i.href)||""}t=t.replace(/[\[\]]/g,"\\$&");let r=new RegExp("[?&#]"+t+"(=([^&#]*)|&|#|$)"),n=r.exec(e);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}function ca(t){var r;if(typeof window=="undefined")return;let e=window==null?void 0:window.location;if(!!e&&e){let n=new URLSearchParams(e.search),i=new URLSearchParams((r=e.hash)==null?void 0:r.slice(1));n.delete(t),i.delete(t);let s=window.location.pathname;Array.from(n).length&&(s+=`?${n.toString()}`),Array.from(i).length&&(s+=`#${i.toString()}`),window.history.pushState({},"",s)}}var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),sr=t=>!!t&&typeof t=="string"&&t.length>=3,la=t=>!!t&&typeof t=="string";var yn={user:null,mfa:null,accessToken:{value:null,expiresAt:null},refreshTimer:{startedAt:null,attempts:0,lastAttempt:null},refreshToken:{value:null},errors:{}};var fa=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changeEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:_({error:i=>ke}),saveRequestError:_({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:a})=>(await n.post("/user/email/change",{newEmail:s,options:ne(e,a)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var da=({backendUrl:t,interpreter:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidPassword",actions:"saveInvalidPasswordError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidPasswordError:_({error:n=>Tt}),saveRequestError:_({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!sr(i)},services:{requestChange:(n,{password:i})=>r.post("/user/password",{newPassword:i},{headers:{authorization:`Bearer ${e==null?void 0:e.state.context.accessToken.value}`}})}})};var ha=({backendUrl:t,clientUrl:e})=>{let r=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"changePassword",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:"requesting"},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"requestChange",id:"requestChange",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveRequestError:_({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:$(n=>({type:"ERROR",error:n.error})),reportSuccess:$("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ne(e,s)})}})};var pa=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=oe(t);return ae({schema:{context:{},events:{}},tsTypes:{},preserveActionOrder:!0,id:"sendVerificationEmail",initial:"idle",context:{error:null},states:{idle:{on:{REQUEST:[{cond:"invalidEmail",actions:"saveInvalidEmailError",target:".error"},{target:"requesting"}]},initial:"initial",states:{initial:{},success:{},error:{}}},requesting:{invoke:{src:"request",id:"request",onDone:{target:"idle.success",actions:"reportSuccess"},onError:{actions:["saveRequestError","reportError"],target:"idle.error"}}}}},{actions:{saveInvalidEmailError:_({error:i=>ke}),saveRequestError:_({error:(i,{data:{error:s}})=>s}),reportError:$(i=>({type:"ERROR",error:i.error})),reportSuccess:$("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:a})=>(await n.post("/user/email/send-verification-email",{email:s,options:ne(e,a)})).data}})};var va=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:a=!0})=>{let u=oe(t),c=async(l,o,f)=>(await u.post(l,o,f)).data;return ae({schema:{context:{},events:{}},tsTypes:{},context:yn,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"importingRefreshToken",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{importingRefreshToken:{always:{cond:"isSignedIn",target:"signedIn"},invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:"saveRefreshToken",target:"starting"},onError:{actions:["saveAuthenticationError"],target:"signedOut"}}},starting:{always:[{cond:"hasRefreshTokenWithoutSession",target:"authenticating.token"},{cond:"hasAuthenticationError",target:"signedOut.failed"},"signedOut"]},signedOut:{tags:["ready"],initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:["clearContextExceptRefreshToken"],exit:["destroyRefreshToken","reportTokenChanged"],invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},password:{invoke:{src:"signInPassword",id:"authenticateUserWithPassword",onDone:[{cond:"hasMfaTicket",actions:["saveMfaTicket"],target:"#nhost.authentication.signedOut.needsMfa"},{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},token:{invoke:{src:"refreshToken",id:"signInToken",onDone:{actions:["saveSession","persist","reportTokenChanged","broadcastToken"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},mfa:{states:{totp:{invoke:{src:"signInMfaTotp",id:"signInMfaTotp",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:"#nhost.authentication.signedIn"},onError:{actions:["saveAuthenticationError"],target:"#nhost.authentication.signedOut.failed.server"}}}}}}},registering:{entry:"resetSignUpError",invoke:{src:"registerUser",id:"registerUser",onDone:[{cond:"hasSession",target:"#nhost.authentication.signedIn",actions:["saveSession","persist","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{tags:["ready"],type:"parallel",entry:"reportSignedIn",on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","persist","resetTimer","reportTokenChanged"],target:"pending"},onError:[{actions:"saveRefreshAttempt",target:"pending"}]}}}}}},deanonymizing:{initial:"error",states:{error:{},success:{}}}}}}},token:{initial:"idle",states:{idle:{on:{TRY_TOKEN:"running"},initial:"noErrors",states:{noErrors:{},error:{}}},running:{invoke:{src:"refreshToken",id:"authenticateWithToken",onDone:{actions:["saveSession","persist","reportTokenChanged"],target:["#nhost.authentication.signedIn","idle.noErrors"]},onError:[{cond:"isSignedIn",target:"idle.error"},{target:["#nhost.authentication.signedOut","idle.error"]}]}}}}}},{actions:{reportSignedIn:$("SIGNED_IN"),reportSignedOut:$("SIGNED_OUT"),reportTokenChanged:$("TOKEN_CHANGED"),clearContextExceptRefreshToken:_(({refreshToken:{value:l}})=>(n(xt,null),{...yn,refreshToken:{value:l}})),saveSession:_({user:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.user},accessToken:(l,o)=>{var f,d,h,m;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((m=(h=o.data)==null?void 0:h.session)==null?void 0:m.accessTokenExpiresIn)*1e3)}},refreshToken:(l,o)=>{var f,d;return{value:(d=(f=o.data)==null?void 0:f.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:_({mfa:(l,o)=>{var f,d;return(d=(f=o.data)==null?void 0:f.mfa)!=null?d:null}}),resetTimer:_({refreshTimer:(l,o)=>({startedAt:new Date,attempts:0,lastAttempt:null})}),saveRefreshAttempt:_({refreshTimer:(l,o)=>({startedAt:l.refreshTimer.startedAt,attempts:l.refreshTimer.attempts+1,lastAttempt:new Date})}),saveAuthenticationError:_({errors:({errors:l},{data:{error:o}})=>({...l,authentication:o})}),resetAuthenticationError:_({errors:({errors:{authentication:l,...o}})=>o}),saveInvalidEmail:_({errors:({errors:l})=>({...l,authentication:ke})}),saveInvalidPassword:_({errors:({errors:l})=>({...l,authentication:Tt})}),saveInvalidPhoneNumber:_({errors:({errors:l})=>({...l,authentication:Xi})}),saveRegisrationError:_({errors:({errors:l},{data:{error:o}})=>({...l,registration:o})}),resetSignUpError:_({errors:({errors:{registration:l,...o}})=>o}),saveInvalidSignUpPassword:_({errors:({errors:l})=>({...l,registration:Tt})}),saveInvalidSignUpEmail:_({errors:({errors:l})=>({...l,registration:ke})}),saveNoMfaTicketError:_({errors:({errors:l})=>({...l,registration:Yi})}),saveRefreshToken:_({accessToken:(l,o)=>({...l.accessToken,expiresAt:o.data.expiresAt}),refreshToken:(l,o)=>({...l.refreshToken,value:o.data.refreshToken})}),persist:(l,{data:o})=>{if(n(Xt,o.session.refreshToken),o.session.accessTokenExpiresIn){let f=new Date(Date.now()+o.session.accessTokenExpiresIn*1e3).toISOString();n(xt,f)}else n(xt,null)},destroyRefreshToken:_({refreshToken:l=>(n(Xt,null),{value:null})}),broadcastToken:l=>{if(a)try{new BroadcastChannel("nhost").postMessage(l.refreshToken.value)}catch{}}},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,hasRefreshTokenWithoutSession:l=>!!l.refreshToken.value&&!l.user&&!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:o})=>{var f;return!o&&!((f=l.mfa)!=null&&f.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,hasAuthenticationError:l=>!!l.errors.authentication,isAutoRefreshDisabled:()=>!s,refreshTimerShouldRefresh:l=>{var h;let{expiresAt:o}=l.accessToken;return o?l.refreshTimer.lastAttempt?Date.now()-l.refreshTimer.lastAttempt.getTime()>5*1e3:i&&Date.now()-(((h=l.refreshTimer.startedAt)==null?void 0:h.getTime())||0)>i*1e3?!0:o.getTime()-Date.now()-1e3*300<=0:!1},unverified:(l,{data:{error:o}})=>o.status===401&&o.message==="Email is not verified",hasSession:(l,o)=>{var f;return!!((f=o.data)!=null&&f.session)},hasMfaTicket:(l,o)=>{var f;return!!((f=o.data)!=null&&f.mfa)},invalidEmail:(l,{email:o})=>!Ke(o),invalidPassword:(l,{password:o})=>!sr(o),invalidPhoneNumber:(l,{phoneNumber:o})=>!la(o)},services:{signInPassword:(l,{email:o,password:f})=>c("/signin/email-password",{email:o,password:f}),signInPasswordlessSms:(l,{phoneNumber:o,options:f})=>c("/signin/passwordless/sms",{phoneNumber:o,options:ne(e,f)}),signInPasswordlessSmsOtp:(l,{phoneNumber:o,otp:f})=>c("/signin/passwordless/sms/otp",{phoneNumber:o,otp:f}),signInPasswordlessEmail:(l,{email:o,options:f})=>c("/signin/passwordless/email",{email:o,options:ne(e,f)}),signInAnonymous:l=>c("/signin/anonymous"),signInMfaTotp:(l,{ticket:o,otp:f})=>{var d;return c("/signin/mfa/totp",{ticket:o||((d=l.mfa)==null?void 0:d.ticket),otp:f})},refreshToken:async(l,o)=>{let f=o.type==="TRY_TOKEN"?o.token:l.refreshToken.value;return{session:await c("/token",{refreshToken:f})}},signout:(l,o)=>c("/signout",{refreshToken:l.refreshToken.value,all:!!o.all}),registerUser:(l,{email:o,password:f,options:d})=>c("/signup/email-password",{email:o,password:f,options:ne(e,d)}),importRefreshToken:async()=>{let l=await r(xt),o=l?new Date(l):null,f=await r(Xt);if(a){let d=ir("refreshToken")||null;if(d)f||(f=d),ca("refreshToken");else{let h=ir("error");if(h)return Promise.reject({error:{status:10,error:h,message:ir("errorDescription")||h}})}}return f?{refreshToken:f,expiresAt:o}:Promise.reject({error:null})}}})};function ar(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}var bl={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function gn(t,e){function r(i,s,a){if(typeof document!="undefined"){a=ar({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var c in a)!a[c]||(u+="; "+c,a[c]!==!0&&(u+="="+a[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+u}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],a={},u=0;u<s.length;u++){var c=s[u].split("="),l=c.slice(1).join("=");try{var o=decodeURIComponent(c[0]);if(a[o]=t.read(l,o),i===o)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",ar({},s,{expires:-1}))},withAttributes:function(i){return gn(this.converter,ar({},this.attributes,i))},withConverter:function(i){return gn(ar({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Kv=gn(bl,{path:"/"});var ma=typeof window!="undefined",or=new Map,ur=t=>{var e;return ma&&localStorage?localStorage.getItem(t):(e=or.get(t))!=null?e:null},cr=(t,e)=>{ma&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?or.set(t,e):or.has(t)&&or.delete(t)};var Xe=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(l=>(l=window.location)==null?void 0:l.origin)()||"",clientStorageGetter:n=ur,clientStorageSetter:i=cr,refreshIntervalTime:s,autoSignIn:a=!0,autoRefreshToken:u=!0,start:c=!0}){this._subscriptions=new Set;if(this.backendUrl=e,this.clientUrl=r,this.machine=va({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:a,autoRefreshToken:u}),c&&(this.interpreter=me(this.machine),this.interpreter.start()),typeof window!="undefined"&&a)try{this._channel=new BroadcastChannel("nhost"),this._channel.addEventListener("message",o=>{var d;let f=(d=this.interpreter)==null?void 0:d.state.context.refreshToken.value;this.interpreter&&o.data!==f&&this.interpreter.send({type:"TRY_TOKEN",token:o.data})})}catch{}}get interpreter(){return this._interpreter}set interpreter(e){this._interpreter=e,e&&this._subscriptions.forEach(r=>r(this))}onStart(e){this.interpreter?e(this):this._subscriptions.add(e)}};var ya=()=>typeof window!="undefined",we=t=>!t||!t.accessToken.value||!t.refreshToken.value||!t.accessToken.expiresAt?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user},Ye=(t,e)=>{e.forEach(r=>{typeof t[r]!="function"&&console.error(`clientStorage.${r} is not a function`)})},ga=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Ye(e,["getItem"]),r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return Ye(e,["get"]),r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return Ye(e,["getItemAsync"]),r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)}}return ur},Ea=(t,e)=>{if(e){if(t==="react-native"||t==="custom")return Ye(e,["setItem","removeItem"]),(r,n)=>{var i,s;n?(i=e.setItem)==null||i.call(e,r,n):(s=e.removeItem)==null||s.call(e,r)};if(t==="capacitor")return Ye(e,["set","remove"]),(r,n)=>{var i,s;n?(i=e.set)==null||i.call(e,{key:r,value:n}):(s=e.remove)==null||s.call(e,{key:r})};if(t==="expo-secure-storage")return Ye(e,["setItemAsync","deleteItemAsync"]),async(r,n)=>{var i,s;n?await((i=e.setItemAsync)==null?void 0:i.call(e,r,n)):(s=e.deleteItemAsync)==null||s.call(e,r)}}return cr};var Sa={message:"User is already signed in",status:100},Al={message:"User is not authenticated",status:101},Rl={message:"User is not anonymous",status:101},Ol={message:"Email needs verification",status:102},lr=class{constructor({url:e,autoRefreshToken:r=!0,autoSignIn:n=!0,autoLogin:i,clientStorage:s,clientStorageType:a="web",clientStorageGetter:u,clientStorageSetter:c,refreshIntervalTime:l,start:o=!0,Client:f=Xe}){this._client=new f({backendUrl:e,autoRefreshToken:r,autoSignIn:typeof i=="boolean"?i:n,start:o,clientStorageGetter:u||ga(a,s),clientStorageSetter:c||Ea(a,s),refreshIntervalTime:l})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:Sa}:new Promise(a=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(u=>{if(u.matches({authentication:{signedOut:"needsEmailVerification"}}))return a({session:null,error:null});if(u.matches({authentication:{signedOut:"failed"}}))return a({session:null,error:u.context.errors.registration||null});if(u.matches({authentication:"signedIn"}))return a({session:we(u.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:Sa};if("provider"in e){let{provider:n,options:i}=e,s=ua(`${this._client.backendUrl}/signin/provider/${n}`,ne(this._client.clientUrl,i));return ya()&&(window.location.href=s),{providerUrl:s,provider:n,session:null,mfa:null,error:null}}return"email"in e&&"password"in e?new Promise(n=>{r.send({type:"SIGNIN_PASSWORD",...e}),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:Ol}):i.matches({authentication:{signedOut:"needsMfa"}})?n({session:null,mfa:i.context.mfa,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):"email"in e&&!("otp"in e)?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_EMAIL",...e})}):"phoneNumber"in e&&!("otp"in e)?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:{signedOut:"needsSmsOtp"}})?n({session:null,mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_SMS",...e})}):"otp"in e?new Promise(n=>{r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})}),r.send({type:"SIGNIN_PASSWORDLESS_SMS_OTP",...e})}):{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(e){let r=await this.waitUntilReady();return this.isAuthenticated()?new Promise(n=>{r.send({type:"SIGNOUT",all:e==null?void 0:e.all}),r.onTransition(i=>{i.matches({authentication:{signedOut:"success"}})?n({error:null}):i.matches({authentication:{signedOut:{failed:"server"}}})&&n({error:i.context.errors.signout||null})})}):{error:Al}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(ha(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async changePassword(e){return new Promise(r=>{let n=me(da(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",password:e.newPassword})})}async sendVerificationEmail(e){return new Promise(r=>{let n=me(pa(this._client));n.onTransition(({event:i})=>{if(i.type==="ERROR")return r({error:i.error});if(i.type==="SUCCESS")return r({error:null})}),n.start(),n.send({type:"REQUEST",email:e.email,options:e.options})})}async changeEmail({newEmail:e,options:r}){return new Promise(n=>{let i=me(fa(this._client));i.onTransition(({event:s})=>{if(s.type==="ERROR")return n({error:s.error});if(s.type==="SUCCESS")return n({error:null})}),i.start(),i.send({type:"REQUEST",email:e,options:r})})}async deanonymize(e){let r=await this.waitUntilReady();return new Promise(n=>{var u;if(!this.isAuthenticated()||!((u=r.state.context.user)!=null&&u.isAnonymous))return{error:Rl};r.onTransition(c=>{c.matches({authentication:{signedIn:{deanonymizing:"success"}}})?n({error:null}):c.matches({authentication:{signedIn:{deanonymizing:"error"}}})&&n({error:c.context.errors.authentication||null})}),r.start();let{signInMethod:i,connection:s,...a}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:a})})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onTokenChanged was added before the interpreter started. Cannot unsubscribe listener.")}}onAuthStateChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{(i.type==="SIGNED_IN"||i.type==="SIGNED_OUT")&&e(i.type,we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onAuthStateChanged was added before the interpreter started. Cannot unsubscribe listener.")}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}getDecodedAccessToken(){let e=this.getAccessToken();return e?fi(e):null}getHasuraClaims(){var e;return((e=this.getDecodedAccessToken())==null?void 0:e["https://hasura.io/jwt/claims"])||null}getHasuraClaim(e){var r;return((r=this.getHasuraClaims())==null?void 0:r[e.startsWith("x-hasura-")?e:`x-hasura-${e}`])||null}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n({session:null,error:Qi});r==null||r.onTransition(s=>{s.matches({token:{idle:"error"}})?n({session:null,error:{status:400,message:"Invalid refresh token"}}):s.event.type==="TOKEN_CHANGED"&&n({session:we(s.context),error:null})}),r.send({type:"TRY_TOKEN",token:i})}):{session:null,error:Zi}}catch(r){return{session:null,error:r.message}}}getSession(){var e,r;return we((r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){let r=this._client.interpreter;if(!r)throw Error("Auth interpreter not set");return r.state.hasTag("ready")?Promise.resolve(r):new Promise((n,i)=>{let s=setTimeout(()=>i(`The state machine is not yet ready after ${15} seconds.`),15e3);r.onTransition(a=>{if(a.hasTag("ready"))return clearTimeout(s),n(r)})})}isReady(){var e,r;return!!((r=(e=this._client.interpreter)==null?void 0:e.state)!=null&&r.hasTag("ready"))}get client(){return this._client}};var No=it(Po()),Sr=class{constructor({url:e}){this.url=e,this.httpClient=No.default.create({baseURL:this.url})}async upload(e){try{return{fileMetadata:(await this.httpClient.post("/files",e.file,{headers:{...this.generateUploadHeaders(e),...this.generateAuthHeaders()}})).data,error:null}}catch(r){return{fileMetadata:null,error:r}}}async getPresignedUrl(e){try{let{fileId:r}=e;return{presignedUrl:(await this.httpClient.get(`/files/${r}/presignedurl`,{headers:{...this.generateAuthHeaders()}})).data,error:null}}catch(r){return{presignedUrl:null,error:r}}}async delete(e){try{let{fileId:r}=e;return await this.httpClient.delete(`/files/${r}`,{headers:{...this.generateAuthHeaders()}}),{error:null}}catch(r){return{error:r}}}setAccessToken(e){return this.accessToken=e,this}setAdminSecret(e){return this.adminSecret=e,this}generateUploadHeaders(e){let{bucketId:r,name:n,id:i}=e,s={};return r&&(s["x-nhost-bucket-id"]=r),i&&(s["x-nhost-file-id"]=i),n&&(s["x-nhost-file-name"]=n),s}generateAuthHeaders(){return!this.adminSecret&&!this.accessToken?null:this.adminSecret?{"x-hasura-admin-secret":this.adminSecret}:{Authorization:`Bearer ${this.accessToken}`}}};var wr=class{constructor({url:e}){this.url=e,this.api=new Sr({url:e})}async upload(e){let r=new FormData;r.append("file",e.file);let{fileMetadata:n,error:i}=await this.api.upload({...e,file:r});return i?{fileMetadata:null,error:i}:n?{fileMetadata:n,error:null}:{fileMetadata:null,error:new Error("Invalid file returned")}}getUrl(e){return this.getPublicUrl(e)}getPublicUrl(e){let{fileId:r}=e;return`${this.url}/files/${r}`}async getPresignedUrl(e){let{presignedUrl:r,error:n}=await this.api.getPresignedUrl(e);return n?{presignedUrl:null,error:n}:r?{presignedUrl:r,error:null}:{presignedUrl:null,error:new Error("Invalid file id")}}async delete(e){let{error:r}=await this.api.delete(e);return r?{error:r}:{error:null}}setAccessToken(e){return this.api.setAccessToken(e),this}setAdminSecret(e){return this.api.setAdminSecret(e),this}};var Uu=it(ni()),Pr=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Uu.default.create({baseURL:r})}async call(e,r,n){let i={...this.generateAccessTokenHeaders(),...n==null?void 0:n.headers},s;try{s=await this.instance.post(e,r,{...n,headers:i})}catch(a){if(a instanceof Error)return{res:null,error:a}}return s?{res:s,error:null}:{res:null,error:new Error("Unable to make post request to funtion")}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var tc=it(ni()),rc=it(ec()),qr=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=tc.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",u=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,rc.print)(e),variables:r},{...n,headers:i})).data,{data:c}=u;return u.errors?{data:null,error:u.errors}:typeof c!="object"||Array.isArray(c)||c===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:c,error:null}}catch(s){return s instanceof Error?{data:null,error:s}:(console.error(s),{data:null,error:new Error("Unable to get do GraphQL request")})}}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}};var Ur=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoSignIn:c,start:l=!0,Client:o}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new lr({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:u,autoSignIn:c,start:l,Client:o}),this.storage=new wr({url:`${e}/v1/storage`}),this.functions=new Pr({url:`${e}/v1/functions`}),this.graphql=new qr({url:`${e}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.client.onStart(()=>{this.auth.onAuthStateChanged((f,d)=>{f==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(f=>{this.storage.setAccessToken(f==null?void 0:f.accessToken),this.functions.setAccessToken(f==null?void 0:f.accessToken),this.graphql.setAccessToken(f==null?void 0:f.accessToken)})})}};var Ag=t=>new Ur(t);export{Ur as NhostClient,Pr as NhostFunctionsClient,qr as NhostGraphqlClient,Ag as createClient};
33
33
  /*! *****************************************************************************
34
34
  Copyright (c) Microsoft Corporation.
35
35