@nhost/nhost-js 1.0.11 → 1.1.2

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,12 +1,35 @@
1
- var $u=Object.create;var Rr=Object.defineProperty;var Wu=Object.getOwnPropertyDescriptor;var Ku=Object.getOwnPropertyNames;var Xu=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty;var Qu=t=>Rr(t,"__esModule",{value:!0});var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Zu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ku(e))!Yu.call(t,i)&&(r||i!=="default")&&Rr(t,i,{get:()=>e[i],enumerable:!(n=Wu(e,i))||n.enumerable});return t},Nt=(t,e)=>Zu(Qu(Rr(t!=null?$u(Xu(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Vr=m((im,us)=>{"use strict";us.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 $=m((sm,ds)=>{"use strict";var uf=Vr(),Ee=Object.prototype.toString;function Jr(t){return Array.isArray(t)}function Hr(t){return typeof t=="undefined"}function cf(t){return t!==null&&!Hr(t)&&t.constructor!==null&&!Hr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function cs(t){return Ee.call(t)==="[object ArrayBuffer]"}function ff(t){return Ee.call(t)==="[object FormData]"}function lf(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&cs(t.buffer),e}function df(t){return typeof t=="string"}function hf(t){return typeof t=="number"}function fs(t){return t!==null&&typeof t=="object"}function Yt(t){if(Ee.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function pf(t){return Ee.call(t)==="[object Date]"}function mf(t){return Ee.call(t)==="[object File]"}function vf(t){return Ee.call(t)==="[object Blob]"}function ls(t){return Ee.call(t)==="[object Function]"}function yf(t){return fs(t)&&ls(t.pipe)}function gf(t){return Ee.call(t)==="[object URLSearchParams]"}function Ef(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Sf(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function zr(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Jr(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 Gr(){var t={};function e(i,s){Yt(t[s])&&Yt(i)?t[s]=Gr(t[s],i):Yt(i)?t[s]=Gr({},i):Jr(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)zr(arguments[r],e);return t}function wf(t,e,r){return zr(e,function(i,s){r&&typeof i=="function"?t[s]=uf(i,r):t[s]=i}),t}function xf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}ds.exports={isArray:Jr,isArrayBuffer:cs,isBuffer:cf,isFormData:ff,isArrayBufferView:lf,isString:df,isNumber:hf,isObject:fs,isPlainObject:Yt,isUndefined:Hr,isDate:pf,isFile:mf,isBlob:vf,isFunction:ls,isStream:yf,isURLSearchParams:gf,isStandardBrowserEnv:Sf,forEach:zr,merge:Gr,extend:wf,trim:Ef,stripBOM:xf}});var $r=m((om,ps)=>{"use strict";var ze=$();function hs(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ps.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,f){c===null||typeof c=="undefined"||(ze.isArray(c)?f=f+"[]":c=[c],ze.forEach(c,function(l){ze.isDate(l)?l=l.toISOString():ze.isObject(l)&&(l=JSON.stringify(l)),s.push(hs(f)+"="+hs(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var vs=m((am,ms)=>{"use strict";var bf=$();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){bf.forEach(this.handlers,function(n){n!==null&&e(n)})};ms.exports=Qt});var gs=m((um,ys)=>{"use strict";var Tf=$();ys.exports=function(e,r){Tf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Wr=m((cm,Es)=>{"use strict";Es.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 Kr=m((fm,Ss)=>{"use strict";var Rf=Wr();Ss.exports=function(e,r,n,i,s){var o=new Error(e);return Rf(o,r,n,i,s)}});var xs=m((lm,ws)=>{"use strict";var Af=Kr();ws.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Af("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Ts=m((dm,bs)=>{"use strict";var Zt=$();bs.exports=Zt.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){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(o)&&c.push("domain="+o),a===!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 As=m((hm,Rs)=>{"use strict";Rs.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Cs=m((pm,Os)=>{"use strict";Os.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var _s=m((mm,Ps)=>{"use strict";var Of=As(),Cf=Cs();Ps.exports=function(e,r){return e&&!Of(r)?Cf(e,r):r}});var Is=m((vm,Ns)=>{"use strict";var Xr=$(),Pf=["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"];Ns.exports=function(e){var r={},n,i,s;return e&&Xr.forEach(e.split(`
2
- `),function(a){if(s=a.indexOf(":"),n=Xr.trim(a.substr(0,s)).toLowerCase(),i=Xr.trim(a.substr(s+1)),n){if(r[n]&&Pf.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 Ds=m((ym,qs)=>{"use strict";var ks=$();qs.exports=ks.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=ks.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var xt=m((gm,Us)=>{"use strict";function Yr(t){this.message=t}Yr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Yr.prototype.__CANCEL__=!0;Us.exports=Yr});var Zr=m((Em,Ms)=>{"use strict";var er=$(),_f=xs(),Nf=Ts(),If=$r(),kf=_s(),qf=Is(),Df=Ds(),Qr=Kr(),Uf=bt(),Mf=xt();Ms.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}er.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+d)}var h=kf(e.baseURL,e.url);u.open(e.method.toUpperCase(),If(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function g(){if(!!u){var p="getAllResponseHeaders"in u?qf(u.getAllResponseHeaders()):null,w=!a||a==="text"||a==="json"?u.responseText:u.response,y={data:w,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};_f(function(C){n(C),f()},function(C){i(C),f()},y),u=null}}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){!u||(i(Qr("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Qr("Network Error",e,null,u)),u=null},u.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||Uf.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Qr(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},er.isStandardBrowserEnv()){var E=(e.withCredentials||Df(h))&&e.xsrfCookieName?Nf.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&er.forEach(o,function(w,y){typeof s=="undefined"&&y.toLowerCase()==="content-type"?delete o[y]:u.setRequestHeader(y,w)}),er.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&a!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(p){!u||(i(!p||p&&p.type?new Mf("canceled"):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),u.send(s)})}});var bt=m((Sm,Bs)=>{"use strict";var F=$(),Ls=gs(),Lf=Wr(),jf={"Content-Type":"application/x-www-form-urlencoded"};function js(t,e){!F.isUndefined(t)&&F.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Bf(){var t;return typeof XMLHttpRequest!="undefined"?t=Zr():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Zr()),t}function Ff(t,e,r){if(F.isString(t))try{return(e||JSON.parse)(t),F.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:Bf(),transformRequest:[function(e,r){return Ls(r,"Accept"),Ls(r,"Content-Type"),F.isFormData(e)||F.isArrayBuffer(e)||F.isBuffer(e)||F.isStream(e)||F.isFile(e)||F.isBlob(e)?e:F.isArrayBufferView(e)?e.buffer:F.isURLSearchParams(e)?(js(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):F.isObject(e)||r&&r["Content-Type"]==="application/json"?(js(r,"application/json"),Ff(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&&F.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Lf(o,this,"E_JSON_PARSE"):o}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, */*"}}};F.forEach(["delete","get","head"],function(e){tr.headers[e]={}});F.forEach(["post","put","patch"],function(e){tr.headers[e]=F.merge(jf)});Bs.exports=tr});var Vs=m((wm,Fs)=>{"use strict";var Vf=$(),Hf=bt();Fs.exports=function(e,r,n){var i=this||Hf;return Vf.forEach(n,function(o){e=o.call(i,e,r)}),e}});var en=m((xm,Hs)=>{"use strict";Hs.exports=function(e){return!!(e&&e.__CANCEL__)}});var zs=m((bm,Js)=>{"use strict";var Gs=$(),tn=Vs(),Gf=en(),Jf=bt(),zf=xt();function rn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new zf("canceled")}Js.exports=function(e){rn(e),e.headers=e.headers||{},e.data=tn.call(e,e.data,e.headers,e.transformRequest),e.headers=Gs.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Gs.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Jf.adapter;return r(e).then(function(i){return rn(e),i.data=tn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Gf(i)||(rn(e),i&&i.response&&(i.response.data=tn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nn=m((Tm,$s)=>{"use strict";var ee=$();$s.exports=function(e,r){r=r||{};var n={};function i(u,l){return ee.isPlainObject(u)&&ee.isPlainObject(l)?ee.merge(u,l):ee.isPlainObject(l)?ee.merge({},l):ee.isArray(l)?l.slice():l}function s(u){if(ee.isUndefined(r[u])){if(!ee.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!ee.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(ee.isUndefined(r[u])){if(!ee.isUndefined(e[u]))return i(void 0,e[u])}else return i(void 0,r[u])}function c(u){if(u in r)return i(e[u],r[u]);if(u in e)return i(void 0,e[u])}var f={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return ee.forEach(Object.keys(e).concat(Object.keys(r)),function(l){var d=f[l]||s,h=d(l);ee.isUndefined(h)&&d!==c||(n[l]=h)}),n}});var sn=m((Rm,Ws)=>{Ws.exports={version:"0.25.0"}});var Ys=m((Am,Xs)=>{"use strict";var $f=sn().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 Ks={};on.transitional=function(e,r,n){function i(s,o){return"[Axios v"+$f+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!Ks[o]&&(Ks[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Wf(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Xs.exports={assertOptions:Wf,validators:on}});var no=m((Om,ro)=>{"use strict";var eo=$(),Kf=$r(),Qs=vs(),Zs=zs(),rr=nn(),to=Ys(),$e=to.validators;function Tt(t){this.defaults=t,this.interceptors={request:new Qs,response:new Qs}}Tt.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&&to.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 o=[];this.interceptors.response.forEach(function(h){o.push(h.fulfilled,h.rejected)});var a;if(!s){var c=[Zs,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(o),a=Promise.resolve(r);c.length;)a=a.then(c.shift(),c.shift());return a}for(var f=r;i.length;){var u=i.shift(),l=i.shift();try{f=u(f)}catch(d){l(d);break}}try{a=Zs(f)}catch(d){return Promise.reject(d)}for(;o.length;)a=a.then(o.shift(),o.shift());return a};Tt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=rr(this.defaults,e),Kf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};eo.forEach(["delete","get","head","options"],function(e){Tt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});eo.forEach(["post","put","patch"],function(e){Tt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});ro.exports=Tt});var so=m((Cm,io)=>{"use strict";var Xf=xt();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(o){r.subscribe(o),i=o}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Xf(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}};io.exports=We});var ao=m((Pm,oo)=>{"use strict";oo.exports=function(e){return function(n){return e.apply(null,n)}}});var co=m((_m,uo)=>{"use strict";var Yf=$();uo.exports=function(e){return Yf.isObject(e)&&e.isAxiosError===!0}});var ho=m((Nm,an)=>{"use strict";var fo=$(),Qf=Vr(),nr=no(),Zf=nn(),el=bt();function lo(t){var e=new nr(t),r=Qf(nr.prototype.request,e);return fo.extend(r,nr.prototype,e),fo.extend(r,e),r.create=function(i){return lo(Zf(t,i))},r}var fe=lo(el);fe.Axios=nr;fe.Cancel=xt();fe.CancelToken=so();fe.isCancel=en();fe.VERSION=sn().version;fe.all=function(e){return Promise.all(e)};fe.spread=ao();fe.isAxiosError=co();an.exports=fe;an.exports.default=fe});var mo=m((Im,po)=>{po.exports=ho()});var ln=m((gy,Po)=>{"use strict";Po.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 W=m((Ey,Io)=>{"use strict";var cl=ln(),ke=Object.prototype.toString;function pn(t){return ke.call(t)==="[object Array]"}function dn(t){return typeof t=="undefined"}function fl(t){return t!==null&&!dn(t)&&t.constructor!==null&&!dn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ll(t){return ke.call(t)==="[object ArrayBuffer]"}function dl(t){return typeof FormData!="undefined"&&t instanceof FormData}function hl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function pl(t){return typeof t=="string"}function ml(t){return typeof t=="number"}function _o(t){return t!==null&&typeof t=="object"}function cr(t){if(ke.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function vl(t){return ke.call(t)==="[object Date]"}function yl(t){return ke.call(t)==="[object File]"}function gl(t){return ke.call(t)==="[object Blob]"}function No(t){return ke.call(t)==="[object Function]"}function El(t){return _o(t)&&No(t.pipe)}function Sl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function wl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function xl(){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]),pn(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 hn(){var t={};function e(i,s){cr(t[s])&&cr(i)?t[s]=hn(t[s],i):cr(i)?t[s]=hn({},i):pn(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 bl(t,e,r){return mn(e,function(i,s){r&&typeof i=="function"?t[s]=cl(i,r):t[s]=i}),t}function Tl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Io.exports={isArray:pn,isArrayBuffer:ll,isBuffer:fl,isFormData:dl,isArrayBufferView:hl,isString:pl,isNumber:ml,isObject:_o,isPlainObject:cr,isUndefined:dn,isDate:vl,isFile:yl,isBlob:gl,isFunction:No,isStream:El,isURLSearchParams:Sl,isStandardBrowserEnv:xl,forEach:mn,merge:hn,extend:bl,trim:wl,stripBOM:Tl}});var vn=m((Sy,qo)=>{"use strict";var Ye=W();function ko(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}qo.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,f){c===null||typeof c=="undefined"||(Ye.isArray(c)?f=f+"[]":c=[c],Ye.forEach(c,function(l){Ye.isDate(l)?l=l.toISOString():Ye.isObject(l)&&(l=JSON.stringify(l)),s.push(ko(f)+"="+ko(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Uo=m((wy,Do)=>{"use strict";var Rl=W();function fr(){this.handlers=[]}fr.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};fr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};fr.prototype.forEach=function(e){Rl.forEach(this.handlers,function(n){n!==null&&e(n)})};Do.exports=fr});var Lo=m((xy,Mo)=>{"use strict";var Al=W();Mo.exports=function(e,r){Al.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var yn=m((by,jo)=>{"use strict";jo.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 gn=m((Ty,Bo)=>{"use strict";var Ol=yn();Bo.exports=function(e,r,n,i,s){var o=new Error(e);return Ol(o,r,n,i,s)}});var Vo=m((Ry,Fo)=>{"use strict";var Cl=gn();Fo.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Cl("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Go=m((Ay,Ho)=>{"use strict";var lr=W();Ho.exports=lr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){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(o)&&c.push("domain="+o),a===!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 zo=m((Oy,Jo)=>{"use strict";Jo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Wo=m((Cy,$o)=>{"use strict";$o.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Xo=m((Py,Ko)=>{"use strict";var Pl=zo(),_l=Wo();Ko.exports=function(e,r){return e&&!Pl(r)?_l(e,r):r}});var Qo=m((_y,Yo)=>{"use strict";var En=W(),Nl=["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"];Yo.exports=function(e){var r={},n,i,s;return e&&En.forEach(e.split(`
3
- `),function(a){if(s=a.indexOf(":"),n=En.trim(a.substr(0,s)).toLowerCase(),i=En.trim(a.substr(s+1)),n){if(r[n]&&Nl.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 ta=m((Ny,ea)=>{"use strict";var Zo=W();ea.exports=Zo.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=Zo.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var wn=m((Iy,ra)=>{"use strict";var dr=W(),Il=Vo(),kl=Go(),ql=vn(),Dl=Xo(),Ul=Qo(),Ml=ta(),Sn=gn();ra.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType;dr.isFormData(s)&&delete o["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",u=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(f+":"+u)}var l=Dl(e.baseURL,e.url);c.open(e.method.toUpperCase(),ql(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function d(){if(!!c){var g="getAllResponseHeaders"in c?Ul(c.getAllResponseHeaders()):null,E=!a||a==="text"||a==="json"?c.responseText:c.response,p={data:E,status:c.status,statusText:c.statusText,headers:g,config:e,request:c};Il(n,i,p),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(Sn("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(Sn("Network Error",e,null,c)),c=null},c.ontimeout=function(){var E="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),i(Sn(E,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},dr.isStandardBrowserEnv()){var h=(e.withCredentials||Ml(l))&&e.xsrfCookieName?kl.read(e.xsrfCookieName):void 0;h&&(o[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&dr.forEach(o,function(E,p){typeof s=="undefined"&&p.toLowerCase()==="content-type"?delete o[p]:c.setRequestHeader(p,E)}),dr.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&a!=="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 pr=m((ky,sa)=>{"use strict";var V=W(),na=Lo(),Ll=yn(),jl={"Content-Type":"application/x-www-form-urlencoded"};function ia(t,e){!V.isUndefined(t)&&V.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Bl(){var t;return typeof XMLHttpRequest!="undefined"?t=wn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=wn()),t}function Fl(t,e,r){if(V.isString(t))try{return(e||JSON.parse)(t),V.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var hr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Bl(),transformRequest:[function(e,r){return na(r,"Accept"),na(r,"Content-Type"),V.isFormData(e)||V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)?e:V.isArrayBufferView(e)?e.buffer:V.isURLSearchParams(e)?(ia(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):V.isObject(e)||r&&r["Content-Type"]==="application/json"?(ia(r,"application/json"),Fl(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&&V.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ll(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};hr.headers={common:{Accept:"application/json, text/plain, */*"}};V.forEach(["delete","get","head"],function(e){hr.headers[e]={}});V.forEach(["post","put","patch"],function(e){hr.headers[e]=V.merge(jl)});sa.exports=hr});var aa=m((qy,oa)=>{"use strict";var Vl=W(),Hl=pr();oa.exports=function(e,r,n){var i=this||Hl;return Vl.forEach(n,function(o){e=o.call(i,e,r)}),e}});var xn=m((Dy,ua)=>{"use strict";ua.exports=function(e){return!!(e&&e.__CANCEL__)}});var la=m((Uy,fa)=>{"use strict";var ca=W(),bn=aa(),Gl=xn(),Jl=pr();function Tn(t){t.cancelToken&&t.cancelToken.throwIfRequested()}fa.exports=function(e){Tn(e),e.headers=e.headers||{},e.data=bn.call(e,e.data,e.headers,e.transformRequest),e.headers=ca.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ca.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Jl.adapter;return r(e).then(function(i){return Tn(e),i.data=bn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Gl(i)||(Tn(e),i&&i.response&&(i.response.data=bn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Rn=m((My,da)=>{"use strict";var z=W();da.exports=function(e,r){r=r||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(d,h){return z.isPlainObject(d)&&z.isPlainObject(h)?z.merge(d,h):z.isPlainObject(h)?z.merge({},h):z.isArray(h)?h.slice():h}function f(d){z.isUndefined(r[d])?z.isUndefined(e[d])||(n[d]=c(void 0,e[d])):n[d]=c(e[d],r[d])}z.forEach(i,function(h){z.isUndefined(r[h])||(n[h]=c(void 0,r[h]))}),z.forEach(s,f),z.forEach(o,function(h){z.isUndefined(r[h])?z.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,r[h])}),z.forEach(a,function(h){h in r?n[h]=c(e[h],r[h]):h in e&&(n[h]=c(void 0,e[h]))});var u=i.concat(s).concat(o).concat(a),l=Object.keys(e).concat(Object.keys(r)).filter(function(h){return u.indexOf(h)===-1});return z.forEach(l,f),n}});var ha=m((Ly,zl)=>{zl.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 ga=m((jy,ya)=>{"use strict";var ma=ha(),An={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){An[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var pa={},$l=ma.version.split(".");function va(t,e){for(var r=e?e.split("."):$l,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}An.transitional=function(e,r,n){var i=r&&va(r);function s(o,a){return"[Axios v"+ma.version+"] Transitional option '"+o+"'"+a+(n?". "+n:"")}return function(o,a,c){if(e===!1)throw new Error(s(a," has been removed in "+r));return i&&!pa[a]&&(pa[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,a,c):!0}};function Wl(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}ya.exports={isOlderVersion:va,assertOptions:Wl,validators:An}});var Ta=m((By,ba)=>{"use strict";var wa=W(),Kl=vn(),Ea=Uo(),Sa=la(),mr=Rn(),xa=ga(),Qe=xa.validators;function At(t){this.defaults=t,this.interceptors={request:new Ea,response:new Ea}}At.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=mr(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&&xa.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 o;if(!i){var a=[Sa,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var c=e;n.length;){var f=n.shift(),u=n.shift();try{c=f(c)}catch(l){u(l);break}}try{o=Sa(c)}catch(l){return Promise.reject(l)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};At.prototype.getUri=function(e){return e=mr(this.defaults,e),Kl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};wa.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(r,n){return this.request(mr(n||{},{method:e,url:r,data:(n||{}).data}))}});wa.forEach(["post","put","patch"],function(e){At.prototype[e]=function(r,n,i){return this.request(mr(i||{},{method:e,url:r,data:n}))}});ba.exports=At});var Cn=m((Fy,Ra)=>{"use strict";function On(t){this.message=t}On.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};On.prototype.__CANCEL__=!0;Ra.exports=On});var Oa=m((Vy,Aa)=>{"use strict";var Xl=Cn();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 Xl(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}};Aa.exports=vr});var Pa=m((Hy,Ca)=>{"use strict";Ca.exports=function(e){return function(n){return e.apply(null,n)}}});var Na=m((Gy,_a)=>{"use strict";_a.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var qa=m((Jy,Pn)=>{"use strict";var Ia=W(),Yl=ln(),yr=Ta(),Ql=Rn(),Zl=pr();function ka(t){var e=new yr(t),r=Yl(yr.prototype.request,e);return Ia.extend(r,yr.prototype,e),Ia.extend(r,e),r}var oe=ka(Zl);oe.Axios=yr;oe.create=function(e){return ka(Ql(oe.defaults,e))};oe.Cancel=Cn();oe.CancelToken=Oa();oe.isCancel=xn();oe.all=function(e){return Promise.all(e)};oe.spread=Pa();oe.isAxiosError=Na();Pn.exports=oe;Pn.exports.default=oe});var Ua=m((zy,Da)=>{Da.exports=qa()});var In=m((tg,La)=>{"use strict";La.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=m((rg,Fa)=>{"use strict";var ed=In(),qe=Object.prototype.toString;function Dn(t){return qe.call(t)==="[object Array]"}function kn(t){return typeof t=="undefined"}function td(t){return t!==null&&!kn(t)&&t.constructor!==null&&!kn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rd(t){return qe.call(t)==="[object ArrayBuffer]"}function nd(t){return typeof FormData!="undefined"&&t instanceof FormData}function id(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function sd(t){return typeof t=="string"}function od(t){return typeof t=="number"}function ja(t){return t!==null&&typeof t=="object"}function gr(t){if(qe.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ad(t){return qe.call(t)==="[object Date]"}function ud(t){return qe.call(t)==="[object File]"}function cd(t){return qe.call(t)==="[object Blob]"}function Ba(t){return qe.call(t)==="[object Function]"}function fd(t){return ja(t)&&Ba(t.pipe)}function ld(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function dd(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function hd(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Un(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Dn(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 qn(){var t={};function e(i,s){gr(t[s])&&gr(i)?t[s]=qn(t[s],i):gr(i)?t[s]=qn({},i):Dn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Un(arguments[r],e);return t}function pd(t,e,r){return Un(e,function(i,s){r&&typeof i=="function"?t[s]=ed(i,r):t[s]=i}),t}function md(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Fa.exports={isArray:Dn,isArrayBuffer:rd,isBuffer:td,isFormData:nd,isArrayBufferView:id,isString:sd,isNumber:od,isObject:ja,isPlainObject:gr,isUndefined:kn,isDate:ad,isFile:ud,isBlob:cd,isFunction:Ba,isStream:fd,isURLSearchParams:ld,isStandardBrowserEnv:hd,forEach:Un,merge:qn,extend:pd,trim:dd,stripBOM:md}});var Mn=m((ng,Ha)=>{"use strict";var Ze=K();function Va(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ha.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,f){c===null||typeof c=="undefined"||(Ze.isArray(c)?f=f+"[]":c=[c],Ze.forEach(c,function(l){Ze.isDate(l)?l=l.toISOString():Ze.isObject(l)&&(l=JSON.stringify(l)),s.push(Va(f)+"="+Va(l))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ja=m((ig,Ga)=>{"use strict";var vd=K();function Er(){this.handlers=[]}Er.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};Er.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Er.prototype.forEach=function(e){vd.forEach(this.handlers,function(n){n!==null&&e(n)})};Ga.exports=Er});var $a=m((sg,za)=>{"use strict";var yd=K();za.exports=function(e,r){yd.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Ln=m((og,Wa)=>{"use strict";Wa.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=m((ag,Ka)=>{"use strict";var gd=Ln();Ka.exports=function(e,r,n,i,s){var o=new Error(e);return gd(o,r,n,i,s)}});var Ya=m((ug,Xa)=>{"use strict";var Ed=jn();Xa.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ed("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Za=m((cg,Qa)=>{"use strict";var Sr=K();Qa.exports=Sr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var c=[];c.push(r+"="+encodeURIComponent(n)),Sr.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),Sr.isString(s)&&c.push("path="+s),Sr.isString(o)&&c.push("domain="+o),a===!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 tu=m((fg,eu)=>{"use strict";eu.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var nu=m((lg,ru)=>{"use strict";ru.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var su=m((dg,iu)=>{"use strict";var Sd=tu(),wd=nu();iu.exports=function(e,r){return e&&!Sd(r)?wd(e,r):r}});var au=m((hg,ou)=>{"use strict";var Bn=K(),xd=["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"];ou.exports=function(e){var r={},n,i,s;return e&&Bn.forEach(e.split(`
4
- `),function(a){if(s=a.indexOf(":"),n=Bn.trim(a.substr(0,s)).toLowerCase(),i=Bn.trim(a.substr(s+1)),n){if(r[n]&&xd.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 fu=m((pg,cu)=>{"use strict";var uu=K();cu.exports=uu.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){var a=uu.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Ot=m((mg,lu)=>{"use strict";function Fn(t){this.message=t}Fn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Fn.prototype.__CANCEL__=!0;lu.exports=Fn});var Hn=m((vg,du)=>{"use strict";var wr=K(),bd=Ya(),Td=Za(),Rd=Mn(),Ad=su(),Od=au(),Cd=fu(),Vn=jn(),Pd=Ct(),_d=Ot();du.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,c;function f(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}wr.isFormData(s)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+d)}var h=Ad(e.baseURL,e.url);u.open(e.method.toUpperCase(),Rd(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function g(){if(!!u){var p="getAllResponseHeaders"in u?Od(u.getAllResponseHeaders()):null,w=!a||a==="text"||a==="json"?u.responseText:u.response,y={data:w,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};bd(function(C){n(C),f()},function(C){i(C),f()},y),u=null}}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){!u||(i(Vn("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Vn("Network Error",e,null,u)),u=null},u.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||Pd.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),i(Vn(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},wr.isStandardBrowserEnv()){var E=(e.withCredentials||Cd(h))&&e.xsrfCookieName?Td.read(e.xsrfCookieName):void 0;E&&(o[e.xsrfHeaderName]=E)}"setRequestHeader"in u&&wr.forEach(o,function(w,y){typeof s=="undefined"&&y.toLowerCase()==="content-type"?delete o[y]:u.setRequestHeader(y,w)}),wr.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&a!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(p){!u||(i(!p||p&&p.type?new _d("canceled"):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),u.send(s)})}});var Ct=m((yg,mu)=>{"use strict";var H=K(),hu=$a(),Nd=Ln(),Id={"Content-Type":"application/x-www-form-urlencoded"};function pu(t,e){!H.isUndefined(t)&&H.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function kd(){var t;return typeof XMLHttpRequest!="undefined"?t=Hn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Hn()),t}function qd(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 xr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:kd(),transformRequest:[function(e,r){return hu(r,"Accept"),hu(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)?(pu(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):H.isObject(e)||r&&r["Content-Type"]==="application/json"?(pu(r,"application/json"),qd(e)):e}],transformResponse:[function(e){var r=this.transitional||xr.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(o){if(s)throw o.name==="SyntaxError"?Nd(o,this,"E_JSON_PARSE"):o}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){xr.headers[e]={}});H.forEach(["post","put","patch"],function(e){xr.headers[e]=H.merge(Id)});mu.exports=xr});var yu=m((gg,vu)=>{"use strict";var Dd=K(),Ud=Ct();vu.exports=function(e,r,n){var i=this||Ud;return Dd.forEach(n,function(o){e=o.call(i,e,r)}),e}});var Gn=m((Eg,gu)=>{"use strict";gu.exports=function(e){return!!(e&&e.__CANCEL__)}});var wu=m((Sg,Su)=>{"use strict";var Eu=K(),Jn=yu(),Md=Gn(),Ld=Ct(),jd=Ot();function zn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new jd("canceled")}Su.exports=function(e){zn(e),e.headers=e.headers||{},e.data=Jn.call(e,e.data,e.headers,e.transformRequest),e.headers=Eu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Eu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Ld.adapter;return r(e).then(function(i){return zn(e),i.data=Jn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Md(i)||(zn(e),i&&i.response&&(i.response.data=Jn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var $n=m((wg,xu)=>{"use strict";var te=K();xu.exports=function(e,r){r=r||{};var n={};function i(u,l){return te.isPlainObject(u)&&te.isPlainObject(l)?te.merge(u,l):te.isPlainObject(l)?te.merge({},l):te.isArray(l)?l.slice():l}function s(u){if(te.isUndefined(r[u])){if(!te.isUndefined(e[u]))return i(void 0,e[u])}else return i(e[u],r[u])}function o(u){if(!te.isUndefined(r[u]))return i(void 0,r[u])}function a(u){if(te.isUndefined(r[u])){if(!te.isUndefined(e[u]))return i(void 0,e[u])}else return i(void 0,r[u])}function c(u){if(u in r)return i(e[u],r[u]);if(u in e)return i(void 0,e[u])}var f={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return te.forEach(Object.keys(e).concat(Object.keys(r)),function(l){var d=f[l]||s,h=d(l);te.isUndefined(h)&&d!==c||(n[l]=h)}),n}});var Wn=m((xg,bu)=>{bu.exports={version:"0.23.0"}});var Au=m((bg,Ru)=>{"use strict";var Bd=Wn().version,Kn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Kn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Tu={};Kn.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Bd+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!Tu[o]&&(Tu[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Fd(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],o=e[s];if(o){var a=t[s],c=a===void 0||o(a,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}Ru.exports={assertOptions:Fd,validators:Kn}});var Iu=m((Tg,Nu)=>{"use strict";var Pu=K(),Vd=Mn(),Ou=Ja(),Cu=wu(),br=$n(),_u=Au(),et=_u.validators;function Pt(t){this.defaults=t,this.interceptors={request:new Ou,response:new Ou}}Pt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=br(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&&_u.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 o;if(!i){var a=[Cu,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var c=e;n.length;){var f=n.shift(),u=n.shift();try{c=f(c)}catch(l){u(l);break}}try{o=Cu(c)}catch(l){return Promise.reject(l)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Pt.prototype.getUri=function(e){return e=br(this.defaults,e),Vd(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Pu.forEach(["delete","get","head","options"],function(e){Pt.prototype[e]=function(r,n){return this.request(br(n||{},{method:e,url:r,data:(n||{}).data}))}});Pu.forEach(["post","put","patch"],function(e){Pt.prototype[e]=function(r,n,i){return this.request(br(i||{},{method:e,url:r,data:n}))}});Nu.exports=Pt});var qu=m((Rg,ku)=>{"use strict";var Hd=Ot();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(o){r.subscribe(o),i=o}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new Hd(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}};ku.exports=tt});var Uu=m((Ag,Du)=>{"use strict";Du.exports=function(e){return function(n){return e.apply(null,n)}}});var Lu=m((Og,Mu)=>{"use strict";Mu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Fu=m((Cg,Xn)=>{"use strict";var ju=K(),Gd=In(),Tr=Iu(),Jd=$n(),zd=Ct();function Bu(t){var e=new Tr(t),r=Gd(Tr.prototype.request,e);return ju.extend(r,Tr.prototype,e),ju.extend(r,e),r.create=function(i){return Bu(Jd(t,i))},r}var le=Bu(zd);le.Axios=Tr;le.Cancel=Ot();le.CancelToken=qu();le.isCancel=Gn();le.VERSION=Wn().version;le.all=function(e){return Promise.all(e)};le.spread=Uu();le.isAxiosError=Lu();Xn.exports=le;Xn.exports.default=le});var Yn=m((Pg,Vu)=>{Vu.exports=Fu()});var v=function(){return v=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},v.apply(this,arguments)};function Ue(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 T(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 R(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function I(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 P;(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"})(P||(P={}));var ve;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(ve||(ve={}));var rt=P.Start,Me=P.Stop,Le=P.Raise,Se=P.Send,It=P.Cancel,ti=P.NullEvent,kt=P.Assign,Yd=P.After,Qd=P.DoneState,qt=P.Log,ri=P.Init,nt=P.Invoke,Zd=P.ErrorExecution,Ar=P.ErrorPlatform,Or=P.ErrorCustom,it=P.Update,ni=P.Choose,ii=P.Pure;var Dt=".",Cr={},Ut="xstate.guard",si="";var D=!0;var Mt;function ot(t,e,r){r===void 0&&(r=Dt);var n=je(t,r),i=je(e,r);return A(i)?A(n)?i===n:!1:A(n)?n in i:Object.keys(n).every(function(s){return s in i?ot(n[s],i[s]):!1})}function Lt(t){try{return A(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 jt(t,e){try{return de(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function ec(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function je(t,e){if(ec(t))return t.value;if(de(t))return st(t);if(typeof t!="string")return t;var r=jt(t,e);return st(r)}function st(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 Be(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 Pr(t,e,r){var n,i,s={};try{for(var o=T(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,f=t[c];!r(f)||(s[c]=e(f,c,t))}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}var oi=function(t){return function(e){var r,n,i=e;try{for(var s=T(t),o=s.next();!o.done;o=s.next()){var a=o.value;i=i[a]}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function ai(t,e){return function(r){var n,i,s=r;try{for(var o=T(t),a=o.next();!a.done;a=o.next()){var c=a.value;s=s[e][c]}}catch(f){n={error:f}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}}function at(t){if(!t)return[[]];if(A(t))return[[t]];var e=q(Object.keys(t).map(function(r){var n=t[r];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[r]]:at(t[r]).map(function(i){return[r].concat(i)})}));return e}function q(t){var e;return(e=[]).concat.apply(e,I([],R(t),!1))}function ui(t){return de(t)?t:[t]}function Z(t){return t===void 0?[]:ui(t)}function we(t,e,r){var n,i;if(_(t))return t(e,r.data);var s={};try{for(var o=T(Object.keys(t)),a=o.next();!a.done;a=o.next()){var c=a.value,f=t[c];_(f)?s[c]=f(e,r.data):s[c]=f}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return s}function ci(t){return/^(done|error)\./.test(t)}function _r(t){return!!(t instanceof Promise||t!==null&&(_(t)||typeof t=="object")&&_(t.then))}function fi(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function Bt(t,e){var r,n,i=R([[],[]],2),s=i[0],o=i[1];try{for(var a=T(t),c=a.next();!c.done;c=a.next()){var f=c.value;e(f)?s.push(f):o.push(f)}}catch(u){r={error:u}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return[s,o]}function li(t,e){return Be(t.states,function(r,n){if(!!r){var i=(A(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:li(r,i)}}})}function di(t,e){return{current:e,states:li(t,e)}}function Nr(t,e,r,n){D||M(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,o){var a,c,f=o.assignment,u={state:n,action:o,_event:e},l={};if(_(f))l=f(s,e.data,u);else try{for(var d=T(Object.keys(f)),h=d.next();!h.done;h=d.next()){var g=h.value,E=f[g];l[g]=_(E)?E(s,e.data,u):E}}catch(p){a={error:p}}finally{try{h&&!h.done&&(c=d.return)&&c.call(d)}finally{if(a)throw a.error}}return Object.assign({},s,l)},t);return i}var M=function(){};D||(M=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 de(t){return Array.isArray(t)}function _(t){return typeof t=="function"}function A(t){return typeof t=="string"}function Ft(t,e){if(!!t)return A(t)?{type:Ut,name:t,predicate:e?e[t]:void 0}:_(t)?{type:Ut,name:t.name,predicate:t}:t}function hi(t){try{return"subscribe"in t&&_(t.subscribe)}catch{return!1}}var ae=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),oh=(Mt={},Mt[ae]=function(){return this},Mt[Symbol.observable]=function(){return this},Mt);function ue(t){return!!t&&"__xstatenode"in t}function pi(t){return!!t&&typeof t.send=="function"}function ut(t,e){return A(t)||typeof t=="number"?v({type:t},e):t}function j(t,e){if(!A(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=ut(t);return v({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function xe(t,e){var r=ui(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||ue(n)?{target:n,event:t}:v(v({},n),{event:t})});return r}function mi(t){if(!(t===void 0||t===si))return Z(t)}function vi(t,e,r){if(!D){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 Vt(t,e,r,n,i){var s=t.options.guards,o={state:i,cond:e,_event:n};if(e.type===Ut)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,o);var a=s==null?void 0:s[e.type];if(!a)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return a(r,n.data,o)}function Ht(t){return typeof t=="string"?{type:t}:t}function ct(t,e,r){if(typeof t=="object")return t;var n=function(){};return{next:t,error:e||n,complete:r||n}}function ft(t,e){return"".concat(t,":invocation[").concat(e,"]")}var be=j({type:ri});function Gt(t,e){return e&&e[t]||void 0}function Fe(t,e){var r;if(A(t)||typeof t=="number"){var n=Gt(t,e);_(n)?r={type:t,exec:n}:n?r=n:r={type:t,exec:void 0}}else if(_(t))r={type:t.name||t.toString(),exec:t};else{var n=Gt(t.type,e);if(_(n))r=v(v({},t),{exec:n});else if(n){var i=n.type||t.type;r=v(v(v({},n),t),{type:i})}else r=t}return r}var lt=function(t,e){if(!t)return[];var r=de(t)?t:[t];return r.map(function(n){return Fe(n,e)})};function zt(t){var e=Fe(t);return v(v({id:A(t)?t:e.id},e),{type:e.type})}function yi(t){return A(t)?{type:Le,event:t}:dt(t,{to:ve.Internal})}function tc(t){return{type:Le,_event:j(t.event)}}function dt(t,e){return{to:e?e.to:void 0,type:Se,event:_(t)?t:ut(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:_(t)?t.name:Lt(t)}}function rc(t,e,r,n){var i={_event:r},s=j(_(t.event)?t.event(e,r.data,i):t.event),o;if(A(t.delay)){var a=n&&n[t.delay];o=_(a)?a(e,r.data,i):a}else o=_(t.delay)?t.delay(e,r.data,i):t.delay;var c=_(t.to)?t.to(e,r.data,i):t.to;return v(v({},t),{to:c,_event:s,event:s.data,delay:o})}var nc=function(t,e,r){return v(v({},t),{value:A(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},gi=function(t){return{type:It,sendId:t}};function Ei(t){var e=zt(t);return{type:P.Start,activity:e,exec:void 0}}function Si(t){var e=_(t)?t:zt(t);return{type:P.Stop,activity:e,exec:void 0}}function ic(t,e,r){var n=_(t.activity)?t.activity(e,r.data):t.activity,i=typeof n=="string"?{id:n}:n,s={type:P.Stop,activity:i};return s}var wi=function(t){return{type:kt,assignment:t}};function xi(t,e){var r=e?"#".concat(e):"";return"".concat(P.After,"(").concat(t,")").concat(r)}function ht(t,e){var r="".concat(P.DoneState,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Te(t,e){var r="".concat(P.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Re(t,e){var r="".concat(P.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Jt(t,e,r,n,i,s){s===void 0&&(s=!1);var o=R(s?[[],i]:Bt(i,function(d){return d.type===kt}),2),a=o[0],c=o[1],f=a.length?Nr(r,n,a,e):r,u=s?[r]:void 0,l=q(c.map(function(d){var h;switch(d.type){case Le:return tc(d);case Se:var g=rc(d,f,n,t.options.delays);return D||M(!A(d.delay)||typeof g.delay=="number","No delay reference for delay expression '".concat(d.delay,"' was found on machine '").concat(t.id,"'")),g;case qt:return nc(d,f,n);case ni:{var E=d,p=(h=E.conds.find(function(U){var B=Ft(U.cond,t.options.guards);return!B||Vt(t,B,f,n,e)}))===null||h===void 0?void 0:h.actions;if(!p)return[];var w=R(Jt(t,e,f,n,lt(Z(p),t.options.actions),s),2),y=w[0],x=w[1];return f=x,u==null||u.push(f),y}case ii:{var p=d.get(f,n.data);if(!p)return[];var C=R(Jt(t,e,f,n,lt(Z(p),t.options.actions),s),2),N=C[0],L=C[1];return f=L,u==null||u.push(f),N}case Me:return ic(d,f,n);case kt:{f=Nr(f,n,[d],e),u==null||u.push(f);break}default:var b=Fe(d,t.options.actions),S=b.exec;if(S&&u){var O=u.length-1;b=v(v({},b),{exec:function(U){for(var B=[],X=1;X<arguments.length;X++)B[X-1]=arguments[X];S.apply(void 0,I([u[O]],R(B),!1))}})}return b}}).filter(function(d){return!!d}));return[l,f]}var bi=[],Ae=function(t,e){bi.push(t);var r=e(t);return bi.pop(),r};function Ti(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[ae]=function(){return this},e}function Ri(t,e,r,n){var i,s=Ht(t.src),o=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],a=t.data?we(t.data,r,n):void 0,c=o?Ai(o,t.id,a):Ti(t.id);return c.meta=t,c}function Ai(t,e,r){var n=Ti(e);if(n.deferred=!0,ue(t)){var i=n.state=Ae(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function sc(t){try{return typeof t.send=="function"}catch{return!1}}function Oi(t){return sc(t)&&"id"in t}function Ci(t){var e;return v((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[ae]=function(){return this},e),t)}var pt=function(t){return t.type==="atomic"||t.type==="final"};function Oe(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function kr(t){var e=[t];return pt(t)?e:e.concat(q(Oe(t).map(kr)))}function Ce(t,e){var r,n,i,s,o,a,c,f,u=new Set(t),l=Ir(u),d=new Set(e);try{for(var h=T(d),g=h.next();!g.done;g=h.next())for(var E=g.value,p=E.parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(O){r={error:O}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}var w=Ir(d);try{for(var y=T(d),x=y.next();!x.done;x=y.next()){var E=x.value;if(E.type==="compound"&&(!w.get(E)||!w.get(E).length))l.get(E)?l.get(E).forEach(function(U){return d.add(U)}):E.initialStateNodes.forEach(function(U){return d.add(U)});else if(E.type==="parallel")try{for(var C=(o=void 0,T(Oe(E))),N=C.next();!N.done;N=C.next()){var L=N.value;L.type!=="history"&&(d.has(L)||(d.add(L),l.get(L)?l.get(L).forEach(function(U){return d.add(U)}):L.initialStateNodes.forEach(function(U){return d.add(U)})))}}catch(U){o={error:U}}finally{try{N&&!N.done&&(a=C.return)&&a.call(C)}finally{if(o)throw o.error}}}}catch(O){i={error:O}}finally{try{x&&!x.done&&(s=y.return)&&s.call(y)}finally{if(i)throw i.error}}try{for(var b=T(d),S=b.next();!S.done;S=b.next())for(var E=S.value,p=E.parent;p&&!d.has(p);)d.add(p),p=p.parent}catch(O){c={error:O}}finally{try{S&&!S.done&&(f=b.return)&&f.call(b)}finally{if(c)throw c.error}}return d}function Pi(t,e){var r=e.get(t);if(!r)return{};if(t.type==="compound"){var n=r[0];if(n){if(pt(n))return n.key}else return{}}var i={};return r.forEach(function(s){i[s.key]=Pi(s,e)}),i}function Ir(t){var e,r,n=new Map;try{for(var i=T(t),s=i.next();!s.done;s=i.next()){var o=s.value;n.has(o)||n.set(o,[]),o.parent&&(n.has(o.parent)||n.set(o.parent,[]),n.get(o.parent).push(o))}}catch(a){e={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function _i(t,e){var r=Ce([t],e);return Pi(t,Ir(r))}function mt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Ni(t){return I([],R(new Set(q(I([],R(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Pe(t,e){return e.type==="compound"?Oe(e).some(function(r){return r.type==="final"&&mt(t,r)}):e.type==="parallel"?Oe(e).every(function(r){return Pe(t,r)}):!1}function Ii(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function qr(t){return new Set(q(t.map(function(e){return e.tags})))}function Dr(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(A(t)||A(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return Dr(t[i],e[i])})}function ki(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function qi(t,e){var r=t.exec,n=v(v({},t),{exec:r!==void 0?function(){return r(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return n}var ne=function(){function t(e){var r=this,n;this.actions=[],this.activities=Cr,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||Cr,this.meta=Ii(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 Ni(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="."),A(e))return[e];var i=Object.keys(e);return i.concat.apply(i,I([],R(i.map(function(s){return n.toStrings(e[s],r).map(function(o){return s+r+o})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=Ue(e,["configuration","transitions","tags","machine"]);return v(v({},n),{tags:Array.from(r)})},t.prototype.matches=function(e){return ot(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var r;D&&M(!!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 oc={deferEvents:!1},Ur=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=v(v({},oc),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 Mr=new Map,ac=0,vt={bookId:function(){return"x:".concat(ac++)},register:function(t,e){return Mr.set(t,e),t},get:function(t){return Mr.get(t)},free:function(t){Mr.delete(t)}};function $t(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;D||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 uc(){var t=$t();if(t&&"__xstate__"in t)return t.__xstate__}function Di(t){if(!!$t()){var e=uc();e&&e.register(t)}}function Ui(t,e){e===void 0&&(e={});var r=t.initialState,n=new Set,i=[],s=!1,o=function(){if(!s){for(s=!0;i.length>0;){var f=i.shift();r=t.transition(r,f,c),n.forEach(function(u){return u.next(r)})}s=!1}},a=Ci({id:e.id,send:function(f){i.push(f),o()},getSnapshot:function(){return r},subscribe:function(f,u,l){var d=ct(f,u,l);return n.add(d),d.next(r),{unsubscribe:function(){n.delete(d)}}}}),c={parent:e.parent,self:a,id:e.id||"anonymous",observers:n};return r=t.start?t.start(c):r,a}var cc={sync:!1,autoForward:!1},G;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(G||(G={}));var Mi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.scheduler=new Ur,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=G.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(u,l){if(de(u))return n.batch(u),n.state;var d=j(ut(u,l));if(n.status===G.Stopped)return D||M(!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.
5
- Event: `).concat(JSON.stringify(d.data))),n.state;if(n.status!==G.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.
6
- 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(u,l){var d=n.parent&&(l===ve.Parent||n.parent.id===l),h=d?n.parent:A(l)?n.children.get(l)||vt.get(l):pi(l)?l:void 0;if(!h){if(!d)throw new Error("Unable to send event to child '".concat(l,"' from service '").concat(n.id,"'."));D||M(!1,"Service '".concat(n.id,"' has no parent: unable to send event ").concat(u.type));return}"machine"in h?h.send(v(v({},u),{name:u.name===Or?"".concat(Re(n.id)):u.name,origin:n.sessionId})):h.send(u.data)};var i=v(v({},t.defaultOptions),r),s=i.clock,o=i.logger,a=i.parent,c=i.id,f=c!==void 0?c:e.id;this.id=f,this.logger=o,this.clock=s,this.parent=a,this.options=i,this.scheduler=new Ur({deferEvents:this.options.deferEvents}),this.sessionId=vt.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Ae(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return D||M(this.status!==G.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=T(e.actions),o=s.next();!o.done;o=s.next()){var a=o.value;this.exec(a,e,r)}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},t.prototype.update=function(e,r){var n,i,s,o,a,c,f,u,l=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(O){l.state.children[O.id]=O}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var d=T(this.eventListeners),h=d.next();!h.done;h=d.next()){var g=h.value;g(e.event)}}catch(O){n={error:O}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}try{for(var E=T(this.listeners),p=E.next();!p.done;p=E.next()){var g=p.value;g(e,e.event)}}catch(O){s={error:O}}finally{try{p&&!p.done&&(o=E.return)&&o.call(E)}finally{if(s)throw s.error}}try{for(var w=T(this.contextListeners),y=w.next();!y.done;y=w.next()){var x=y.value;x(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(O){a={error:O}}finally{try{y&&!y.done&&(c=w.return)&&c.call(w)}finally{if(a)throw a.error}}var C=Pe(e.configuration||[],this.machine);if(this.state.configuration&&C){var N=e.configuration.find(function(O){return O.type==="final"&&O.parent===l.machine}),L=N&&N.doneData?we(N.doneData,e.context,r):void 0;try{for(var b=T(this.doneListeners),S=b.next();!S.done;S=b.next()){var g=S.value;g(Te(this.id,L))}}catch(O){f={error:O}}finally{try{S&&!S.done&&(u=b.return)&&u.call(b)}finally{if(f)throw f.error}}this.stop()}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===G.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,o=n;return typeof e=="function"?s=e:(s=e.next.bind(e),o=e.complete.bind(e)),this.listeners.add(s),this.status===G.Running&&s(this.state),o&&this.onDone(o),{unsubscribe:function(){s&&i.listeners.delete(s),o&&i.doneListeners.delete(o)}}},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===G.Running)return this;this.machine._init(),vt.register(this.sessionId,this),this.initialized=!0,this.status=G.Running;var n=e===void 0?this.initialState:Ae(this,function(){return ki(e)?r.machine.resolveState(e):r.machine.resolveState(ne.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,o,a,c,f,u,l=this;try{for(var d=T(this.listeners),h=d.next();!h.done;h=d.next()){var g=h.value;this.listeners.delete(g)}}catch(S){e={error:S}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}try{for(var E=T(this.stopListeners),p=E.next();!p.done;p=E.next()){var g=p.value;g(),this.stopListeners.delete(g)}}catch(S){n={error:S}}finally{try{p&&!p.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}try{for(var w=T(this.contextListeners),y=w.next();!y.done;y=w.next()){var g=y.value;this.contextListeners.delete(g)}}catch(S){s={error:S}}finally{try{y&&!y.done&&(o=w.return)&&o.call(w)}finally{if(s)throw s.error}}try{for(var x=T(this.doneListeners),C=x.next();!C.done;C=x.next()){var g=C.value;this.doneListeners.delete(g)}}catch(S){a={error:S}}finally{try{C&&!C.done&&(c=x.return)&&c.call(x)}finally{if(a)throw a.error}}if(!this.initialized)return this;I([],R(this.state.configuration),!1).sort(function(S,O){return O.order-S.order}).forEach(function(S){var O,U;try{for(var B=T(S.definition.exit),X=B.next();!X.done;X=B.next()){var me=X.value;l.exec(me,l.state)}}catch(_t){O={error:_t}}finally{try{X&&!X.done&&(U=B.return)&&U.call(B)}finally{if(O)throw O.error}}}),this.children.forEach(function(S){_(S.stop)&&S.stop()});try{for(var N=T(Object.keys(this.delayedEventsMap)),L=N.next();!L.done;L=N.next()){var b=L.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(S){f={error:S}}finally{try{L&&!L.done&&(u=N.return)&&u.call(N)}finally{if(f)throw f.error}}return this.scheduler.clear(),this.initialized=!1,this.status=G.Stopped,vt.free(this.sessionId),this},t.prototype.batch=function(e){var r=this;if(this.status===G.NotStarted&&this.options.deferEvents)D||M(!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.
7
- Event: `).concat(JSON.stringify(event)));else if(this.status!==G.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,o=!1,a=[],c=function(d){var h=j(d);r.forward(h),s=Ae(r,function(){return r.machine.transition(s,h)}),a.push.apply(a,I([],R(s.actions.map(function(g){return qi(g,s)})),!1)),o=o||!!s.changed};try{for(var f=T(e),u=f.next();!u.done;u=f.next()){var l=u.value;c(l)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}s.changed=o,s.actions=a,r.update(s,j(e[e.length-1]))})},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype.nextState=function(e){var r=this,n=j(e);if(n.name.indexOf(Ar)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(Ar)===0}))throw n.data.data;var i=Ae(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=T(this.forwardTo),s=i.next();!s.done;s=i.next()){var o=s.value,a=this.children.get(o);if(!a)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));a.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,o=e.exec||Gt(e.type,n),a=_(o)?o:o?o.exec:e.exec;if(a)try{return a(i,s.data,{action:e,state:this.state,_event:s})}catch(C){throw this.parent&&this.parent.send({type:"xstate.error",data:C}),C}switch(e.type){case Se: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 It:this.cancel(e.sendId);break;case rt:{if(this.status!==G.Running)return;var f=e.activity;if(!this.state.activities[f.id||f.type])break;if(f.type===P.Invoke){var u=Ht(f.src),l=this.machine.options.services?this.machine.options.services[u.type]:void 0,d=f.id,h=f.data;D||M(!("forward"in f),"`forward` property is deprecated (found in invocation of '".concat(f.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var g="autoForward"in f?f.autoForward:!!f.forward;if(!l){D||M(!1,"No service found for invocation '".concat(f.src,"' in machine '").concat(this.machine.id,"'."));return}var E=h?we(h,i,s):void 0;if(typeof l=="string")return;var p=_(l)?l(i,s.data,{data:E,src:u,meta:f.meta}):l;if(!p)return;var w=void 0;ue(p)&&(p=E?p.withContext(E):p,w={autoForward:g}),this.spawn(p,d,w)}else this.spawnActivity(f);break}case Me:{this.stopChild(e.activity.id);break}case qt:var y=e.label,x=e.value;y?this.logger(y,x):this.logger(x);break;default:D||M(!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),_(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(_r(e))return this.spawnPromise(Promise.resolve(e),r);if(_(e))return this.spawnCallback(e,r);if(Oi(e))return this.spawnActor(e,r);if(hi(e))return this.spawnObservable(e,r);if(ue(e))return this.spawnMachine(e,v(v({},n),{id:r}));if(fi(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,v(v({},this.options),{parent:this,id:r.id||e.id})),s=v(v({},cc),r);s.sync&&i.onTransition(function(a){n.send(it,{state:a,id:i.id})});var o=i;return this.children.set(i.id,o),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(a){n.removeChild(i.id),n.send(j(a,{origin:i.id}))}).start(),o},t.prototype.spawnBehavior=function(e,r){var n=Ui(e,{id:r,parent:this});return this.children.set(r,n),n},t.prototype.spawnPromise=function(e,r){var n,i=this,s=!1,o;e.then(function(c){s||(o=c,i.removeChild(r),i.send(j(Te(r,c),{origin:r})))},function(c){if(!s){i.removeChild(r);var f=Re(r,c);try{i.send(j(f,{origin:r}))}catch(u){vi(c,u,r),i.devTools&&i.devTools.send(f,i.state),i.machine.strict&&i.stop()}}});var a=(n={id:r,send:function(){},subscribe:function(c,f,u){var l=ct(c,f,u),d=!1;return e.then(function(h){d||(l.next(h),!d&&l.complete())},function(h){d||l.error(h)}),{unsubscribe:function(){return d=!0}}},stop:function(){s=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return o}},n[ae]=function(){return this},n);return this.children.set(r,a),a},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,o=new Set,a=new Set,c,f=function(d){c=d,a.forEach(function(h){return h(d)}),!s&&i.send(j(d,{origin:r}))},u;try{u=e(f,function(d){o.add(d)})}catch(d){this.send(Re(r,d))}if(_r(u))return this.spawnPromise(u,r);var l=(n={id:r,send:function(d){return o.forEach(function(h){return h(d)})},subscribe:function(d){var h=ct(d);return a.add(h.next),{unsubscribe:function(){a.delete(h.next)}}},stop:function(){s=!0,_(u)&&u()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},n[ae]=function(){return this},n);return this.children.set(r,l),l},t.prototype.spawnObservable=function(e,r){var n,i=this,s,o=e.subscribe(function(c){s=c,i.send(j(c,{origin:r}))},function(c){i.removeChild(r),i.send(j(Re(r,c),{origin:r}))},function(){i.removeChild(r),i.send(j(Te(r),{origin:r}))}),a=(n={id:r,send:function(){},subscribe:function(c,f,u){return e.subscribe(c,f,u)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:r}}},n[ae]=function(){return this},n);return this.children.set(r,a),a},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){D||M(!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[ae]=function(){return this},n))},t.prototype.attachDev=function(){var e=$t();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(v(v({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:v({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Di(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[ae]=function(){return this},t.prototype.getSnapshot=function(){return this.status===G.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=he,t}();function he(t,e){var r=new Mi(t,e);return r}function fc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function yt(t){return v(v({type:nt},t),{toJSON:function(){t.onDone,t.onError;var e=Ue(t,["onDone","onError"]);return v(v({},e),{type:nt,src:fc(t.src)})}})}var Ge="",Lr="#",gt="*",Ve={},He=function(t){return t[0]===Lr},lc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},dc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(A(s.target)||ue(s.target))}),i=e===Ge?"the transient event":"event '".concat(e,"'");M(!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.")},Li=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var o;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(lc(),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:Dt),this.id=this.config.id||I([this.machine.key],R(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:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,D||M(!("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?Be(this.config.states,function(f,u){var l,d=new t(f,{},void 0,{parent:s,key:u});return Object.assign(s.idMap,v((l={},l[d.id]=d,l),d.idMap)),d}):Ve;var a=0;function c(f){var u,l;f.order=a++;try{for(var d=T(Oe(f)),h=d.next();!h.done;h=d.next()){var g=h.value;c(g)}}catch(E){u={error:E}}finally{try{h&&!h.done&&(l=d.return)&&l.call(d)}finally{if(u)throw u.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(f){var u=f.event;return u===Ge}):Ge in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=Z(this.config.entry||this.config.onEntry).map(function(f){return Fe(f)}),this.onExit=Z(this.config.exit||this.config.onExit).map(function(f){return Fe(f)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=Z(this.config.invoke).map(function(f,u){var l,d;if(ue(f)){var h=ft(s.id,u);return s.machine.options.services=v((l={},l[h]=f,l),s.machine.options.services),yt({src:h,id:h})}else if(A(f.src)){var h=f.id||ft(s.id,u);return yt(v(v({},f),{id:h,src:f.src}))}else if(ue(f.src)||_(f.src)){var h=f.id||ft(s.id,u);return s.machine.options.services=v((d={},d[h]=f.src,d),s.machine.options.services),yt(v(v({id:h},f),{src:h}))}else{var g=f.src;return yt(v(v({id:ft(s.id,u)},f),{src:g}))}}),this.activities=Z(this.config.activities).concat(this.invoke).map(function(f){return zt(f)}),this.transition=this.transition.bind(this),this.tags=Z(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||kr(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,r){var n=this.options,i=n.actions,s=n.activities,o=n.guards,a=n.services,c=n.delays;return new t(this.config,{actions:v(v({},i),e.actions),activities:v(v({},s),e.activities),guards:v(v({},o),e.guards),services:v(v({},a),e.services),delays:v(v({},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 _(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:Be(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===Ge,n=this.transitions.filter(function(i){var s=i.eventType===e;return r?s:s||i.eventType===gt});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,o){var a=_(s)?"".concat(e.id,":delay[").concat(o,"]"):s,c=xi(a,e.id);return e.onEntry.push(dt(c,{delay:s})),e.onExit.push(gi(c)),c},i=de(r)?r.map(function(s,o){var a=n(s.delay,o);return v(v({},s),{event:a})}):q(Object.keys(r).map(function(s,o){var a=r[s],c=A(a)?{target:a}:a,f=isNaN(+s)?s:+s,u=n(f,o);return Z(c).map(function(l){return v(v({},l),{event:u,delay:f})})}));return i.map(function(s){var o=s.delay;return v(v({},e.formatTransition(s)),{delay:o})})},t.prototype.getStateNodes=function(e){var r,n=this;if(!e)return[];var i=e instanceof ne?e.value:je(e,this.delimiter);if(A(i)){var s=this.getStateNode(i).initial;return s!==void 0?this.getStateNodes((r={},r[i]=s,r)):[this,this.states[i]]}var o=Object.keys(i),a=[this];return a.push.apply(a,I([],R(q(o.map(function(c){return n.getStateNode(c).getStateNodes(i[c])}))),!1)),a},t.prototype.handles=function(e){var r=Lt(e);return this.events.includes(r)},t.prototype.resolveState=function(e){var r=e instanceof ne?e:ne.create(e),n=Array.from(Ce([],this.getStateNodes(r.value)));return new ne(v(v({},r),{value:this.resolve(r.value),configuration:n,done:Pe(n,this),tags:qr(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]),o=s._transition(e[i[0]],r,n);return!o||!o.transitions.length?this.next(r,n):o},t.prototype.transitionParallelNode=function(e,r,n){var i,s,o={};try{for(var a=T(Object.keys(e)),c=a.next();!c.done;c=a.next()){var f=c.value,u=e[f];if(!!u){var l=this.getStateNode(f),d=l._transition(u,r,n);d&&(o[f]=d)}}}catch(y){i={error:y}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}var h=Object.keys(o).map(function(y){return o[y]}),g=q(h.map(function(y){return y.transitions})),E=h.some(function(y){return y.transitions.length>0});if(!E)return this.next(r,n);var p=q(h.map(function(y){return y.entrySet})),w=q(Object.keys(o).map(function(y){return o[y].configuration}));return{transitions:g,entrySet:p,exitSet:q(h.map(function(y){return y.exitSet})),configuration:w,source:r,actions:q(Object.keys(o).map(function(y){return o[y].actions}))}},t.prototype._transition=function(e,r,n){return A(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,j(r))},t.prototype.next=function(e,r){var n,i,s=this,o=r.name,a=[],c=[],f;try{for(var u=T(this.getCandidates(o)),l=u.next();!l.done;l=u.next()){var d=l.value,h=d.cond,g=d.in,E=e.context,p=g?A(g)&&He(g)?e.matches(je(this.getStateNodeById(g).path,this.delimiter)):ot(je(g,this.delimiter),oi(this.path.slice(0,-2))(e.value)):!0,w=!1;try{w=!h||Vt(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(o,"' in state node '").concat(this.id,`':
8
- `).concat(N.message))}if(w&&p){d.target!==void 0&&(c=d.target),a.push.apply(a,I([],R(d.actions),!1)),f=d;break}}}catch(N){n={error:N}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}if(!!f){if(!c.length)return{transitions:[f],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:a};var y=q(c.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),x=!!f.internal,C=x?[]:q(y.map(function(N){return s.nodesFromChild(N)}));return{transitions:[f],entrySet:C,exitSet:x?[]:[this],configuration:y,source:e,actions:a}}},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,o,a,c,f=Ce([],i?this.getStateNodes(i.value):[this]),u=e.configuration.length?Ce(f,e.configuration):f;try{for(var l=T(u),d=l.next();!d.done;d=l.next()){var h=d.value;mt(f,h)||e.entrySet.push(h)}}catch(b){s={error:b}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(s)throw s.error}}try{for(var g=T(f),E=g.next();!E.done;E=g.next()){var h=E.value;(!mt(u,h)||mt(e.exitSet,h.parent))&&e.exitSet.push(h)}}catch(b){a={error:b}}finally{try{E&&!E.done&&(c=g.return)&&c.call(g)}finally{if(a)throw a.error}}var p=q(e.entrySet.map(function(b){var S=[];if(b.type!=="final")return S;var O=b.parent;if(!O.parent)return S;S.push(ht(b.id,b.doneData),ht(O.id,b.doneData?we(b.doneData,r,n):void 0));var U=O.parent;return U.type==="parallel"&&Oe(U).every(function(B){return Pe(e.configuration,B)})&&S.push(ht(U.id)),S}));e.exitSet.sort(function(b,S){return S.order-b.order}),e.entrySet.sort(function(b,S){return b.order-S.order});var w=new Set(e.entrySet),y=new Set(e.exitSet),x=R([q(Array.from(w).map(function(b){return I(I([],R(b.activities.map(function(S){return Ei(S)})),!1),R(b.onEntry),!1)})).concat(p.map(yi)),q(Array.from(y).map(function(b){return I(I([],R(b.onExit),!1),R(b.activities.map(function(S){return Si(S)})),!1)}))],2),C=x[0],N=x[1],L=lt(N.concat(e.actions).concat(C),this.machine.options.actions);return L},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=j(r),s;if(e instanceof ne)s=n===void 0?e:this.resolveState(ne.from(e,n));else{var o=A(e)?this.resolve(st(this.getResolvedPath(e))):this.resolve(e),a=n!=null?n:this.machine.context;s=this.resolveState(ne.from(o,a))}if(!D&&i.name===gt)throw new Error("An event cannot have the wildcard type ('".concat(gt,"')"));if(this.strict&&!this.events.includes(i.name)&&!ci(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:[]},f=Ce([],this.getStateNodes(s.value)),u=c.configuration.length?Ce(f,c.configuration):f;return c.configuration=I([],R(u),!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,I([],R(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,o,a=this;i===void 0&&(i=be);var c=e.configuration,f=!r||e.transitions.length>0,u=f?_i(this.machine,c):void 0,l=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?v({},r.activities):{};try{for(var g=T(d),E=g.next();!E.done;E=g.next()){var p=E.value;p.type===rt?h[p.activity.id||p.activity.type]=p:p.type===Me&&(h[p.activity.id||p.activity.type]=!1)}}catch(Q){s={error:Q}}finally{try{E&&!E.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}var w=R(Jt(this,r,n,i,d,this.machine.config.preserveActionOrder),2),y=w[0],x=w[1],C=R(Bt(y,function(Q){return Q.type===Le||Q.type===Se&&Q.to===ve.Internal}),2),N=C[0],L=C[1],b=y.filter(function(Q){var De;return Q.type===rt&&((De=Q.activity)===null||De===void 0?void 0:De.type)===nt}),S=b.reduce(function(Q,De){return Q[De.activity.id]=Ri(De.activity,a.machine,x,i),Q},r?v({},r.children):{}),O=f?e.configuration:r?r.configuration:[],U=Pe(O,this),B=new ne({value:u||r.value,context:x,_event:i,_sessionid:r?r._sessionid:null,historyValue:u?l?di(l,u):void 0:r?r.historyValue:void 0,history:!u||e.source?r:void 0,actions:u?L:[],activities:u?h:r?r.activities:{},events:[],configuration:O,transitions:e.transitions,children:S,done:U,tags:r==null?void 0:r.tags,machine:this}),X=n!==x;B.changed=i.name===it||X;var me=B.history;me&&delete me.history;var _t=!U&&(this._transient||c.some(function(Q){return Q._transient}));if(!f&&(!_t||i.name===Ge))return B;var Y=B;if(!U)for(_t&&(Y=this.resolveRaisedTransition(Y,{type:ti},i));N.length;){var Ju=N.shift();Y=this.resolveRaisedTransition(Y,Ju._event,i)}var zu=Y.changed||(me?!!Y.actions.length||X||typeof me.value!=typeof Y.value||!Dr(Y.value,me.value):void 0);return Y.changed=zu,Y.history=me,Y.tags=qr(Y.configuration),Y},t.prototype.getStateNode=function(e){if(He(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=He(e)?e.slice(Lr.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"&&He(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=jt(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||Ve;switch(this.type){case"parallel":return Be(this.initialStateValue,function(s,o){return s?n.getStateNode(o).resolve(e[o]||s):Ve});case"compound":if(A(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?Be(e,function(s,o){return s?n.getStateNode(o).resolve(s):Ve}):this.initialStateValue||{};default:return e||Ve}},t.prototype.getResolvedPath=function(e){if(He(e)){var r=this.machine.idMap[e.slice(Lr.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return jt(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=Pr(this.states,function(n){return n.initialStateValue||Ve},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=pt(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;A(r.target)?e=He(r.target)?st(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(pt(this))return[this];if(this.type==="compound"&&!this.initial)return D||M(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=at(this.initialStateValue);return q(r.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=R(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:Pr(this.states,function(r,n){if(!e)return r.historyValue();var i=A(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?q(at(i).map(function(o){return n.getFromRelativePath(o)})):n.initialStateNodes}var s=ai(n.path,"states")(e).current;return A(s)?[n.getStateNode(s)]:q(at(s).map(function(o){return r.history==="deep"?n.getFromRelativePath(o):[n.states[o[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,r=q(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,o=new Set(this.ownEvents);if(s)try{for(var a=T(Object.keys(s)),c=a.next();!c.done;c=a.next()){var f=c.value,u=s[f];if(u.states)try{for(var l=(n=void 0,T(u.events)),d=l.next();!d.done;d=l.next()){var h=d.value;o.add("".concat(h))}}catch(g){n={error:g}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}}catch(g){e={error:g}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},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(!A(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 o=r.parent.getStateNodeByPath(s);return o}catch(a){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
9
- `).concat(a.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=mi(e.target),i="internal"in e?e.internal:n?n.some(function(c){return A(c)&&c[0]===r.delimiter}):!0,s=this.machine.options.guards,o=this.resolveTarget(n),a=v(v({},e),{actions:lt(Z(e.actions)),cond:Ft(e.cond,s),target:o,source:this,internal:i,eventType:e.event,toJSON:function(){return v(v({},a),{target:a.target?a.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return a},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,o=gt,a=s[o],c=a===void 0?[]:a,f=Ue(s,[typeof o=="symbol"?o:o+""]);i=q(Object.keys(f).map(function(y){!D&&y===Ge&&M(!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 x=xe(y,f[y]);return D||dc(n,y,x),x}).concat(xe(gt,c)))}var u=this.config.always?xe("",this.config.always):[],l=this.config.onDone?xe(String(ht(this.id)),this.config.onDone):[];D||M(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=q(this.invoke.map(function(y){var x=[];return y.onDone&&x.push.apply(x,I([],R(xe(String(Te(y.id)),y.onDone)),!1)),y.onError&&x.push.apply(x,I([],R(xe(String(Re(y.id)),y.onError)),!1)),x})),h=this.after,g=q(I(I(I(I([],R(l),!1),R(d),!1),R(i),!1),R(u),!1).map(function(y){return Z(y).map(function(x){return n.formatTransition(x)})}));try{for(var E=T(h),p=E.next();!p.done;p=E.next()){var w=p.value;g.push(w)}}catch(y){e={error:y}}finally{try{p&&!p.done&&(r=E.return)&&r.call(E)}finally{if(e)throw e.error}}return g},t}();function ie(t,e){return new Li(t,e)}var k=wi,J=dt;function Bi(t){return!!(t&&typeof t.then=="function")}var hc=Promise.resolve(!1),Ap=Promise.resolve(!0),ce=Promise.resolve();function Wt(t,e){return t||(t=0),new Promise(function(r){return setTimeout(function(){return r(e)},t)})}function Fi(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function Et(){return Math.random().toString(36).substring(2)}var ji=0,jr=0;function ye(){var t=new Date().getTime();return t===ji?(jr++,t*1e3+jr):(ji=t,jr=0,t*1e3)}var ge=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";var pc=ye,mc="native";function vc(t){var e={messagesCallback:null,bc:new BroadcastChannel(t),subFns:[]};return e.bc.onmessage=function(r){e.messagesCallback&&e.messagesCallback(r.data)},e}function yc(t){t.bc.close(),t.subFns=[]}function gc(t,e){try{return t.bc.postMessage(e,!1),ce}catch(r){return Promise.reject(r)}}function Ec(t,e){t.messagesCallback=e}function Sc(){if(ge&&typeof window=="undefined")return!1;if(typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}function wc(){return 150}var Vi={create:vc,close:yc,onMessage:Ec,postMessage:gc,canBeUsed:Sc,type:mc,averageResponseTime:wc,microSeconds:pc};var Kt=function(){function t(e){this.ttl=e,this.set=new Set,this.timeMap=new Map}return t.prototype.has=function(e){return this.set.has(e)},t.prototype.add=function(e){var r=this;this.timeMap.set(e,Hi()),this.set.add(e),setTimeout(function(){xc(r)},0)},t.prototype.clear=function(){this.set.clear(),this.timeMap.clear()},t}();function xc(t){for(var e=Hi()-t.ttl,r=t.set[Symbol.iterator]();;){var n=r.next().value;if(!n)return;var i=t.timeMap.get(n);if(i<e)t.timeMap.delete(n),t.set.delete(n);else return}}function Hi(){return new Date().getTime()}function Je(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(t));return typeof e.webWorkerSupport=="undefined"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),t.idb&&typeof t.idb.onclose=="function"&&(e.idb.onclose=t.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),t.methods&&(e.methods=t.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath=="undefined"&&(e.node.useFastPath=!0),e}var bc=ye,Tc="pubkey.broadcast-channel-0-",pe="messages",Rc="idb";function Gi(){if(typeof indexedDB!="undefined")return indexedDB;if(typeof window!="undefined"){if(typeof window.mozIndexedDB!="undefined")return window.mozIndexedDB;if(typeof window.webkitIndexedDB!="undefined")return window.webkitIndexedDB;if(typeof window.msIndexedDB!="undefined")return window.msIndexedDB}return!1}function Ac(t){var e=Gi(),r=Tc+t,n=e.open(r,1);n.onupgradeneeded=function(s){var o=s.target.result;o.createObjectStore(pe,{keyPath:"id",autoIncrement:!0})};var i=new Promise(function(s,o){n.onerror=function(a){return o(a)},n.onsuccess=function(){s(n.result)}});return i}function Oc(t,e,r){var n=new Date().getTime(),i={uuid:e,time:n,data:r},s=t.transaction([pe],"readwrite");return new Promise(function(o,a){s.oncomplete=function(){return o()},s.onerror=function(f){return a(f)};var c=s.objectStore(pe);c.add(i)})}function Cc(t,e){var r=t.transaction(pe).objectStore(pe),n=[];function i(){try{var s=IDBKeyRange.bound(e+1,1/0);return r.openCursor(s)}catch{return r.openCursor()}}return new Promise(function(s){i().onsuccess=function(o){var a=o.target.result;a?a.value.id<e+1?a.continue(e+1):(n.push(a.value),a.continue()):s(n)}})}function Pc(t,e){var r=t.transaction([pe],"readwrite").objectStore(pe).delete(e);return new Promise(function(n){r.onsuccess=function(){return n()}})}function _c(t,e){var r=new Date().getTime()-e,n=t.transaction(pe).objectStore(pe),i=[];return new Promise(function(s){n.openCursor().onsuccess=function(o){var a=o.target.result;if(a){var c=a.value;if(c.time<r)i.push(c),a.continue();else{s(i);return}}else s(i)}})}function Nc(t,e){return _c(t,e).then(function(r){return Promise.all(r.map(function(n){return Pc(t,n.id)}))})}function Ic(t,e){return e=Je(e),Ac(t).then(function(r){var n={closed:!1,lastCursorId:0,channelName:t,options:e,uuid:Et(),eMIs:new Kt(e.idb.ttl*2),writeBlockPromise:ce,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){n.closed=!0,e.idb.onclose&&e.idb.onclose()},Ji(n),n})}function Ji(t){t.closed||zi(t).then(function(){return Wt(t.options.idb.fallbackInterval)}).then(function(){return Ji(t)})}function kc(t,e){return!(t.uuid===e.uuid||e.eMIs.has(t.id)||t.data.time<e.messagesCallbackTime)}function zi(t){return t.closed?ce:t.messagesCallback?Cc(t.db,t.lastCursorId).then(function(e){var r=e.filter(function(n){return!!n}).map(function(n){return n.id>t.lastCursorId&&(t.lastCursorId=n.id),n}).filter(function(n){return kc(n,t)}).sort(function(n,i){return n.time-i.time});return r.forEach(function(n){t.messagesCallback&&(t.eMIs.add(n.id),t.messagesCallback(n.data))}),ce}):ce}function qc(t){t.closed=!0,t.db.close()}function Dc(t,e){return t.writeBlockPromise=t.writeBlockPromise.then(function(){return Oc(t.db,t.uuid,e)}).then(function(){Fi(0,10)===0&&Nc(t.db,t.options.idb.ttl)}),t.writeBlockPromise}function Uc(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e,zi(t)}function Mc(){if(ge)return!1;var t=Gi();return!!t}function Lc(t){return t.idb.fallbackInterval*2}var $i={create:Ic,close:qc,onMessage:Uc,postMessage:Dc,canBeUsed:Mc,type:Rc,averageResponseTime:Lc,microSeconds:bc};var jc=ye,Bc="pubkey.broadcastChannel-",Fc="localstorage";function Wi(){var t;if(typeof window=="undefined")return null;try{t=window.localStorage,t=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return t}function Ki(t){return Bc+t}function Vc(t,e){return new Promise(function(r){Wt().then(function(){var n=Ki(t.channelName),i={token:Et(),time:new Date().getTime(),data:e,uuid:t.uuid},s=JSON.stringify(i);Wi().setItem(n,s);var o=document.createEvent("Event");o.initEvent("storage",!0,!0),o.key=n,o.newValue=s,window.dispatchEvent(o),r()})})}function Hc(t,e){var r=Ki(t),n=function(s){s.key===r&&e(JSON.parse(s.newValue))};return window.addEventListener("storage",n),n}function Gc(t){window.removeEventListener("storage",t)}function Jc(t,e){if(e=Je(e),!Xi())throw new Error("BroadcastChannel: localstorage cannot be used");var r=Et(),n=new Kt(e.localstorage.removeTimeout),i={channelName:t,uuid:r,eMIs:n};return i.listener=Hc(t,function(s){!i.messagesCallback||s.uuid!==r&&(!s.token||n.has(s.token)||s.data.time&&s.data.time<i.messagesCallbackTime||(n.add(s.token),i.messagesCallback(s.data)))}),i}function zc(t){Gc(t.listener)}function $c(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e}function Xi(){if(ge)return!1;var t=Wi();if(!t)return!1;try{var e="__broadcastchannel_check";t.setItem(e,"works"),t.removeItem(e)}catch{return!1}return!0}function Wc(){var t=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?t*2:t}var Yi={create:Jc,close:zc,onMessage:$c,postMessage:Vc,canBeUsed:Xi,type:Fc,averageResponseTime:Wc,microSeconds:jc};var Kc=ye,Xc="simulate",Br=new Set;function Yc(t){var e={name:t,messagesCallback:null};return Br.add(e),e}function Qc(t){Br.delete(t)}function Zc(t,e){return new Promise(function(r){return setTimeout(function(){var n=Array.from(Br);n.filter(function(i){return i.name===t.name}).filter(function(i){return i!==t}).filter(function(i){return!!i.messagesCallback}).forEach(function(i){return i.messagesCallback(e)}),r()},5)})}function ef(t,e){t.messagesCallback=e}function tf(){return!0}function rf(){return 5}var Qi={create:Yc,close:Qc,onMessage:ef,postMessage:Zc,canBeUsed:tf,type:Xc,averageResponseTime:rf,microSeconds:Kc};var Zi=[Vi,$i,Yi];function es(t){var e=[].concat(t.methods,Zi).filter(Boolean);if(t.type){if(t.type==="simulate")return Qi;var r=e.find(function(i){return i.type===t.type});if(r)return r;throw new Error("method-type "+t.type+" not found")}!t.webWorkerSupport&&!ge&&(e=e.filter(function(i){return i.type!=="idb"}));var n=e.find(function(i){return i.canBeUsed()});if(n)return n;throw new Error("No useable method found in "+JSON.stringify(Zi.map(function(i){return i.type})))}var Fr=new Set,nf=0,_e=function(e,r){this.id=nf++,Fr.add(this),this.name=e,ts&&(r=ts),this.options=Je(r),this.method=es(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,sf(this)};_e._pubkey=!0;var ts;_e.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return rs(this,"message",e)},postInternal:function(e){return rs(this,"internal",e)},set onmessage(t){var e=this.method.microSeconds(),r={time:e,fn:t};is(this,"message",this._onML),t&&typeof t=="function"?(this._onML=r,ns(this,"message",r)):this._onML=null},addEventListener:function(e,r){var n=this.method.microSeconds(),i={time:n,fn:r};ns(this,e,i)},removeEventListener:function(e,r){var n=this._addEL[e].find(function(i){return i.fn===r});is(this,e,n)},close:function(){var e=this;if(!this.closed){Fr.delete(this),this.closed=!0;var r=this._prepP?this._prepP:ce;return this._onML=null,this._addEL.message=[],r.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(n){return n()}))}).then(function(){return e.method.close(e._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function rs(t,e,r){var n=t.method.microSeconds(),i={time:n,type:e,data:r},s=t._prepP?t._prepP:ce;return s.then(function(){var o=t.method.postMessage(t._state,i);return t._uMP.add(o),o.catch().then(function(){return t._uMP.delete(o)}),o})}function sf(t){var e=t.method.create(t.name,t.options);Bi(e)?(t._prepP=e,e.then(function(r){t._state=r})):t._state=e}function ss(t){return t._addEL.message.length>0||t._addEL.internal.length>0}function ns(t,e,r){t._addEL[e].push(r),of(t)}function is(t,e,r){t._addEL[e]=t._addEL[e].filter(function(n){return n!==r}),af(t)}function of(t){if(!t._iL&&ss(t)){var e=function(i){t._addEL[i.type].forEach(function(s){var o=1e5,a=s.time-o;i.time>=a&&s.fn(i.data)})},r=t.method.microSeconds();t._prepP?t._prepP.then(function(){t._iL=!0,t.method.onMessage(t._state,e,r)}):(t._iL=!0,t.method.onMessage(t._state,e,r))}}function af(t){if(t._iL&&!ss(t)){t._iL=!1;var e=t.method.microSeconds();t.method.onMessage(t._state,null,e)}}var Xt="nhostRefreshToken",St="nhostRefreshTokenExpiresAt";var Ne={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var wt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},os={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},as={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"};var vo=Nt(mo());var se=t=>{let e=vo.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,o,a,c,f,u,l,d;return Promise.reject({error:{message:(a=(o=(s=(i=(n=r.response)==null?void 0:n.data)==null?void 0:i.message)!=null?s:r.message)!=null?o:r.request.responseText)!=null?a:JSON.stringify(r),status:(l=(u=(c=r.response)==null?void 0:c.status)!=null?u:(f=r.response)==null?void 0:f.data.statusCode)!=null?l:0,error:((d=r.response)==null?void 0:d.data.error)||r.request.statusText||"network"}})}),e};var yo=(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},re=(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,}))$/),ir=t=>!!t&&typeof t=="string"&&t.length>=3,go=t=>!!t&&typeof t=="string";var un={user:null,mfa:null,accessToken:{value:null,expiresAt:new Date},refreshTimer:{elapsed:0,attempts:0},refreshToken:{value:null},errors:{}};var Eo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=se(t);return ie({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:k({error:i=>Ne}),saveRequestError:k({error:(i,{data:{error:s}})=>s}),reportError:J(i=>({type:"ERROR",error:i.error})),reportSuccess:J("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:o})=>(await n.post("/user/email/change",{newEmail:s,options:re(e,o)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var So=({backendUrl:t,interpreter:e})=>{let r=se(t);return ie({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:k({error:n=>wt}),saveRequestError:k({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:J(n=>({type:"ERROR",error:n.error})),reportSuccess:J("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!ir(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 wo=({backendUrl:t,clientUrl:e})=>{let r=se(t);return ie({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:k({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:J(n=>({type:"ERROR",error:n.error})),reportSuccess:J("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:re(e,s)})}})};var xo=({backendUrl:t,clientUrl:e,interpreter:r})=>{let n=se(t);return ie({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:k({error:i=>Ne}),saveRequestError:k({error:(i,{data:{error:s}})=>s}),reportError:J(i=>({type:"ERROR",error:i.error})),reportSuccess:J("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:o})=>(await n.post("/user/email/send-verification-email",{email:s,options:re(e,o)})).data}})};var bo=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,refreshIntervalTime:i,autoRefreshToken:s=!0,autoSignIn:o=!0})=>{let a=se(t),c=async(f,u,l)=>(await a.post(f,u,l)).data;return ie({schema:{context:{},events:{}},tsTypes:{},context:un,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:J("SIGNED_IN"),reportSignedOut:J("SIGNED_OUT"),reportTokenChanged:J("TOKEN_CHANGED"),clearContext:k(()=>un),saveSession:k({user:(f,u)=>{var l,d;return(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.user},accessToken:(f,u)=>{var l,d,h,g;return{value:(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.accessToken,expiresAt:new Date(Date.now()+((g=(h=u.data)==null?void 0:h.session)==null?void 0:g.accessTokenExpiresIn)*1e3)}},refreshToken:(f,u)=>{var l,d;return{value:(d=(l=u.data)==null?void 0:l.session)==null?void 0:d.refreshToken}}}),saveMfaTicket:k({mfa:(f,u)=>{var l,d;return(d=(l=u.data)==null?void 0:l.mfa)!=null?d:null}}),resetTimer:k({refreshTimer:(f,u)=>({elapsed:0,attempts:0})}),tickRefreshTimer:k({refreshTimer:(f,u)=>({elapsed:f.refreshTimer.elapsed+1,attempts:f.refreshTimer.attempts})}),saveAuthenticationError:k({errors:({errors:f},{data:{error:u}})=>({...f,authentication:u})}),resetAuthenticationError:k({errors:({errors:{authentication:f,...u}})=>u}),saveInvalidEmail:k({errors:({errors:f})=>({...f,authentication:Ne})}),saveInvalidPassword:k({errors:({errors:f})=>({...f,authentication:wt})}),saveInvalidPhoneNumber:k({errors:({errors:f})=>({...f,authentication:os})}),saveRegisrationError:k({errors:({errors:f},{data:{error:u}})=>({...f,registration:u})}),resetSignUpError:k({errors:({errors:{registration:f,...u}})=>u}),saveInvalidSignUpPassword:k({errors:({errors:f})=>({...f,registration:Ne})}),saveInvalidSignUpEmail:k({errors:({errors:f})=>({...f,registration:wt})}),saveNoMfaTicketError:k({errors:({errors:f})=>({...f,registration:as})}),saveRefreshToken:k({accessToken:(f,u)=>({...f.accessToken,expiresAt:u.data.expiresAt}),refreshToken:(f,u)=>({...f.refreshToken,value:u.data.refreshToken})}),persist:(f,{data:u})=>{if(n(Xt,u.session.refreshToken),u.session.accessTokenExpiresIn){let l=new Date(Date.now()+u.session.accessTokenExpiresIn*1e3).toISOString();n(St,l)}else n(St,null)},destroyToken:()=>{n(Xt,null),n(St,null)}},guards:{isSignedIn:f=>!!f.user&&!!f.refreshToken.value&&!!f.accessToken.value,hasRefreshTokenWithoutSession:f=>!!f.refreshToken.value&&!f.user&&!f.accessToken.value,noToken:f=>!f.refreshToken.value,noMfaTicket:(f,{ticket:u})=>{var l;return!u&&!((l=f.mfa)!=null&&l.ticket)},hasRefreshToken:f=>!!f.refreshToken.value,isAutoRefreshDisabled:()=>!s,isAutoSignInDisabled:()=>!o,refreshTimerShouldRefresh:f=>f.refreshTimer.elapsed>Math.max((Date.now()-f.accessToken.expiresAt.getTime())/1e3-900,i),unverified:(f,{data:{error:u}})=>u.status===401&&u.message==="Email is not verified",hasSession:(f,u)=>{var l;return!!((l=u.data)!=null&&l.session)},hasMfaTicket:(f,u)=>{var l;return!!((l=u.data)!=null&&l.mfa)},invalidEmail:(f,{email:u})=>!Ke(u),invalidPassword:(f,{password:u})=>!ir(u),invalidPhoneNumber:(f,{phoneNumber:u})=>!go(u)},services:{signInPassword:(f,{email:u,password:l})=>c("/signin/email-password",{email:u,password:l}),signInPasswordlessSms:(f,{phoneNumber:u,options:l})=>c("/signin/passwordless/sms",{phoneNumber:u,options:re(e,l)}),signInPasswordlessSmsOtp:(f,{phoneNumber:u,otp:l})=>c("/signin/passwordless/sms/otp",{phoneNumber:u,otp:l}),signInPasswordlessEmail:(f,{email:u,options:l})=>c("/signin/passwordless/email",{email:u,options:re(e,l)}),signInAnonymous:f=>c("/signin/anonymous"),signInMfaTotp:(f,{ticket:u,otp:l})=>{var d;return c("/signin/mfa/totp",{ticket:u||((d=f.mfa)==null?void 0:d.ticket),otp:l})},refreshToken:async(f,u)=>{let l=u.type==="TRY_TOKEN"?u.token:f.refreshToken.value;return{session:await c("/token",{refreshToken:l})}},signout:(f,u)=>c("/signout",{refreshToken:f.refreshToken.value,all:!!u.all}),registerUser:(f,{email:u,password:l,options:d})=>c("/signup/email-password",{email:u,password:l,options:re(e,d)}),autoSignIn:async()=>{if(typeof window=="undefined"||!window.location)throw Error("window is undefined or location does not exist");let{hash:f}=window.location;if(!f)throw Error("No hash in window.location");let l=new URLSearchParams(f.slice(1)).get("refreshToken");if(!l)throw Error("No refresh token in the location hash");let d=await c("/token",{refreshToken:l});return new _e("nhost").postMessage(l),{session:d}},importRefreshToken:async()=>{let f=await r(St),u=f?new Date(f):null;return{refreshToken:await r(Xt),expiresAt:u}}}})};function sr(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 il={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 cn(t,e){function r(i,s,o){if(typeof document!="undefined"){o=sr({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in o)!o[c]||(a+="; "+c,o[c]!==!0&&(a+="="+o[c].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+a}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],o={},a=0;a<s.length;a++){var c=s[a].split("="),f=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(o[u]=t.read(f,u),i===u)break}catch{}}return i?o[i]:o}}return Object.create({set:r,get:n,remove:function(i,s){r(i,"",sr({},s,{expires:-1}))},withAttributes:function(i){return cn(this.converter,sr({},this.attributes,i))},withConverter:function(i){return cn(sr({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var _v=cn(il,{path:"/"});var To=typeof window!="undefined",or=new Map,ar=t=>{var e;return To&&localStorage?localStorage.getItem(t):(e=or.get(t))!=null?e:null},ur=(t,e)=>{To&&localStorage?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?or.set(t,e):or.has(t)&&or.delete(t)};var Rt=class{constructor({backendUrl:e,clientUrl:r=typeof window!="undefined"&&(f=>(f=window.location)==null?void 0:f.origin)()||"",clientStorageGetter:n=ar,clientStorageSetter:i=ur,refreshIntervalTime:s=60,autoSignIn:o=!0,autoRefreshToken:a=!0,start:c=!0}){this._subscriptions=new Set;this.backendUrl=e,this.clientUrl=r,this.machine=bo({backendUrl:e,clientUrl:r,refreshIntervalTime:s,clientStorageGetter:n,clientStorageSetter:i,autoSignIn:o,autoRefreshToken:a}),c&&(this.interpreter=he(this.machine),this.interpreter.start()),typeof window!="undefined"&&o&&(this._channel=new _e("nhost"),this._channel.addEventListener("message",u=>{var d;let l=(d=this.interpreter)==null?void 0:d.state.context.refreshToken;this.interpreter&&u!==l&&this.interpreter.send({type:"TRY_TOKEN",token:u})}))}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 Ro=()=>typeof window!="undefined",Ie=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`)})},Ao=(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},Oo=(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 ur};var Co={message:"User is already signed in",status:100},ol={message:"User is not authenticated",status:101},al={message:"User is not anonymous",status:101},ul={message:"Email needs verification",status:102},fn=class{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,clientStorage:i,clientStorageType:s="web",clientStorageGetter:o,clientStorageSetter:a,refreshIntervalTime:c,start:f=!0,Client:u=Rt}){this._client=new u({backendUrl:e,autoRefreshToken:r,autoSignIn:n,start:f,clientStorageGetter:o||Ao(s,i),clientStorageSetter:a||Oo(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:Co}:new Promise(o=>{r.send({type:"SIGNUP_EMAIL_PASSWORD",email:n,password:i,options:s}),r.onTransition(a=>{if(a.matches({authentication:{signedOut:"needsEmailVerification"}}))return o({session:null,error:null});if(a.matches({authentication:{signedOut:"failed"}}))return o({session:null,error:a.context.errors.registration||null});if(a.matches({authentication:"signedIn"}))return o({session:Ie(a.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:Co};if("provider"in e){let{provider:n,options:i}=e,s=yo(`${this._client.backendUrl}/signin/provider/${n}`,re(this._client.clientUrl,i));return Ro()&&(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:Ie(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:ul}):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:Ie(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:ol}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=he(wo(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=he(So(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=he(xo(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=he(Eo(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 a;if(!this.isAuthenticated()||!((a=r.state.context.user)!=null&&a.isAnonymous))return{error:al};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,...o}=e;r.send({type:"DEANONYMIZE",signInMethod:i,connection:s,options:o})})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(Ie(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,Ie(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 Ie((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(o=>{if(o.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 Ma=Nt(Ua()),_n=class{constructor({url:e}){this.url=e,this.httpClient=Ma.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 Nn=class{constructor({url:e}){this.url=e,this.api=new _n({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 Hu=Nt(Yn()),Qn=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Hu.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(o){if(o instanceof Error)return{res:null,error:o}}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 Gu=Nt(Yn()),Zn=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Gu.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()},s="",o;try{o=(await this.instance.post("",{operationName:s||void 0,query:e,variables:r},{...n,headers:i})).data}catch(a){return a instanceof Error?{data:null,error:a}:(console.error(a),{data:null,error:new Error("Unable to get do GraphQL request")})}return typeof o!="object"||Array.isArray(o)||o===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:(o=o,o.errors?{data:null,error:o.errors}:{data:o.data,error:null})}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 ei=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:o,autoRefreshToken:a,autoLogin:c,start:f=!0,Client:u}){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:o,autoRefreshToken:a,autoLogin:c,start:f,Client:u}),this.storage=new Nn({url:`${e}/v1/storage`}),this.functions=new Qn({url:`${e}/v1/functions`}),this.graphql=new Zn({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((l,d)=>{l==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(l=>{this.storage.setAccessToken(l==null?void 0:l.accessToken),this.functions.setAccessToken(l==null?void 0:l.accessToken),this.graphql.setAccessToken(l==null?void 0:l.accessToken)})})}};var zg=t=>new ei(t);export{ei as NhostClient,zg as createClient};
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(`
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
+ `+e),c+=e?t.replace(/\n/g,`
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,`
10
+
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,`
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,`
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,`
20
+ `)),`
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
+ `)}}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,`
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};
10
33
  /*! *****************************************************************************
11
34
  Copyright (c) Microsoft Corporation.
12
35