@nhost/nhost-js 1.1.8 → 1.1.11
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/clients/functions.d.ts +1 -0
- package/dist/clients/functions.d.ts.map +1 -0
- package/dist/clients/graphql.d.ts +1 -0
- package/dist/clients/graphql.d.ts.map +1 -0
- package/dist/clients/index.d.ts +1 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/nhost-client.d.ts +1 -0
- package/dist/core/nhost-client.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +184 -47
- package/dist/index.es.js.map +1 -7
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +25 -25
- package/umd/clients/functions.d.ts +17 -0
- package/umd/clients/functions.d.ts.map +1 -0
- package/umd/clients/graphql.d.ts +20 -0
- package/umd/clients/graphql.d.ts.map +1 -0
- package/umd/clients/index.d.ts +3 -0
- package/umd/clients/index.d.ts.map +1 -0
- package/umd/core/index.d.ts +2 -0
- package/umd/core/index.d.ts.map +1 -0
- package/umd/core/nhost-client.d.ts +26 -0
- package/umd/core/nhost-client.d.ts.map +1 -0
- package/umd/index.d.ts +6 -0
- package/umd/index.d.ts.map +1 -0
- package/umd/nhost-js.umd.js +19 -0
- package/umd/nhost-js.umd.js.map +1 -0
- package/umd/types.d.ts +20 -0
- package/umd/types.d.ts.map +1 -0
- package/src/index.ts +0 -7
package/dist/index.es.js
CHANGED
|
@@ -1,48 +1,185 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),function(o){if(s=o.indexOf(":"),n=sn.trim(o.substr(0,s)).toLowerCase(),i=sn.trim(o.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 Os=y((jp,Rs)=>{"use strict";var As=K();Rs.exports=As.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){var o=As.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var xt=y((Mp,Cs)=>{"use strict";function an(t){this.message=t}an.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};an.prototype.__CANCEL__=!0;Cs.exports=an});var un=y((Lp,Ps)=>{"use strict";var er=K(),$c=ps(),zc=ms(),Wc=tn(),Kc=xs(),Xc=bs(),Yc=Os(),on=nn(),Qc=Tt(),Zc=xt();Ps.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,o=e.responseType,u;function d(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}er.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(h+":"+f)}var l=Kc(e.baseURL,e.url);c.open(e.method.toUpperCase(),Wc(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function p(){if(!!c){var m="getAllResponseHeaders"in c?Xc(c.getAllResponseHeaders()):null,x=!o||o==="text"||o==="json"?c.responseText:c.response,E={data:x,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};$c(function(O){n(O),d()},function(O){i(O),d()},E),c=null}}if("onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(p)},c.onabort=function(){!c||(i(on("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){i(on("Network Error",e,null,c)),c=null},c.ontimeout=function(){var x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",E=e.transitional||Qc.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(on(x,e,E.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},er.isStandardBrowserEnv()){var v=(e.withCredentials||Yc(l))&&e.xsrfCookieName?zc.read(e.xsrfCookieName):void 0;v&&(a[e.xsrfHeaderName]=v)}"setRequestHeader"in c&&er.forEach(a,function(x,E){typeof s=="undefined"&&E.toLowerCase()==="content-type"?delete a[E]:c.setRequestHeader(E,x)}),er.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="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.signal)&&(u=function(m){!c||(i(!m||m&&m.type?new Zc("canceled"):m),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),c.send(s)})}});var Tt=y((Bp,_s)=>{"use strict";var G=K(),Ns=ls(),el=rn(),tl={"Content-Type":"application/x-www-form-urlencoded"};function Is(t,e){!G.isUndefined(t)&&G.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function rl(){var t;return typeof XMLHttpRequest!="undefined"?t=un():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=un()),t}function nl(t,e,r){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var tr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:rl(),transformRequest:[function(e,r){return Ns(r,"Accept"),Ns(r,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Is(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||r&&r["Content-Type"]==="application/json"?(Is(r,"application/json"),nl(e)):e}],transformResponse:[function(e){var r=this.transitional||tr.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?el(a,this,"E_JSON_PARSE"):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};G.forEach(["delete","get","head"],function(e){tr.headers[e]={}});G.forEach(["post","put","patch"],function(e){tr.headers[e]=G.merge(tl)});_s.exports=tr});var Ds=y((Fp,ks)=>{"use strict";var il=K(),sl=Tt();ks.exports=function(e,r,n){var i=this||sl;return il.forEach(n,function(a){e=a.call(i,e,r)}),e}});var cn=y((Vp,qs)=>{"use strict";qs.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ms=y((Hp,js)=>{"use strict";var Us=K(),ln=Ds(),al=cn(),ol=Tt(),ul=xt();function fn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ul("canceled")}js.exports=function(e){fn(e),e.headers=e.headers||{},e.data=ln.call(e,e.data,e.headers,e.transformRequest),e.headers=Us.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Us.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||ol.adapter;return r(e).then(function(i){return fn(e),i.data=ln.call(e,i.data,i.headers,e.transformResponse),i},function(i){return al(i)||(fn(e),i&&i.response&&(i.response.data=ln.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var dn=y((Gp,Ls)=>{"use strict";var te=K();Ls.exports=function(e,r){r=r||{};var n={};function i(c,h){return te.isPlainObject(c)&&te.isPlainObject(h)?te.merge(c,h):te.isPlainObject(h)?te.merge({},h):te.isArray(h)?h.slice():h}function s(c){if(te.isUndefined(r[c])){if(!te.isUndefined(e[c]))return i(void 0,e[c])}else return i(e[c],r[c])}function a(c){if(!te.isUndefined(r[c]))return i(void 0,r[c])}function o(c){if(te.isUndefined(r[c])){if(!te.isUndefined(e[c]))return i(void 0,e[c])}else return i(void 0,r[c])}function u(c){if(c in r)return i(e[c],r[c]);if(c in e)return i(void 0,e[c])}var d={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u};return te.forEach(Object.keys(e).concat(Object.keys(r)),function(h){var f=d[h]||s,l=f(h);te.isUndefined(l)&&f!==u||(n[h]=l)}),n}});var hn=y((Jp,Bs)=>{Bs.exports={version:"0.25.0"}});var Hs=y(($p,Vs)=>{"use strict";var cl=hn().version,pn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){pn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Fs={};pn.transitional=function(e,r,n){function i(s,a){return"[Axios v"+cl+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,o){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!Fs[a]&&(Fs[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,o):!0}};function ll(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 o=t[s],u=o===void 0||a(o,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}Vs.exports={assertOptions:ll,validators:pn}});var Ks=y((zp,Ws)=>{"use strict";var $s=K(),fl=tn(),Gs=us(),Js=Ms(),rr=dn(),zs=Hs(),ze=zs.validators;function bt(t){this.defaults=t,this.interceptors={request:new Gs,response:new Gs}}bt.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&&zs.assertOptions(n,{silentJSONParsing:ze.transitional(ze.boolean),forcedJSONParsing:ze.transitional(ze.boolean),clarifyTimeoutError:ze.transitional(ze.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(l){typeof l.runWhen=="function"&&l.runWhen(r)===!1||(s=s&&l.synchronous,i.unshift(l.fulfilled,l.rejected))});var a=[];this.interceptors.response.forEach(function(l){a.push(l.fulfilled,l.rejected)});var o;if(!s){var u=[Js,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(a),o=Promise.resolve(r);u.length;)o=o.then(u.shift(),u.shift());return o}for(var d=r;i.length;){var c=i.shift(),h=i.shift();try{d=c(d)}catch(f){h(f);break}}try{o=Js(d)}catch(f){return Promise.reject(f)}for(;a.length;)o=o.then(a.shift(),a.shift());return o};bt.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=rr(this.defaults,e),fl(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};$s.forEach(["delete","get","head","options"],function(e){bt.prototype[e]=function(r,n){return this.request(rr(n||{},{method:e,url:r,data:(n||{}).data}))}});$s.forEach(["post","put","patch"],function(e){bt.prototype[e]=function(r,n,i){return this.request(rr(i||{},{method:e,url:r,data:n}))}});Ws.exports=bt});var Ys=y((Wp,Xs)=>{"use strict";var dl=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(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new dl(i),e(r.reason))})}We.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};We.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};We.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};We.source=function(){var e,r=new We(function(i){e=i});return{token:r,cancel:e}};Xs.exports=We});var Zs=y((Kp,Qs)=>{"use strict";Qs.exports=function(e){return function(n){return e.apply(null,n)}}});var ta=y((Xp,ea)=>{"use strict";var hl=K();ea.exports=function(e){return hl.isObject(e)&&e.isAxiosError===!0}});var ia=y((Yp,vn)=>{"use strict";var ra=K(),pl=Xr(),nr=Ks(),vl=dn(),ml=Tt();function na(t){var e=new nr(t),r=pl(nr.prototype.request,e);return ra.extend(r,nr.prototype,e),ra.extend(r,e),r.create=function(i){return na(vl(t,i))},r}var he=na(ml);he.Axios=nr;he.Cancel=xt();he.CancelToken=Ys();he.isCancel=cn();he.VERSION=hn().version;he.all=function(e){return Promise.all(e)};he.spread=Zs();he.isAxiosError=ta();vn.exports=he;vn.exports.default=he});var aa=y((Qp,sa)=>{sa.exports=ia()});var En=y((Im,Ea)=>{"use strict";Ea.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=y((_m,xa)=>{"use strict";var Pl=En(),ke=Object.prototype.toString;function xn(t){return ke.call(t)==="[object Array]"}function Sn(t){return typeof t=="undefined"}function Nl(t){return t!==null&&!Sn(t)&&t.constructor!==null&&!Sn(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Il(t){return ke.call(t)==="[object ArrayBuffer]"}function _l(t){return typeof FormData!="undefined"&&t instanceof FormData}function kl(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Dl(t){return typeof t=="string"}function ql(t){return typeof t=="number"}function Sa(t){return t!==null&&typeof t=="object"}function lr(t){if(ke.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Ul(t){return ke.call(t)==="[object Date]"}function jl(t){return ke.call(t)==="[object File]"}function Ml(t){return ke.call(t)==="[object Blob]"}function wa(t){return ke.call(t)==="[object Function]"}function Ll(t){return Sa(t)&&wa(t.pipe)}function Bl(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Fl(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Vl(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Tn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),xn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function wn(){var t={};function e(i,s){lr(t[s])&&lr(i)?t[s]=wn(t[s],i):lr(i)?t[s]=wn({},i):xn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Tn(arguments[r],e);return t}function Hl(t,e,r){return Tn(e,function(i,s){r&&typeof i=="function"?t[s]=Pl(i,r):t[s]=i}),t}function Gl(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}xa.exports={isArray:xn,isArrayBuffer:Il,isBuffer:Nl,isFormData:_l,isArrayBufferView:kl,isString:Dl,isNumber:ql,isObject:Sa,isPlainObject:lr,isUndefined:Sn,isDate:Ul,isFile:jl,isBlob:Ml,isFunction:wa,isStream:Ll,isURLSearchParams:Bl,isStandardBrowserEnv:Vl,forEach:Tn,merge:wn,extend:Hl,trim:Fl,stripBOM:Gl}});var bn=y((km,ba)=>{"use strict";var Ye=X();function Ta(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ba.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(u,d){u===null||typeof u=="undefined"||(Ye.isArray(u)?d=d+"[]":u=[u],Ye.forEach(u,function(h){Ye.isDate(h)?h=h.toISOString():Ye.isObject(h)&&(h=JSON.stringify(h)),s.push(Ta(d)+"="+Ta(h))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ra=y((Dm,Aa)=>{"use strict";var Jl=X();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){Jl.forEach(this.handlers,function(n){n!==null&&e(n)})};Aa.exports=fr});var Ca=y((qm,Oa)=>{"use strict";var $l=X();Oa.exports=function(e,r){$l.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var An=y((Um,Pa)=>{"use strict";Pa.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}});var Rn=y((jm,Na)=>{"use strict";var zl=An();Na.exports=function(e,r,n,i,s){var a=new Error(e);return zl(a,r,n,i,s)}});var _a=y((Mm,Ia)=>{"use strict";var Wl=Rn();Ia.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Wl("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Da=y((Lm,ka)=>{"use strict";var dr=X();ka.exports=dr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),dr.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),dr.isString(s)&&u.push("path="+s),dr.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.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 Ua=y((Bm,qa)=>{"use strict";qa.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Ma=y((Fm,ja)=>{"use strict";ja.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Ba=y((Vm,La)=>{"use strict";var Kl=Ua(),Xl=Ma();La.exports=function(e,r){return e&&!Kl(r)?Xl(e,r):r}});var Va=y((Hm,Fa)=>{"use strict";var On=X(),Yl=["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"];Fa.exports=function(e){var r={},n,i,s;return e&&On.forEach(e.split(`
|
|
3
|
-
`),function(o){if(s=o.indexOf(":"),n=On.trim(o.substr(0,s)).toLowerCase(),i=On.trim(o.substr(s+1)),n){if(r[n]&&Yl.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 Ja=y((Gm,Ga)=>{"use strict";var Ha=X();Ga.exports=Ha.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 o=Ha.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var Pn=y((Jm,$a)=>{"use strict";var hr=X(),Ql=_a(),Zl=Da(),ef=bn(),tf=Ba(),rf=Va(),nf=Ja(),Cn=Rn();$a.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,o=e.responseType;hr.isFormData(s)&&delete a["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(d+":"+c)}var h=tf(e.baseURL,e.url);u.open(e.method.toUpperCase(),ef(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function f(){if(!!u){var p="getAllResponseHeaders"in u?rf(u.getAllResponseHeaders()):null,v=!o||o==="text"||o==="json"?u.responseText:u.response,m={data:v,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};Ql(n,i,m),u=null}}if("onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(f)},u.onabort=function(){!u||(i(Cn("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(Cn("Network Error",e,null,u)),u=null},u.ontimeout=function(){var v="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(v=e.timeoutErrorMessage),i(Cn(v,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},hr.isStandardBrowserEnv()){var l=(e.withCredentials||nf(h))&&e.xsrfCookieName?Zl.read(e.xsrfCookieName):void 0;l&&(a[e.xsrfHeaderName]=l)}"setRequestHeader"in u&&hr.forEach(a,function(v,m){typeof s=="undefined"&&m.toLowerCase()==="content-type"?delete a[m]:u.setRequestHeader(m,v)}),hr.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&o!=="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.cancelToken.promise.then(function(v){!u||(u.abort(),i(v),u=null)}),s||(s=null),u.send(s)})}});var vr=y(($m,Ka)=>{"use strict";var J=X(),za=Ca(),sf=An(),af={"Content-Type":"application/x-www-form-urlencoded"};function Wa(t,e){!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function of(){var t;return typeof XMLHttpRequest!="undefined"?t=Pn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Pn()),t}function uf(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 pr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:of(),transformRequest:[function(e,r){return za(r,"Accept"),za(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)?(Wa(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)||r&&r["Content-Type"]==="application/json"?(Wa(r,"application/json"),uf(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&J.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?sf(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}};pr.headers={common:{Accept:"application/json, text/plain, */*"}};J.forEach(["delete","get","head"],function(e){pr.headers[e]={}});J.forEach(["post","put","patch"],function(e){pr.headers[e]=J.merge(af)});Ka.exports=pr});var Ya=y((zm,Xa)=>{"use strict";var cf=X(),lf=vr();Xa.exports=function(e,r,n){var i=this||lf;return cf.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Nn=y((Wm,Qa)=>{"use strict";Qa.exports=function(e){return!!(e&&e.__CANCEL__)}});var to=y((Km,eo)=>{"use strict";var Za=X(),In=Ya(),ff=Nn(),df=vr();function _n(t){t.cancelToken&&t.cancelToken.throwIfRequested()}eo.exports=function(e){_n(e),e.headers=e.headers||{},e.data=In.call(e,e.data,e.headers,e.transformRequest),e.headers=Za.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Za.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||df.adapter;return r(e).then(function(i){return _n(e),i.data=In.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ff(i)||(_n(e),i&&i.response&&(i.response.data=In.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var kn=y((Xm,ro)=>{"use strict";var W=X();ro.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"],o=["validateStatus"];function u(f,l){return W.isPlainObject(f)&&W.isPlainObject(l)?W.merge(f,l):W.isPlainObject(l)?W.merge({},l):W.isArray(l)?l.slice():l}function d(f){W.isUndefined(r[f])?W.isUndefined(e[f])||(n[f]=u(void 0,e[f])):n[f]=u(e[f],r[f])}W.forEach(i,function(l){W.isUndefined(r[l])||(n[l]=u(void 0,r[l]))}),W.forEach(s,d),W.forEach(a,function(l){W.isUndefined(r[l])?W.isUndefined(e[l])||(n[l]=u(void 0,e[l])):n[l]=u(void 0,r[l])}),W.forEach(o,function(l){l in r?n[l]=u(e[l],r[l]):l in e&&(n[l]=u(void 0,e[l]))});var c=i.concat(s).concat(a).concat(o),h=Object.keys(e).concat(Object.keys(r)).filter(function(l){return c.indexOf(l)===-1});return W.forEach(h,d),n}});var no=y((Ym,hf)=>{hf.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 uo=y((Qm,oo)=>{"use strict";var so=no(),Dn={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Dn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var io={},pf=so.version.split(".");function ao(t,e){for(var r=e?e.split("."):pf,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}Dn.transitional=function(e,r,n){var i=r&&ao(r);function s(a,o){return"[Axios v"+so.version+"] Transitional option '"+a+"'"+o+(n?". "+n:"")}return function(a,o,u){if(e===!1)throw new Error(s(o," has been removed in "+r));return i&&!io[o]&&(io[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,o,u):!0}};function vf(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 o=t[s],u=o===void 0||a(o,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}oo.exports={isOlderVersion:ao,assertOptions:vf,validators:Dn}});var vo=y((Zm,po)=>{"use strict";var fo=X(),mf=bn(),co=Ra(),lo=to(),mr=kn(),ho=uo(),Qe=ho.validators;function Rt(t){this.defaults=t,this.interceptors={request:new co,response:new co}}Rt.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&&ho.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(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(i=i&&f.synchronous,n.unshift(f.fulfilled,f.rejected))});var s=[];this.interceptors.response.forEach(function(f){s.push(f.fulfilled,f.rejected)});var a;if(!i){var o=[lo,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(s),a=Promise.resolve(e);o.length;)a=a.then(o.shift(),o.shift());return a}for(var u=e;n.length;){var d=n.shift(),c=n.shift();try{u=d(u)}catch(h){c(h);break}}try{a=lo(u)}catch(h){return Promise.reject(h)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Rt.prototype.getUri=function(e){return e=mr(this.defaults,e),mf(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};fo.forEach(["delete","get","head","options"],function(e){Rt.prototype[e]=function(r,n){return this.request(mr(n||{},{method:e,url:r,data:(n||{}).data}))}});fo.forEach(["post","put","patch"],function(e){Rt.prototype[e]=function(r,n,i){return this.request(mr(i||{},{method:e,url:r,data:n}))}});po.exports=Rt});var Un=y((ey,mo)=>{"use strict";function qn(t){this.message=t}qn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};qn.prototype.__CANCEL__=!0;mo.exports=qn});var go=y((ty,yo)=>{"use strict";var yf=Un();function yr(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 yf(i),e(r.reason))})}yr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};yr.source=function(){var e,r=new yr(function(i){e=i});return{token:r,cancel:e}};yo.exports=yr});var So=y((ry,Eo)=>{"use strict";Eo.exports=function(e){return function(n){return e.apply(null,n)}}});var xo=y((ny,wo)=>{"use strict";wo.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var Ao=y((iy,jn)=>{"use strict";var To=X(),gf=En(),gr=vo(),Ef=kn(),Sf=vr();function bo(t){var e=new gr(t),r=gf(gr.prototype.request,e);return To.extend(r,gr.prototype,e),To.extend(r,e),r}var ue=bo(Sf);ue.Axios=gr;ue.create=function(e){return bo(Ef(ue.defaults,e))};ue.Cancel=Un();ue.CancelToken=go();ue.isCancel=Nn();ue.all=function(e){return Promise.all(e)};ue.spread=So();ue.isAxiosError=xo();jn.exports=ue;jn.exports.default=ue});var Oo=y((sy,Ro)=>{Ro.exports=Ao()});var Mn=y((py,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 Y=y((vy,_o)=>{"use strict";var wf=Mn(),De=Object.prototype.toString;function Fn(t){return De.call(t)==="[object Array]"}function Ln(t){return typeof t=="undefined"}function xf(t){return t!==null&&!Ln(t)&&t.constructor!==null&&!Ln(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Tf(t){return De.call(t)==="[object ArrayBuffer]"}function bf(t){return typeof FormData!="undefined"&&t instanceof FormData}function Af(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Rf(t){return typeof t=="string"}function Of(t){return typeof t=="number"}function No(t){return t!==null&&typeof t=="object"}function wr(t){if(De.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Cf(t){return De.call(t)==="[object Date]"}function Pf(t){return De.call(t)==="[object File]"}function Nf(t){return De.call(t)==="[object Blob]"}function Io(t){return De.call(t)==="[object Function]"}function If(t){return No(t)&&Io(t.pipe)}function _f(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function kf(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Df(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Vn(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Fn(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Bn(){var t={};function e(i,s){wr(t[s])&&wr(i)?t[s]=Bn(t[s],i):wr(i)?t[s]=Bn({},i):Fn(i)?t[s]=i.slice():t[s]=i}for(var r=0,n=arguments.length;r<n;r++)Vn(arguments[r],e);return t}function qf(t,e,r){return Vn(e,function(i,s){r&&typeof i=="function"?t[s]=wf(i,r):t[s]=i}),t}function Uf(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}_o.exports={isArray:Fn,isArrayBuffer:Tf,isBuffer:xf,isFormData:bf,isArrayBufferView:Af,isString:Rf,isNumber:Of,isObject:No,isPlainObject:wr,isUndefined:Ln,isDate:Cf,isFile:Pf,isBlob:Nf,isFunction:Io,isStream:If,isURLSearchParams:_f,isStandardBrowserEnv:Df,forEach:Vn,merge:Bn,extend:qf,trim:kf,stripBOM:Uf}});var Hn=y((my,Do)=>{"use strict";var Ze=Y();function ko(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Do.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(u,d){u===null||typeof u=="undefined"||(Ze.isArray(u)?d=d+"[]":u=[u],Ze.forEach(u,function(h){Ze.isDate(h)?h=h.toISOString():Ze.isObject(h)&&(h=JSON.stringify(h)),s.push(ko(d)+"="+ko(h))}))}),i=s.join("&")}if(i){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Uo=y((yy,qo)=>{"use strict";var jf=Y();function xr(){this.handlers=[]}xr.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};xr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};xr.prototype.forEach=function(e){jf.forEach(this.handlers,function(n){n!==null&&e(n)})};qo.exports=xr});var Mo=y((gy,jo)=>{"use strict";var Mf=Y();jo.exports=function(e,r){Mf.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Gn=y((Ey,Lo)=>{"use strict";Lo.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=y((Sy,Bo)=>{"use strict";var Lf=Gn();Bo.exports=function(e,r,n,i,s){var a=new Error(e);return Lf(a,r,n,i,s)}});var Vo=y((wy,Fo)=>{"use strict";var Bf=Jn();Fo.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Bf("Request failed with status code "+n.status,n.config,null,n.request,n))}});var Go=y((xy,Ho)=>{"use strict";var Tr=Y();Ho.exports=Tr.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,a,o){var u=[];u.push(r+"="+encodeURIComponent(n)),Tr.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),Tr.isString(s)&&u.push("path="+s),Tr.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.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 $o=y((Ty,Jo)=>{"use strict";Jo.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Wo=y((by,zo)=>{"use strict";zo.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Xo=y((Ay,Ko)=>{"use strict";var Ff=$o(),Vf=Wo();Ko.exports=function(e,r){return e&&!Ff(r)?Vf(e,r):r}});var Qo=y((Ry,Yo)=>{"use strict";var $n=Y(),Hf=["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&&$n.forEach(e.split(`
|
|
4
|
-
`),function(o){if(s=o.indexOf(":"),n=$n.trim(o.substr(0,s)).toLowerCase(),i=$n.trim(o.substr(s+1)),n){if(r[n]&&Hf.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 tu=y((Oy,eu)=>{"use strict";var Zo=Y();eu.exports=Zo.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 o=Zo.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}()});var Ot=y((Cy,ru)=>{"use strict";function zn(t){this.message=t}zn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};zn.prototype.__CANCEL__=!0;ru.exports=zn});var Kn=y((Py,nu)=>{"use strict";var br=Y(),Gf=Vo(),Jf=Go(),$f=Hn(),zf=Xo(),Wf=Qo(),Kf=tu(),Wn=Jn(),Xf=Ct(),Yf=Ot();nu.exports=function(e){return new Promise(function(n,i){var s=e.data,a=e.headers,o=e.responseType,u;function d(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}br.isFormData(s)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(h+":"+f)}var l=zf(e.baseURL,e.url);c.open(e.method.toUpperCase(),$f(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function p(){if(!!c){var m="getAllResponseHeaders"in c?Wf(c.getAllResponseHeaders()):null,x=!o||o==="text"||o==="json"?c.responseText:c.response,E={data:x,status:c.status,statusText:c.statusText,headers:m,config:e,request:c};Gf(function(O){n(O),d()},function(O){i(O),d()},E),c=null}}if("onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(p)},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 x=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",E=e.transitional||Xf.transitional;e.timeoutErrorMessage&&(x=e.timeoutErrorMessage),i(Wn(x,e,E.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},br.isStandardBrowserEnv()){var v=(e.withCredentials||Kf(l))&&e.xsrfCookieName?Jf.read(e.xsrfCookieName):void 0;v&&(a[e.xsrfHeaderName]=v)}"setRequestHeader"in c&&br.forEach(a,function(x,E){typeof s=="undefined"&&E.toLowerCase()==="content-type"?delete a[E]:c.setRequestHeader(E,x)}),br.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="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.signal)&&(u=function(m){!c||(i(!m||m&&m.type?new Yf("canceled"):m),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),c.send(s)})}});var Ct=y((Ny,au)=>{"use strict";var $=Y(),iu=Mo(),Qf=Gn(),Zf={"Content-Type":"application/x-www-form-urlencoded"};function su(t,e){!$.isUndefined(t)&&$.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function ed(){var t;return typeof XMLHttpRequest!="undefined"?t=Kn():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Kn()),t}function td(t,e,r){if($.isString(t))try{return(e||JSON.parse)(t),$.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Ar={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:ed(),transformRequest:[function(e,r){return iu(r,"Accept"),iu(r,"Content-Type"),$.isFormData(e)||$.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e)?e:$.isArrayBufferView(e)?e.buffer:$.isURLSearchParams(e)?(su(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):$.isObject(e)||r&&r["Content-Type"]==="application/json"?(su(r,"application/json"),td(e)):e}],transformResponse:[function(e){var r=this.transitional||Ar.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&$.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?Qf(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, */*"}}};$.forEach(["delete","get","head"],function(e){Ar.headers[e]={}});$.forEach(["post","put","patch"],function(e){Ar.headers[e]=$.merge(Zf)});au.exports=Ar});var uu=y((Iy,ou)=>{"use strict";var rd=Y(),nd=Ct();ou.exports=function(e,r,n){var i=this||nd;return rd.forEach(n,function(a){e=a.call(i,e,r)}),e}});var Xn=y((_y,cu)=>{"use strict";cu.exports=function(e){return!!(e&&e.__CANCEL__)}});var du=y((ky,fu)=>{"use strict";var lu=Y(),Yn=uu(),id=Xn(),sd=Ct(),ad=Ot();function Qn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ad("canceled")}fu.exports=function(e){Qn(e),e.headers=e.headers||{},e.data=Yn.call(e,e.data,e.headers,e.transformRequest),e.headers=lu.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),lu.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||sd.adapter;return r(e).then(function(i){return Qn(e),i.data=Yn.call(e,i.data,i.headers,e.transformResponse),i},function(i){return id(i)||(Qn(e),i&&i.response&&(i.response.data=Yn.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Zn=y((Dy,hu)=>{"use strict";var re=Y();hu.exports=function(e,r){r=r||{};var n={};function i(c,h){return re.isPlainObject(c)&&re.isPlainObject(h)?re.merge(c,h):re.isPlainObject(h)?re.merge({},h):re.isArray(h)?h.slice():h}function s(c){if(re.isUndefined(r[c])){if(!re.isUndefined(e[c]))return i(void 0,e[c])}else return i(e[c],r[c])}function a(c){if(!re.isUndefined(r[c]))return i(void 0,r[c])}function o(c){if(re.isUndefined(r[c])){if(!re.isUndefined(e[c]))return i(void 0,e[c])}else return i(void 0,r[c])}function u(c){if(c in r)return i(e[c],r[c]);if(c in e)return i(void 0,e[c])}var d={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u};return re.forEach(Object.keys(e).concat(Object.keys(r)),function(h){var f=d[h]||s,l=f(h);re.isUndefined(l)&&f!==u||(n[h]=l)}),n}});var ei=y((qy,pu)=>{pu.exports={version:"0.23.0"}});var yu=y((Uy,mu)=>{"use strict";var od=ei().version,ti={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ti[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var vu={};ti.transitional=function(e,r,n){function i(s,a){return"[Axios v"+od+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,o){if(e===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!vu[a]&&(vu[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,o):!0}};function ud(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 o=t[s],u=o===void 0||a(o,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}mu.exports={assertOptions:ud,validators:ti}});var Tu=y((jy,xu)=>{"use strict";var Su=Y(),cd=Hn(),gu=Uo(),Eu=du(),Rr=Zn(),wu=yu(),et=wu.validators;function Pt(t){this.defaults=t,this.interceptors={request:new gu,response:new gu}}Pt.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Rr(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&&wu.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(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(i=i&&f.synchronous,n.unshift(f.fulfilled,f.rejected))});var s=[];this.interceptors.response.forEach(function(f){s.push(f.fulfilled,f.rejected)});var a;if(!i){var o=[Eu,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(s),a=Promise.resolve(e);o.length;)a=a.then(o.shift(),o.shift());return a}for(var u=e;n.length;){var d=n.shift(),c=n.shift();try{u=d(u)}catch(h){c(h);break}}try{a=Eu(u)}catch(h){return Promise.reject(h)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};Pt.prototype.getUri=function(e){return e=Rr(this.defaults,e),cd(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Su.forEach(["delete","get","head","options"],function(e){Pt.prototype[e]=function(r,n){return this.request(Rr(n||{},{method:e,url:r,data:(n||{}).data}))}});Su.forEach(["post","put","patch"],function(e){Pt.prototype[e]=function(r,n,i){return this.request(Rr(i||{},{method:e,url:r,data:n}))}});xu.exports=Pt});var Au=y((My,bu)=>{"use strict";var ld=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(a){r.subscribe(a),i=a}).then(n);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i){r.reason||(r.reason=new ld(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}};bu.exports=tt});var Ou=y((Ly,Ru)=>{"use strict";Ru.exports=function(e){return function(n){return e.apply(null,n)}}});var Pu=y((By,Cu)=>{"use strict";Cu.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var _u=y((Fy,ri)=>{"use strict";var Nu=Y(),fd=Mn(),Or=Tu(),dd=Zn(),hd=Ct();function Iu(t){var e=new Or(t),r=fd(Or.prototype.request,e);return Nu.extend(r,Or.prototype,e),Nu.extend(r,e),r.create=function(i){return Iu(dd(t,i))},r}var pe=Iu(hd);pe.Axios=Or;pe.Cancel=Ot();pe.CancelToken=Au();pe.isCancel=Xn();pe.VERSION=ei().version;pe.all=function(e){return Promise.all(e)};pe.spread=Ou();pe.isAxiosError=Pu();ri.exports=pe;ri.exports.default=pe});var ni=y((Vy,ku)=>{ku.exports=_u()});var ii=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.default=void 0;var pd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,vd=pd;Pr.default=vd});var Uu=y(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.default=Ed;var md=yd(ii());function yd(t){return t&&t.__esModule?t:{default:t}}function Nr(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nr=function(r){return typeof r}:Nr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nr(t)}var gd=10,qu=2;function Ed(t){return Ir(t,[])}function Ir(t,e){switch(Nr(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Sd(t,e);default:return String(t)}}function Sd(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Td(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Ir(i,r)}else if(Array.isArray(t))return xd(t,r);return wd(t,r)}function wd(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>qu)return"["+bd(t)+"]";var n=r.map(function(i){var s=Ir(t[i],e);return i+": "+s});return"{ "+n.join(", ")+" }"}function xd(t,e){if(t.length===0)return"[]";if(e.length>qu)return"[Array]";for(var r=Math.min(gd,t.length),n=t.length-r,i=[],s=0;s<r;++s)i.push(Ir(t[s],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Td(t){var e=t[String(md.default)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function bd(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 ju=y(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.default=Ad;function Ad(t,e){var r=Boolean(t);if(!r)throw new Error(e!=null?e:"Unexpected invariant triggered.")}});var Bu=y(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.default=Od;var Rd=Lu(ju()),Mu=Lu(ii());function Lu(t){return t&&t.__esModule?t:{default:t}}function Od(t){var e=t.prototype.toJSON;typeof e=="function"||(0,Rd.default)(0),t.prototype.inspect=e,Mu.default&&(t.prototype[Mu.default]=e)}});var Gu=y(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.isNode=Pd;qe.Token=qe.Location=void 0;var Fu=Cd(Bu());function Cd(t){return t&&t.__esModule?t:{default:t}}var Vu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();qe.Location=Vu;(0,Fu.default)(Vu);var Hu=function(){function t(r,n,i,s,a,o,u){this.kind=r,this.start=n,this.end=i,this.line=s,this.column=a,this.value=u,this.prev=o,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();qe.Token=Hu;(0,Fu.default)(Hu);function Pd(t){return t!=null&&typeof t.kind=="string"}});var zu=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.visit=_d;ye.visitInParallel=kd;ye.getVisitFn=_r;ye.BREAK=ye.QueryDocumentKeys=void 0;var Nd=Id(Uu()),Ju=Gu();function Id(t){return t&&t.__esModule?t:{default:t}}var $u={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=$u;var rt=Object.freeze({});ye.BREAK=rt;function _d(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$u,n=void 0,i=Array.isArray(t),s=[t],a=-1,o=[],u=void 0,d=void 0,c=void 0,h=[],f=[],l=t;do{a++;var p=a===s.length,v=p&&o.length!==0;if(p){if(d=f.length===0?void 0:h[h.length-1],u=c,c=f.pop(),v){if(i)u=u.slice();else{for(var m={},x=0,E=Object.keys(u);x<E.length;x++){var T=E[x];m[T]=u[T]}u=m}for(var O=0,N=0;N<o.length;N++){var M=o[N][0],b=o[N][1];i&&(M-=O),i&&b===null?(u.splice(M,1),O++):u[M]=b}}a=n.index,s=n.keys,o=n.edits,i=n.inArray,n=n.prev}else{if(d=c?i?a:s[a]:void 0,u=c?c[d]:l,u==null)continue;c&&h.push(d)}var w=void 0;if(!Array.isArray(u)){if(!(0,Ju.isNode)(u))throw new Error("Invalid AST Node: ".concat((0,Nd.default)(u),"."));var A=_r(e,u.kind,p);if(A){if(w=A.call(e,u,d,c,h,f),w===rt)break;if(w===!1){if(!p){h.pop();continue}}else if(w!==void 0&&(o.push([d,w]),!p))if((0,Ju.isNode)(w))u=w;else{h.pop();continue}}}if(w===void 0&&v&&o.push([d,u]),p)h.pop();else{var q;n={inArray:i,index:a,keys:s,edits:o,prev:n},i=Array.isArray(u),s=i?u:(q=r[u.kind])!==null&&q!==void 0?q:[],a=-1,o=[],c&&f.push(c),c=u}}while(n!==void 0);return o.length!==0&&(l=o[o.length-1][1]),l}function kd(t){var e=new Array(t.length);return{enter:function(n){for(var i=0;i<t.length;i++)if(e[i]==null){var s=_r(t[i],n.kind,!1);if(s){var a=s.apply(t[i],arguments);if(a===!1)e[i]=n;else if(a===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=_r(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 _r(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var s=r?t.leave:t.enter;if(s){if(typeof s=="function")return s;var a=s[e];if(typeof a=="function")return a}}}});var Xu=y(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.dedentBlockStringValue=Dd;Nt.getBlockStringIndentation=Ku;Nt.printBlockString=qd;function Dd(t){var e=t.split(/\r\n|[\n\r]/g),r=Ku(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&&Wu(e[i]);)++i;for(var s=e.length;s>i&&Wu(e[s-1]);)--s;return e.slice(i,s).join(`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`)!==-1}function Yu(t){return t!=null&&t.some(Fd)}});function Ur(t){this.message=t}Ur.prototype=new Error,Ur.prototype.name="InvalidCharacterError";var li=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new Ur("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=e.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function cc(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(li(r).replace(/(.)/g,function(n,i){var s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch{return li(e)}}function _t(t){this.message=t}function lc(t,e){if(typeof t!="string")throw new _t("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(cc(t.split(".")[r]))}catch(n){throw new _t("Invalid token specified: "+n.message)}}_t.prototype=new Error,_t.prototype.name="InvalidTokenError";var fi=lc;var g=function(){return g=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},g.apply(this,arguments)};function je(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function k(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,Me=I.Stop,Le=I.Raise,xe=I.Send,kt=I.Cancel,di=I.NullEvent,Dt=I.Assign,zd=I.After,Wd=I.DoneState,qt=I.Log,hi=I.Init,st=I.Invoke,Kd=I.ErrorExecution,jr=I.ErrorPlatform,Mr=I.ErrorCustom,at=I.Update,pi=I.Choose,vi=I.Pure;var Ut=".",Lr={},jt="xstate.guard",mi="";var j=!0;var Mt;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 fc(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Be(t,e){if(fc(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 Br(t,e,r){var n,i,s={};try{for(var a=R(Object.keys(t)),o=a.next();!o.done;o=a.next()){var u=o.value,d=t[u];!r(d)||(s[u]=e(d,u,t))}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}var yi=function(t){return function(e){var r,n,i=e;try{for(var s=R(t),a=s.next();!a.done;a=s.next()){var o=a.value;i=i[o]}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}};function gi(t,e){return function(r){var n,i,s=r;try{for(var a=R(t),o=a.next();!o.done;o=a.next()){var u=o.value;s=s[e][u]}}catch(d){n={error:d}}finally{try{o&&!o.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,k([],C(t),!1))}function Ei(t){return ve(t)?t:[t]}function ee(t){return t===void 0?[]:Ei(t)}function Te(t,e,r){var n,i;if(_(t))return t(e,r.data);var s={};try{for(var a=R(Object.keys(t)),o=a.next();!o.done;o=a.next()){var u=o.value,d=t[u];_(d)?s[u]=d(e,r.data):s[u]=d}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return s}function Si(t){return/^(done|error)\./.test(t)}function Fr(t){return!!(t instanceof Promise||t!==null&&(_(t)||typeof t=="object")&&_(t.then))}function wi(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 o=R(t),u=o.next();!u.done;u=o.next()){var d=u.value;e(d)?s.push(d):a.push(d)}}catch(c){r={error:c}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return[s,a]}function xi(t,e){return Fe(t.states,function(r,n){if(!!r){var i=(P(e)?void 0:e[n])||(r?r.current:void 0);if(!!i)return{current:i,states:xi(r,i)}}})}function Ti(t,e){return{current:e,states:xi(t,e)}}function Vr(t,e,r,n){j||B(!!t,"Attempting to update undefined context");var i=t&&r.reduce(function(s,a){var o,u,d=a.assignment,c={state:n,action:a,_event:e},h={};if(_(d))h=d(s,e.data,c);else try{for(var f=R(Object.keys(d)),l=f.next();!l.done;l=f.next()){var p=l.value,v=d[p];h[p]=_(v)?v(s,e.data,c):v}}catch(m){o={error:m}}finally{try{l&&!l.done&&(u=f.return)&&u.call(f)}finally{if(o)throw o.error}}return Object.assign({},s,h)},t);return i}var B=function(){};j||(B=function(t,e){var r=t instanceof Error?t:void 0;if(!(!r&&t)&&console!==void 0){var n=["Warning: ".concat(e)];r&&n.push(r),console.warn.apply(console,n)}});function ve(t){return Array.isArray(t)}function _(t){return typeof t=="function"}function P(t){return typeof t=="string"}function Vt(t,e){if(!!t)return P(t)?{type:jt,name:t,predicate:e?e[t]:void 0}:_(t)?{type:jt,name:t.name,predicate:t}:t}function bi(t){try{return"subscribe"in t&&_(t.subscribe)}catch{return!1}}var fe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),rh=(Mt={},Mt[fe]=function(){return this},Mt[Symbol.observable]=function(){return this},Mt);function de(t){return!!t&&"__xstatenode"in t}function Ai(t){return!!t&&typeof t.send=="function"}function lt(t,e){return P(t)||typeof t=="number"?g({type:t},e):t}function F(t,e){if(!P(t)&&"$$type"in t&&t.$$type==="scxml")return t;var r=lt(t);return g({name:r.type,data:r,$$type:"scxml",type:"external"},e)}function be(t,e){var r=Ei(e).map(function(n){return typeof n=="undefined"||typeof n=="string"||de(n)?{target:n,event:t}:g(g({},n),{event:t})});return r}function Ri(t){if(!(t===void 0||t===mi))return ee(t)}function Oi(t,e,r){if(!j){var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(t,"'.").concat(n));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(t,"'. ").concat(n," Current error is '").concat(e,"'.").concat(i))}}}function Ht(t,e,r,n,i){var s=t.options.guards,a={state:i,cond:e,_event:n};if(e.type===jt)return((s==null?void 0:s[e.name])||e.predicate)(r,n.data,a);var o=s==null?void 0:s[e.type];if(!o)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return o(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 Ae=F({type:hi});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);_(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=Jt(t.type,e);if(_(n))r=g(g({},t),{exec:n});else if(n){var i=n.type||t.type;r=g(g(g({},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 zt(t){var e=Ve(t);return g(g({id:P(t)?t:e.id},e),{type:e.type})}function Ci(t){return P(t)?{type:Le,event:t}:pt(t,{to:Ee.Internal})}function dc(t){return{type:Le,_event:F(t.event)}}function pt(t,e){return{to:e?e.to:void 0,type:xe,event:_(t)?t:lt(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:_(t)?t.name:Lt(t)}}function hc(t,e,r,n){var i={_event:r},s=F(_(t.event)?t.event(e,r.data,i):t.event),a;if(P(t.delay)){var o=n&&n[t.delay];a=_(o)?o(e,r.data,i):o}else a=_(t.delay)?t.delay(e,r.data,i):t.delay;var u=_(t.to)?t.to(e,r.data,i):t.to;return g(g({},t),{to:u,_event:s,event:s.data,delay:a})}var pc=function(t,e,r){return g(g({},t),{value:P(t.expr)?t.expr:t.expr(e,r.data,{_event:r})})},Pi=function(t){return{type:kt,sendId:t}};function Ni(t){var e=zt(t);return{type:I.Start,activity:e,exec:void 0}}function Ii(t){var e=_(t)?t:zt(t);return{type:I.Stop,activity:e,exec:void 0}}function vc(t,e,r){var n=_(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 _i=function(t){return{type:Dt,assignment:t}};function ki(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 Re(t,e){var r="".concat(I.DoneInvoke,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function Oe(t,e){var r="".concat(I.ErrorPlatform,".").concat(t),n={type:r,data:e};return n.toString=function(){return r},n}function $t(t,e,r,n,i,s){s===void 0&&(s=!1);var a=C(s?[[],i]:Ft(i,function(f){return f.type===Dt}),2),o=a[0],u=a[1],d=o.length?Vr(r,n,o,e):r,c=s?[r]:void 0,h=U(u.map(function(f){var l;switch(f.type){case Le:return dc(f);case xe:var p=hc(f,d,n,t.options.delays);return j||B(!P(f.delay)||typeof p.delay=="number","No delay reference for delay expression '".concat(f.delay,"' was found on machine '").concat(t.id,"'")),p;case qt:return pc(f,d,n);case pi:{var v=f,m=(l=v.conds.find(function(q){var V=Vt(q.cond,t.options.guards);return!V||Ht(t,V,d,n,e)}))===null||l===void 0?void 0:l.actions;if(!m)return[];var x=C($t(t,e,d,n,ht(ee(m),t.options.actions),s),2),E=x[0],T=x[1];return d=T,c==null||c.push(d),E}case vi:{var m=f.get(d,n.data);if(!m)return[];var O=C($t(t,e,d,n,ht(ee(m),t.options.actions),s),2),N=O[0],M=O[1];return d=M,c==null||c.push(d),N}case Me:return vc(f,d,n);case Dt:{d=Vr(d,n,[f],e),c==null||c.push(d);break}default:var b=Ve(f,t.options.actions),w=b.exec;if(w&&c){var A=c.length-1;b=g(g({},b),{exec:function(q){for(var V=[],Q=1;Q<arguments.length;Q++)V[Q-1]=arguments[Q];w.apply(void 0,k([c[A]],C(V),!1))}})}return b}}).filter(function(f){return!!f}));return[h,d]}var Di=[],Ce=function(t,e){Di.push(t);var r=e(t);return Di.pop(),r};function qi(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[fe]=function(){return this},e}function Ui(t,e,r,n){var i,s=Gt(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[s.type],o=t.data?Te(t.data,r,n):void 0,u=a?ji(a,t.id,o):qi(t.id);return u.meta=t,u}function ji(t,e,r){var n=qi(e);if(n.deferred=!0,de(t)){var i=n.state=Ce(void 0,function(){return(r?t.withContext(r):t).initialState});n.getSnapshot=function(){return i}}return n}function mc(t){try{return typeof t.send=="function"}catch{return!1}}function Mi(t){return mc(t)&&"id"in t}function Li(t){var e;return g((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 Pe(t){return Object.keys(t.states).map(function(e){return t.states[e]}).filter(function(e){return e.type!=="history"})}function Gr(t){var e=[t];return mt(t)?e:e.concat(U(Pe(t).map(Gr)))}function Ne(t,e){var r,n,i,s,a,o,u,d,c=new Set(t),h=Hr(c),f=new Set(e);try{for(var l=R(f),p=l.next();!p.done;p=l.next())for(var v=p.value,m=v.parent;m&&!f.has(m);)f.add(m),m=m.parent}catch(A){r={error:A}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}var x=Hr(f);try{for(var E=R(f),T=E.next();!T.done;T=E.next()){var v=T.value;if(v.type==="compound"&&(!x.get(v)||!x.get(v).length))h.get(v)?h.get(v).forEach(function(q){return f.add(q)}):v.initialStateNodes.forEach(function(q){return f.add(q)});else if(v.type==="parallel")try{for(var O=(a=void 0,R(Pe(v))),N=O.next();!N.done;N=O.next()){var M=N.value;f.has(M)||(f.add(M),h.get(M)?h.get(M).forEach(function(q){return f.add(q)}):M.initialStateNodes.forEach(function(q){return f.add(q)}))}}catch(q){a={error:q}}finally{try{N&&!N.done&&(o=O.return)&&o.call(O)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(s=E.return)&&s.call(E)}finally{if(i)throw i.error}}try{for(var b=R(f),w=b.next();!w.done;w=b.next())for(var v=w.value,m=v.parent;m&&!f.has(m);)f.add(m),m=m.parent}catch(A){u={error:A}}finally{try{w&&!w.done&&(d=b.return)&&d.call(b)}finally{if(u)throw u.error}}return f}function Bi(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]=Bi(s,e)}),i}function Hr(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(o){e={error:o}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Fi(t,e){var r=Ne([t],e);return Bi(t,Hr(r))}function yt(t,e){return Array.isArray(t)?t.some(function(r){return r===e}):t instanceof Set?t.has(e):!1}function Vi(t){return k([],C(new Set(U(k([],C(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Ie(t,e){return e.type==="compound"?Pe(e).some(function(r){return r.type==="final"&&yt(t,r)}):e.type==="parallel"?Pe(e).every(function(r){return Ie(t,r)}):!1}function Hi(t){return t===void 0&&(t=[]),t.reduce(function(e,r){return r.meta!==void 0&&(e[r.id]=r.meta),e},{})}function Jr(t){return new Set(U(t.map(function(e){return e.tags})))}function $r(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(P(t)||P(e))return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(i){return $r(t[i],e[i])})}function Gi(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function Ji(t,e){var r=t.exec,n=g(g({},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=Lr,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||Lr,this.meta=Hi(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return Vi(r.configuration)}})}return t.from=function(e,r){if(e instanceof t)return e.context!==r?new t({value:e.value,context:r,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=Ae;return new t({value:e,context:r,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,r){if(e instanceof t){if(!e.actions.length)return e;var n=Ae;return new t({value:e.value,context:r,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,r)},t.prototype.toStrings=function(e,r){var n=this;if(e===void 0&&(e=this.value),r===void 0&&(r="."),P(e))return[e];var i=Object.keys(e);return i.concat.apply(i,k([],C(i.map(function(s){return n.toStrings(e[s],r).map(function(a){return s+r+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var r=e.tags;e.machine;var n=je(e,["configuration","transitions","tags","machine"]);return g(g({},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;j&&B(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}();var yc={deferEvents:!1},zr=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=g(g({},yc),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 Wr=new Map,gc=0,gt={bookId:function(){return"x:".concat(gc++)},register:function(t,e){return Wr.set(t,e),t},get:function(t){return Wr.get(t)},free:function(t){Wr.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;j||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function Ec(){var t=Wt();if(t&&"__xstate__"in t)return t.__xstate__}function $i(t){if(!!Wt()){var e=Ec();e&&e.register(t)}}function zi(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 d=i.shift();r=t.transition(r,d,u),n.forEach(function(c){return c.next(r)})}s=!1}},o=Li({id:e.id,send:function(d){i.push(d),a()},getSnapshot:function(){return r},subscribe:function(d,c,h){var f=ft(d,c,h);return n.add(f),f.next(r),{unsubscribe:function(){n.delete(f)}}}}),u={parent:e.parent,self:o,id:e.id||"anonymous",observers:n};return r=t.start?t.start(u):r,o}var Sc={sync:!1,autoForward:!1},H;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(H||(H={}));var Wi=function(){function t(e,r){var n=this;r===void 0&&(r=t.defaultOptions),this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=H.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(c,h){if(ve(c))return n.batch(c),n.state;var f=F(lt(c,h));if(n.status===H.Stopped)return j||B(!1,'Event "'.concat(f.name,'" was sent to stopped service "').concat(n.machine.id,`". This service has already reached its final state, and will not transition.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Event: `).concat(JSON.stringify(event)));else if(this.status!==H.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));this.scheduler.schedule(function(){var n,i,s=r.state,a=!1,o=[],u=function(f){var l=F(f);r.forward(l),s=Ce(r,function(){return r.machine.transition(s,l)}),o.push.apply(o,k([],C(s.actions.map(function(p){return Ji(p,s)})),!1)),a=a||!!s.changed};try{for(var d=R(e),c=d.next();!c.done;c=d.next()){var h=c.value;u(h)}}catch(f){n={error:f}}finally{try{c&&!c.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}s.changed=a,s.actions=o,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(jr)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(jr)===0}))throw n.data.data;var i=Ce(this,function(){return r.machine.transition(r.state,n)});return i},t.prototype.forward=function(e){var r,n;try{for(var i=R(this.forwardTo),s=i.next();!s.done;s=i.next()){var a=s.value,o=this.children.get(a);if(!o)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));o.send(e)}}catch(u){r={error:u}}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),o=_(a)?a:a?a.exec:e.exec;if(o)try{return o(i,s.data,{action:e,state:this.state,_event:s})}catch(O){throw this.parent&&this.parent.send({type:"xstate.error",data:O}),O}switch(e.type){case xe:var u=e;if(typeof u.delay=="number"){this.defer(u);return}else u.to?this.sendTo(u._event,u.to):this.send(u._event);break;case kt:this.cancel(e.sendId);break;case it:{if(this.status!==H.Running)return;var d=e.activity;if(!this.state.activities[d.id||d.type])break;if(d.type===I.Invoke){var c=Gt(d.src),h=this.machine.options.services?this.machine.options.services[c.type]:void 0,f=d.id,l=d.data;j||B(!("forward"in d),"`forward` property is deprecated (found in invocation of '".concat(d.src,"' in in machine '").concat(this.machine.id,"'). ")+"Please use `autoForward` instead.");var p="autoForward"in d?d.autoForward:!!d.forward;if(!h){j||B(!1,"No service found for invocation '".concat(d.src,"' in machine '").concat(this.machine.id,"'."));return}var v=l?Te(l,i,s):void 0;if(typeof h=="string")return;var m=_(h)?h(i,s.data,{data:v,src:c,meta:d.meta}):h;if(!m)return;var x=void 0;de(m)&&(m=v?m.withContext(v):m,x={autoForward:p}),this.spawn(m,f,x)}else this.spawnActivity(d);break}case Me:{this.stopChild(e.activity.id);break}case qt:var E=e.label,T=e.value;E?this.logger(E,T):this.logger(T);break;default:j||B(!1,"No implementation found for action type '".concat(e.type,"'"));break}},t.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},t.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),_(r.stop)&&r.stop())},t.prototype.spawn=function(e,r,n){if(Fr(e))return this.spawnPromise(Promise.resolve(e),r);if(_(e))return this.spawnCallback(e,r);if(Mi(e))return this.spawnActor(e,r);if(bi(e))return this.spawnObservable(e,r);if(de(e))return this.spawnMachine(e,g(g({},n),{id:r}));if(wi(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,r){var n=this;r===void 0&&(r={});var i=new t(e,g(g({},this.options),{parent:this,id:r.id||e.id})),s=g(g({},Sc),r);s.sync&&i.onTransition(function(o){n.send(at,{state:o,id:i.id})});var a=i;return this.children.set(i.id,a),s.autoForward&&this.forwardTo.add(i.id),i.onDone(function(o){n.removeChild(i.id),n.send(F(o,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,r){var n=zi(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(u){s||(a=u,i.removeChild(r),i.send(F(Re(r,u),{origin:r})))},function(u){if(!s){i.removeChild(r);var d=Oe(r,u);try{i.send(F(d,{origin:r}))}catch(c){Oi(u,c,r),i.devTools&&i.devTools.send(d,i.state),i.machine.strict&&i.stop()}}});var o=(n={id:r,send:function(){},subscribe:function(u,d,c){var h=ft(u,d,c),f=!1;return e.then(function(l){f||(h.next(l),!f&&h.complete())},function(l){f||h.error(l)}),{unsubscribe:function(){return f=!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,o),o},t.prototype.spawnCallback=function(e,r){var n,i=this,s=!1,a=new Set,o=new Set,u,d=function(f){u=f,o.forEach(function(l){return l(f)}),!s&&i.send(F(f,{origin:r}))},c;try{c=e(d,function(f){a.add(f)})}catch(f){this.send(Oe(r,f))}if(Fr(c))return this.spawnPromise(c,r);var h=(n={id:r,send:function(f){return a.forEach(function(l){return l(f)})},subscribe:function(f){var l=ft(f);return o.add(l.next),{unsubscribe:function(){o.delete(l.next)}}},stop:function(){s=!0,_(c)&&c()},toJSON:function(){return{id:r}},getSnapshot:function(){return u}},n[fe]=function(){return this},n);return this.children.set(r,h),h},t.prototype.spawnObservable=function(e,r){var n,i=this,s,a=e.subscribe(function(u){s=u,i.send(F(u,{origin:r}))},function(u){i.removeChild(r),i.send(F(Oe(r,u),{origin:r}))},function(){i.removeChild(r),i.send(F(Re(r),{origin:r}))}),o=(n={id:r,send:function(){},subscribe:function(u,d,c){return e.subscribe(u,d,c)},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,o),o},t.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},t.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){j||B(!1,"No implementation found for activity '".concat(e.type,"'"));return}var n=r(this.state.context,e);this.spawnEffect(e.id,n)},t.prototype.spawnEffect=function(e,r){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[fe]=function(){return this},n))},t.prototype.attachDev=function(){var e=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(g(g({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},r),{features:g({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}$i(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[fe]=function(){return this},t.prototype.getSnapshot=function(){return this.status===H.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=me,t}();function me(t,e){var r=new Wi(t,e);return r}function wc(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function Et(t){return g(g({type:st},t),{toJSON:function(){t.onDone,t.onError;var e=je(t,["onDone","onError"]);return g(g({},e),{type:st,src:wc(t.src)})}})}var Je="",Kr="#",St="*",He={},Ge=function(t){return t[0]===Kr},xc=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Tc=function(t,e,r){var n=r.slice(0,-1).some(function(s){return!("cond"in s)&&!("in"in s)&&(P(s.target)||de(s.target))}),i=e===Je?"the transient event":"event '".concat(e,"'");B(!n,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Ki=function(){function t(e,r,n,i){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var a;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(xc(),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||k([this.machine.key],C(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,j||B(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Fe(this.config.states,function(d,c){var h,f=new t(d,{},void 0,{parent:s,key:c});return Object.assign(s.idMap,g((h={},h[f.id]=f,h),f.idMap)),f}):He;var o=0;function u(d){var c,h;d.order=o++;try{for(var f=R(Pe(d)),l=f.next();!l.done;l=f.next()){var p=l.value;u(p)}}catch(v){c={error:v}}finally{try{l&&!l.done&&(h=f.return)&&h.call(f)}finally{if(c)throw c.error}}}u(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(d){var c=d.event;return c===Je}):Je in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=ee(this.config.entry||this.config.onEntry).map(function(d){return Ve(d)}),this.onExit=ee(this.config.exit||this.config.onExit).map(function(d){return Ve(d)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=ee(this.config.invoke).map(function(d,c){var h,f;if(de(d)){var l=dt(s.id,c);return s.machine.options.services=g((h={},h[l]=d,h),s.machine.options.services),Et({src:l,id:l})}else if(P(d.src)){var l=d.id||dt(s.id,c);return Et(g(g({},d),{id:l,src:d.src}))}else if(de(d.src)||_(d.src)){var l=d.id||dt(s.id,c);return s.machine.options.services=g((f={},f[l]=d.src,f),s.machine.options.services),Et(g(g({id:l},d),{src:l}))}else{var p=d.src;return Et(g(g({id:dt(s.id,c)},d),{src:p}))}}),this.activities=ee(this.config.activities).concat(this.invoke).map(function(d){return zt(d)}),this.transition=this.transition.bind(this),this.tags=ee(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Gr(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,o=n.services,u=n.delays;return new t(this.config,{actions:g(g({},i),e.actions),activities:g(g({},s),e.activities),guards:g(g({},a),e.guards),services:g(g({},o),e.services),delays:g(g({},u),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: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 o=_(s)?"".concat(e.id,":delay[").concat(a,"]"):s,u=ki(o,e.id);return e.onEntry.push(pt(u,{delay:s})),e.onExit.push(Pi(u)),u},i=ve(r)?r.map(function(s,a){var o=n(s.delay,a);return g(g({},s),{event:o})}):U(Object.keys(r).map(function(s,a){var o=r[s],u=P(o)?{target:o}:o,d=isNaN(+s)?s:+s,c=n(d,a);return ee(u).map(function(h){return g(g({},h),{event:c,delay:d})})}));return i.map(function(s){var a=s.delay;return g(g({},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),o=[this];return o.push.apply(o,k([],C(U(a.map(function(u){return n.getStateNode(u).getStateNodes(i[u])}))),!1)),o},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(Ne([],this.getStateNodes(r.value)));return new se(g(g({},r),{value:this.resolve(r.value),configuration:n,done:Ie(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 o=R(Object.keys(e)),u=o.next();!u.done;u=o.next()){var d=u.value,c=e[d];if(!!c){var h=this.getStateNode(d),f=h._transition(c,r,n);f&&(a[d]=f)}}}catch(E){i={error:E}}finally{try{u&&!u.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}var l=Object.keys(a).map(function(E){return a[E]}),p=U(l.map(function(E){return E.transitions})),v=l.some(function(E){return E.transitions.length>0});if(!v)return this.next(r,n);var m=U(l.map(function(E){return E.entrySet})),x=U(Object.keys(a).map(function(E){return a[E].configuration}));return{transitions:p,entrySet:m,exitSet:U(l.map(function(E){return E.exitSet})),configuration:x,source:r,actions:U(Object.keys(a).map(function(E){return a[E].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,o=[],u=[],d;try{for(var c=R(this.getCandidates(a)),h=c.next();!h.done;h=c.next()){var f=h.value,l=f.cond,p=f.in,v=e.context,m=p?P(p)&&Ge(p)?e.matches(Be(this.getStateNodeById(p).path,this.delimiter)):ut(Be(p,this.delimiter),yi(this.path.slice(0,-2))(e.value)):!0,x=!1;try{x=!l||Ht(this.machine,l,v,r,e)}catch(N){throw new Error("Unable to evaluate guard '".concat(l.name||l.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
|
|
31
|
-
`).concat(N.message))}if(x&&m){f.target!==void 0&&(u=f.target),o.push.apply(o,k([],C(f.actions),!1)),d=f;break}}}catch(N){n={error:N}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}if(!!d){if(!u.length)return{transitions:[d],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:o};var E=U(u.map(function(N){return s.getRelativeStateNodes(N,e.historyValue)})),T=!!d.internal,O=T?[]:U(E.map(function(N){return s.nodesFromChild(N)}));return{transitions:[d],entrySet:O,exitSet:T?[]:[this],configuration:E,source:e,actions:o}}},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,o,u,d=Ne([],i?this.getStateNodes(i.value):[this]),c=e.configuration.length?Ne(d,e.configuration):d;try{for(var h=R(c),f=h.next();!f.done;f=h.next()){var l=f.value;yt(d,l)||e.entrySet.push(l)}}catch(b){s={error:b}}finally{try{f&&!f.done&&(a=h.return)&&a.call(h)}finally{if(s)throw s.error}}try{for(var p=R(d),v=p.next();!v.done;v=p.next()){var l=v.value;(!yt(c,l)||yt(e.exitSet,l.parent))&&e.exitSet.push(l)}}catch(b){o={error:b}}finally{try{v&&!v.done&&(u=p.return)&&u.call(p)}finally{if(o)throw o.error}}var m=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?Te(b.doneData,r,n):void 0));var q=A.parent;return q.type==="parallel"&&Pe(q).every(function(V){return Ie(e.configuration,V)})&&w.push(vt(q.id)),w}));e.exitSet.sort(function(b,w){return w.order-b.order}),e.entrySet.sort(function(b,w){return b.order-w.order});var x=new Set(e.entrySet),E=new Set(e.exitSet),T=C([U(Array.from(x).map(function(b){return k(k([],C(b.activities.map(function(w){return Ni(w)})),!1),C(b.onEntry),!1)})).concat(m.map(Ci)),U(Array.from(E).map(function(b){return k(k([],C(b.onExit),!1),C(b.activities.map(function(w){return Ii(w)})),!1)}))],2),O=T[0],N=T[1],M=ht(N.concat(e.actions).concat(O),this.machine.options.actions);return M},t.prototype.transition=function(e,r,n){e===void 0&&(e=this.initialState);var i=F(r),s;if(e instanceof se)s=n===void 0?e:this.resolveState(se.from(e,n));else{var a=P(e)?this.resolve(ot(this.getResolvedPath(e))):this.resolve(e),o=n!=null?n:this.machine.context;s=this.resolveState(se.from(a,o))}if(!j&&i.name===St)throw new Error("An event cannot have the wildcard type ('".concat(St,"')"));if(this.strict&&!this.events.includes(i.name)&&!Si(i.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(i.name,"'"));var u=this._transition(s.value,s,i)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},d=Ne([],this.getStateNodes(s.value)),c=u.configuration.length?Ne(d,u.configuration):d;return u.configuration=k([],C(c),!1),this.resolveTransition(u,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,k([],C(s),!1)),e},t.prototype.resolveTransition=function(e,r,n,i){var s,a,o=this;i===void 0&&(i=Ae);var u=e.configuration,d=!r||e.transitions.length>0,c=d?Fi(this.machine,u):void 0,h=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,f=this.getActions(e,n,i,r),l=r?g({},r.activities):{};try{for(var p=R(f),v=p.next();!v.done;v=p.next()){var m=v.value;m.type===it?l[m.activity.id||m.activity.type]=m:m.type===Me&&(l[m.activity.id||m.activity.type]=!1)}}catch(Z){s={error:Z}}finally{try{v&&!v.done&&(a=p.return)&&a.call(p)}finally{if(s)throw s.error}}var x=C($t(this,r,n,i,f,this.machine.config.preserveActionOrder),2),E=x[0],T=x[1],O=C(Ft(E,function(Z){return Z.type===Le||Z.type===xe&&Z.to===Ee.Internal}),2),N=O[0],M=O[1],b=E.filter(function(Z){var Ue;return Z.type===it&&((Ue=Z.activity)===null||Ue===void 0?void 0:Ue.type)===st}),w=b.reduce(function(Z,Ue){return Z[Ue.activity.id]=Ui(Ue.activity,o.machine,T,i),Z},r?g({},r.children):{}),A=d?e.configuration:r?r.configuration:[],q=Ie(A,this),V=new se({value:c||r.value,context:T,_event:i,_sessionid:r?r._sessionid:null,historyValue:c?h?Ti(h,c):void 0:r?r.historyValue:void 0,history:!c||e.source?r:void 0,actions:c?M:[],activities:c?l:r?r.activities:{},events:[],configuration:A,transitions:e.transitions,children:w,done:q,tags:Jr(A),machine:this}),Q=n!==T;V.changed=i.name===at||Q;var ge=V.history;ge&&delete ge.history;var It=!q&&(this._transient||u.some(function(Z){return Z._transient}));if(!d&&(!It||i.name===Je))return V;var ie=V;if(!q)for(It&&(ie=this.resolveRaisedTransition(ie,{type:di},i));N.length;){var tc=N.shift();ie=this.resolveRaisedTransition(ie,tc._event,i)}var rc=ie.changed||(ge?!!ie.actions.length||Q||typeof ge.value!=typeof ie.value||!$r(ie.value,ge.value):void 0);return ie.changed=rc,ie.history=ge,ie},t.prototype.getStateNode=function(e){if(Ge(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},t.prototype.getStateNodeById=function(e){var r=Ge(e)?e.slice(Kr.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(Kr.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=Br(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 j||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:Br(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=gi(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 o=R(Object.keys(s)),u=o.next();!u.done;u=o.next()){var d=u.value,c=s[d];if(c.states)try{for(var h=(n=void 0,R(c.events)),f=h.next();!f.done;f=h.next()){var l=f.value;a.add("".concat(l))}}catch(p){n={error:p}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}}catch(p){e={error:p}}finally{try{u&&!u.done&&(r=o.return)&&r.call(o)}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(o){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
|
|
32
|
-
`).concat(o.message))}else return r.getStateNodeByPath(s)})},t.prototype.formatTransition=function(e){var r=this,n=Ri(e.target),i="internal"in e?e.internal:n?n.some(function(u){return P(u)&&u[0]===r.delimiter}):!0,s=this.machine.options.guards,a=this.resolveTarget(n),o=g(g({},e),{actions:ht(ee(e.actions)),cond:Vt(e.cond,s),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return g(g({},o),{target:o.target?o.target.map(function(u){return"#".concat(u.id)}):void 0,source:"#".concat(r.id)})}});return o},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,o=s[a],u=o===void 0?[]:o,d=je(s,[typeof a=="symbol"?a:a+""]);i=U(Object.keys(d).map(function(E){!j&&E===Je&&B(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var T=be(E,d[E]);return j||Tc(n,E,T),T}).concat(be(St,u)))}var c=this.config.always?be("",this.config.always):[],h=this.config.onDone?be(String(vt(this.id)),this.config.onDone):[];j||B(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var f=U(this.invoke.map(function(E){var T=[];return E.onDone&&T.push.apply(T,k([],C(be(String(Re(E.id)),E.onDone)),!1)),E.onError&&T.push.apply(T,k([],C(be(String(Oe(E.id)),E.onError)),!1)),T})),l=this.after,p=U(k(k(k(k([],C(h),!1),C(f),!1),C(i),!1),C(c),!1).map(function(E){return ee(E).map(function(T){return n.formatTransition(T)})}));try{for(var v=R(l),m=v.next();!m.done;m=v.next()){var x=m.value;p.push(x)}}catch(E){e={error:E}}finally{try{m&&!m.done&&(r=v.return)&&r.call(v)}finally{if(e)throw e.error}}return p},t}();function ae(t,e){return new Ki(t,e)}var D=_i,z=pt;var Kt="nhostRefreshToken",Xt="nhostRefreshTokenExpiresAt";var _e={status:10,error:"invalid-email",message:"Email is incorrectly formatted"};var wt={status:10,error:"invalid-password",message:"Password is incorrectly formatted"},Xi={status:10,error:"invalid-phone-number",message:"Phone number is incorrectly formatted"},Yi={status:10,error:"no-mfa-ticket",message:"No MFA ticket has been provided"},Qi={status:10,error:"no-refresh-token",message:"No refresh token has been provided"},Zi={status:20,error:"refresher-already-running",message:"The token refresher is already running. You must wait until is has finished before submitting a new token."};var oa=nt(aa());var oe=t=>{let e=oa.default.create({baseURL:t});return e.interceptors.response.use(r=>r,r=>{var n,i,s,a,o,u,d,c,h,f;return Promise.reject({error:{message:(o=(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?o:JSON.stringify(r),status:(h=(c=(u=r.response)==null?void 0:u.status)!=null?c:(d=r.response)==null?void 0:d.data.statusCode)!=null?h:0,error:((f=r.response)==null?void 0:f.data.error)||r.request.statusText||"network"}})}),e};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 gl={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 mn(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 o="";for(var u in a)!a[u]||(o+="; "+u,a[u]!==!0&&(o+="="+a[u].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+o}}function n(i){if(!(typeof document=="undefined"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],a={},o=0;o<s.length;o++){var u=s[o].split("="),d=u.slice(1).join("=");try{var c=decodeURIComponent(u[0]);if(a[c]=t.read(d,c),i===c)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 mn(this.converter,ir({},this.attributes,i))},withConverter:function(i){return mn(ir({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var El=mn(gl,{path:"/"}),sr=El;var or=typeof window!="undefined",ar=new Map,Sl=t=>{var e;return or&&typeof localStorage!="undefined"?localStorage.getItem(t):(e=ar.get(t))!=null?e:null},wl=(t,e)=>{or&&typeof localStorage!="undefined"?e?localStorage.setItem(t,e):localStorage.removeItem(t):e?ar.set(t,e):ar.has(t)&&ar.delete(t)};var ua=(t,e)=>{if(!e||t==="localStorage"||t==="web")return Sl;if(t==="react-native")return r=>{var n;return(n=e.getItem)==null?void 0:n.call(e,r)};if(t==="capacitor")return r=>{var n;return(n=e.get)==null?void 0:n.call(e,{key:r})};if(t==="expo-secure-storage")return r=>{var n;return(n=e.getItemAsync)==null?void 0:n.call(e,r)};if(t==="cookie")return r=>{var n;return or&&(n=sr.get(r))!=null?n:null};if(t==="custom"){if(e.getItem&&e.removeItem)return e.getItem;if(e.getItemAsync)return e.getItemAsync;throw Error("clientStorageType is set to 'custom' but clientStorage is missing getItem or getItemAsync property")}throw Error(`Unknown storage type: ${t}`)},ca=(t,e)=>{if(!e||t==="localStorage"||t==="web")return wl;if(t==="react-native")return(r,n)=>{var i,s;return n?(i=e.setItem)==null?void 0:i.call(e,r,n):(s=e.removeItem)==null?void 0:s.call(e,r)};if(t==="capacitor")return(r,n)=>{var i,s;return n?(i=e.set)==null?void 0:i.call(e,{key:r,value:n}):(s=e.remove)==null?void 0:s.call(e,{key:r})};if(t==="expo-secure-storage")return async(r,n)=>{var i,s;return n?(i=e.setItemAsync)==null?void 0:i.call(e,r,n):(s=e.deleteItemAsync)==null?void 0:s.call(e,r)};if(t==="cookie")return(r,n)=>{or&&(n?sr.set(r,n):sr.remove(r))};if(t==="custom"){if(!e.removeItem)throw Error("clientStorageType is set to 'custom' but clientStorage is missing a removeItem property");if(e.setItem)return(r,n)=>{var i,s;return n?(i=e.setItem)==null?void 0:i.call(e,r,n):(s=e.removeItem)==null?void 0:s.call(e,r)};if(e.setItemAsync)return async(r,n)=>{var i,s;return n?(i=e.setItemAsync)==null?void 0:i.call(e,r,n):(s=e.removeItem)==null?void 0:s.call(e,r)};throw Error("clientStorageType is set to 'custom' but clientStorage is missing setItem or setItemAsync property")}throw Error(`Unknown storage type: ${t}`)};var la=(t,e)=>{let r=e&&Object.entries(e).map(([n,i])=>{let s=Array.isArray(i)?i.join(","):typeof i=="object"?JSON.stringify(i):i;return`${n}=${encodeURIComponent(s)}`}).join("&");return r?`${t}?${r}`:t},ne=(t,e)=>{var r;return e!=null&&e.redirectTo?{...e,redirectTo:(r=e==null?void 0:e.redirectTo)!=null&&r.startsWith("/")?t+e.redirectTo:e==null?void 0:e.redirectTo}:e};function At(t,e){var i;if(!e){if(typeof window=="undefined")return;e=((i=window.location)==null?void 0:i.href)||""}t=t.replace(/[\[\]]/g,"\\$&");let r=new RegExp("[?&#]"+t+"(=([^&#]*)|&|#|$)"),n=r.exec(e);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}function yn(t){var r;if(typeof window=="undefined")return;let e=window==null?void 0:window.location;if(!!e&&e){let n=new URLSearchParams(e.search),i=new URLSearchParams((r=e.hash)==null?void 0:r.slice(1));n.delete(t),i.delete(t);let s=window.location.pathname;Array.from(n).length&&(s+=`?${n.toString()}`),Array.from(i).length&&(s+=`#${i.toString()}`),window.history.pushState({},"",s)}}var Ke=t=>!!t&&typeof t=="string"&&!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),ur=t=>!!t&&typeof t=="string"&&t.length>=3,fa=t=>!!t&&typeof t=="string";var gn={user:null,mfa:null,accessToken:{value:null,expiresAt:null},refreshTimer:{startedAt:null,attempts:0,lastAttempt:null},refreshToken:{value:null},errors:{}};var da=({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:D({error:i=>_e}),saveRequestError:D({error:(i,{data:{error:s}})=>s}),reportError:z(i=>({type:"ERROR",error:i.error})),reportSuccess:z("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{requestChange:async(i,{email:s,options:a})=>(await n.post("/user/email/change",{newEmail:s,options:ne(e,a)},{headers:{authorization:`Bearer ${r==null?void 0:r.state.context.accessToken.value}`}})).data}})};var ha=({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:D({error:n=>wt}),saveRequestError:D({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:z(n=>({type:"ERROR",error:n.error})),reportSuccess:z("SUCCESS")},guards:{invalidPassword:(n,{password:i})=>!ur(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 pa=({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:D({error:(n,{data:{error:i}})=>(console.log(i),i)}),reportError:z(n=>({type:"ERROR",error:n.error})),reportSuccess:z("SUCCESS")},services:{requestChange:(n,{email:i,options:s})=>r.post("/user/password/reset",{email:i,options:ne(e,s)})}})};var va=({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:D({error:i=>_e}),saveRequestError:D({error:(i,{data:{error:s}})=>s}),reportError:z(i=>({type:"ERROR",error:i.error})),reportSuccess:z("SUCCESS")},guards:{invalidEmail:(i,{email:s})=>!Ke(s)},services:{request:async(i,{email:s,options:a})=>(await n.post("/user/email/send-verification-email",{email:s,options:ne(e,a)})).data}})};var ma=({backendUrl:t,clientUrl:e,clientStorageGetter:r,clientStorageSetter:n,clientStorageType:i="web",clientStorage:s,refreshIntervalTime:a,autoRefreshToken:o=!0,autoSignIn:u=!0})=>{let d=r||ua(i,s),c=n||ca(i,s),h=oe(t),f=async(l,p,v)=>(await h.post(l,p,v)).data;return ae({schema:{context:{},events:{}},tsTypes:{},context:gn,preserveActionOrder:!0,id:"nhost",type:"parallel",states:{authentication:{initial:"starting",on:{SESSION_UPDATE:[{cond:"hasSession",actions:["saveSession","resetTimer","reportTokenChanged"],target:".signedIn"}]},states:{starting:{tags:["loading"],always:{cond:"isSignedIn",target:"signedIn"},invoke:{id:"importRefreshToken",src:"importRefreshToken",onDone:{actions:["saveSession","reportTokenChanged"],target:"signedIn"},onError:{actions:["saveAuthenticationError"],target:"signedOut"}}},signedOut:{initial:"noErrors",entry:"reportSignedOut",states:{noErrors:{},success:{},needsEmailVerification:{},needsSmsOtp:{},needsMfa:{},failed:{exit:"resetAuthenticationError",initial:"server",states:{server:{},validation:{states:{password:{},email:{},phoneNumber:{}}}}},signingOut:{entry:["clearContextExceptRefreshToken"],exit:["destroyRefreshToken","reportTokenChanged"],invoke:{src:"signout",id:"signingOut",onDone:{target:"success"},onError:{target:"failed.server"}}}},on:{SIGNIN_PASSWORD:[{cond:"invalidEmail",actions:["saveInvalidEmail"],target:".failed.validation.email"},{cond:"invalidPassword",actions:["saveInvalidPassword"],target:".failed.validation.password"},"#nhost.authentication.authenticating.password"],SIGNIN_PASSWORDLESS_EMAIL:[{cond:"invalidEmail",actions:"saveInvalidEmail",target:".failed.validation.email"},"#nhost.authentication.authenticating.passwordlessEmail"],SIGNIN_PASSWORDLESS_SMS:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSms"],SIGNIN_PASSWORDLESS_SMS_OTP:[{cond:"invalidPhoneNumber",actions:"saveInvalidPhoneNumber",target:".failed.validation.phoneNumber"},"#nhost.authentication.authenticating.passwordlessSmsOtp"],SIGNUP_EMAIL_PASSWORD:[{cond:"invalidEmail",actions:"saveInvalidSignUpEmail",target:".failed.validation.email"},{cond:"invalidPassword",actions:"saveInvalidSignUpPassword",target:".failed.validation.password"},"#nhost.authentication.registering"],SIGNIN_ANONYMOUS:"#nhost.authentication.authenticating.anonymous",SIGNIN_MFA_TOTP:[{cond:"noMfaTicket",actions:["saveNoMfaTicketError"],target:".failed"},"#nhost.authentication.authenticating.mfa.totp"]}},authenticating:{states:{passwordlessEmail:{invoke:{src:"signInPasswordlessEmail",id:"authenticatePasswordlessEmail",onDone:"#nhost.authentication.signedOut.needsEmailVerification",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSms:{invoke:{src:"signInPasswordlessSms",id:"authenticatePasswordlessSms",onDone:"#nhost.authentication.signedOut.needsSmsOtp",onError:{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}}},passwordlessSmsOtp:{invoke:{src:"signInPasswordlessSmsOtp",id:"authenticatePasswordlessSmsOtp",onDone:{actions:["saveSession","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","reportTokenChanged"],target:"#nhost.authentication.signedIn"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveAuthenticationError",target:"#nhost.authentication.signedOut.failed.server"}]}},anonymous:{invoke:{src:"signInAnonymous",id:"authenticateAnonymously",onDone:{actions:["saveSession","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","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","reportTokenChanged"]},{target:"#nhost.authentication.signedOut.needsEmailVerification"}],onError:[{cond:"unverified",target:"#nhost.authentication.signedOut.needsEmailVerification"},{actions:"saveRegisrationError",target:"#nhost.authentication.signedOut.failed.server"}]}},signedIn:{type:"parallel",entry:["reportSignedIn","cleanUrl","broadcastToken"],on:{SIGNOUT:"#nhost.authentication.signedOut.signingOut",DEANONYMIZE:{target:".deanonymizing"}},states:{refreshTimer:{id:"timer",initial:"idle",states:{disabled:{type:"final"},stopped:{always:{cond:"noToken",target:"idle"}},idle:{always:[{cond:"isAutoRefreshDisabled",target:"disabled"},{cond:"hasRefreshToken",target:"running"}]},running:{initial:"pending",entry:"resetTimer",states:{pending:{after:{"1000":{internal:!1,target:"pending"}},always:{cond:"refreshTimerShouldRefresh",target:"refreshing"}},refreshing:{invoke:{src:"refreshToken",id:"refreshToken",onDone:{actions:["saveSession","resetTimer","reportTokenChanged"],target:"pending"},onError:[{actions:"saveRefreshAttempt",target:"pending"}]}}}}}},deanonymizing:{initial:"error",states:{error:{},success:{}}}}}}},token:{initial:"idle",states:{idle:{on:{TRY_TOKEN:"running"},initial:"noErrors",states:{noErrors:{},error:{}}},running:{invoke:{src:"refreshToken",id:"authenticateWithToken",onDone:{actions:["saveSession","reportTokenChanged"],target:["#nhost.authentication.signedIn","idle.noErrors"]},onError:[{cond:"isSignedIn",target:"idle.error"},{target:["#nhost.authentication.signedOut","idle.error"]}]}}}}}},{actions:{reportSignedIn:z("SIGNED_IN"),reportSignedOut:z("SIGNED_OUT"),reportTokenChanged:z("TOKEN_CHANGED"),clearContextExceptRefreshToken:D(({refreshToken:{value:l}})=>(c(Xt,null),{...gn,refreshToken:{value:l}})),saveSession:D({user:(l,{data:p})=>{var v;return(v=p==null?void 0:p.session)==null?void 0:v.user},accessToken:(l,{data:p})=>{var v,m;if(p.session.accessTokenExpiresIn){let x=new Date(Date.now()+p.session.accessTokenExpiresIn*1e3).toISOString();c(Xt,x)}else c(Xt,null);return{value:(v=p==null?void 0:p.session)==null?void 0:v.accessToken,expiresAt:new Date(Date.now()+((m=p==null?void 0:p.session)==null?void 0:m.accessTokenExpiresIn)*1e3)}},refreshToken:(l,{data:p})=>{var v;return c(Kt,p.session.refreshToken),{value:(v=p==null?void 0:p.session)==null?void 0:v.refreshToken}}}),saveMfaTicket:D({mfa:(l,p)=>{var v,m;return(m=(v=p.data)==null?void 0:v.mfa)!=null?m:null}}),resetTimer:D({refreshTimer:(l,p)=>({startedAt:new Date,attempts:0,lastAttempt:null})}),saveRefreshAttempt:D({refreshTimer:(l,p)=>({startedAt:l.refreshTimer.startedAt,attempts:l.refreshTimer.attempts+1,lastAttempt:new Date})}),saveAuthenticationError:D({errors:({errors:l},{data:{error:p}})=>({...l,authentication:p})}),resetAuthenticationError:D({errors:({errors:{authentication:l,...p}})=>p}),saveInvalidEmail:D({errors:({errors:l})=>({...l,authentication:_e})}),saveInvalidPassword:D({errors:({errors:l})=>({...l,authentication:wt})}),saveInvalidPhoneNumber:D({errors:({errors:l})=>({...l,authentication:Xi})}),saveRegisrationError:D({errors:({errors:l},{data:{error:p}})=>({...l,registration:p})}),resetSignUpError:D({errors:({errors:{registration:l,...p}})=>p}),saveInvalidSignUpPassword:D({errors:({errors:l})=>({...l,registration:wt})}),saveInvalidSignUpEmail:D({errors:({errors:l})=>({...l,registration:_e})}),saveNoMfaTicketError:D({errors:({errors:l})=>({...l,registration:Yi})}),destroyRefreshToken:D({refreshToken:l=>(c(Kt,null),{value:null})}),cleanUrl:()=>{u&&At("refreshToken")&&(yn("refreshToken"),yn("type"))},broadcastToken:l=>{if(u)try{new BroadcastChannel("nhost").postMessage(l.refreshToken.value)}catch{}}},guards:{isSignedIn:l=>!!l.user&&!!l.refreshToken.value&&!!l.accessToken.value,noToken:l=>!l.refreshToken.value,noMfaTicket:(l,{ticket:p})=>{var v;return!p&&!((v=l.mfa)!=null&&v.ticket)},hasRefreshToken:l=>!!l.refreshToken.value,isAutoRefreshDisabled:()=>!o,refreshTimerShouldRefresh:l=>{var x;let{expiresAt:p}=l.accessToken;return p?l.refreshTimer.lastAttempt?Date.now()-l.refreshTimer.lastAttempt.getTime()>5*1e3:a&&Date.now()-(((x=l.refreshTimer.startedAt)==null?void 0:x.getTime())||0)>a*1e3?!0:p.getTime()-Date.now()-1e3*300<=0:!1},unverified:(l,{data:{error:p}})=>p.status===401&&p.message==="Email is not verified",hasSession:(l,p)=>{var v;return!!((v=p.data)!=null&&v.session)},hasMfaTicket:(l,p)=>{var v;return!!((v=p.data)!=null&&v.mfa)},invalidEmail:(l,{email:p})=>!Ke(p),invalidPassword:(l,{password:p})=>!ur(p),invalidPhoneNumber:(l,{phoneNumber:p})=>!fa(p)},services:{signInPassword:(l,{email:p,password:v})=>f("/signin/email-password",{email:p,password:v}),signInPasswordlessSms:(l,{phoneNumber:p,options:v})=>f("/signin/passwordless/sms",{phoneNumber:p,options:ne(e,v)}),signInPasswordlessSmsOtp:(l,{phoneNumber:p,otp:v})=>f("/signin/passwordless/sms/otp",{phoneNumber:p,otp:v}),signInPasswordlessEmail:(l,{email:p,options:v})=>f("/signin/passwordless/email",{email:p,options:ne(e,v)}),signInAnonymous:l=>f("/signin/anonymous"),signInMfaTotp:(l,{ticket:p,otp:v})=>{var m;return f("/signin/mfa/totp",{ticket:p||((m=l.mfa)==null?void 0:m.ticket),otp:v})},refreshToken:async(l,p)=>{let v=p.type==="TRY_TOKEN"?p.token:l.refreshToken.value;return{session:await f("/token",{refreshToken:v})}},signout:(l,p)=>f("/signout",{refreshToken:l.refreshToken.value,all:!!p.all}),registerUser:(l,{email:p,password:v,options:m})=>f("/signup/email-password",{email:p,password:v,options:ne(e,m)}),importRefreshToken:async()=>{let l=null;if(u){let v=At("refreshToken")||null;if(v)try{return{session:await f("/token",{refreshToken:v})}}catch(m){l=m.error}else{let m=At("error");if(m)return Promise.reject({error:{status:10,error:m,message:At("errorDescription")||m}})}}let p=await d(Kt);if(p)try{return{session:await f("/token",{refreshToken:p})}}catch(v){l=v.error}return Promise.reject({error:l})}}})};var Xe=class{constructor({clientStorageType:e="web",autoSignIn:r=!0,autoRefreshToken:n=!0,start:i=!0,backendUrl:s,clientUrl:a,...o}){this._subscriptions=new Set;if(this.backendUrl=s,this.clientUrl=a,this.machine=ma({...o,backendUrl:s,clientUrl:a,clientStorageType:e,autoSignIn:r,autoRefreshToken:n}),i&&(this.interpreter=me(this.machine),this.interpreter.start()),typeof window!="undefined"&&r)try{this._channel=new BroadcastChannel("nhost"),this._channel.addEventListener("message",u=>{var c;let d=(c=this.interpreter)==null?void 0:c.state.context.refreshToken.value;this.interpreter&&u.data!==d&&this.interpreter.send({type:"TRY_TOKEN",token:u.data})})}catch{}}get interpreter(){return this._interpreter}set interpreter(e){this._interpreter=e,e&&this._subscriptions.forEach(r=>r(this))}onStart(e){this.interpreter?e(this):this._subscriptions.add(e)}};var ya=()=>typeof window!="undefined",we=t=>!t||!t.accessToken.value||!t.refreshToken.value||!t.accessToken.expiresAt?null:{accessToken:t.accessToken.value,accessTokenExpiresIn:(t.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:t.refreshToken.value,user:t.user};var ga={message:"User is already signed in",status:100},Rl={message:"User is not authenticated",status:101},Ol={message:"User is not anonymous",status:101},Cl={message:"Email needs verification",status:102},cr=class{constructor({url:e,autoRefreshToken:r=!0,autoSignIn:n=!0,autoLogin:i,clientStorage:s,clientStorageType:a,clientStorageGetter:o,clientStorageSetter:u,refreshIntervalTime:d,start:c=!0}){var h;this._client=new Xe({backendUrl:e,clientUrl:typeof window!="undefined"&&((h=window.location)==null?void 0:h.origin)||"",autoRefreshToken:r,autoSignIn:typeof i=="boolean"?i:n,start:c,clientStorage:s,clientStorageType:a,clientStorageGetter:o,clientStorageSetter:u,refreshIntervalTime:d})}async signUp(e){let r=await this.waitUntilReady(),{email:n,password:i,options:s}=e;return this.isAuthenticated()?{session:null,error:ga}:new Promise(a=>{r.send("SIGNUP_EMAIL_PASSWORD",{email:n,password:i,options:s}),r.onTransition(o=>{if(o.matches({authentication:{signedOut:"needsEmailVerification"}}))return a({session:null,error:null});if(o.matches({authentication:{signedOut:"failed"}}))return a({session:null,error:o.context.errors.registration||null});if(o.matches({authentication:"signedIn"}))return a({session:we(o.context),error:null})})})}async signIn(e){let r=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:ga};if("provider"in e){let{provider:n,options:i}=e,s=la(`${this._client.backendUrl}/signin/provider/${n}`,ne(this._client.clientUrl,i));return ya()&&(window.location.href=s),{providerUrl:s,provider:n,session:null,mfa:null,error:null}}return"email"in e&&"password"in e?new Promise(n=>{r.send("SIGNIN_PASSWORD",e),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"needsEmailVerification"}})?n({session:null,mfa:null,error:Cl}):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.send("SIGNIN_PASSWORDLESS_EMAIL",e),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})})}):"phoneNumber"in e&&!("otp"in e)?new Promise(n=>{r.send("SIGNIN_PASSWORDLESS_SMS",e),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})})}):"otp"in e?new Promise(n=>{r.send("SIGNIN_PASSWORDLESS_SMS_OTP",e),r.onTransition(i=>{i.matches({authentication:"signedIn"})?n({session:we(i.context),mfa:null,error:null}):i.matches({authentication:{signedOut:"failed"}})&&n({session:null,mfa:null,error:i.context.errors.authentication||null})})}):{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("SIGNOUT",{all:e==null?void 0:e.all}),r.onTransition(i=>{i.matches({authentication:{signedOut:"success"}})?n({error:null}):i.matches({authentication:{signedOut:{failed:"server"}}})&&n({error:i.context.errors.signout||null})})}):{error:Rl}}async resetPassword({email:e,options:r}){return new Promise(n=>{let i=me(pa(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("REQUEST",{email:e,options:r})})}async changePassword(e){return new Promise(r=>{let n=me(ha(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("REQUEST",{password:e.newPassword})})}async sendVerificationEmail(e){return new Promise(r=>{let n=me(va(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("REQUEST",{email:e.email,options:e.options})})}async changeEmail({newEmail:e,options:r}){return new Promise(n=>{let i=me(da(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("REQUEST",{email:e,options:r})})}async deanonymize(e){let r=await this.waitUntilReady();return new Promise(n=>{var o;if(!this.isAuthenticated()||!((o=r.state.context.user)!=null&&o.isAnonymous))return{error:Ol};let{signInMethod:i,connection:s,...a}=e;r.send("DEANONYMIZE",{signInMethod:i,connection:s,options:a}),r.onTransition(u=>{u.matches({authentication:{signedIn:{deanonymizing:"success"}}})?n({error:null}):u.matches({authentication:{signedIn:{deanonymizing:"error"}}})&&n({error:u.context.errors.authentication||null})}),r.start()})}onTokenChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{i.type==="TOKEN_CHANGED"&&e(we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onTokenChanged was added before the interpreter started. Cannot unsubscribe listener.")}}onAuthStateChanged(e){let r=n=>n.onTransition(({event:i,context:s})=>{(i.type==="SIGNED_IN"||i.type==="SIGNED_OUT")&&e(i.type,we(s))});if(this._client.interpreter){let n=r(this._client.interpreter);return()=>n.stop()}else return this._client.onStart(n=>{r(n.interpreter)}),()=>{console.log("onAuthStateChanged was added before the interpreter started. Cannot unsubscribe listener.")}}isAuthenticated(){var e;return!!((e=this._client.interpreter)!=null&&e.state.matches({authentication:"signedIn"}))}async isAuthenticatedAsync(){return(await this.waitUntilReady()).state.matches({authentication:"signedIn"})}getAuthenticationStatus(){return this.isReady()?{isAuthenticated:this.isAuthenticated(),isLoading:!1}:{isAuthenticated:!1,isLoading:!0}}getJWTToken(){return this.getAccessToken()}getAccessToken(){var e,r;return(r=(e=this._client.interpreter)==null?void 0:e.state.context.accessToken.value)!=null?r:void 0}getDecodedAccessToken(){let e=this.getAccessToken();return e?fi(e):null}getHasuraClaims(){var e;return((e=this.getDecodedAccessToken())==null?void 0:e["https://hasura.io/jwt/claims"])||null}getHasuraClaim(e){var r;return((r=this.getHasuraClaims())==null?void 0:r[e.startsWith("x-hasura-")?e:`x-hasura-${e}`])||null}async refreshSession(e){try{let r=await this.waitUntilReady();return r.state.matches({token:"idle"})?new Promise(n=>{let i=e||r.state.context.refreshToken.value;if(!i)return n({session:null,error:Qi});r.send("TRY_TOKEN",{token:i}),r==null||r.onTransition(s=>{s.matches({token:{idle:"error"}})?n({session:null,error:{status:400,message:"Invalid refresh token"}}):s.event.type==="TOKEN_CHANGED"&&n({session:we(s.context),error:null})})}):{session:null,error:Zi}}catch(r){return{session:null,error:r.message}}}getSession(){var e,r;return we((r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)}getUser(){var e,r,n;return((n=(r=(e=this._client.interpreter)==null?void 0:e.state)==null?void 0:r.context)==null?void 0:n.user)||null}waitUntilReady(){let r=this._client.interpreter;if(!r)throw Error("Auth interpreter not set");return r.state.hasTag("loading")?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("loading"))return clearTimeout(s),n(r)})}):Promise.resolve(r)}isReady(){var e,r;return!((r=(e=this._client.interpreter)==null?void 0:e.state)!=null&&r.hasTag("loading"))}get client(){return this._client}};var Co=nt(Oo()),Er=class{constructor({url:e}){this.url=e,this.httpClient=Co.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 Sr=class{constructor({url:e}){this.url=e,this.api=new Er({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 Du=nt(ni()),Cr=class{constructor(e){let{url:r}=e;this.accessToken=null,this.instance=Du.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 Zu=nt(ni()),ec=nt(Qu()),Dr=class{constructor(e){let{url:r}=e;this.url=r,this.accessToken=null,this.instance=Zu.default.create({baseURL:r})}async request(e,r,n){let i={...n==null?void 0:n.headers,...this.generateAccessTokenHeaders()};try{let s="",o=(await this.instance.post("",{operationName:s||void 0,query:typeof e=="string"?e:(0,ec.print)(e),variables:r},{...n,headers:i})).data,{data:u}=o;return o.errors?{data:null,error:o.errors}:typeof u!="object"||Array.isArray(u)||u===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:{data:u,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 qr=class{constructor({backendUrl:e,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:o,autoSignIn:u,start:d=!0}){if(!e)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");this.auth=new cr({url:`${e}/v1/auth`,refreshIntervalTime:r,clientStorageGetter:n,clientStorageSetter:i,clientStorage:s,clientStorageType:a,autoRefreshToken:o,autoSignIn:u,start:d}),this.storage=new Sr({url:`${e}/v1/storage`}),this.functions=new Cr({url:`${e}/v1/functions`}),this.graphql=new Dr({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((c,h)=>{c==="SIGNED_OUT"&&(this.storage.setAccessToken(void 0),this.functions.setAccessToken(void 0),this.graphql.setAccessToken(void 0))}),this.auth.onTokenChanged(c=>{this.storage.setAccessToken(c==null?void 0:c.accessToken),this.functions.setAccessToken(c==null?void 0:c.accessToken),this.graphql.setAccessToken(c==null?void 0:c.accessToken)})})}};var yg=t=>new qr(t);export{qr as NhostClient,Cr as NhostFunctionsClient,Dr as NhostGraphqlClient,yg as createClient};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { HasuraAuthClient } from "@nhost/hasura-auth-js";
|
|
21
|
+
import { HasuraStorageClient } from "@nhost/hasura-storage-js";
|
|
22
|
+
import axios from "axios";
|
|
23
|
+
import { print } from "graphql/language/printer";
|
|
24
|
+
class NhostFunctionsClient {
|
|
25
|
+
constructor(params) {
|
|
26
|
+
const { url } = params;
|
|
27
|
+
this.accessToken = null;
|
|
28
|
+
this.instance = axios.create({
|
|
29
|
+
baseURL: url
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async call(url, data, config) {
|
|
33
|
+
const headers = __spreadValues(__spreadValues({}, this.generateAccessTokenHeaders()), config == null ? void 0 : config.headers);
|
|
34
|
+
let res;
|
|
35
|
+
try {
|
|
36
|
+
res = await this.instance.post(url, data, __spreadProps(__spreadValues({}, config), { headers }));
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (error instanceof Error) {
|
|
39
|
+
return { res: null, error };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!res) {
|
|
43
|
+
return {
|
|
44
|
+
res: null,
|
|
45
|
+
error: new Error("Unable to make post request to funtion")
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return { res, error: null };
|
|
49
|
+
}
|
|
50
|
+
setAccessToken(accessToken) {
|
|
51
|
+
if (!accessToken) {
|
|
52
|
+
this.accessToken = null;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.accessToken = accessToken;
|
|
56
|
+
}
|
|
57
|
+
generateAccessTokenHeaders() {
|
|
58
|
+
if (!this.accessToken) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
Authorization: `Bearer ${this.accessToken}`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class NhostGraphqlClient {
|
|
67
|
+
constructor(params) {
|
|
68
|
+
const { url } = params;
|
|
69
|
+
this.url = url;
|
|
70
|
+
this.accessToken = null;
|
|
71
|
+
this.instance = axios.create({
|
|
72
|
+
baseURL: url
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async request(document, variables, config) {
|
|
76
|
+
const headers = __spreadValues(__spreadValues({}, config == null ? void 0 : config.headers), this.generateAccessTokenHeaders());
|
|
77
|
+
try {
|
|
78
|
+
const operationName = "";
|
|
79
|
+
const res = await this.instance.post("", {
|
|
80
|
+
operationName: operationName || void 0,
|
|
81
|
+
query: typeof document === "string" ? document : print(document),
|
|
82
|
+
variables
|
|
83
|
+
}, __spreadProps(__spreadValues({}, config), { headers }));
|
|
84
|
+
const responseData = res.data;
|
|
85
|
+
const { data } = responseData;
|
|
86
|
+
if (responseData.errors) {
|
|
87
|
+
return {
|
|
88
|
+
data: null,
|
|
89
|
+
error: responseData.errors
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (typeof data !== "object" || Array.isArray(data) || data === null) {
|
|
93
|
+
return {
|
|
94
|
+
data: null,
|
|
95
|
+
error: new Error("incorrect response data from GraphQL server")
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return { data, error: null };
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (error instanceof Error) {
|
|
101
|
+
return { data: null, error };
|
|
102
|
+
}
|
|
103
|
+
console.error(error);
|
|
104
|
+
return {
|
|
105
|
+
data: null,
|
|
106
|
+
error: new Error("Unable to get do GraphQL request")
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
getUrl() {
|
|
111
|
+
return this.url;
|
|
112
|
+
}
|
|
113
|
+
setAccessToken(accessToken) {
|
|
114
|
+
if (!accessToken) {
|
|
115
|
+
this.accessToken = null;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.accessToken = accessToken;
|
|
119
|
+
}
|
|
120
|
+
generateAccessTokenHeaders() {
|
|
121
|
+
if (!this.accessToken) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
Authorization: `Bearer ${this.accessToken}`
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
class NhostClient {
|
|
130
|
+
constructor({
|
|
131
|
+
backendUrl,
|
|
132
|
+
refreshIntervalTime,
|
|
133
|
+
clientStorageGetter,
|
|
134
|
+
clientStorageSetter,
|
|
135
|
+
clientStorage,
|
|
136
|
+
clientStorageType,
|
|
137
|
+
autoRefreshToken,
|
|
138
|
+
autoSignIn,
|
|
139
|
+
start = true
|
|
140
|
+
}) {
|
|
141
|
+
var _a;
|
|
142
|
+
if (!backendUrl)
|
|
143
|
+
throw new Error("Please specify a `backendUrl`. Docs: [todo]!");
|
|
144
|
+
this.auth = new HasuraAuthClient({
|
|
145
|
+
url: `${backendUrl}/v1/auth`,
|
|
146
|
+
refreshIntervalTime,
|
|
147
|
+
clientStorageGetter,
|
|
148
|
+
clientStorageSetter,
|
|
149
|
+
clientStorage,
|
|
150
|
+
clientStorageType,
|
|
151
|
+
autoRefreshToken,
|
|
152
|
+
autoSignIn,
|
|
153
|
+
start
|
|
154
|
+
});
|
|
155
|
+
this.storage = new HasuraStorageClient({
|
|
156
|
+
url: `${backendUrl}/v1/storage`
|
|
157
|
+
});
|
|
158
|
+
this.functions = new NhostFunctionsClient({
|
|
159
|
+
url: `${backendUrl}/v1/functions`
|
|
160
|
+
});
|
|
161
|
+
this.graphql = new NhostGraphqlClient({
|
|
162
|
+
url: `${backendUrl}/v1/graphql`
|
|
163
|
+
});
|
|
164
|
+
this.storage.setAccessToken(this.auth.getAccessToken());
|
|
165
|
+
this.functions.setAccessToken(this.auth.getAccessToken());
|
|
166
|
+
this.graphql.setAccessToken(this.auth.getAccessToken());
|
|
167
|
+
(_a = this.auth.client) == null ? void 0 : _a.onStart(() => {
|
|
168
|
+
this.auth.onAuthStateChanged((_event, session) => {
|
|
169
|
+
if (_event === "SIGNED_OUT") {
|
|
170
|
+
this.storage.setAccessToken(void 0);
|
|
171
|
+
this.functions.setAccessToken(void 0);
|
|
172
|
+
this.graphql.setAccessToken(void 0);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
this.auth.onTokenChanged((session) => {
|
|
176
|
+
this.storage.setAccessToken(session == null ? void 0 : session.accessToken);
|
|
177
|
+
this.functions.setAccessToken(session == null ? void 0 : session.accessToken);
|
|
178
|
+
this.graphql.setAccessToken(session == null ? void 0 : session.accessToken);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const createClient = (config) => new NhostClient(config);
|
|
184
|
+
export { NhostClient, NhostFunctionsClient, NhostGraphqlClient, createClient };
|
|
48
185
|
//# sourceMappingURL=index.es.js.map
|