work-workflow-test 0.0.6 → 0.0.7

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.
@@ -12441,9 +12441,9 @@ class oR {
12441
12441
  }
12442
12442
  }
12443
12443
  const Gl = {
12444
- clientApiUrl: "http://localhost:3500/api/client/",
12445
- clientGraphqlUrl: "http://localhost:3500/api/client/graphql",
12446
- serverGraphqlUrl: "http://localhost:3000/api/crm/graphql"
12444
+ clientApiUrl: "https://api.testin.doworks.com/api/client/",
12445
+ clientGraphqlUrl: "https://api.testin.doworks.com/api/client/graphql",
12446
+ serverGraphqlUrl: "https://api.testin.doworks.com/api/crm/graphql"
12447
12447
  }, iR = Gl.clientApiUrl, mc = new oR(), nr = je.create({
12448
12448
  baseURL: iR
12449
12449
  });
@@ -147,7 +147,7 @@ const theme2 = createTheme({ palette: {
147
147
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(o){return o instanceof this?o:new this(o)}static concat(o,...e){const d=new this(o);return e.forEach(t=>d.set(t)),d}static accessor(o){const d=(this[Ip]=this[Ip]={accessors:{}}).accessors,t=this.prototype;function l(i){const a=zt(i);d[a]||(KF(t,i),d[a]=!0)}return j.isArray(o)?o.forEach(l):l(o),this}};mo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),j.reduceDescriptors(mo.prototype,({value:r},o)=>{let e=o[0].toUpperCase()+o.slice(1);return{get:()=>r,set(d){this[e]=d}}}),j.freezeMethods(mo);function Kw(r,o){const e=this||Lt,d=o||e,t=mo.from(d.headers);let l=d.data;return j.forEach(r,function(a){l=a.call(e,l,t.normalize(),o?o.status:void 0)}),t.normalize(),l}function Tp(r){return!!(r&&r.__CANCEL__)}function Ud(r,o,e){br.call(this,r??"canceled",br.ERR_CANCELED,o,e),this.name="CanceledError"}j.inherits(Ud,br,{__CANCEL__:!0});function Np(r,o,e){const d=e.config.validateStatus;!e.status||!d||d(e.status)?r(e):o(new br("Request failed with status code "+e.status,[br.ERR_BAD_REQUEST,br.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function YF(r){const o=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return o&&o[1]||""}function GF(r,o){r=r||10;const e=new Array(r),d=new Array(r);let t=0,l=0,i;return o=o!==void 0?o:1e3,function(w){const b=Date.now(),n=d[l];i||(i=b),e[t]=w,d[t]=b;let s=l,p=0;for(;s!==t;)p+=e[s++],s=s%r;if(t=(t+1)%r,t===l&&(l=(l+1)%r),b-i<o)return;const m=n&&b-n;return m?Math.round(p*1e3/m):void 0}}function XF(r,o){let e=0,d=1e3/o,t,l;const i=(b,n=Date.now())=>{e=n,t=null,l&&(clearTimeout(l),l=null),r(...b)};return[(...b)=>{const n=Date.now(),s=n-e;s>=d?i(b,n):(t=b,l||(l=setTimeout(()=>{l=null,i(t)},d-s)))},()=>t&&i(t)]}const _i=(r,o,e=3)=>{let d=0;const t=GF(50,250);return XF(l=>{const i=l.loaded,a=l.lengthComputable?l.total:void 0,w=i-d,b=t(w),n=i<=a;d=i;const s={loaded:i,total:a,progress:a?i/a:void 0,bytes:w,rate:b||void 0,estimated:b&&a&&n?(a-i)/b:void 0,event:l,lengthComputable:a!=null,[o?"download":"upload"]:!0};r(s)},e)},Pp=(r,o)=>{const e=r!=null;return[d=>o[0]({lengthComputable:e,total:r,loaded:d}),o[1]]},Op=r=>(...o)=>j.asap(()=>r(...o)),ZF=io.hasStandardBrowserEnv?((r,o)=>e=>(e=new URL(e,io.origin),r.protocol===e.protocol&&r.host===e.host&&(o||r.port===e.port)))(new URL(io.origin),io.navigator&&/(msie|trident)/i.test(io.navigator.userAgent)):()=>!0,JF=io.hasStandardBrowserEnv?{write(r,o,e,d,t,l){const i=[r+"="+encodeURIComponent(o)];j.isNumber(e)&&i.push("expires="+new Date(e).toGMTString()),j.isString(d)&&i.push("path="+d),j.isString(t)&&i.push("domain="+t),l===!0&&i.push("secure"),document.cookie=i.join("; ")},read(r){const o=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function QF(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function rA(r,o){return o?r.replace(/\/?\/$/,"")+"/"+o.replace(/^\/+/,""):r}function Rp(r,o,e){let d=!QF(o);return r&&(d||e==!1)?rA(r,o):o}const Mp=r=>r instanceof mo?{...r}:r;function wd(r,o){o=o||{};const e={};function d(b,n,s,p){return j.isPlainObject(b)&&j.isPlainObject(n)?j.merge.call({caseless:p},b,n):j.isPlainObject(n)?j.merge({},n):j.isArray(n)?n.slice():n}function t(b,n,s,p){if(j.isUndefined(n)){if(!j.isUndefined(b))return d(void 0,b,s,p)}else return d(b,n,s,p)}function l(b,n){if(!j.isUndefined(n))return d(void 0,n)}function i(b,n){if(j.isUndefined(n)){if(!j.isUndefined(b))return d(void 0,b)}else return d(void 0,n)}function a(b,n,s){if(s in o)return d(b,n);if(s in r)return d(void 0,b)}const w={url:l,method:l,data:l,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(b,n,s)=>t(Mp(b),Mp(n),s,!0)};return j.forEach(Object.keys({...r,...o}),function(n){const s=w[n]||t,p=s(r[n],o[n],n);j.isUndefined(p)&&s!==a||(e[n]=p)}),e}const $p=r=>{const o=wd({},r);let{data:e,withXSRFToken:d,xsrfHeaderName:t,xsrfCookieName:l,headers:i,auth:a}=o;if(o.headers=i=mo.from(i),o.url=Sp(Rp(o.baseURL,o.url,o.allowAbsoluteUrls),r.params,r.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),j.isFormData(e)){if(io.hasStandardBrowserEnv||io.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(j.isFunction(e.getHeaders)){const w=e.getHeaders(),b=["content-type","content-length"];Object.entries(w).forEach(([n,s])=>{b.includes(n.toLowerCase())&&i.set(n,s)})}}if(io.hasStandardBrowserEnv&&(d&&j.isFunction(d)&&(d=d(o)),d||d!==!1&&ZF(o.url))){const w=t&&l&&JF.read(l);w&&i.set(t,w)}return o},oA=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(e,d){const t=$p(r);let l=t.data;const i=mo.from(t.headers).normalize();let{responseType:a,onUploadProgress:w,onDownloadProgress:b}=t,n,s,p,m,h;function f(){m&&m(),h&&h(),t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}let k=new XMLHttpRequest;k.open(t.method.toUpperCase(),t.url,!0),k.timeout=t.timeout;function x(){if(!k)return;const A=mo.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),g={data:!a||a==="text"||a==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:A,config:r,request:k};Np(function(D){e(D),f()},function(D){d(D),f()},g),k=null}"onloadend"in k?k.onloadend=x:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(x)},k.onabort=function(){k&&(d(new br("Request aborted",br.ECONNABORTED,r,k)),k=null)},k.onerror=function(u){const g=u&&u.message?u.message:"Network Error",B=new br(g,br.ERR_NETWORK,r,k);B.event=u||null,d(B),k=null},k.ontimeout=function(){let u=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const g=t.transitional||Cp;t.timeoutErrorMessage&&(u=t.timeoutErrorMessage),d(new br(u,g.clarifyTimeoutError?br.ETIMEDOUT:br.ECONNABORTED,r,k)),k=null},l===void 0&&i.setContentType(null),"setRequestHeader"in k&&j.forEach(i.toJSON(),function(u,g){k.setRequestHeader(g,u)}),j.isUndefined(t.withCredentials)||(k.withCredentials=!!t.withCredentials),a&&a!=="json"&&(k.responseType=t.responseType),b&&([p,h]=_i(b,!0),k.addEventListener("progress",p)),w&&k.upload&&([s,m]=_i(w),k.upload.addEventListener("progress",s),k.upload.addEventListener("loadend",m)),(t.cancelToken||t.signal)&&(n=A=>{k&&(d(!A||A.type?new Ud(null,r,k):A),k.abort(),k=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n)));const c=YF(t.url);if(c&&io.protocols.indexOf(c)===-1){d(new br("Unsupported protocol "+c+":",br.ERR_BAD_REQUEST,r));return}k.send(l||null)})},eA=(r,o)=>{const{length:e}=r=r?r.filter(Boolean):[];if(o||e){let d=new AbortController,t;const l=function(b){if(!t){t=!0,a();const n=b instanceof Error?b:this.reason;d.abort(n instanceof br?n:new Ud(n instanceof Error?n.message:n))}};let i=o&&setTimeout(()=>{i=null,l(new br(`timeout ${o} of ms exceeded`,br.ETIMEDOUT))},o);const a=()=>{r&&(i&&clearTimeout(i),i=null,r.forEach(b=>{b.unsubscribe?b.unsubscribe(l):b.removeEventListener("abort",l)}),r=null)};r.forEach(b=>b.addEventListener("abort",l));const{signal:w}=d;return w.unsubscribe=()=>j.asap(a),w}},dA=function*(r,o){let e=r.byteLength;if(e<o){yield r;return}let d=0,t;for(;d<e;)t=d+o,yield r.slice(d,t),d=t},tA=async function*(r,o){for await(const e of lA(r))yield*dA(e,o)},lA=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const o=r.getReader();try{for(;;){const{done:e,value:d}=await o.read();if(e)break;yield d}}finally{await o.cancel()}},Up=(r,o,e,d)=>{const t=tA(r,o);let l=0,i,a=w=>{i||(i=!0,d&&d(w))};return new ReadableStream({async pull(w){try{const{done:b,value:n}=await t.next();if(b){a(),w.close();return}let s=n.byteLength;if(e){let p=l+=s;e(p)}w.enqueue(new Uint8Array(n))}catch(b){throw a(b),b}},cancel(w){return a(w),t.return()}},{highWaterMark:2})},jp=64*1024,{isFunction:Ci}=j,iA=(({Request:r,Response:o})=>({Request:r,Response:o}))(j.global),{ReadableStream:Lp,TextEncoder:zp}=j.global,Vp=(r,...o)=>{try{return!!r(...o)}catch{return!1}},aA=r=>{r=j.merge.call({skipUndefined:!0},iA,r);const{fetch:o,Request:e,Response:d}=r,t=o?Ci(o):typeof fetch=="function",l=Ci(e),i=Ci(d);if(!t)return!1;const a=t&&Ci(Lp),w=t&&(typeof zp=="function"?(h=>f=>h.encode(f))(new zp):async h=>new Uint8Array(await new e(h).arrayBuffer())),b=l&&a&&Vp(()=>{let h=!1;const f=new e(io.origin,{body:new Lp,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!f}),n=i&&a&&Vp(()=>j.isReadableStream(new d("").body)),s={stream:n&&(h=>h.body)};t&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!s[h]&&(s[h]=(f,k)=>{let x=f&&f[h];if(x)return x.call(f);throw new br(`Response type '${h}' is not supported`,br.ERR_NOT_SUPPORT,k)})});const p=async h=>{if(h==null)return 0;if(j.isBlob(h))return h.size;if(j.isSpecCompliantForm(h))return(await new e(io.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(j.isArrayBufferView(h)||j.isArrayBuffer(h))return h.byteLength;if(j.isURLSearchParams(h)&&(h=h+""),j.isString(h))return(await w(h)).byteLength},m=async(h,f)=>{const k=j.toFiniteNumber(h.getContentLength());return k??p(f)};return async h=>{let{url:f,method:k,data:x,signal:c,cancelToken:A,timeout:u,onDownloadProgress:g,onUploadProgress:B,responseType:D,headers:v,withCredentials:_="same-origin",fetchOptions:T}=$p(h),$=o||fetch;D=D?(D+"").toLowerCase():"text";let H=eA([c,A&&A.toAbortSignal()],u),R=null;const E=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let O;try{if(B&&b&&k!=="get"&&k!=="head"&&(O=await m(v,x))!==0){let N=new e(f,{method:"POST",body:x,duplex:"half"}),z;if(j.isFormData(x)&&(z=N.headers.get("content-type"))&&v.setContentType(z),N.body){const[q,L]=Pp(O,_i(Op(B)));x=Up(N.body,jp,q,L)}}j.isString(_)||(_=_?"include":"omit");const C=l&&"credentials"in e.prototype,U={...T,signal:H,method:k.toUpperCase(),headers:v.normalize().toJSON(),body:x,duplex:"half",credentials:C?_:void 0};R=l&&new e(f,U);let V=await(l?$(R,T):$(f,U));const P=n&&(D==="stream"||D==="response");if(n&&(g||P&&E)){const N={};["status","statusText","headers"].forEach(W=>{N[W]=V[W]});const z=j.toFiniteNumber(V.headers.get("content-length")),[q,L]=g&&Pp(z,_i(Op(g),!0))||[];V=new d(Up(V.body,jp,q,()=>{L&&L(),E&&E()}),N)}D=D||"text";let I=await s[j.findKey(s,D)||"text"](V,h);return!P&&E&&E(),await new Promise((N,z)=>{Np(N,z,{data:I,headers:mo.from(V.headers),status:V.status,statusText:V.statusText,config:h,request:R})})}catch(C){throw E&&E(),C&&C.name==="TypeError"&&/Load failed|fetch/i.test(C.message)?Object.assign(new br("Network Error",br.ERR_NETWORK,h,R),{cause:C.cause||C}):br.from(C,C&&C.code,h,R)}}},wA=new Map,Hp=r=>{let o=r?r.env:{};const{fetch:e,Request:d,Response:t}=o,l=[d,t,e];let i=l.length,a=i,w,b,n=wA;for(;a--;)w=l[a],b=n.get(w),b===void 0&&n.set(w,b=a?new Map:aA(o)),n=b;return b};Hp();const Yw={http:BF,xhr:oA,fetch:{get:Hp}};j.forEach(Yw,(r,o)=>{if(r){try{Object.defineProperty(r,"name",{value:o})}catch{}Object.defineProperty(r,"adapterName",{value:o})}});const qp=r=>`- ${r}`,bA=r=>j.isFunction(r)||r===null||r===!1,Wp={getAdapter:(r,o)=>{r=j.isArray(r)?r:[r];const{length:e}=r;let d,t;const l={};for(let i=0;i<e;i++){d=r[i];let a;if(t=d,!bA(d)&&(t=Yw[(a=String(d)).toLowerCase()],t===void 0))throw new br(`Unknown adapter '${a}'`);if(t&&(j.isFunction(t)||(t=t.get(o))))break;l[a||"#"+i]=t}if(!t){const i=Object.entries(l).map(([w,b])=>`adapter ${w} `+(b===!1?"is not supported by the environment":"is not available in the build"));let a=e?i.length>1?`since :
148
148
  `+i.map(qp).join(`
149
149
  `):" "+qp(i[0]):"as no adapter specified";throw new br("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return t},adapters:Yw};function Gw(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Ud(null,r)}function Kp(r){return Gw(r),r.headers=mo.from(r.headers),r.data=Kw.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Wp.getAdapter(r.adapter||Lt.adapter,r)(r).then(function(d){return Gw(r),d.data=Kw.call(r,r.transformResponse,d),d.headers=mo.from(d.headers),d},function(d){return Tp(d)||(Gw(r),d&&d.response&&(d.response.data=Kw.call(r,r.transformResponse,d.response),d.response.headers=mo.from(d.response.headers))),Promise.reject(d)})}const Yp="1.12.2",Bi={};["object","boolean","number","function","string","symbol"].forEach((r,o)=>{Bi[r]=function(d){return typeof d===r||"a"+(o<1?"n ":" ")+r}});const Gp={};Bi.transitional=function(o,e,d){function t(l,i){return"[Axios v"+Yp+"] Transitional option '"+l+"'"+i+(d?". "+d:"")}return(l,i,a)=>{if(o===!1)throw new br(t(i," has been removed"+(e?" in "+e:"")),br.ERR_DEPRECATED);return e&&!Gp[i]&&(Gp[i]=!0,console.warn(t(i," has been deprecated since v"+e+" and will be removed in the near future"))),o?o(l,i,a):!0}},Bi.spelling=function(o){return(e,d)=>(console.warn(`${d} is likely a misspelling of ${o}`),!0)};function nA(r,o,e){if(typeof r!="object")throw new br("options must be an object",br.ERR_BAD_OPTION_VALUE);const d=Object.keys(r);let t=d.length;for(;t-- >0;){const l=d[t],i=o[l];if(i){const a=r[l],w=a===void 0||i(a,l,r);if(w!==!0)throw new br("option "+l+" must be "+w,br.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new br("Unknown option "+l,br.ERR_BAD_OPTION)}}const Ii={assertOptions:nA,validators:Bi},le=Ii.validators;let bd=class{constructor(o){this.defaults=o||{},this.interceptors={request:new _p,response:new _p}}async request(o,e){try{return await this._request(o,e)}catch(d){if(d instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const l=t.stack?t.stack.replace(/^.+\n/,""):"";try{d.stack?l&&!String(d.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(d.stack+=`
150
- `+l):d.stack=l}catch{}}throw d}}_request(o,e){typeof o=="string"?(e=e||{},e.url=o):e=o||{},e=wd(this.defaults,e);const{transitional:d,paramsSerializer:t,headers:l}=e;d!==void 0&&Ii.assertOptions(d,{silentJSONParsing:le.transitional(le.boolean),forcedJSONParsing:le.transitional(le.boolean),clarifyTimeoutError:le.transitional(le.boolean)},!1),t!=null&&(j.isFunction(t)?e.paramsSerializer={serialize:t}:Ii.assertOptions(t,{encode:le.function,serialize:le.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ii.assertOptions(e,{baseUrl:le.spelling("baseURL"),withXsrfToken:le.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=l&&j.merge(l.common,l[e.method]);l&&j.forEach(["delete","get","head","post","put","patch","common"],h=>{delete l[h]}),e.headers=mo.concat(i,l);const a=[];let w=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(w=w&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});const b=[];this.interceptors.response.forEach(function(f){b.push(f.fulfilled,f.rejected)});let n,s=0,p;if(!w){const h=[Kp.bind(this),void 0];for(h.unshift(...a),h.push(...b),p=h.length,n=Promise.resolve(e);s<p;)n=n.then(h[s++],h[s++]);return n}p=a.length;let m=e;for(;s<p;){const h=a[s++],f=a[s++];try{m=h(m)}catch(k){f.call(this,k);break}}try{n=Kp.call(this,m)}catch(h){return Promise.reject(h)}for(s=0,p=b.length;s<p;)n=n.then(b[s++],b[s++]);return n}getUri(o){o=wd(this.defaults,o);const e=Rp(o.baseURL,o.url,o.allowAbsoluteUrls);return Sp(e,o.params,o.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(o){bd.prototype[o]=function(e,d){return this.request(wd(d||{},{method:o,url:e,data:(d||{}).data}))}}),j.forEach(["post","put","patch"],function(o){function e(d){return function(l,i,a){return this.request(wd(a||{},{method:o,headers:d?{"Content-Type":"multipart/form-data"}:{},url:l,data:i}))}}bd.prototype[o]=e(),bd.prototype[o+"Form"]=e(!0)});let sA=class Zm{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(l){e=l});const d=this;this.promise.then(t=>{if(!d._listeners)return;let l=d._listeners.length;for(;l-- >0;)d._listeners[l](t);d._listeners=null}),this.promise.then=t=>{let l;const i=new Promise(a=>{d.subscribe(a),l=a}).then(t);return i.cancel=function(){d.unsubscribe(l)},i},o(function(l,i,a){d.reason||(d.reason=new Ud(l,i,a),e(d.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const e=this._listeners.indexOf(o);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const o=new AbortController,e=d=>{o.abort(d)};return this.subscribe(e),o.signal.unsubscribe=()=>this.unsubscribe(e),o.signal}static source(){let o;return{token:new Zm(function(t){o=t}),cancel:o}}};function pA(r){return function(e){return r.apply(null,e)}}function fA(r){return j.isObject(r)&&r.isAxiosError===!0}const Xw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xw).forEach(([r,o])=>{Xw[o]=r});function Xp(r){const o=new bd(r),e=pp(bd.prototype.request,o);return j.extend(e,bd.prototype,o,{allOwnKeys:!0}),j.extend(e,o,null,{allOwnKeys:!0}),e.create=function(t){return Xp(wd(r,t))},e}const Rr=Xp(Lt);Rr.Axios=bd,Rr.CanceledError=Ud,Rr.CancelToken=sA,Rr.isCancel=Tp,Rr.VERSION=Yp,Rr.toFormData=vi,Rr.AxiosError=br,Rr.Cancel=Rr.CanceledError,Rr.all=function(o){return Promise.all(o)},Rr.spread=pA,Rr.isAxiosError=fA,Rr.mergeConfig=wd,Rr.AxiosHeaders=mo,Rr.formToJSON=r=>Bp(j.isHTMLForm(r)?new FormData(r):r),Rr.getAdapter=Wp.getAdapter,Rr.HttpStatusCode=Xw,Rr.default=Rr;const{Axios:nv,AxiosError:sv,CanceledError:pv,isCancel:fv,CancelToken:hv,VERSION:mv,all:kv,Cancel:xv,isAxiosError:gv,spread:cv,toFormData:uv,AxiosHeaders:Fv,HttpStatusCode:Av,formToJSON:yv,getAdapter:Ev,mergeConfig:Dv}=Rr;var Vt={},Zp;function hA(){if(Zp)return Vt;Zp=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.parse=i,Vt.serialize=b;const r=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,o=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,d=/^[\u0020-\u003A\u003D-\u007E]*$/,t=Object.prototype.toString,l=(()=>{const p=function(){};return p.prototype=Object.create(null),p})();function i(p,m){const h=new l,f=p.length;if(f<2)return h;const k=m?.decode||n;let x=0;do{const c=p.indexOf("=",x);if(c===-1)break;const A=p.indexOf(";",x),u=A===-1?f:A;if(c>u){x=p.lastIndexOf(";",c-1)+1;continue}const g=a(p,x,c),B=w(p,c,g),D=p.slice(g,B);if(h[D]===void 0){let v=a(p,c+1,u),_=w(p,u,v);const T=k(p.slice(v,_));h[D]=T}x=u+1}while(x<f);return h}function a(p,m,h){do{const f=p.charCodeAt(m);if(f!==32&&f!==9)return m}while(++m<h);return h}function w(p,m,h){for(;m>h;){const f=p.charCodeAt(--m);if(f!==32&&f!==9)return m+1}return h}function b(p,m,h){const f=h?.encode||encodeURIComponent;if(!r.test(p))throw new TypeError(`argument name is invalid: ${p}`);const k=f(m);if(!o.test(k))throw new TypeError(`argument val is invalid: ${m}`);let x=p+"="+k;if(!h)return x;if(h.maxAge!==void 0){if(!Number.isInteger(h.maxAge))throw new TypeError(`option maxAge is invalid: ${h.maxAge}`);x+="; Max-Age="+h.maxAge}if(h.domain){if(!e.test(h.domain))throw new TypeError(`option domain is invalid: ${h.domain}`);x+="; Domain="+h.domain}if(h.path){if(!d.test(h.path))throw new TypeError(`option path is invalid: ${h.path}`);x+="; Path="+h.path}if(h.expires){if(!s(h.expires)||!Number.isFinite(h.expires.valueOf()))throw new TypeError(`option expires is invalid: ${h.expires}`);x+="; Expires="+h.expires.toUTCString()}if(h.httpOnly&&(x+="; HttpOnly"),h.secure&&(x+="; Secure"),h.partitioned&&(x+="; Partitioned"),h.priority)switch(typeof h.priority=="string"?h.priority.toLowerCase():void 0){case"low":x+="; Priority=Low";break;case"medium":x+="; Priority=Medium";break;case"high":x+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${h.priority}`)}if(h.sameSite)switch(typeof h.sameSite=="string"?h.sameSite.toLowerCase():h.sameSite){case!0:case"strict":x+="; SameSite=Strict";break;case"lax":x+="; SameSite=Lax";break;case"none":x+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${h.sameSite}`)}return x}function n(p){if(p.indexOf("%")===-1)return p;try{return decodeURIComponent(p)}catch{return p}}function s(p){return t.call(p)==="[object Date]"}return Vt}var Ti=hA();function mA(){const r=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof r=="boolean"?r:typeof document=="object"&&typeof document.cookie=="string"}function kA(r){return typeof r=="string"?Ti.parse(r):typeof r=="object"&&r!==null?r:{}}function Zw(r,o={}){const e=xA(r);if(!o.doNotParse)try{return JSON.parse(e)}catch{}return r}function xA(r){return r&&r[0]==="j"&&r[1]===":"?r.substr(2):r}class gA{constructor(o,e={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const t=this.cookies;this.cookies=Ti.parse(document.cookie),this._checkChanges(t)};const d=typeof document>"u"?"":document.cookie;this.cookies=kA(o||d),this.defaultSetOptions=e,this.HAS_DOCUMENT_COOKIE=mA()}_emitChange(o){for(let e=0;e<this.changeListeners.length;++e)this.changeListeners[e](o)}_checkChanges(o){new Set(Object.keys(o).concat(Object.keys(this.cookies))).forEach(d=>{o[d]!==this.cookies[d]&&this._emitChange({name:d,value:Zw(this.cookies[d])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(o,e={}){return e.doNotUpdate||this.update(),Zw(this.cookies[o],e)}getAll(o={}){o.doNotUpdate||this.update();const e={};for(let d in this.cookies)e[d]=Zw(this.cookies[d],o);return e}set(o,e,d){d?d=Object.assign(Object.assign({},this.defaultSetOptions),d):d=this.defaultSetOptions;const t=typeof e=="string"?e:JSON.stringify(e);this.cookies=Object.assign(Object.assign({},this.cookies),{[o]:t}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=Ti.serialize(o,t,d)),this._emitChange({name:o,value:e,options:d})}remove(o,e){const d=e=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),e),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[o],this.HAS_DOCUMENT_COOKIE&&(document.cookie=Ti.serialize(o,"",d)),this._emitChange({name:o,value:void 0,options:e})}addChangeListener(o){this.changeListeners.push(o),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(o){const e=this.changeListeners.indexOf(o);e>=0&&this.changeListeners.splice(e,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}const Jw={clientApiUrl:"http://localhost:3500/api/client/",clientGraphqlUrl:"http://localhost:3500/api/client/graphql",serverGraphqlUrl:"http://localhost:3000/api/crm/graphql"},cA=Jw.clientApiUrl,Qw=new gA,ze=Rr.create({baseURL:cA});ze.interceptors.request.use(r=>{const e=(()=>{const l=Object.keys(Qw.getAll()).find(i=>i.endsWith("accessToken"));return l?Qw.get(l):null})(),d=Qw.get("workspaceId");return e&&(r.headers.Authorization=e),d&&(r.headers["x-tenant-id"]=d),r},r=>Promise.reject(r));const uA=async r=>{try{return(await ze.post(`/workspace/${r.workspaceId}/workflow`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},FA=async r=>{try{return(await ze.post(`/workspace/${r.workspaceId}/automation`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},AA=async r=>{try{return(await ze.put(`/workspace/${r.workspaceId}/automation/automationAction`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},yA=async(r,o)=>{try{return(await ze.get(`/workspace/${o}/automation/workflowSeg/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},EA=async({id:r,isActive:o,workspaceId:e})=>{try{return(await ze.put(`/workspace/${e}/automation/activetoggle/${r}/${o}`)).data}catch(d){throw console.error("Failed to fetch table column data types:",d),d}},DA=async({id:r,workspaceId:o})=>{try{return(await ze.delete(`/workspace/${o}/automation/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},vA=async({fieldId:r,workspaceId:o})=>{try{return(await ze.get(`/workspace/${o}/workflow/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},Jp=r=>r?.toLowerCase()?.split(/[\s\-_]+/)?.map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),SA=(r,o,e=void 0)=>{const d=o.split(".");let t=r;for(const l of d)if(t&&typeof t=="object"&&l in t)t=t[l];else return e;return t},Qp=(r,o)=>{const e=r.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(t,l,i,a)=>`#${l}${l}${i}${i}${a}${a}`),d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return d?`rgba(${parseInt(d[1],16)}, ${parseInt(d[2],16)}, ${parseInt(d[3],16)}, ${o})`:""},rf=(r,o)=>{const e=r.match(/\d+/g);return e?`rgba(${e.join(", ")}, ${o})`:r},r4=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?Qp(o,.2):rf(o,.2)},Ve=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?Qp(o,1):rf(o,1)},_A=({data:r})=>F.jsxs("div",{style:{backgroundColor:r4(r.color),border:`1px solid ${Ve(r.color)}`},className:"w-264px h-40px radius-8 d-flex align-center justify-center",children:[F.jsx("p",{className:"f-14 f-w-600 ",style:{color:Ve(r.color)},children:r.label}),F.jsx(Fd,{type:"target",position:er.Top,style:{width:6,height:6,background:"#a855f7",borderRadius:"50%",opacity:1,pointerEvents:"auto"}}),F.jsx(Fd,{type:"source",position:er.Bottom,isConnectable:!0,style:{opacity:0}})]}),CA=({id:r,sourceX:o,sourceY:e,targetX:d,targetY:t,data:l})=>{const[i,a,w]=Va({sourceX:o,sourceY:e,targetX:d,targetY:t});return F.jsxs(F.Fragment,{children:[F.jsx(ud,{id:r,path:i,style:{stroke:"#B475FC",strokeWidth:1}}),F.jsx("foreignObject",{width:18,height:20,x:a-10,y:w-8,color:"#B475FC",children:F.jsx("div",{style:{background:"#fff",border:"1px solid #ccc",borderRadius:"5px",padding:"2px 4px"},className:"d-flex align-center justify-center",children:F.jsx("div",{style:{background:"linear-gradient(163.3deg, #FA5B5B 14.56%, #186EDF 96.43%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},children:F.jsx("img",{src:"/vector.svg",alt:"vector"})})})})]})},BA={customHandle:_A},IA={custom:CA},TA=({setEdges:r,nodes:o,edges:e,onNodesChange:d,onEdgesChange:t})=>{const l=y.useCallback(i=>{const a=o.find(p=>p.id===i.source),w=o.find(p=>p.id===i.target),b=a?.data?.color||"#000",n=w?.data?.color||"#000",s={...i,id:`reactflow__edge-${i.source}-${i.target}`,type:"custom",source:i.source,target:i.target,data:{sourceLabel:a?.data?.label,targetLabel:w?.data?.label,sourceColor:b,targetColor:n,permission:[],requiredColumns:[],condition:""}};r(p=>On(s,p))},[]);return F.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:F.jsxs(Ts,{nodes:o,edges:e,nodeTypes:BA,edgeTypes:IA,onNodesChange:d,onEdgesChange:t,onConnect:l,fitView:!0,fitViewOptions:{maxZoom:1},children:[F.jsx(Lg,{}),F.jsx(Yg,{}),F.jsx(rc,{})]})})},NA=()=>F.jsx("div",{style:{background:"#fff",border:"1px solid #ccc",borderRadius:"5px",padding:"2px 4px"},className:"d-flex align-center justify-center",children:F.jsx("div",{style:{background:"linear-gradient(163.3deg, #FA5B5B 14.56%, #186EDF 96.43%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},children:F.jsx("img",{src:"/vector.svg",alt:"vector"})})}),PA=({edges:r,setSelectedId:o,saveToBackend:e})=>F.jsx("div",{style:{top:0,right:0,height:"100%",width:"422px",background:"#fff",borderLeft:"1px solid #ccc"},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[F.jsxs("div",{children:[F.jsx("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:"Configuration"}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsx("div",{className:"flex-1",children:r?.map(d=>F.jsxs("div",{className:"d-flex h-44px mb-12",children:[F.jsxs("div",{style:{backgroundColor:r4(d.data?.sourceColor),border:`1px solid ${Ve(d.data?.sourceColor)}`},className:" flex-1 radius-8 px-12 py-6 d-flex justify-between align-center cursor-pointer",onClick:()=>{o({id:d.id,type:"config"})},children:[F.jsx("div",{className:"f-14 f-w-400 mr-20",style:{color:Ve(d.data?.sourceColor)},children:d?.data?.sourceLabel}),F.jsx("img",{src:"/arrow.svg",alt:"arrow",className:"mr-20"}),F.jsx("div",{className:"f-w-400 f-14",style:{color:Ve(d.data?.targetColor)},children:d?.data?.targetLabel})]}),F.jsx("div",{className:"w-42px d-flex align-center justify-center cursor-pointer",onClick:()=>{o({id:d.id,type:"auto"})},children:F.jsx(NA,{})})]}))}),F.jsxs("div",{className:"d-flex justify-end",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>close(),children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",onClick:()=>{e()},children:"Update"})]})]})});var Ht={},of;function OA(){if(of)return Ht;of=1;var r=Yo();Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.default=void 0;var o=r(ue()),e=Jo();return Ht.default=(0,o.default)((0,e.jsx)("path",{d:"m8.71 11.71 2.59 2.59c.39.39 1.02.39 1.41 0l2.59-2.59c.63-.63.18-1.71-.71-1.71H9.41c-.89 0-1.33 1.08-.7 1.71"}),"ArrowDropDownRounded"),Ht}var RA=OA();const ef=Io(RA),Ni={"popper-border":"#eaeff4","success-disabled":"#a6aaaf"};var qt={},df;function MA(){if(df)return qt;df=1;var r=Yo();Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=void 0;var o=r(ue()),e=Jo();return qt.default=(0,o.default)((0,e.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear"),qt}var $A=MA();const UA=Io($A);var o4=function(r,o){return o4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,d){e.__proto__=d}||function(e,d){for(var t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t])},o4(r,o)};function jA(r,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");o4(r,o);function e(){this.constructor=r}r.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var He=function(){return He=Object.assign||function(o){for(var e,d=1,t=arguments.length;d<t;d++){e=arguments[d];for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&(o[l]=e[l])}return o},He.apply(this,arguments)};function LA(r,o){var e={};for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&o.indexOf(d)<0&&(e[d]=r[d]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,d=Object.getOwnPropertySymbols(r);t<d.length;t++)o.indexOf(d[t])<0&&Object.prototype.propertyIsEnumerable.call(r,d[t])&&(e[d[t]]=r[d[t]]);return e}function zA(r,o,e,d){function t(l){return l instanceof e?l:new e(function(i){i(l)})}return new(e||(e=Promise))(function(l,i){function a(n){try{b(d.next(n))}catch(s){i(s)}}function w(n){try{b(d.throw(n))}catch(s){i(s)}}function b(n){n.done?l(n.value):t(n.value).then(a,w)}b((d=d.apply(r,o||[])).next())})}function VA(r,o){var e={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},d,t,l,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(b){return function(n){return w([b,n])}}function w(b){if(d)throw new TypeError("Generator is already executing.");for(;i&&(i=0,b[0]&&(e=0)),e;)try{if(d=1,t&&(l=b[0]&2?t.return:b[0]?t.throw||((l=t.return)&&l.call(t),0):t.next)&&!(l=l.call(t,b[1])).done)return l;switch(t=0,l&&(b=[b[0]&2,l.value]),b[0]){case 0:case 1:l=b;break;case 4:return e.label++,{value:b[1],done:!1};case 5:e.label++,t=b[1],b=[0];continue;case 7:b=e.ops.pop(),e.trys.pop();continue;default:if(l=e.trys,!(l=l.length>0&&l[l.length-1])&&(b[0]===6||b[0]===2)){e=0;continue}if(b[0]===3&&(!l||b[1]>l[0]&&b[1]<l[3])){e.label=b[1];break}if(b[0]===6&&e.label<l[1]){e.label=l[1],l=b;break}if(l&&e.label<l[2]){e.label=l[2],e.ops.push(b);break}l[2]&&e.ops.pop(),e.trys.pop();continue}b=o.call(r,e)}catch(n){b=[6,n],t=0}finally{d=l=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var e4="Invariant Violation",tf=Object.setPrototypeOf,HA=tf===void 0?function(r,o){return r.__proto__=o,r}:tf,lf=function(r){jA(o,r);function o(e){e===void 0&&(e=e4);var d=r.call(this,typeof e=="number"?e4+": "+e+" (see https://github.com/apollographql/invariant-packages)":e)||this;return d.framesToPop=1,d.name=e4,HA(d,o.prototype),d}return o}(Error);function nd(r,o){if(!r)throw new lf(o)}var af=["debug","log","warn","error","silent"],qA=af.indexOf("log");function Pi(r){return function(){if(af.indexOf(r)>=qA){var o=console[r]||console.log;return o.apply(console,arguments)}}}(function(r){r.debug=Pi("debug"),r.log=Pi("log"),r.warn=Pi("warn"),r.error=Pi("error")})(nd||(nd={}));var wf="3.14.0";function jd(r){try{return r()}catch{}}const d4=jd(function(){return globalThis})||jd(function(){return window})||jd(function(){return self})||jd(function(){return global})||jd(function(){return jd.constructor("return this")()});var bf=new Map;function WA(r){var o=bf.get(r)||1;return bf.set(r,o+1),"".concat(r,":").concat(o,":").concat(Math.random().toString(36).slice(2))}function KA(r,o){var e=WA("stringifyForDisplay");return JSON.stringify(r,function(d,t){return t===void 0?e:t},o).split(JSON.stringify(e)).join("<undefined>")}function Oi(r){return function(o){for(var e=[],d=1;d<arguments.length;d++)e[d-1]=arguments[d];if(typeof o=="number"){var t=o;o=l4(t),o||(o=i4(t,e),e=[])}r.apply(void 0,[o].concat(e))}}var t4=Object.assign(function(o,e){for(var d=[],t=2;t<arguments.length;t++)d[t-2]=arguments[t];o||nd(o,l4(e,d)||i4(e,d))},{debug:Oi(nd.debug),log:Oi(nd.log),warn:Oi(nd.warn),error:Oi(nd.error)});function nf(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return new lf(l4(r,o)||i4(r,o))}var sf=Symbol.for("ApolloErrorMessageHandler_"+wf);function pf(r){if(typeof r=="string")return r;try{return KA(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function l4(r,o){if(o===void 0&&(o=[]),!!r)return d4[sf]&&d4[sf](r,o.map(pf))}function i4(r,o){if(o===void 0&&(o=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:wf,message:r,args:o.map(pf)})))}function YA(r){return r.definitions.filter(function(o){return o.kind==="OperationDefinition"&&!!o.name}).map(function(o){return o.name.value})[0]||null}let oo=null;const ff={};let GA=1;const XA=()=>class{constructor(){this.id=["slot",GA++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let o=oo;o;o=o.parent)if(this.id in o.slots){const e=o.slots[this.id];if(e===ff)break;return o!==oo&&(oo.slots[this.id]=e),!0}return oo&&(oo.slots[this.id]=ff),!1}getValue(){if(this.hasValue())return oo.slots[this.id]}withValue(o,e,d,t){const l={__proto__:null,[this.id]:o},i=oo;oo={parent:i,slots:l};try{return e.apply(t,d)}finally{oo=i}}static bind(o){const e=oo;return function(){const d=oo;try{return oo=e,o.apply(this,arguments)}finally{oo=d}}}static noContext(o,e,d){if(oo){const t=oo;try{return oo=null,o.apply(d,e)}finally{oo=t}}else return o.apply(d,e)}};function hf(r){try{return r()}catch{}}const a4="@wry/context:Slot",mf=hf(()=>globalThis)||hf(()=>global)||Object.create(null),w4=mf[a4]||Array[a4]||function(r){try{Object.defineProperty(mf,a4,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(XA()),{bind:Sv,noContext:_v}=w4;new w4;function ZA(r,o){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=JA(r))||o){e&&(r=e);var d=0;return function(){return d>=r.length?{done:!0}:{done:!1,value:r[d++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
150
+ `+l):d.stack=l}catch{}}throw d}}_request(o,e){typeof o=="string"?(e=e||{},e.url=o):e=o||{},e=wd(this.defaults,e);const{transitional:d,paramsSerializer:t,headers:l}=e;d!==void 0&&Ii.assertOptions(d,{silentJSONParsing:le.transitional(le.boolean),forcedJSONParsing:le.transitional(le.boolean),clarifyTimeoutError:le.transitional(le.boolean)},!1),t!=null&&(j.isFunction(t)?e.paramsSerializer={serialize:t}:Ii.assertOptions(t,{encode:le.function,serialize:le.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ii.assertOptions(e,{baseUrl:le.spelling("baseURL"),withXsrfToken:le.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=l&&j.merge(l.common,l[e.method]);l&&j.forEach(["delete","get","head","post","put","patch","common"],h=>{delete l[h]}),e.headers=mo.concat(i,l);const a=[];let w=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(w=w&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});const b=[];this.interceptors.response.forEach(function(f){b.push(f.fulfilled,f.rejected)});let n,s=0,p;if(!w){const h=[Kp.bind(this),void 0];for(h.unshift(...a),h.push(...b),p=h.length,n=Promise.resolve(e);s<p;)n=n.then(h[s++],h[s++]);return n}p=a.length;let m=e;for(;s<p;){const h=a[s++],f=a[s++];try{m=h(m)}catch(k){f.call(this,k);break}}try{n=Kp.call(this,m)}catch(h){return Promise.reject(h)}for(s=0,p=b.length;s<p;)n=n.then(b[s++],b[s++]);return n}getUri(o){o=wd(this.defaults,o);const e=Rp(o.baseURL,o.url,o.allowAbsoluteUrls);return Sp(e,o.params,o.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(o){bd.prototype[o]=function(e,d){return this.request(wd(d||{},{method:o,url:e,data:(d||{}).data}))}}),j.forEach(["post","put","patch"],function(o){function e(d){return function(l,i,a){return this.request(wd(a||{},{method:o,headers:d?{"Content-Type":"multipart/form-data"}:{},url:l,data:i}))}}bd.prototype[o]=e(),bd.prototype[o+"Form"]=e(!0)});let sA=class Zm{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(l){e=l});const d=this;this.promise.then(t=>{if(!d._listeners)return;let l=d._listeners.length;for(;l-- >0;)d._listeners[l](t);d._listeners=null}),this.promise.then=t=>{let l;const i=new Promise(a=>{d.subscribe(a),l=a}).then(t);return i.cancel=function(){d.unsubscribe(l)},i},o(function(l,i,a){d.reason||(d.reason=new Ud(l,i,a),e(d.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const e=this._listeners.indexOf(o);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const o=new AbortController,e=d=>{o.abort(d)};return this.subscribe(e),o.signal.unsubscribe=()=>this.unsubscribe(e),o.signal}static source(){let o;return{token:new Zm(function(t){o=t}),cancel:o}}};function pA(r){return function(e){return r.apply(null,e)}}function fA(r){return j.isObject(r)&&r.isAxiosError===!0}const Xw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xw).forEach(([r,o])=>{Xw[o]=r});function Xp(r){const o=new bd(r),e=pp(bd.prototype.request,o);return j.extend(e,bd.prototype,o,{allOwnKeys:!0}),j.extend(e,o,null,{allOwnKeys:!0}),e.create=function(t){return Xp(wd(r,t))},e}const Rr=Xp(Lt);Rr.Axios=bd,Rr.CanceledError=Ud,Rr.CancelToken=sA,Rr.isCancel=Tp,Rr.VERSION=Yp,Rr.toFormData=vi,Rr.AxiosError=br,Rr.Cancel=Rr.CanceledError,Rr.all=function(o){return Promise.all(o)},Rr.spread=pA,Rr.isAxiosError=fA,Rr.mergeConfig=wd,Rr.AxiosHeaders=mo,Rr.formToJSON=r=>Bp(j.isHTMLForm(r)?new FormData(r):r),Rr.getAdapter=Wp.getAdapter,Rr.HttpStatusCode=Xw,Rr.default=Rr;const{Axios:nv,AxiosError:sv,CanceledError:pv,isCancel:fv,CancelToken:hv,VERSION:mv,all:kv,Cancel:xv,isAxiosError:gv,spread:cv,toFormData:uv,AxiosHeaders:Fv,HttpStatusCode:Av,formToJSON:yv,getAdapter:Ev,mergeConfig:Dv}=Rr;var Vt={},Zp;function hA(){if(Zp)return Vt;Zp=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.parse=i,Vt.serialize=b;const r=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,o=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,d=/^[\u0020-\u003A\u003D-\u007E]*$/,t=Object.prototype.toString,l=(()=>{const p=function(){};return p.prototype=Object.create(null),p})();function i(p,m){const h=new l,f=p.length;if(f<2)return h;const k=m?.decode||n;let x=0;do{const c=p.indexOf("=",x);if(c===-1)break;const A=p.indexOf(";",x),u=A===-1?f:A;if(c>u){x=p.lastIndexOf(";",c-1)+1;continue}const g=a(p,x,c),B=w(p,c,g),D=p.slice(g,B);if(h[D]===void 0){let v=a(p,c+1,u),_=w(p,u,v);const T=k(p.slice(v,_));h[D]=T}x=u+1}while(x<f);return h}function a(p,m,h){do{const f=p.charCodeAt(m);if(f!==32&&f!==9)return m}while(++m<h);return h}function w(p,m,h){for(;m>h;){const f=p.charCodeAt(--m);if(f!==32&&f!==9)return m+1}return h}function b(p,m,h){const f=h?.encode||encodeURIComponent;if(!r.test(p))throw new TypeError(`argument name is invalid: ${p}`);const k=f(m);if(!o.test(k))throw new TypeError(`argument val is invalid: ${m}`);let x=p+"="+k;if(!h)return x;if(h.maxAge!==void 0){if(!Number.isInteger(h.maxAge))throw new TypeError(`option maxAge is invalid: ${h.maxAge}`);x+="; Max-Age="+h.maxAge}if(h.domain){if(!e.test(h.domain))throw new TypeError(`option domain is invalid: ${h.domain}`);x+="; Domain="+h.domain}if(h.path){if(!d.test(h.path))throw new TypeError(`option path is invalid: ${h.path}`);x+="; Path="+h.path}if(h.expires){if(!s(h.expires)||!Number.isFinite(h.expires.valueOf()))throw new TypeError(`option expires is invalid: ${h.expires}`);x+="; Expires="+h.expires.toUTCString()}if(h.httpOnly&&(x+="; HttpOnly"),h.secure&&(x+="; Secure"),h.partitioned&&(x+="; Partitioned"),h.priority)switch(typeof h.priority=="string"?h.priority.toLowerCase():void 0){case"low":x+="; Priority=Low";break;case"medium":x+="; Priority=Medium";break;case"high":x+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${h.priority}`)}if(h.sameSite)switch(typeof h.sameSite=="string"?h.sameSite.toLowerCase():h.sameSite){case!0:case"strict":x+="; SameSite=Strict";break;case"lax":x+="; SameSite=Lax";break;case"none":x+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${h.sameSite}`)}return x}function n(p){if(p.indexOf("%")===-1)return p;try{return decodeURIComponent(p)}catch{return p}}function s(p){return t.call(p)==="[object Date]"}return Vt}var Ti=hA();function mA(){const r=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof r=="boolean"?r:typeof document=="object"&&typeof document.cookie=="string"}function kA(r){return typeof r=="string"?Ti.parse(r):typeof r=="object"&&r!==null?r:{}}function Zw(r,o={}){const e=xA(r);if(!o.doNotParse)try{return JSON.parse(e)}catch{}return r}function xA(r){return r&&r[0]==="j"&&r[1]===":"?r.substr(2):r}class gA{constructor(o,e={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const t=this.cookies;this.cookies=Ti.parse(document.cookie),this._checkChanges(t)};const d=typeof document>"u"?"":document.cookie;this.cookies=kA(o||d),this.defaultSetOptions=e,this.HAS_DOCUMENT_COOKIE=mA()}_emitChange(o){for(let e=0;e<this.changeListeners.length;++e)this.changeListeners[e](o)}_checkChanges(o){new Set(Object.keys(o).concat(Object.keys(this.cookies))).forEach(d=>{o[d]!==this.cookies[d]&&this._emitChange({name:d,value:Zw(this.cookies[d])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(o,e={}){return e.doNotUpdate||this.update(),Zw(this.cookies[o],e)}getAll(o={}){o.doNotUpdate||this.update();const e={};for(let d in this.cookies)e[d]=Zw(this.cookies[d],o);return e}set(o,e,d){d?d=Object.assign(Object.assign({},this.defaultSetOptions),d):d=this.defaultSetOptions;const t=typeof e=="string"?e:JSON.stringify(e);this.cookies=Object.assign(Object.assign({},this.cookies),{[o]:t}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=Ti.serialize(o,t,d)),this._emitChange({name:o,value:e,options:d})}remove(o,e){const d=e=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),e),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[o],this.HAS_DOCUMENT_COOKIE&&(document.cookie=Ti.serialize(o,"",d)),this._emitChange({name:o,value:void 0,options:e})}addChangeListener(o){this.changeListeners.push(o),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(o){const e=this.changeListeners.indexOf(o);e>=0&&this.changeListeners.splice(e,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}const Jw={clientApiUrl:"https://api.testin.doworks.com/api/client/",clientGraphqlUrl:"https://api.testin.doworks.com/api/client/graphql",serverGraphqlUrl:"https://api.testin.doworks.com/api/crm/graphql"},cA=Jw.clientApiUrl,Qw=new gA,ze=Rr.create({baseURL:cA});ze.interceptors.request.use(r=>{const e=(()=>{const l=Object.keys(Qw.getAll()).find(i=>i.endsWith("accessToken"));return l?Qw.get(l):null})(),d=Qw.get("workspaceId");return e&&(r.headers.Authorization=e),d&&(r.headers["x-tenant-id"]=d),r},r=>Promise.reject(r));const uA=async r=>{try{return(await ze.post(`/workspace/${r.workspaceId}/workflow`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},FA=async r=>{try{return(await ze.post(`/workspace/${r.workspaceId}/automation`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},AA=async r=>{try{return(await ze.put(`/workspace/${r.workspaceId}/automation/automationAction`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},yA=async(r,o)=>{try{return(await ze.get(`/workspace/${o}/automation/workflowSeg/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},EA=async({id:r,isActive:o,workspaceId:e})=>{try{return(await ze.put(`/workspace/${e}/automation/activetoggle/${r}/${o}`)).data}catch(d){throw console.error("Failed to fetch table column data types:",d),d}},DA=async({id:r,workspaceId:o})=>{try{return(await ze.delete(`/workspace/${o}/automation/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},vA=async({fieldId:r,workspaceId:o})=>{try{return(await ze.get(`/workspace/${o}/workflow/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},Jp=r=>r?.toLowerCase()?.split(/[\s\-_]+/)?.map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),SA=(r,o,e=void 0)=>{const d=o.split(".");let t=r;for(const l of d)if(t&&typeof t=="object"&&l in t)t=t[l];else return e;return t},Qp=(r,o)=>{const e=r.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(t,l,i,a)=>`#${l}${l}${i}${i}${a}${a}`),d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return d?`rgba(${parseInt(d[1],16)}, ${parseInt(d[2],16)}, ${parseInt(d[3],16)}, ${o})`:""},rf=(r,o)=>{const e=r.match(/\d+/g);return e?`rgba(${e.join(", ")}, ${o})`:r},r4=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?Qp(o,.2):rf(o,.2)},Ve=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?Qp(o,1):rf(o,1)},_A=({data:r})=>F.jsxs("div",{style:{backgroundColor:r4(r.color),border:`1px solid ${Ve(r.color)}`},className:"w-264px h-40px radius-8 d-flex align-center justify-center",children:[F.jsx("p",{className:"f-14 f-w-600 ",style:{color:Ve(r.color)},children:r.label}),F.jsx(Fd,{type:"target",position:er.Top,style:{width:6,height:6,background:"#a855f7",borderRadius:"50%",opacity:1,pointerEvents:"auto"}}),F.jsx(Fd,{type:"source",position:er.Bottom,isConnectable:!0,style:{opacity:0}})]}),CA=({id:r,sourceX:o,sourceY:e,targetX:d,targetY:t,data:l})=>{const[i,a,w]=Va({sourceX:o,sourceY:e,targetX:d,targetY:t});return F.jsxs(F.Fragment,{children:[F.jsx(ud,{id:r,path:i,style:{stroke:"#B475FC",strokeWidth:1}}),F.jsx("foreignObject",{width:18,height:20,x:a-10,y:w-8,color:"#B475FC",children:F.jsx("div",{style:{background:"#fff",border:"1px solid #ccc",borderRadius:"5px",padding:"2px 4px"},className:"d-flex align-center justify-center",children:F.jsx("div",{style:{background:"linear-gradient(163.3deg, #FA5B5B 14.56%, #186EDF 96.43%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},children:F.jsx("img",{src:"/vector.svg",alt:"vector"})})})})]})},BA={customHandle:_A},IA={custom:CA},TA=({setEdges:r,nodes:o,edges:e,onNodesChange:d,onEdgesChange:t})=>{const l=y.useCallback(i=>{const a=o.find(p=>p.id===i.source),w=o.find(p=>p.id===i.target),b=a?.data?.color||"#000",n=w?.data?.color||"#000",s={...i,id:`reactflow__edge-${i.source}-${i.target}`,type:"custom",source:i.source,target:i.target,data:{sourceLabel:a?.data?.label,targetLabel:w?.data?.label,sourceColor:b,targetColor:n,permission:[],requiredColumns:[],condition:""}};r(p=>On(s,p))},[]);return F.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:F.jsxs(Ts,{nodes:o,edges:e,nodeTypes:BA,edgeTypes:IA,onNodesChange:d,onEdgesChange:t,onConnect:l,fitView:!0,fitViewOptions:{maxZoom:1},children:[F.jsx(Lg,{}),F.jsx(Yg,{}),F.jsx(rc,{})]})})},NA=()=>F.jsx("div",{style:{background:"#fff",border:"1px solid #ccc",borderRadius:"5px",padding:"2px 4px"},className:"d-flex align-center justify-center",children:F.jsx("div",{style:{background:"linear-gradient(163.3deg, #FA5B5B 14.56%, #186EDF 96.43%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},children:F.jsx("img",{src:"/vector.svg",alt:"vector"})})}),PA=({edges:r,setSelectedId:o,saveToBackend:e})=>F.jsx("div",{style:{top:0,right:0,height:"100%",width:"422px",background:"#fff",borderLeft:"1px solid #ccc"},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[F.jsxs("div",{children:[F.jsx("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:"Configuration"}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsx("div",{className:"flex-1",children:r?.map(d=>F.jsxs("div",{className:"d-flex h-44px mb-12",children:[F.jsxs("div",{style:{backgroundColor:r4(d.data?.sourceColor),border:`1px solid ${Ve(d.data?.sourceColor)}`},className:" flex-1 radius-8 px-12 py-6 d-flex justify-between align-center cursor-pointer",onClick:()=>{o({id:d.id,type:"config"})},children:[F.jsx("div",{className:"f-14 f-w-400 mr-20",style:{color:Ve(d.data?.sourceColor)},children:d?.data?.sourceLabel}),F.jsx("img",{src:"/arrow.svg",alt:"arrow",className:"mr-20"}),F.jsx("div",{className:"f-w-400 f-14",style:{color:Ve(d.data?.targetColor)},children:d?.data?.targetLabel})]}),F.jsx("div",{className:"w-42px d-flex align-center justify-center cursor-pointer",onClick:()=>{o({id:d.id,type:"auto"})},children:F.jsx(NA,{})})]}))}),F.jsxs("div",{className:"d-flex justify-end",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>close(),children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",onClick:()=>{e()},children:"Update"})]})]})});var Ht={},of;function OA(){if(of)return Ht;of=1;var r=Yo();Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.default=void 0;var o=r(ue()),e=Jo();return Ht.default=(0,o.default)((0,e.jsx)("path",{d:"m8.71 11.71 2.59 2.59c.39.39 1.02.39 1.41 0l2.59-2.59c.63-.63.18-1.71-.71-1.71H9.41c-.89 0-1.33 1.08-.7 1.71"}),"ArrowDropDownRounded"),Ht}var RA=OA();const ef=Io(RA),Ni={"popper-border":"#eaeff4","success-disabled":"#a6aaaf"};var qt={},df;function MA(){if(df)return qt;df=1;var r=Yo();Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=void 0;var o=r(ue()),e=Jo();return qt.default=(0,o.default)((0,e.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear"),qt}var $A=MA();const UA=Io($A);var o4=function(r,o){return o4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,d){e.__proto__=d}||function(e,d){for(var t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t])},o4(r,o)};function jA(r,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");o4(r,o);function e(){this.constructor=r}r.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var He=function(){return He=Object.assign||function(o){for(var e,d=1,t=arguments.length;d<t;d++){e=arguments[d];for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&(o[l]=e[l])}return o},He.apply(this,arguments)};function LA(r,o){var e={};for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&o.indexOf(d)<0&&(e[d]=r[d]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,d=Object.getOwnPropertySymbols(r);t<d.length;t++)o.indexOf(d[t])<0&&Object.prototype.propertyIsEnumerable.call(r,d[t])&&(e[d[t]]=r[d[t]]);return e}function zA(r,o,e,d){function t(l){return l instanceof e?l:new e(function(i){i(l)})}return new(e||(e=Promise))(function(l,i){function a(n){try{b(d.next(n))}catch(s){i(s)}}function w(n){try{b(d.throw(n))}catch(s){i(s)}}function b(n){n.done?l(n.value):t(n.value).then(a,w)}b((d=d.apply(r,o||[])).next())})}function VA(r,o){var e={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},d,t,l,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(b){return function(n){return w([b,n])}}function w(b){if(d)throw new TypeError("Generator is already executing.");for(;i&&(i=0,b[0]&&(e=0)),e;)try{if(d=1,t&&(l=b[0]&2?t.return:b[0]?t.throw||((l=t.return)&&l.call(t),0):t.next)&&!(l=l.call(t,b[1])).done)return l;switch(t=0,l&&(b=[b[0]&2,l.value]),b[0]){case 0:case 1:l=b;break;case 4:return e.label++,{value:b[1],done:!1};case 5:e.label++,t=b[1],b=[0];continue;case 7:b=e.ops.pop(),e.trys.pop();continue;default:if(l=e.trys,!(l=l.length>0&&l[l.length-1])&&(b[0]===6||b[0]===2)){e=0;continue}if(b[0]===3&&(!l||b[1]>l[0]&&b[1]<l[3])){e.label=b[1];break}if(b[0]===6&&e.label<l[1]){e.label=l[1],l=b;break}if(l&&e.label<l[2]){e.label=l[2],e.ops.push(b);break}l[2]&&e.ops.pop(),e.trys.pop();continue}b=o.call(r,e)}catch(n){b=[6,n],t=0}finally{d=l=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var e4="Invariant Violation",tf=Object.setPrototypeOf,HA=tf===void 0?function(r,o){return r.__proto__=o,r}:tf,lf=function(r){jA(o,r);function o(e){e===void 0&&(e=e4);var d=r.call(this,typeof e=="number"?e4+": "+e+" (see https://github.com/apollographql/invariant-packages)":e)||this;return d.framesToPop=1,d.name=e4,HA(d,o.prototype),d}return o}(Error);function nd(r,o){if(!r)throw new lf(o)}var af=["debug","log","warn","error","silent"],qA=af.indexOf("log");function Pi(r){return function(){if(af.indexOf(r)>=qA){var o=console[r]||console.log;return o.apply(console,arguments)}}}(function(r){r.debug=Pi("debug"),r.log=Pi("log"),r.warn=Pi("warn"),r.error=Pi("error")})(nd||(nd={}));var wf="3.14.0";function jd(r){try{return r()}catch{}}const d4=jd(function(){return globalThis})||jd(function(){return window})||jd(function(){return self})||jd(function(){return global})||jd(function(){return jd.constructor("return this")()});var bf=new Map;function WA(r){var o=bf.get(r)||1;return bf.set(r,o+1),"".concat(r,":").concat(o,":").concat(Math.random().toString(36).slice(2))}function KA(r,o){var e=WA("stringifyForDisplay");return JSON.stringify(r,function(d,t){return t===void 0?e:t},o).split(JSON.stringify(e)).join("<undefined>")}function Oi(r){return function(o){for(var e=[],d=1;d<arguments.length;d++)e[d-1]=arguments[d];if(typeof o=="number"){var t=o;o=l4(t),o||(o=i4(t,e),e=[])}r.apply(void 0,[o].concat(e))}}var t4=Object.assign(function(o,e){for(var d=[],t=2;t<arguments.length;t++)d[t-2]=arguments[t];o||nd(o,l4(e,d)||i4(e,d))},{debug:Oi(nd.debug),log:Oi(nd.log),warn:Oi(nd.warn),error:Oi(nd.error)});function nf(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return new lf(l4(r,o)||i4(r,o))}var sf=Symbol.for("ApolloErrorMessageHandler_"+wf);function pf(r){if(typeof r=="string")return r;try{return KA(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function l4(r,o){if(o===void 0&&(o=[]),!!r)return d4[sf]&&d4[sf](r,o.map(pf))}function i4(r,o){if(o===void 0&&(o=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:wf,message:r,args:o.map(pf)})))}function YA(r){return r.definitions.filter(function(o){return o.kind==="OperationDefinition"&&!!o.name}).map(function(o){return o.name.value})[0]||null}let oo=null;const ff={};let GA=1;const XA=()=>class{constructor(){this.id=["slot",GA++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let o=oo;o;o=o.parent)if(this.id in o.slots){const e=o.slots[this.id];if(e===ff)break;return o!==oo&&(oo.slots[this.id]=e),!0}return oo&&(oo.slots[this.id]=ff),!1}getValue(){if(this.hasValue())return oo.slots[this.id]}withValue(o,e,d,t){const l={__proto__:null,[this.id]:o},i=oo;oo={parent:i,slots:l};try{return e.apply(t,d)}finally{oo=i}}static bind(o){const e=oo;return function(){const d=oo;try{return oo=e,o.apply(this,arguments)}finally{oo=d}}}static noContext(o,e,d){if(oo){const t=oo;try{return oo=null,o.apply(d,e)}finally{oo=t}}else return o.apply(d,e)}};function hf(r){try{return r()}catch{}}const a4="@wry/context:Slot",mf=hf(()=>globalThis)||hf(()=>global)||Object.create(null),w4=mf[a4]||Array[a4]||function(r){try{Object.defineProperty(mf,a4,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(XA()),{bind:Sv,noContext:_v}=w4;new w4;function ZA(r,o){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=JA(r))||o){e&&(r=e);var d=0;return function(){return d>=r.length?{done:!0}:{done:!1,value:r[d++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
151
151
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JA(r,o){if(r){if(typeof r=="string")return kf(r,o);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return kf(r,o)}}function kf(r,o){(o==null||o>r.length)&&(o=r.length);for(var e=0,d=new Array(o);e<o;e++)d[e]=r[e];return d}function xf(r,o){for(var e=0;e<o.length;e++){var d=o[e];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(r,d.key,d)}}function b4(r,o,e){return o&&xf(r.prototype,o),e&&xf(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}var n4=function(){return typeof Symbol=="function"},s4=function(r){return n4()&&!!Symbol[r]},p4=function(r){return s4(r)?Symbol[r]:"@@"+r};n4()&&!s4("observable")&&(Symbol.observable=Symbol("observable"));var QA=p4("iterator"),f4=p4("observable"),gf=p4("species");function Ri(r,o){var e=r[o];if(e!=null){if(typeof e!="function")throw new TypeError(e+" is not a function");return e}}function Wt(r){var o=r.constructor;return o!==void 0&&(o=o[gf],o===null&&(o=void 0)),o!==void 0?o:ao}function ry(r){return r instanceof ao}function Ld(r){Ld.log?Ld.log(r):setTimeout(function(){throw r})}function Mi(r){Promise.resolve().then(function(){try{r()}catch(o){Ld(o)}})}function cf(r){var o=r._cleanup;if(o!==void 0&&(r._cleanup=void 0,!!o))try{if(typeof o=="function")o();else{var e=Ri(o,"unsubscribe");e&&e.call(o)}}catch(d){Ld(d)}}function h4(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function oy(r){var o=r._queue;if(o){r._queue=void 0,r._state="ready";for(var e=0;e<o.length&&(uf(r,o[e].type,o[e].value),r._state!=="closed");++e);}}function uf(r,o,e){r._state="running";var d=r._observer;try{var t=Ri(d,o);switch(o){case"next":t&&t.call(d,e);break;case"error":if(h4(r),t)t.call(d,e);else throw e;break;case"complete":h4(r),t&&t.call(d);break}}catch(l){Ld(l)}r._state==="closed"?cf(r):r._state==="running"&&(r._state="ready")}function m4(r,o,e){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:o,value:e});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:o,value:e}],Mi(function(){return oy(r)});return}uf(r,o,e)}}var ey=function(){function r(e,d){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var t=new dy(this);try{this._cleanup=d.call(void 0,t)}catch(l){t.error(l)}this._state==="initializing"&&(this._state="ready")}var o=r.prototype;return o.unsubscribe=function(){this._state!=="closed"&&(h4(this),cf(this))},b4(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),dy=function(){function r(e){this._subscription=e}var o=r.prototype;return o.next=function(d){m4(this._subscription,"next",d)},o.error=function(d){m4(this._subscription,"error",d)},o.complete=function(){m4(this._subscription,"complete")},b4(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ao=function(){function r(e){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}var o=r.prototype;return o.subscribe=function(d){return(typeof d!="object"||d===null)&&(d={next:d,error:arguments[1],complete:arguments[2]}),new ey(d,this._subscriber)},o.forEach=function(d){var t=this;return new Promise(function(l,i){if(typeof d!="function"){i(new TypeError(d+" is not a function"));return}function a(){w.unsubscribe(),l()}var w=t.subscribe({next:function(b){try{d(b,a)}catch(n){i(n),w.unsubscribe()}},error:i,complete:l})})},o.map=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=Wt(this);return new l(function(i){return t.subscribe({next:function(a){try{a=d(a)}catch(w){return i.error(w)}i.next(a)},error:function(a){i.error(a)},complete:function(){i.complete()}})})},o.filter=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=Wt(this);return new l(function(i){return t.subscribe({next:function(a){try{if(!d(a))return}catch(w){return i.error(w)}i.next(a)},error:function(a){i.error(a)},complete:function(){i.complete()}})})},o.reduce=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=Wt(this),i=arguments.length>1,a=!1,w=arguments[1],b=w;return new l(function(n){return t.subscribe({next:function(s){var p=!a;if(a=!0,!p||i)try{b=d(b,s)}catch(m){return n.error(m)}else b=s},error:function(s){n.error(s)},complete:function(){if(!a&&!i)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(b),n.complete()}})})},o.concat=function(){for(var d=this,t=arguments.length,l=new Array(t),i=0;i<t;i++)l[i]=arguments[i];var a=Wt(this);return new a(function(w){var b,n=0;function s(p){b=p.subscribe({next:function(m){w.next(m)},error:function(m){w.error(m)},complete:function(){n===l.length?(b=void 0,w.complete()):s(a.from(l[n++]))}})}return s(d),function(){b&&(b.unsubscribe(),b=void 0)}})},o.flatMap=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=Wt(this);return new l(function(i){var a=[],w=t.subscribe({next:function(n){if(d)try{n=d(n)}catch(p){return i.error(p)}var s=l.from(n).subscribe({next:function(p){i.next(p)},error:function(p){i.error(p)},complete:function(){var p=a.indexOf(s);p>=0&&a.splice(p,1),b()}});a.push(s)},error:function(n){i.error(n)},complete:function(){b()}});function b(){w.closed&&a.length===0&&i.complete()}return function(){a.forEach(function(n){return n.unsubscribe()}),w.unsubscribe()}})},o[f4]=function(){return this},r.from=function(d){var t=typeof this=="function"?this:r;if(d==null)throw new TypeError(d+" is not an object");var l=Ri(d,f4);if(l){var i=l.call(d);if(Object(i)!==i)throw new TypeError(i+" is not an object");return ry(i)&&i.constructor===t?i:new t(function(a){return i.subscribe(a)})}if(s4("iterator")&&(l=Ri(d,QA),l))return new t(function(a){Mi(function(){if(!a.closed){for(var w=ZA(l.call(d)),b;!(b=w()).done;){var n=b.value;if(a.next(n),a.closed)return}a.complete()}})});if(Array.isArray(d))return new t(function(a){Mi(function(){if(!a.closed){for(var w=0;w<d.length;++w)if(a.next(d[w]),a.closed)return;a.complete()}})});throw new TypeError(d+" is not observable")},r.of=function(){for(var d=arguments.length,t=new Array(d),l=0;l<d;l++)t[l]=arguments[l];var i=typeof this=="function"?this:r;return new i(function(a){Mi(function(){if(!a.closed){for(var w=0;w<t.length;++w)if(a.next(t[w]),a.closed)return;a.complete()}})})},b4(r,null,[{key:gf,get:function(){return this}}]),r}();n4()&&Object.defineProperty(ao,Symbol("extensions"),{value:{symbol:f4,hostReportError:Ld},configurable:!0});function ty(r){var o,e=r.Symbol;if(typeof e=="function")if(e.observable)o=e.observable;else{typeof e.for=="function"?o=e.for("https://github.com/benlesh/symbol-observable"):o=e("https://github.com/benlesh/symbol-observable");try{e.observable=o}catch{}}else o="@@observable";return o}var zd;typeof self<"u"?zd=self:typeof window<"u"?zd=window:typeof global<"u"?zd=global:typeof module<"u"?zd=module:zd=Function("return this")(),ty(zd);var Ff=ao.prototype,Af="@@observable";Ff[Af]||(Ff[Af]=function(){return this});function ly(r){for(var o=["query","operationName","variables","extensions","context"],e=0,d=Object.keys(r);e<d.length;e++){var t=d[e];if(o.indexOf(t)<0)throw nf(58,t)}return r}function iy(r,o){var e=He({},r),d=function(l){typeof l=="function"?e=He(He({},e),l(e)):e=He(He({},e),l)},t=function(){return He({},e)};return Object.defineProperty(o,"setContext",{enumerable:!1,value:d}),Object.defineProperty(o,"getContext",{enumerable:!1,value:t}),o}function ay(r){var o={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return o.operationName||(o.operationName=typeof o.query!="string"?YA(o.query)||void 0:""),o}var wy=Symbol.for("apollo.deprecations"),by=d4,ny=new w4;function sy(r){return by[wy]||(ny.getValue()||[]).includes(r)}function py(r,o){sy(r)||o()}function yf(r,o){return o?o(r):ao.of()}function Kt(r){return typeof r=="function"?new Ef(r):r}function $i(r){return r.request.length<=1}var Ef=function(){function r(o){o&&(this.request=o)}return r.empty=function(){return new r(function(){return ao.of()})},r.from=function(o){return o.length===0?r.empty():o.map(Kt).reduce(function(e,d){return e.concat(d)})},r.split=function(o,e,d){var t=Kt(e),l=Kt(d||new r(yf)),i;return $i(t)&&$i(l)?i=new r(function(a){return o(a)?t.request(a)||ao.of():l.request(a)||ao.of()}):i=new r(function(a,w){return o(a)?t.request(a,w)||ao.of():l.request(a,w)||ao.of()}),Object.assign(i,{left:t,right:l})},r.execute=function(o,e){return o.request(iy(e.context,ay(ly(e))))||ao.of()},r.concat=function(o,e){var d=Kt(o);if($i(d))return globalThis.__DEV__!==!1&&t4.warn(47,d),d;var t=Kt(e),l;return $i(t)?l=new r(function(i){return d.request(i,function(a){return t.request(a)||ao.of()})||ao.of()}):l=new r(function(i,a){return d.request(i,function(w){return t.request(w,a)||ao.of()})||ao.of()}),Object.assign(l,{left:d,right:t})},r.prototype.split=function(o,e,d){return this.concat(r.split(o,e,d||new r(yf)))},r.prototype.concat=function(o){return r.concat(this,o)},r.prototype.request=function(o,e){throw nf(48)},r.prototype.onError=function(o,e){if(globalThis.__DEV__!==!1&&py("onError",function(){globalThis.__DEV__!==!1&&t4.warn(49)}),e&&e.error)return e.error(o),!1;throw o},r.prototype.setOnError=function(o){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&t4.warn(50),this.onError=o,this},r}();function fy(r){return new Ef(function(o,e){var d=LA(o,[]);return new ao(function(t){var l,i=!1;return Promise.resolve(d).then(function(a){return r(a,o.getContext())}).then(o.setContext).then(function(){i||(l=e(o).subscribe({next:t.next.bind(t),error:t.error.bind(t),complete:t.complete.bind(t)}))}).catch(t.error.bind(t)),function(){i=!0,l&&l.unsubscribe()}})})}/*! js-cookie v3.0.5 | MIT */function Ui(r){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var d in e)r[d]=e[d]}return r}var hy={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function k4(r,o){function e(t,l,i){if(!(typeof document>"u")){i=Ui({},o,i),typeof i.expires=="number"&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var w in i)i[w]&&(a+="; "+w,i[w]!==!0&&(a+="="+i[w].split(";")[0]));return document.cookie=t+"="+r.write(l,t)+a}}function d(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var l=document.cookie?document.cookie.split("; "):[],i={},a=0;a<l.length;a++){var w=l[a].split("="),b=w.slice(1).join("=");try{var n=decodeURIComponent(w[0]);if(i[n]=r.read(b,n),t===n)break}catch{}}return t?i[t]:i}}return Object.create({set:e,get:d,remove:function(t,l){e(t,"",Ui({},l,{expires:-1}))},withAttributes:function(t){return k4(this.converter,Ui({},this.attributes,t))},withConverter:function(t){return k4(Ui({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}var Yt=k4(hy,{path:"/"});const Gt={NOTIFY:"notify",UPDATE_FIELD:"update_field",MOVE_RECORD:"move_record",COPY_RECORD_TO_OTHER_WORKSPACE:"copy_record_to_other_workspace"},Df={Config:"config",Auto:"auto"},my={login:"/auth/login"},vf={workspaceId:"workspaceId"},ky="Logging",xy="NoHubcallbackProvidedException";var Eo;(function(r){r.DEBUG="DEBUG",r.ERROR="ERROR",r.INFO="INFO",r.WARN="WARN",r.VERBOSE="VERBOSE",r.NONE="NONE"})(Eo||(Eo={}));const Sf={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class Do{constructor(o,e=Eo.WARN){this.name=o,this.level=e,this._pluggables=[]}_padding(o){return o<10?"0"+o:""+o}_ts(){const o=new Date;return[this._padding(o.getMinutes()),this._padding(o.getSeconds())].join(":")+"."+o.getMilliseconds()}configure(o){return o?(this._config=o,this._config):this._config}_log(o,...e){let d=this.level;Do.LOG_LEVEL&&(d=Do.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(d=window.LOG_LEVEL);const t=Sf[d];if(!(Sf[o]>=t))return;let i=console.log.bind(console);o===Eo.ERROR&&console.error&&(i=console.error.bind(console)),o===Eo.WARN&&console.warn&&(i=console.warn.bind(console)),Do.BIND_ALL_LOG_LEVELS&&(o===Eo.INFO&&console.info&&(i=console.info.bind(console)),o===Eo.DEBUG&&console.debug&&(i=console.debug.bind(console)));const a=`[${o}] ${this._ts()} ${this.name}`;let w="";if(e.length===1&&typeof e[0]=="string")w=`${a} - ${e[0]}`,i(w);else if(e.length===1)w=`${a} ${e[0]}`,i(a,e[0]);else if(typeof e[0]=="string"){let b=e.slice(1);b.length===1&&(b=b[0]),w=`${a} - ${e[0]} ${b}`,i(`${a} - ${e[0]}`,b)}else w=`${a} ${e}`,i(a,e);for(const b of this._pluggables){const n={message:w,timestamp:Date.now()};b.pushLogs([n])}}log(...o){this._log(Eo.INFO,...o)}info(...o){this._log(Eo.INFO,...o)}warn(...o){this._log(Eo.WARN,...o)}error(...o){this._log(Eo.ERROR,...o)}debug(...o){this._log(Eo.DEBUG,...o)}verbose(...o){this._log(Eo.VERBOSE,...o)}addPluggable(o){o&&o.getCategoryName()===ky&&(this._pluggables.push(o),o.configure(this._config))}listPluggables(){return this._pluggables}}Do.LOG_LEVEL=null,Do.BIND_ALL_LOG_LEVELS=!1;class ko extends Error{constructor({message:o,name:e,recoverySuggestion:d,underlyingError:t,metadata:l}){if(super(o),this.name=e,this.underlyingError=t,this.recoverySuggestion=d,l){const{extendedRequestId:i,httpStatusCode:a,requestId:w}=l;this.metadata={extendedRequestId:i,httpStatusCode:a,requestId:w}}this.constructor=ko,Object.setPrototypeOf(this,ko.prototype)}}var qe;(function(r){r.NoEndpointId="NoEndpointId",r.PlatformNotSupported="PlatformNotSupported",r.Unknown="Unknown",r.NetworkError="NetworkError"})(qe||(qe={}));const x4=(r,o=ko)=>(e,d,t)=>{const{message:l,recoverySuggestion:i}=r[d];if(!e)throw new o({name:d,message:t?`${l} ${t}`:l,recoverySuggestion:i})},sd=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",Xt=new Do("Hub");class _f{constructor(o){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=o}_remove(o,e){const d=this.listeners.get(o);if(!d){Xt.warn(`No listeners for ${o}`);return}this.listeners.set(o,[...d.filter(({callback:t})=>t!==e)])}dispatch(o,e,d,t){typeof o=="string"&&this.protectedChannels.indexOf(o)>-1&&(t===sd||Xt.warn(`WARNING: ${o} is protected and dispatching on it can have unintended consequences`));const l={channel:o,payload:{...e},source:d,patternInfo:[]};try{this._toListeners(l)}catch(i){Xt.error(i)}}listen(o,e,d="noname"){let t;if(typeof e!="function")throw new ko({name:xy,message:"No callback supplied to Hub"});t=e;let l=this.listeners.get(o);return l||(l=[],this.listeners.set(o,l)),l.push({name:d,callback:t}),()=>{this._remove(o,t)}}_toListeners(o){const{channel:e,payload:d}=o,t=this.listeners.get(e);t&&t.forEach(l=>{Xt.debug(`Dispatching to ${e} with `,d);try{l.callback(o)}catch(i){Xt.error(i)}})}}const Vd=new _f("__default__"),ji=new _f("internal-hub"),gy=()=>{if(typeof window=="object"&&typeof window.crypto=="object")return window.crypto;if(typeof crypto=="object")return crypto;throw new ko({name:"MissingPolyfill",message:"Cannot resolve the `crypto` function from the environment."})},cy=()=>{if(typeof window<"u"&&typeof window.btoa=="function")return window.btoa;if(typeof btoa=="function")return btoa;throw new ko({name:"Base64EncoderError",message:"Cannot resolve the `btoa` function from the environment."})},uy=()=>{if(typeof window<"u"&&typeof window.atob=="function")return window.atob;if(typeof atob=="function")return atob;throw new ko({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})},g4={convert(r,o){let e=r;return o?.urlSafe&&(e=e.replace(/-/g,"+").replace(/_/g,"/")),uy()(e)}};var ie;(function(r){r.AuthTokenConfigException="AuthTokenConfigException",r.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",r.AuthUserPoolException="AuthUserPoolException",r.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",r.OAuthNotConfigureException="OAuthNotConfigureException"})(ie||(ie={}));const Fy={[ie.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[ie.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[ie.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[ie.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[ie.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}},c4=x4(Fy);function Sr(r){let o=!0;r?o=!!r.userPoolId&&!!r.userPoolClientId:o=!1,c4(o,ie.AuthUserPoolException)}function Cf(r){const o=!!r?.loginWith?.oauth?.domain&&!!r?.loginWith?.oauth?.redirectSignOut&&!!r?.loginWith?.oauth?.redirectSignIn&&!!r?.loginWith?.oauth?.responseType;c4(o,ie.OAuthNotConfigureException)}function Li(r){const o=!!r?.identityPoolId;c4(o,ie.InvalidIdentityPoolIdException)}function pd(r){const o=r.split(".");if(o.length!==3)throw new Error("Invalid token");try{const d=o[1].replace(/-/g,"+").replace(/_/g,"/"),t=decodeURIComponent(g4.convert(d).split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),l=JSON.parse(t);return{toString:()=>r,payload:l}}catch{throw new Error("Invalid token payload")}}const Bf=r=>{const o=Reflect.ownKeys(r);for(const e of o){const d=r[e];(d&&typeof d=="object"||typeof d=="function")&&Bf(d)}return Object.freeze(r)},Ay=new Do("parseAWSExports"),yy={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},Ey=(r={})=>{if(!Object.prototype.hasOwnProperty.call(r,"aws_project_region"))throw new ko({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});const{aws_appsync_apiKey:o,aws_appsync_authenticationType:e,aws_appsync_graphqlEndpoint:d,aws_appsync_region:t,aws_bots_config:l,aws_cognito_identity_pool_id:i,aws_cognito_sign_up_verification_method:a,aws_cognito_mfa_configuration:w,aws_cognito_mfa_types:b,aws_cognito_password_protection_settings:n,aws_cognito_verification_mechanisms:s,aws_cognito_signup_attributes:p,aws_cognito_social_providers:m,aws_cognito_username_attributes:h,aws_mandatory_sign_in:f,aws_mobile_analytics_app_id:k,aws_mobile_analytics_app_region:x,aws_user_files_s3_bucket:c,aws_user_files_s3_bucket_region:A,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:u,aws_user_pools_id:g,aws_user_pools_web_client_id:B,geo:D,oauth:v,predictions:_,aws_cloud_logic_custom:T,Notifications:$,modelIntrospection:H}=r,R={};k&&(R.Analytics={Pinpoint:{appId:k,region:x}});const{InAppMessaging:E,Push:O}=$??{};if(E?.AWSPinpoint||O?.AWSPinpoint){if(E?.AWSPinpoint){const{appId:L,region:W}=E.AWSPinpoint;R.Notifications={InAppMessaging:{Pinpoint:{appId:L,region:W}}}}if(O?.AWSPinpoint){const{appId:L,region:W}=O.AWSPinpoint;R.Notifications={...R.Notifications,PushNotification:{Pinpoint:{appId:L,region:W}}}}}if(Array.isArray(l)&&(R.Interactions={LexV1:Object.fromEntries(l.map(L=>[L.name,L]))}),d){const L=yy[e];L||Ay.debug(`Invalid authentication type ${e}. Falling back to IAM.`),R.API={GraphQL:{endpoint:d,apiKey:o,region:t,defaultAuthMode:L??"iam"}},H&&(R.API.GraphQL.modelIntrospection=H)}const C=w?{status:w&&w.toLowerCase(),totpEnabled:b?.includes("TOTP")??!1,smsEnabled:b?.includes("SMS")??!1}:void 0,U=n?{minLength:n.passwordPolicyMinLength,requireLowercase:n.passwordPolicyCharacters?.includes("REQUIRES_LOWERCASE")??!1,requireUppercase:n.passwordPolicyCharacters?.includes("REQUIRES_UPPERCASE")??!1,requireNumbers:n.passwordPolicyCharacters?.includes("REQUIRES_NUMBERS")??!1,requireSpecialCharacters:n.passwordPolicyCharacters?.includes("REQUIRES_SYMBOLS")??!1}:void 0,P=Array.from(new Set([...s??[],...p??[]])).reduce((L,W)=>({...L,[W.toLowerCase()]:{required:!0}}),{}),I=h?.includes("EMAIL")??!1,N=h?.includes("PHONE_NUMBER")??!1;(i||g)&&(R.Auth={Cognito:{identityPoolId:i,allowGuestAccess:f!=="enable",signUpVerificationMethod:a,userAttributes:P,userPoolClientId:B,userPoolId:g,mfa:C,passwordFormat:U,loginWith:{username:!(I||N),email:I,phone:N}}});const z=v?Object.keys(v).length>0:!1,q=m?m.length>0:!1;if(R.Auth&&z&&(R.Auth.Cognito.loginWith={...R.Auth.Cognito.loginWith,oauth:{...Dy(v),...q&&{providers:vy(m)}}}),c&&(R.Storage={S3:{bucket:c,region:A,dangerouslyConnectToHttpEndpointForTesting:u}}),D){const{amazon_location_service:L}=D;R.Geo={LocationService:{maps:L.maps,geofenceCollections:L.geofenceCollections,searchIndices:L.search_indices,region:L.region}}}if(T&&(R.API={...R.API,REST:T.reduce((L,W)=>{const{name:Y,endpoint:X,region:Z,service:J}=W;return{...L,[Y]:{endpoint:X,...J?{service:J}:void 0,...Z?{region:Z}:void 0}}},{})}),_){const{VoiceId:L}=_?.convert?.speechGenerator?.defaults??{};R.Predictions=L?{..._,convert:{..._.convert,speechGenerator:{..._.convert.speechGenerator,defaults:{voiceId:L}}}}:_}return R},If=r=>r?.split(",")??[],Dy=({domain:r,scope:o,redirectSignIn:e,redirectSignOut:d,responseType:t})=>({domain:r,scopes:o,redirectSignIn:If(e),redirectSignOut:If(d),responseType:t}),vy=r=>r.map(o=>{const e=o.toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}),Sy=Symbol("oauth-listener"),eo=[];for(let r=0;r<256;++r)eo.push((r+256).toString(16).slice(1));function _y(r,o=0){return(eo[r[o+0]]+eo[r[o+1]]+eo[r[o+2]]+eo[r[o+3]]+"-"+eo[r[o+4]]+eo[r[o+5]]+"-"+eo[r[o+6]]+eo[r[o+7]]+"-"+eo[r[o+8]]+eo[r[o+9]]+"-"+eo[r[o+10]]+eo[r[o+11]]+eo[r[o+12]]+eo[r[o+13]]+eo[r[o+14]]+eo[r[o+15]]).toLowerCase()}let u4;const Cy=new Uint8Array(16);function By(){if(!u4){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");u4=crypto.getRandomValues.bind(crypto)}return u4(Cy)}const Tf={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Iy(r,o,e){if(Tf.randomUUID&&!o&&!r)return Tf.randomUUID();r=r||{};const d=r.random??r.rng?.()??By();if(d.length<16)throw new Error("Random bytes length must be >= 16");if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,o){if(e=e||0,e<0||e+16>o.length)throw new RangeError(`UUID byte range ${e}:${e+15} is out of buffer bounds`);for(let t=0;t<16;++t)o[e+t]=d[t];return o}return _y(d)}function Ty(r){const{version:o}=r;return o?o.startsWith("1"):!1}function Ny(r){if(!r)return;const{bucket_name:o,aws_region:e,buckets:d}=r;return{S3:{bucket:o,region:e,buckets:d&&Hy(d)}}}function Py(r){if(!r)return;const{user_pool_id:o,user_pool_client_id:e,identity_pool_id:d,password_policy:t,mfa_configuration:l,mfa_methods:i,unauthenticated_identities_enabled:a,oauth:w,username_attributes:b,standard_required_attributes:n,groups:s}=r,p={Cognito:{userPoolId:o,userPoolClientId:e,groups:s}};return d&&(p.Cognito={...p.Cognito,identityPoolId:d}),t&&(p.Cognito.passwordFormat={requireLowercase:t.require_lowercase,requireNumbers:t.require_numbers,requireUppercase:t.require_uppercase,requireSpecialCharacters:t.require_symbols,minLength:t.min_length??6}),l&&(p.Cognito.mfa={status:Vy(l),smsEnabled:i?.includes("SMS"),totpEnabled:i?.includes("TOTP")}),a&&(p.Cognito.allowGuestAccess=a),w&&(p.Cognito.loginWith={oauth:{domain:w.domain,redirectSignIn:w.redirect_sign_in_uri,redirectSignOut:w.redirect_sign_out_uri,responseType:w.response_type==="token"?"token":"code",scopes:w.scopes,providers:zy(w.identity_providers)}}),b&&(p.Cognito.loginWith={...p.Cognito.loginWith,email:b.includes("email"),phone:b.includes("phone_number"),username:b.includes("username")}),n&&(p.Cognito.userAttributes=n.reduce((m,h)=>({...m,[h]:{required:!0}}),{})),p}function Oy(r){if(!r?.amazon_pinpoint)return;const{amazon_pinpoint:o}=r;return{Pinpoint:{appId:o.app_id,region:o.aws_region}}}function Ry(r){if(!r)return;const{aws_region:o,geofence_collections:e,maps:d,search_indices:t}=r;return{LocationService:{region:o,searchIndices:t,geofenceCollections:e,maps:d}}}function My(r){if(!r)return;const{aws_region:o,default_authorization_type:e,url:d,api_key:t,model_introspection:l}=r;return{GraphQL:{endpoint:d,defaultAuthMode:Nf(e),region:o,apiKey:t,modelIntrospection:l}}}function $y(r){if(!r?.events)return;const{url:o,aws_region:e,api_key:d,default_authorization_type:t}=r.events;return{Events:{endpoint:o,defaultAuthMode:Nf(t),region:e,apiKey:d}}}function Uy(r){if(!r)return;const{aws_region:o,channels:e,amazon_pinpoint_app_id:d}=r,t=e.includes("IN_APP_MESSAGING"),l=e.includes("APNS")||e.includes("FCM");if(!(t||l))return;const i={};return t&&(i.InAppMessaging={Pinpoint:{appId:d,region:o}}),l&&(i.PushNotification={Pinpoint:{appId:d,region:o}}),i}function jy(r){const o={};if(r.storage&&(o.Storage=Ny(r.storage)),r.auth&&(o.Auth=Py(r.auth)),r.analytics&&(o.Analytics=Oy(r.analytics)),r.geo&&(o.Geo=Ry(r.geo)),r.data&&(o.API=My(r.data)),r.custom){const e=$y(r.custom);e&&"Events"in e&&(o.API={...o.API,...e})}return r.notifications&&(o.Notifications=Uy(r.notifications)),o}const Ly={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function Nf(r){return Ly[r]}const Pf={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function zy(r=[]){return r.reduce((o,e)=>(Pf[e]!==void 0&&o.push(Pf[e]),o),[])}function Vy(r){return r==="OPTIONAL"?"optional":r==="REQUIRED"?"on":"off"}function Hy(r){const o={};return r.forEach(({name:e,bucket_name:d,aws_region:t,paths:l})=>{if(e in o)throw new Error(`Duplicate friendly name found: ${e}. Name must be unique.`);const i=l?Object.entries(l).reduce((a,[w,b])=>(b!==void 0&&(a[w]=b),a),{}):void 0;o[e]={bucketName:d,region:t,paths:i}}),o}const Of=r=>Object.keys(r).some(o=>o.startsWith("aws_"))?Ey(r):Ty(r)?jy(r):r;var Ro=64,qy=32,Wy=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ky=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Yy=Math.pow(2,53)-1,zi=function(){function r(){this.state=Int32Array.from(Ky),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return r.prototype.update=function(o){if(this.finished)throw new Error("Attempted to update an already finished hash.");var e=0,d=o.byteLength;if(this.bytesHashed+=d,this.bytesHashed*8>Yy)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;d>0;)this.buffer[this.bufferLength++]=o[e++],d--,this.bufferLength===Ro&&(this.hashBuffer(),this.bufferLength=0)},r.prototype.digest=function(){if(!this.finished){var o=this.bytesHashed*8,e=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),d=this.bufferLength;if(e.setUint8(this.bufferLength++,128),d%Ro>=Ro-8){for(var t=this.bufferLength;t<Ro;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(var t=this.bufferLength;t<Ro-8;t++)e.setUint8(t,0);e.setUint32(Ro-8,Math.floor(o/4294967296),!0),e.setUint32(Ro-4,o),this.hashBuffer(),this.finished=!0}for(var l=new Uint8Array(qy),t=0;t<8;t++)l[t*4]=this.state[t]>>>24&255,l[t*4+1]=this.state[t]>>>16&255,l[t*4+2]=this.state[t]>>>8&255,l[t*4+3]=this.state[t]>>>0&255;return l},r.prototype.hashBuffer=function(){for(var o=this,e=o.buffer,d=o.state,t=d[0],l=d[1],i=d[2],a=d[3],w=d[4],b=d[5],n=d[6],s=d[7],p=0;p<Ro;p++){if(p<16)this.temp[p]=(e[p*4]&255)<<24|(e[p*4+1]&255)<<16|(e[p*4+2]&255)<<8|e[p*4+3]&255;else{var m=this.temp[p-2],h=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10;m=this.temp[p-15];var f=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;this.temp[p]=(h+this.temp[p-7]|0)+(f+this.temp[p-16]|0)}var k=(((w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7))+(w&b^~w&n)|0)+(s+(Wy[p]+this.temp[p]|0)|0)|0,x=((t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10))+(t&l^t&i^l&i)|0;s=n,n=b,b=w,w=a+k|0,a=i,i=l,l=t,t=k+x|0}d[0]+=t,d[1]+=l,d[2]+=i,d[3]+=a,d[4]+=w,d[5]+=b,d[6]+=n,d[7]+=s},r}();const Gy=r=>new TextEncoder().encode(r);var Xy=typeof Buffer<"u"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:Gy;function Rf(r){return r instanceof Uint8Array?r:typeof r=="string"?Xy(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function Zy(r){return typeof r=="string"?r.length===0:r.byteLength===0}var Vi=function(){function r(o){this.secret=o,this.hash=new zi,this.reset()}return r.prototype.update=function(o){if(!(Zy(o)||this.error))try{this.hash.update(Rf(o))}catch(e){this.error=e}},r.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},r.prototype.digest=function(){return zA(this,void 0,void 0,function(){return VA(this,function(o){return[2,this.digestSync()]})})},r.prototype.reset=function(){if(this.hash=new zi,this.secret){this.outer=new zi;var o=Jy(this.secret),e=new Uint8Array(Ro);e.set(o);for(var d=0;d<Ro;d++)o[d]^=54,e[d]^=92;this.hash.update(o),this.outer.update(e);for(var d=0;d<o.byteLength;d++)o[d]=0}},r}();function Jy(r){var o=Rf(r);if(o.byteLength>Ro){var e=new zi;e.update(o),o=e.digest()}var d=new Uint8Array(Ro);return d.set(o),d}for(let r=0;r<256;r++){let o=r.toString(16).toLowerCase();o.length===1&&(o=`0${o}`)}var Wr;(function(r){r.WebUnknown="0",r.React="1",r.NextJs="2",r.Angular="3",r.VueJs="4",r.Nuxt="5",r.Svelte="6",r.ServerSideUnknown="100",r.ReactSSR="101",r.NextJsSSR="102",r.AngularSSR="103",r.VueJsSSR="104",r.NuxtSSR="105",r.SvelteSSR="106",r.ReactNative="201",r.Expo="202"})(Wr||(Wr={}));var F4;(function(r){r.AI="ai",r.API="api",r.Auth="auth",r.Analytics="analytics",r.DataStore="datastore",r.Geo="geo",r.InAppMessaging="inappmessaging",r.Interactions="interactions",r.Predictions="predictions",r.PubSub="pubsub",r.PushNotification="pushnotification",r.Storage="storage"})(F4||(F4={}));var Mf;(function(r){r.CreateConversation="1",r.GetConversation="2",r.ListConversations="3",r.DeleteConversation="4",r.SendMessage="5",r.ListMessages="6",r.OnMessage="7",r.Generation="8",r.UpdateConversation="9"})(Mf||(Mf={}));var $f;(function(r){r.Record="1",r.IdentifyUser="2"})($f||($f={}));var Uf;(function(r){r.GraphQl="1",r.Get="2",r.Post="3",r.Put="4",r.Patch="5",r.Del="6",r.Head="7"})(Uf||(Uf={}));var wo;(function(r){r.SignUp="1",r.ConfirmSignUp="2",r.ResendSignUpCode="3",r.SignIn="4",r.FetchMFAPreference="6",r.UpdateMFAPreference="7",r.SetUpTOTP="10",r.VerifyTOTPSetup="11",r.ConfirmSignIn="12",r.DeleteUserAttributes="15",r.DeleteUser="16",r.UpdateUserAttributes="17",r.FetchUserAttributes="18",r.ConfirmUserAttribute="22",r.SignOut="26",r.UpdatePassword="27",r.ResetPassword="28",r.ConfirmResetPassword="29",r.FederatedSignIn="30",r.RememberDevice="32",r.ForgetDevice="33",r.FetchDevices="34",r.SendUserAttributeVerificationCode="35",r.SignInWithRedirect="36",r.StartWebAuthnRegistration="37",r.CompleteWebAuthnRegistration="38",r.ListWebAuthnCredentials="39",r.DeleteWebAuthnCredential="40"})(wo||(wo={}));var jf;(function(r){r.Subscribe="1",r.GraphQl="2"})(jf||(jf={}));var Lf;(function(r){r.SearchByText="0",r.SearchByCoordinates="1",r.SearchForSuggestions="2",r.SearchByPlaceId="3",r.SaveGeofences="4",r.GetGeofence="5",r.ListGeofences="6",r.DeleteGeofences="7"})(Lf||(Lf={}));var zf;(function(r){r.SyncMessages="1",r.IdentifyUser="2",r.NotifyMessageInteraction="3"})(zf||(zf={}));var Vf;(function(r){r.None="0"})(Vf||(Vf={}));var Hf;(function(r){r.Convert="1",r.Identify="2",r.Interpret="3"})(Hf||(Hf={}));var qf;(function(r){r.Subscribe="1"})(qf||(qf={}));var Wf;(function(r){r.InitializePushNotifications="1",r.IdentifyUser="2"})(Wf||(Wf={}));var Kf;(function(r){r.UploadData="1",r.DownloadData="2",r.List="3",r.Copy="4",r.Remove="5",r.GetProperties="6",r.GetUrl="7",r.GetDataAccess="8",r.ListCallerAccessGrants="9"})(Kf||(Kf={}));const Qy="6.15.5",Hi=()=>typeof global<"u",Hd=()=>typeof window<"u",Yf=()=>typeof document<"u",A4=()=>typeof process<"u",Zt=(r,o)=>!!Object.keys(r).find(e=>e.startsWith(o));function r8(){const r=d=>d.startsWith("_react")||d.startsWith("__react"),o=d=>Object.keys(d).find(r),e=()=>Array.from(document.querySelectorAll("[id]"));return Yf()&&e().some(o)}function o8(){return A4()&&typeof process.env<"u"&&!!Object.keys(process.env).find(r=>r.includes("react"))}function e8(){return Hd()&&Zt(window,"__VUE")}function d8(){return Hi()&&Zt(global,"__VUE")}function t8(){return Hd()&&Zt(window,"__SVELTE")}function l8(){return A4()&&typeof process.env<"u"&&!!Object.keys(process.env).find(r=>r.includes("svelte"))}function i8(){return Hd()&&window.next&&typeof window.next=="object"}function a8(){return Hi()&&(Zt(global,"__next")||Zt(global,"__NEXT"))}function w8(){return Hd()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function b8(){return Hi()&&typeof global.__NUXT_PATHS__<"u"}function n8(){const r=!!(Yf()&&document.querySelector("[ng-version]")),o=!!(Hd()&&typeof window.ng<"u");return r||o}function s8(){return A4()&&typeof process.env=="object"&&process.env.npm_lifecycle_script?.startsWith("ng ")||!1}function p8(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function f8(){return Hi()&&typeof global.expo<"u"}function h8(){return Hd()}const m8=[{platform:Wr.Expo,detectionMethod:f8},{platform:Wr.ReactNative,detectionMethod:p8},{platform:Wr.NextJs,detectionMethod:i8},{platform:Wr.Nuxt,detectionMethod:w8},{platform:Wr.Angular,detectionMethod:n8},{platform:Wr.React,detectionMethod:r8},{platform:Wr.VueJs,detectionMethod:e8},{platform:Wr.Svelte,detectionMethod:t8},{platform:Wr.WebUnknown,detectionMethod:h8},{platform:Wr.NextJsSSR,detectionMethod:a8},{platform:Wr.NuxtSSR,detectionMethod:b8},{platform:Wr.ReactSSR,detectionMethod:o8},{platform:Wr.VueJsSSR,detectionMethod:d8},{platform:Wr.AngularSSR,detectionMethod:s8},{platform:Wr.SvelteSSR,detectionMethod:l8}];function k8(){return m8.find(r=>r.detectionMethod())?.platform||Wr.ServerSideUnknown}let Jt;const y4=[];let E4=!1;const x8=10,g8=10,c8=1e3,Gf=()=>{if(!Jt){if(Jt=k8(),E4)for(;y4.length;)y4.pop()?.();else y4.forEach(r=>{r()});Xf(Wr.ServerSideUnknown,x8),Xf(Wr.WebUnknown,g8)}return Jt};function u8(){Jt=void 0}function Xf(r,o){Jt===r&&!E4&&setTimeout(()=>{u8(),E4=!0,setTimeout(Gf,c8)},o)}const F8={},A8=(r,o)=>F8[r]?.[o]?.additionalDetails,y8="aws-amplify",E8=r=>r.replace(/\+.*/,""),D8=({category:r,action:o}={})=>{const e=[[y8,E8(Qy)]];if(r&&e.push([r,o]),e.push(["framework",Gf()]),r&&o){const d=A8(r,o);d&&d.forEach(t=>{e.push(t)})}return e},qi=r=>D8(r).map(([d,t])=>d&&t?`${d}/${t}`:d).join(" "),Zf=()=>typeof window<"u"&&typeof window.document<"u",Jf=new Do("Auth");class v8{configure(o,e){this.authConfig=o,this.authOptions=e,o&&o.Cognito?.userPoolEndpoint&&Jf.warn(Qf("Amazon Cognito User Pool")),o&&o.Cognito?.identityPoolEndpoint&&Jf.warn(Qf("Amazon Cognito Identity Pool"))}async fetchAuthSession(o={}){let e,d;const t=await this.getTokens(o);return t?(d=t.accessToken?.payload?.sub,e=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:t,authenticated:!0,forceRefresh:o.forceRefresh})):e=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:o.forceRefresh}),{tokens:t,credentials:e?.credentials,identityId:e?.identityId,userSub:d}}async clearCredentials(){await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId()}async getTokens(o){return await this.authOptions?.tokenProvider?.getTokens(o)??void 0}}const Qf=r=>`You are using a custom Amazon ${r} endpoint, ensure the endpoint is correct.`;class S8{constructor(){this.oAuthListener=void 0,this.isConfigured=!1,this.resourcesConfig={},this.libraryOptions={},this.Auth=new v8}configure(o,e){const d=Of(o);this.resourcesConfig=d,e&&(this.libraryOptions=e),this.resourcesConfig=Bf(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),Vd.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",sd),this.notifyOAuthListener(),this.isConfigured=!0}getConfig(){return this.isConfigured||console.warn("Amplify has not been configured. Please call Amplify.configure() before using this service."),this.resourcesConfig}[Sy](o){this.resourcesConfig.Auth?.Cognito.loginWith?.oauth?o(this.resourcesConfig.Auth?.Cognito):this.oAuthListener=o}notifyOAuthListener(){!this.resourcesConfig.Auth?.Cognito.loginWith?.oauth||!this.oAuthListener||(this.oAuthListener(this.resourcesConfig.Auth?.Cognito),this.oAuthListener=void 0)}}const Tr=new S8,_8=(r,o)=>r.Auth.fetchAuthSession(o),rh=r=>_8(Tr,r);function oh(){return Tr.Auth.clearCredentials()}const Wi=r=>{const{headers:o,statusCode:e}=r;return{...C8(r)?r.$metadata:{},httpStatusCode:e,requestId:o["x-amzn-requestid"]??o["x-amzn-request-id"]??o["x-amz-request-id"],extendedRequestId:o["x-amz-id-2"],cfId:o["x-amz-cf-id"]}},C8=r=>typeof r?.$metadata=="object",qd=async r=>{if(!r||r.statusCode<300)return;const o=await Qt(r),d=(i=>{const[a]=i.toString().split(/[,:]+/);return a.includes("#")?a.split("#")[1]:a})(r.headers["x-amzn-errortype"]??o.code??o.__type??"UnknownError"),t=o.message??o.Message??"Unknown error",l=new Error(t);return Object.assign(l,{name:d,$metadata:Wi(r)})},Qt=async r=>{if(!r.body)throw new Error("Missing response payload");const o=await r.body.json();return Object.assign(o,{$metadata:Wi(r)})},no=(r,o,e,d)=>async(t,l)=>{const i={...d,...t},a=await i.endpointResolver(i,l),w=await o(l,a),b=await r(w,{...i});return e(b)},B8=300*1e3;function I8(r=B8){return d=>{const t=2**d*100+100*Math.random();return t>r?!1:t}}const eh=3,dh="amz-sdk-invocation-id",T8="amz-sdk-request",th=300*1e3,lh=r=>{const e=I8(th)(r);return e===!1?th:e},N8=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],P8=r=>!!r&&N8.includes(r),ih=r=>async(o,e)=>{const d=e??await r(o)??void 0,t=d?.code||d?.name,l=o?.statusCode;return{retryable:$8(e)||M8(l,t)||P8(t)||U8(l,t)}},O8=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],R8=["TimeoutError","RequestTimeout","RequestTimeoutException"],M8=(r,o)=>r===429||!!o&&O8.includes(o),$8=r=>[qe.NetworkError,"ERR_NETWORK"].includes(r?.name),U8=(r,o)=>!!r&&[500,502,503,504].includes(r)||!!o&&R8.includes(o),ah="cognito-identity",wh={service:ah,retryDecider:ih(qd),computeDelay:lh,cache:"no-store"},j8=({maxAttempts:r=eh,retryDecider:o,computeDelay:e,abortSignal:d})=>{if(r<1)throw new Error("maxAttempts must be greater than 0");return(t,l)=>async function(a){let w,b=l.attemptsCount??0,n;const s=()=>{if(n)return bh(n,b),n;throw bh(w,b),w};for(;!d?.aborted&&b<r;){try{n=await t(a),w=void 0}catch(h){w=h,n=void 0}b=(l.attemptsCount??0)>b?l.attemptsCount??0:b+1,l.attemptsCount=b;const{isCredentialsExpiredError:p,retryable:m}=await o(n,w,l);if(m){if(l.isCredentialsExpired=!!p,!d?.aborted&&b<r){const h=e(b);await L8(h,d)}continue}else return s()}if(d?.aborted)throw new Error("Request aborted.");return s()}},L8=(r,o)=>{if(o?.aborted)return Promise.resolve();let e,d;const t=new Promise(l=>{d=l,e=setTimeout(l,r)});return o?.addEventListener("abort",function l(i){clearTimeout(e),o?.removeEventListener("abort",l),d()}),t},bh=(r,o)=>{Object.prototype.toString.call(r)==="[object Object]"&&(r.$metadata={...r.$metadata??{},attempts:o})},z8=Iy,V8=()=>r=>async function(e){return e.headers[dh]||(e.headers[dh]=z8()),r(e)},H8=({maxAttempts:r=eh})=>(o,e)=>async function(t){const l=e.attemptsCount??0;return t.headers[T8]=`attempt=${l+1}; max=${r}`,o(t)},q8=({userAgentHeader:r="x-amz-user-agent",userAgentValue:o=""})=>e=>async function(t){if(o.trim().length===0)return await e(t);{const l=r.toLowerCase();return t.headers[l]=t.headers[l]?`${t.headers[l]} ${o}`:o,await e(t)}},D4=(r,o)=>(e,d)=>{const t={};let l=i=>r(i,d);for(let i=o.length-1;i>=0;i--){const a=o[i];l=a(d)(l,t)}return l(e)},v4=r=>{let o;return()=>(o||(o=r()),o)},W8=r=>!["HEAD","GET"].includes(r.toUpperCase()),nh=D4(async({url:r,method:o,headers:e,body:d},{abortSignal:t,cache:l,withCrossDomainCredentials:i})=>{let a;try{a=await fetch(r,{method:o,headers:e,body:W8(o)?d:void 0,signal:t,cache:l,credentials:i?"include":"same-origin"})}catch(s){throw s instanceof TypeError?new ko({name:qe.NetworkError,message:"A network error has occurred.",underlyingError:s}):s}const w={};a.headers?.forEach((s,p)=>{w[p.toLowerCase()]=s});const b={statusCode:a.status,headers:w,body:null},n=Object.assign(a.body??{},{text:v4(()=>a.text()),blob:v4(()=>a.blob()),json:v4(()=>a.json())});return{...b,body:n}},[q8,V8,j8,H8]),sh=D4(nh,[()=>r=>async function(e){return e.headers["cache-control"]="no-store",r(e)}]),ph=r=>(o,e)=>{const d=K8(r),t=JSON.stringify(o);return Y8(e,d,t)},K8=r=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${r}`}),Y8=({url:r},o,e)=>({headers:o,url:r,body:e,method:"POST"}),fh=r=>no(sh,ph("GetCredentialsForIdentity"),G8,{...wh,...r,userAgentValue:qi()}),G8=async r=>{if(r.statusCode>=300)throw await qd(r);const o=await Qt(r);return{IdentityId:o.IdentityId,Credentials:X8(o.Credentials),$metadata:Wi(r)}},X8=({Expiration:r,...o}={})=>({...o,Expiration:r&&new Date(r*1e3)}),Z8=r=>no(sh,ph("GetId"),J8,{...wh,...r,userAgentValue:qi()}),J8=async r=>{if(r.statusCode>=300)throw await qd(r);return{IdentityId:(await Qt(r)).IdentityId,$metadata:Wi(r)}},hh={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},Q8={partitions:[hh,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]},mh=r=>{const{partitions:o}=Q8;for(const{regions:e,outputs:d,regionRegex:t}of o){const l=new RegExp(t);if(e.includes(r)||l.test(r))return d.dnsSuffix}return hh.outputs.dnsSuffix},rl=URL,rE=({region:r})=>({url:new rl(`https://${ah}.${r}.${mh(r)}`)});class ol extends ko{constructor(){super({name:qe.PlatformNotSupported,message:"Function not supported on current platform"})}}class kh{constructor(o){this.storage=o}async setItem(o,e){if(!this.storage)throw new ol;this.storage.setItem(o,e)}async getItem(o){if(!this.storage)throw new ol;return this.storage.getItem(o)}async removeItem(o){if(!this.storage)throw new ol;this.storage.removeItem(o)}async clear(){if(!this.storage)throw new ol;this.storage.clear()}}class xh{constructor(){this.storage=new Map}get length(){return this.storage.size}key(o){return o>this.length-1?null:Array.from(this.storage.keys())[o]}setItem(o,e){this.storage.set(o,e)}getItem(o){return this.storage.get(o)??null}removeItem(o){this.storage.delete(o)}clear(){this.storage.clear()}}const gh=new Do("CoreStorageUtils"),oE=()=>{try{if(typeof window<"u"&&window.localStorage)return window.localStorage}catch{gh.info("localStorage not found. InMemoryStorage is used as a fallback.")}return new xh},ch=()=>{try{if(typeof window<"u"&&window.sessionStorage)return window.sessionStorage.getItem("test"),window.sessionStorage;throw new Error("sessionStorage is not defined")}catch{return gh.info("sessionStorage not found. InMemoryStorage is used as a fallback."),new xh}};class eE extends kh{constructor(){super(oE())}}class dE extends kh{constructor(){super(ch())}}class tE{constructor(o){this._storage=o}get storage(){if(!this._storage)throw new ol;return this._storage}setItem(o,e){this.storage.setItem(o,e)}getItem(o){return this.storage.getItem(o)}removeItem(o){this.storage.removeItem(o)}clear(){this.storage.clear()}}class lE extends tE{constructor(){super(ch())}}class uh{constructor(o={}){const{path:e,domain:d,expires:t,sameSite:l,secure:i}=o;if(this.domain=d,this.path=e||"/",this.expires=Object.prototype.hasOwnProperty.call(o,"expires")?t:365,this.secure=Object.prototype.hasOwnProperty.call(o,"secure")?i:!0,Object.prototype.hasOwnProperty.call(o,"sameSite")){if(!l||!["strict","lax","none"].includes(l))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if(l==="none"&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=l}}async setItem(o,e){Yt.set(o,e,this.getData())}async getItem(o){return Yt.get(o)??null}async removeItem(o){Yt.remove(o,this.getData())}async clear(){const o=Yt.get(),e=Object.keys(o).map(d=>this.removeItem(d));await Promise.all(e)}getData(){return{path:this.path,expires:this.expires,domain:this.domain,secure:this.secure,...this.sameSite&&{sameSite:this.sameSite}}}}const el=new eE;new dE;const Fe=new lE,iE=r=>{let o;return async(...e)=>o||(o=new Promise((d,t)=>{r(...e).then(l=>{d(l)}).catch(l=>{t(l)}).finally(()=>{o=void 0})}),o)};function Fh({expiresAt:r,clockDrift:o,tolerance:e=5e3}){return Date.now()+o+e>r}const aE=async()=>{const{userAgentData:r}=navigator;if(!r)return navigator.userAgent;const{platform:o="",platformVersion:e="",model:d="",architecture:t="",fullVersionList:l=[]}=await r.getHighEntropyValues(["platform","platformVersion","architecture","model","fullVersionList"]),i=l.map(w=>`${w.brand}/${w.version}`).join(";");return[o,e,t,d,o,i].filter(w=>w).join(" ")||navigator.userAgent};function wE(r){return Array.from(r,o=>String.fromCodePoint(o)).join("")}const dl={convert(r,o={urlSafe:!1,skipPadding:!1}){const e=typeof r=="string"?r:wE(r);let d=cy()(e);return o.urlSafe&&(d=d.replace(/\+/g,"-").replace(/\//g,"_")),o.skipPadding&&(d=d.replace(/=/g,"")),d}};function bE(){return gy().getRandomValues(new Uint32Array(1))[0]}function nE(r){const{words:o}=r,{sigBytes:e}=r,d=[];for(let t=0;t<e;t++){const l=o[t>>>2]>>>24-t%4*8&255;d.push((l>>>4).toString(16)),d.push((l&15).toString(16))}return d.join("")}class S4{constructor(o,e){this.words=[];let d=o;d=this.words=d||[],e!==void 0?this.sigBytes=e:this.sigBytes=d.length*4}random(o){const e=[];for(let d=0;d<o;d+=4)e.push(bE());return new S4(e,o)}toString(){return nE(this)}}var sr;(function(r){r.EmptySignInUsername="EmptySignInUsername",r.EmptySignInPassword="EmptySignInPassword",r.CustomAuthSignInPassword="CustomAuthSignInPassword",r.EmptySignUpUsername="EmptySignUpUsername",r.EmptySignUpPassword="EmptySignUpPassword",r.EmptyConfirmSignUpUsername="EmptyConfirmSignUpUsername",r.EmptyConfirmSignUpCode="EmptyConfirmSignUpCode",r.EmptyResendSignUpCodeUsername="EmptyresendSignUpCodeUsername",r.EmptyChallengeResponse="EmptyChallengeResponse",r.EmptyConfirmResetPasswordUsername="EmptyConfirmResetPasswordUsername",r.EmptyConfirmResetPasswordNewPassword="EmptyConfirmResetPasswordNewPassword",r.EmptyConfirmResetPasswordConfirmationCode="EmptyConfirmResetPasswordConfirmationCode",r.EmptyResetPasswordUsername="EmptyResetPasswordUsername",r.EmptyVerifyTOTPSetupCode="EmptyVerifyTOTPSetupCode",r.EmptyConfirmUserAttributeCode="EmptyConfirmUserAttributeCode",r.IncorrectMFAMethod="IncorrectMFAMethod",r.EmptyUpdatePassword="EmptyUpdatePassword"})(sr||(sr={}));const Ah={[sr.EmptyChallengeResponse]:{message:"challengeResponse is required to confirmSignIn"},[sr.EmptyConfirmResetPasswordUsername]:{message:"username is required to confirmResetPassword"},[sr.EmptyConfirmSignUpCode]:{message:"code is required to confirmSignUp"},[sr.EmptyConfirmSignUpUsername]:{message:"username is required to confirmSignUp"},[sr.EmptyConfirmResetPasswordConfirmationCode]:{message:"confirmationCode is required to confirmResetPassword"},[sr.EmptyConfirmResetPasswordNewPassword]:{message:"newPassword is required to confirmResetPassword"},[sr.EmptyResendSignUpCodeUsername]:{message:"username is required to confirmSignUp"},[sr.EmptyResetPasswordUsername]:{message:"username is required to resetPassword"},[sr.EmptySignInPassword]:{message:"password is required to signIn"},[sr.EmptySignInUsername]:{message:"username is required to signIn"},[sr.EmptySignUpPassword]:{message:"password is required to signUp"},[sr.EmptySignUpUsername]:{message:"username is required to signUp"},[sr.CustomAuthSignInPassword]:{message:"A password is not needed when signing in with CUSTOM_WITHOUT_SRP",recoverySuggestion:"Do not include a password in your signIn call."},[sr.IncorrectMFAMethod]:{message:"Incorrect MFA method was chosen. It should be either SMS, TOTP, or EMAIL",recoverySuggestion:"Try to pass SMS, TOTP, or EMAIL as the challengeResponse"},[sr.EmptyVerifyTOTPSetupCode]:{message:"code is required to verifyTotpSetup"},[sr.EmptyUpdatePassword]:{message:"oldPassword and newPassword are required to changePassword"},[sr.EmptyConfirmUserAttributeCode]:{message:"confirmation code is required to confirmUserAttribute"}};var yh;(function(r){r.DEFAULT_MSG="Authentication Error",r.EMPTY_EMAIL="Email cannot be empty",r.EMPTY_PHONE="Phone number cannot be empty",r.EMPTY_USERNAME="Username cannot be empty",r.INVALID_USERNAME="The username should either be a string or one of the sign in types",r.EMPTY_PASSWORD="Password cannot be empty",r.EMPTY_CODE="Confirmation code cannot be empty",r.SIGN_UP_ERROR="Error creating account",r.NO_MFA="No valid MFA method provided",r.INVALID_MFA="Invalid MFA type",r.EMPTY_CHALLENGE="Challenge response cannot be empty",r.NO_USER_SESSION="Failed to get the session because the user is empty",r.NETWORK_ERROR="Network Error",r.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",r.AUTOSIGNIN_ERROR="Please use your credentials to sign in",r.OAUTH_ERROR="Couldn't finish OAuth flow, check your User Pool HostedUI settings"})(yh||(yh={}));var Wd;(function(r){r.SignInException="SignInException",r.OAuthSignInError="OAuthSignInException"})(Wd||(Wd={}));class ar extends ko{constructor(o){super(o),this.constructor=ar,Object.setPrototypeOf(this,ar.prototype)}}function Vr(r,o){const{message:e,recoverySuggestion:d}=Ah[o];if(!r)throw new ar({name:o,message:e,recoverySuggestion:d})}function Kr(r){const o=r?.split("_")[0];if(!r||r.indexOf("_")<0||!o||typeof o!="string")throw new ar({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return o}function _4(r){if(!r||!r.includes(":"))throw new ar({name:"InvalidIdentityPoolIdException",message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."});return r.split(":")[0]}function Eh(r){return Object.entries(r).map(([o,e])=>({Name:o,Value:e}))}var Dh;(function(r){r.ConcurrentModificationException="ConcurrentModificationException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException"})(Dh||(Dh={}));var vh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(vh||(vh={}));var Sh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UsernameExistsException="UsernameExistsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Sh||(Sh={}));var _h;(function(r){r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyFailedAttemptsException="TooManyFailedAttemptsException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(_h||(_h={}));var Ch;(function(r){r.AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyFailedAttemptsException="TooManyFailedAttemptsException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException"})(Ch||(Ch={}));var Bh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Bh||(Bh={}));var Ih;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Ih||(Ih={}));var Th;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Th||(Th={}));var Nh;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException"})(Nh||(Nh={}));var Ph;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Ph||(Ph={}));var Oh;(function(r){r.ExternalServiceException="ExternalServiceException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceConflictException="ResourceConflictException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException"})(Oh||(Oh={}));var Rh;(function(r){r.ExternalServiceException="ExternalServiceException",r.InternalErrorException="InternalErrorException",r.InvalidIdentityPoolConfigurationException="InvalidIdentityPoolConfigurationException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceConflictException="ResourceConflictException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException"})(Rh||(Rh={}));var Mh;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Mh||(Mh={}));var $h;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException"})($h||($h={}));var Ki;(function(r){r.PasswordResetRequiredException="PasswordResetRequiredException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Ki||(Ki={}));var Uh;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException"})(Uh||(Uh={}));var jh;(function(r){r.AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.MFAMethodNotFoundException="MFAMethodNotFoundException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(jh||(jh={}));var Lh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Lh||(Lh={}));var C4;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UsernameExistsException="UsernameExistsException"})(C4||(C4={}));var zh;(function(r){r.AliasExistsException="AliasExistsException",r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(zh||(zh={}));var Vh;(function(r){r.CodeMismatchException="CodeMismatchException",r.EnableSoftwareTokenMFAException="EnableSoftwareTokenMFAException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Vh||(Vh={}));var Hh;(function(r){r.AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Hh||(Hh={}));var qh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(qh||(qh={}));var Wh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Wh||(Wh={}));const Yi="UserUnAuthenticatedException",sE="UserAlreadyAuthenticatedException",pE="DeviceMetadataNotFoundException",Kh="AutoSignInException",fE="InvalidRedirectException",hE="InvalidAppSchemeException",mE="InvalidPreferredRedirectUrlException",kE=new ar({name:fE,message:"signInRedirect or signOutRedirect had an invalid format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."});new ar({name:hE,message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."});const xE=new ar({name:mE,message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."}),gE="InvalidOriginException",cE=new ar({name:gE,message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."}),uE="OAuthSignOutException",FE="TokenRefreshException",AE="UnexpectedSignInInterruptionException";function B4(r){if(!r||!r.accessToken)throw new ar({name:Yi,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}function yE(r){if(!r||!r.idToken)throw new ar({name:Yi,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}const EE=new ar({name:FE,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow.
152
152
  Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow.
153
153
  E.g { responseType: 'code' }`}),DE=new ar({name:Yi,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function Yh(r){if(_E(r))throw EE;if(!SE(r))throw DE}function Gh(r){if(!r||!r.deviceKey||!r.deviceGroupKey||!r.randomPassword)throw new ar({name:pE,message:"Either deviceKey, deviceGroupKey or secretPassword were not found during the sign-in process.",recoverySuggestion:"Make sure to not clear storage after calling the signIn API."})}const vE={inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"};function Xh(r){return r?.accessToken||r?.idToken}function SE(r){return Xh(r)&&r?.refreshToken}function _E(r){return Xh(r)&&!r?.refreshToken}const CE=async r=>{const o=r.getConfig().Auth?.Cognito;Sr(o);const e=await r.Auth.getTokens({forceRefresh:!1});B4(e);const{"cognito:username":d,sub:t}=e.idToken?.payload??{},l={username:d,userId:t},i=BE(e);return i&&(l.signInDetails=i),l};function BE(r){return r?.signInDetails}const Zh=async()=>CE(Tr),xo=(r,o)=>qi({category:F4.Auth,action:r,...o}),vo=r=>(o,e)=>{const d=IE(r),t=JSON.stringify(o);return TE(e,d,t)},IE=r=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${r}`}),TE=({url:r},o,e)=>({headers:o,url:r,body:e,method:"POST"});function Xo(r){if(!r||r.name==="Error"||r instanceof TypeError)throw new ar({name:qe.Unknown,message:"An unknown error has occurred.",underlyingError:r})}const Mo=()=>async r=>{if(r.statusCode>=300){const o=await qd(r);throw Xo(o),new ar({name:o.name,message:o.message,metadata:o.$metadata})}return Qt(r)},So=D4(nh,[()=>(r,o)=>async function(d){return d.headers["cache-control"]="no-store",r(d)}]),Jh="cognito-idp",_o={service:Jh,retryDecider:ih(qd),computeDelay:lh,get userAgentValue(){return qi()},cache:"no-store"},tl=r=>no(So,vo("InitiateAuth"),Mo(),{..._o,...r}),Gi=r=>no(So,vo("RespondToAuthChallenge"),Mo(),{..._o,...r}),NE=r=>no(So,vo("AssociateSoftwareToken"),Mo(),{..._o,...r}),PE=({region:r})=>({url:new rl(`https://${Jh}.${r}.${mh(r)}`)}),Yr=({endpointOverride:r})=>o=>r?{url:new rl(r)}:PE(o),OE=r=>no(So,vo("GetTokensFromRefreshToken"),Mo(),{..._o,...r}),RE=iE(async({tokens:r,authConfig:o,username:e})=>{Sr(o?.Cognito);const{userPoolId:d,userPoolClientId:t,userPoolEndpoint:l}=o.Cognito,i=Kr(d);Yh(r);const a=OE({endpointResolver:Yr({endpointOverride:l})}),{AuthenticationResult:w}=await a({region:i},{ClientId:t,RefreshToken:r.refreshToken,DeviceKey:r.deviceMetadata?.deviceKey}),b=pd(w?.AccessToken??""),n=w?.IdToken?pd(w.IdToken):void 0,{iat:s}=b.payload;if(!s)throw new ar({name:"iatNotFoundException",message:"iat not found in access token"});const p=s*1e3-new Date().getTime();return{accessToken:b,idToken:n,clockDrift:p,refreshToken:w?.RefreshToken??r.refreshToken,username:e}}),ME={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var Xi;(function(r){r.InvalidAuthTokens="InvalidAuthTokens"})(Xi||(Xi={}));const $E={[Xi.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},UE=x4($E),Qh="CognitoIdentityServiceProvider";class jE{getKeyValueStorage(){if(!this.keyValueStorage)throw new ar({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(o){this.keyValueStorage=o}setAuthConfig(o){this.authConfig=o}async loadTokens(){try{const o=await this.getAuthKeys(),e=await this.getKeyValueStorage().getItem(o.accessToken);if(!e)throw new ar({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});const d=pd(e),t=await this.getKeyValueStorage().getItem(o.idToken),l=t?pd(t):void 0,i=await this.getKeyValueStorage().getItem(o.refreshToken)??void 0,a=await this.getKeyValueStorage().getItem(o.clockDrift)??"0",w=Number.parseInt(a),b=await this.getKeyValueStorage().getItem(o.signInDetails),n={accessToken:d,idToken:l,refreshToken:i,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:w,username:await this.getLastAuthUser()};return b&&(n.signInDetails=JSON.parse(b)),n}catch{return null}}async storeTokens(o){UE(o!==void 0,Xi.InvalidAuthTokens);const e=o.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),e);const d=await this.getAuthKeys();await this.getKeyValueStorage().setItem(d.accessToken,o.accessToken.toString()),o.idToken?await this.getKeyValueStorage().setItem(d.idToken,o.idToken.toString()):await this.getKeyValueStorage().removeItem(d.idToken),o.refreshToken?await this.getKeyValueStorage().setItem(d.refreshToken,o.refreshToken):await this.getKeyValueStorage().removeItem(d.refreshToken),o.deviceMetadata&&(o.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(d.deviceKey,o.deviceMetadata.deviceKey),o.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(d.deviceGroupKey,o.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(d.randomPasswordKey,o.deviceMetadata.randomPassword)),o.signInDetails?await this.getKeyValueStorage().setItem(d.signInDetails,JSON.stringify(o.signInDetails)):await this.getKeyValueStorage().removeItem(d.signInDetails),await this.getKeyValueStorage().setItem(d.clockDrift,`${o.clockDrift}`)}async clearTokens(){const o=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(o.accessToken),this.getKeyValueStorage().removeItem(o.idToken),this.getKeyValueStorage().removeItem(o.clockDrift),this.getKeyValueStorage().removeItem(o.refreshToken),this.getKeyValueStorage().removeItem(o.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(o.oauthMetadata)])}async getDeviceMetadata(o){const e=await this.getAuthKeys(o),d=await this.getKeyValueStorage().getItem(e.deviceKey),t=await this.getKeyValueStorage().getItem(e.deviceGroupKey),l=await this.getKeyValueStorage().getItem(e.randomPasswordKey);return l&&t&&d?{deviceKey:d,deviceGroupKey:t,randomPassword:l}:null}async clearDeviceMetadata(o){const e=await this.getAuthKeys(o);await Promise.all([this.getKeyValueStorage().removeItem(e.deviceKey),this.getKeyValueStorage().removeItem(e.deviceGroupKey),this.getKeyValueStorage().removeItem(e.randomPasswordKey)])}async getAuthKeys(o){Sr(this.authConfig?.Cognito);const e=o??await this.getLastAuthUser();return LE(Qh,`${this.authConfig.Cognito.userPoolClientId}.${e}`)}getLastAuthUserKey(){Sr(this.authConfig?.Cognito);const o=this.authConfig.Cognito.userPoolClientId;return`${Qh}.${o}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(o){const{oauthMetadata:e}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(e,JSON.stringify(o))}async getOAuthMetadata(){const{oauthMetadata:o}=await this.getAuthKeys(),e=await this.getKeyValueStorage().getItem(o);return e&&JSON.parse(e)}}const LE=(r,o)=>I4(ME)(`${r}`,o);function I4(r){const o=Object.values({...r});return(e,d)=>o.reduce((t,l)=>({...t,[l]:`${e}.${d}.${l}`}),{})}const rm="amplify-signin-with-hostedUI",ae="CognitoIdentityServiceProvider";class om{constructor(o){this.keyValueStorage=o}async clearOAuthInflightData(){Sr(this.cognitoConfig);const o=we(ae,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(o.inflightOAuth),this.keyValueStorage.removeItem(o.oauthPKCE),this.keyValueStorage.removeItem(o.oauthState)])}async clearOAuthData(){Sr(this.cognitoConfig);const o=we(ae,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(rm),this.keyValueStorage.removeItem(o.oauthSignIn)}loadOAuthState(){Sr(this.cognitoConfig);const o=we(ae,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(o.oauthState)}storeOAuthState(o){Sr(this.cognitoConfig);const e=we(ae,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(e.oauthState,o)}loadPKCE(){Sr(this.cognitoConfig);const o=we(ae,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(o.oauthPKCE)}storePKCE(o){Sr(this.cognitoConfig);const e=we(ae,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(e.oauthPKCE,o)}setAuthConfig(o){this.cognitoConfig=o}async loadOAuthInFlight(){Sr(this.cognitoConfig);const o=we(ae,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(o.inflightOAuth)==="true"}async storeOAuthInFlight(o){Sr(this.cognitoConfig);const e=we(ae,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(e.inflightOAuth,`${o}`)}async loadOAuthSignIn(){Sr(this.cognitoConfig);const o=we(ae,this.cognitoConfig.userPoolClientId),e=await this.keyValueStorage.getItem(rm),[d,t]=(await this.keyValueStorage.getItem(o.oauthSignIn))?.split(",")??[];return{isOAuthSignIn:d==="true"||e==="true",preferPrivateSession:t==="true"}}async storeOAuthSignIn(o,e=!1){Sr(this.cognitoConfig);const d=we(ae,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(d.oauthSignIn,`${o},${e}`)}}const we=(r,o)=>I4(vE)(r,o),em=new om(el);class zE{constructor(){this.waitForInflightOAuth=Zf()?async()=>{if(await em.loadOAuthInFlight())return this.inflightPromise?this.inflightPromise:(this.inflightPromise=new Promise((o,e)=>{}),this.inflightPromise)}:async()=>{}}setAuthConfig(o){em.setAuthConfig(o.Cognito),this.authConfig=o}setTokenRefresher(o){this.tokenRefresher=o}setAuthTokenStore(o){this.tokenStore=o}getTokenStore(){if(!this.tokenStore)throw new ar({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new ar({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}async getTokens(o){let e;try{Sr(this.authConfig?.Cognito)}catch{return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,e=await this.getTokenStore().loadTokens();const d=await this.getTokenStore().getLastAuthUser();if(e===null)return null;const t=!!e?.idToken&&Fh({expiresAt:(e.idToken?.payload?.exp??0)*1e3,clockDrift:e.clockDrift??0}),l=Fh({expiresAt:(e.accessToken?.payload?.exp??0)*1e3,clockDrift:e.clockDrift??0});return(o?.forceRefresh||t||l)&&(e=await this.refreshTokens({tokens:e,username:d}),e===null)?null:{accessToken:e?.accessToken,idToken:e?.idToken,signInDetails:e?.signInDetails}}async refreshTokens({tokens:o,username:e}){try{const{signInDetails:d}=o,t=await this.getTokenRefresher()({tokens:o,authConfig:this.authConfig,username:e});return t.signInDetails=d,await this.setTokens({tokens:t}),Vd.dispatch("auth",{event:"tokenRefresh"},"Auth",sd),t}catch(d){return this.handleErrors(d)}}handleErrors(o){if(Xo(o),o.name!==qe.NetworkError&&this.clearTokens(),Vd.dispatch("auth",{event:"tokenRefresh_failure",data:{error:o}},"Auth",sd),o.name.startsWith("NotAuthorizedException"))return null;throw o}async setTokens({tokens:o}){return this.getTokenStore().storeTokens(o)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(o){return this.getTokenStore().getDeviceMetadata(o)}clearDeviceMetadata(o){return this.getTokenStore().clearDeviceMetadata(o)}setOAuthMetadata(o){return this.getTokenStore().setOAuthMetadata(o)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}}class VE{constructor(){this.authTokenStore=new jE,this.authTokenStore.setKeyValueStorage(el),this.tokenOrchestrator=new zE,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(RE)}getTokens({forceRefresh:o}={forceRefresh:!1}){return this.tokenOrchestrator.getTokens({forceRefresh:o})}setKeyValueStorage(o){this.authTokenStore.setKeyValueStorage(o)}setAuthConfig(o){this.authTokenStore.setAuthConfig(o),this.tokenOrchestrator.setAuthConfig(o)}}const Kd=new VE,{tokenOrchestrator:Co}=Kd;async function Yd(r){if(r.AccessToken){const o=pd(r.AccessToken),e=(o.payload.iat||0)*1e3,d=new Date().getTime(),t=e>0?e-d:0;let l,i,a;r.RefreshToken&&(i=r.RefreshToken),r.IdToken&&(l=pd(r.IdToken)),r?.NewDeviceMetadata&&(a=r.NewDeviceMetadata);const w={accessToken:o,idToken:l,refreshToken:i,clockDrift:t,deviceMetadata:a,username:r.username};r?.signInDetails&&(w.signInDetails=r.signInDetails),await Co.setTokens({tokens:w})}else throw new ko({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}const HE="Unable to get user session following successful sign-in.",Gd=async()=>{try{Vd.dispatch("auth",{event:"signedIn",data:await Zh()},"Auth",sd)}catch(r){throw r.name===Yi?new ar({name:AE,message:HE,recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."}):r}};function dm(){return{active:!1}}const We=(r=>{let o=r(dm(),{type:"RESET"});return{getState:()=>o,dispatch:e=>{o=r(o,e)}}})((r,o)=>{switch(o.type){case"SET_USERNAME":return{...r,username:o.value};case"SET_SESSION":return{...r,session:o.value};case"START":return{...r,active:!0};case"RESET":return dm();default:return r}}),qE=180*1e3,Zi="CognitoSignInState",Ae={username:`${Zi}.username`,challengeName:`${Zi}.challengeName`,signInSession:`${Zi}.signInSession`,expiry:`${Zi}.expiry`},WE=(r,o)=>{switch(o.type){case"SET_SIGN_IN_SESSION":return Ji({signInSession:o.value}),{...r,signInSession:o.value};case"SET_SIGN_IN_STATE":return Ji(o.value),{...o.value};case"SET_CHALLENGE_NAME":return Ji({challengeName:o.value}),{...r,challengeName:o.value};case"SET_USERNAME":return Ji({username:o.value}),{...r,username:o.value};case"SET_INITIAL_STATE":return YE();case"RESET_STATE":return tm(),T4();default:return r}},KE=r=>{const o=Number(r),e=Date.now();return o<=e},be=()=>{Ke.dispatch({type:"RESET_STATE"})},tm=()=>{for(const r of Object.values(Ae))Fe.removeItem(r)},T4=()=>({username:void 0,challengeName:void 0,signInSession:void 0}),YE=()=>{const r=Fe.getItem(Ae.expiry);if(!r||KE(r))return tm(),T4();const o=Fe.getItem(Ae.username)??void 0,e=Fe.getItem(Ae.challengeName)??void 0,d=Fe.getItem(Ae.signInSession)??void 0;return{username:o,challengeName:e,signInSession:d}},Ke=(r=>{let o=r(T4(),{type:"SET_INITIAL_STATE"});return{getState:()=>o,dispatch:e=>{o=r(o,e)}}})(WE);function Xd(r){Ke.dispatch({type:"SET_SIGN_IN_STATE",value:r})}const Ji=({challengeName:r,signInSession:o,username:e})=>{e&&Fe.setItem(Ae.username,e),r&&Fe.setItem(Ae.challengeName,r),o&&(Fe.setItem(Ae.signInSession,o),Fe.setItem(Ae.expiry,String(Date.now()+qE)))};class ye extends ko{constructor(o){super(o),this.constructor=ye,Object.setPrototypeOf(this,ye.prototype)}}var Hr;(function(r){r.PasskeyNotSupported="PasskeyNotSupported",r.PasskeyAlreadyExists="PasskeyAlreadyExists",r.InvalidPasskeyRegistrationOptions="InvalidPasskeyRegistrationOptions",r.InvalidPasskeyAuthenticationOptions="InvalidPasskeyAuthenticationOptions",r.RelyingPartyMismatch="RelyingPartyMismatch",r.PasskeyRegistrationFailed="PasskeyRegistrationFailed",r.PasskeyRetrievalFailed="PasskeyRetrievalFailed",r.PasskeyRegistrationCanceled="PasskeyRegistrationCanceled",r.PasskeyAuthenticationCanceled="PasskeyAuthenticationCanceled",r.PasskeyOperationAborted="PasskeyOperationAborted"})(Hr||(Hr={}));const lm="Passkeys may not be supported on this device. Ensure your application is running in a secure context (HTTPS) and Web Authentication API is supported.",N4="User may have canceled the ceremony or another interruption has occurred. Check underlying error for details.",im="Ensure your user pool is configured to support the WEB_AUTHN as an authentication factor.",Qi={[Hr.PasskeyNotSupported]:{message:"Passkeys may not be supported on this device.",recoverySuggestion:lm},[Hr.InvalidPasskeyRegistrationOptions]:{message:"Invalid passkey registration options.",recoverySuggestion:im},[Hr.InvalidPasskeyAuthenticationOptions]:{message:"Invalid passkey authentication options.",recoverySuggestion:im},[Hr.PasskeyRegistrationFailed]:{message:"Device failed to create passkey.",recoverySuggestion:lm},[Hr.PasskeyRetrievalFailed]:{message:"Device failed to retrieve passkey.",recoverySuggestion:"Passkeys may not be available on this device. Try an alternative authentication factor like PASSWORD, EMAIL_OTP, or SMS_OTP."},[Hr.PasskeyAlreadyExists]:{message:"Passkey already exists in authenticator.",recoverySuggestion:"Proceed with existing passkey or try again after deleting the credential."},[Hr.PasskeyRegistrationCanceled]:{message:"Passkey registration ceremony has been canceled.",recoverySuggestion:N4},[Hr.PasskeyAuthenticationCanceled]:{message:"Passkey authentication ceremony has been canceled.",recoverySuggestion:N4},[Hr.PasskeyOperationAborted]:{message:"Passkey operation has been aborted.",recoverySuggestion:N4},[Hr.RelyingPartyMismatch]:{message:"Relying party does not match current domain.",recoverySuggestion:"Ensure relying party identifier matches current domain."}},P4=x4(Qi,ye),GE=r=>{if(r instanceof ye)return r;if(r instanceof Error&&r.name==="NotAllowedError"){const{message:o,recoverySuggestion:e}=Qi[Hr.PasskeyAuthenticationCanceled];return new ye({name:Hr.PasskeyAuthenticationCanceled,message:o,recoverySuggestion:e,underlyingError:r})}return XE(r)},XE=r=>{if(r instanceof Error){if(r.name==="AbortError"){const{message:o,recoverySuggestion:e}=Qi[Hr.PasskeyOperationAborted];return new ye({name:Hr.PasskeyOperationAborted,message:o,recoverySuggestion:e,underlyingError:r})}if(r.name==="SecurityError"){const{message:o,recoverySuggestion:e}=Qi[Hr.RelyingPartyMismatch];return new ye({name:Hr.RelyingPartyMismatch,message:o,recoverySuggestion:e,underlyingError:r})}}return new ye({name:qe.Unknown,message:"An unknown error has occurred.",underlyingError:r})},ZE=()=>Zf()&&window.isSecureContext&&"credentials"in navigator&&typeof window.PublicKeyCredential=="function",ll=r=>dl.convert(new Uint8Array(r),{urlSafe:!0,skipPadding:!0}),am=r=>Uint8Array.from(g4.convert(r,{urlSafe:!0}),o=>o.charCodeAt(0)).buffer,JE=r=>{const o=am(r.challenge),e=(r.allowCredentials||[]).map(d=>({...d,id:am(d.id)}));return{...r,challenge:o,allowCredentials:e}},QE=r=>{const o={clientDataJSON:ll(r.response.clientDataJSON),authenticatorData:ll(r.response.authenticatorData),signature:ll(r.response.signature)};r.response.userHandle&&(o.userHandle=ll(r.response.userHandle));const e={id:r.id,rawId:ll(r.rawId),type:r.type,clientExtensionResults:r.getClientExtensionResults(),response:o};return r.authenticatorAttachment&&(e.authenticatorAttachment=r.authenticatorAttachment),e};function rD(r){P4(r&&r instanceof PublicKeyCredential&&r.response instanceof AuthenticatorAssertionResponse,Hr.PasskeyRetrievalFailed)}const oD=async r=>{try{const o=ZE();P4(o,Hr.PasskeyNotSupported);const e=JE(r),d=await navigator.credentials.get({publicKey:e});return rD(d),QE(d)}catch(o){throw GE(o)}},eD=r=>no(So,vo("ConfirmDevice"),Mo(),{..._o,...r}),ra={convert(r){return new TextEncoder().encode(r)}};function rr(r,o){r!=null&&this.fromString(r,o)}function so(){return new rr(null,null)}let Ye;const wm=(0xdeadbeefcafe&16777215)===15715070;function dD(r,o,e,d,t,l){for(;--l>=0;){const i=o*this[r++]+e[d]+t;t=Math.floor(i/67108864),e[d++]=i&67108863}return t}function tD(r,o,e,d,t,l){const i=o&32767,a=o>>15;for(;--l>=0;){let w=this[r]&32767;const b=this[r++]>>15,n=a*w+b*i;w=i*w+((n&32767)<<15)+e[d]+(t&1073741823),t=(w>>>30)+(n>>>15)+a*b+(t>>>30),e[d++]=w&1073741823}return t}function lD(r,o,e,d,t,l){const i=o&16383,a=o>>14;for(;--l>=0;){let w=this[r]&16383;const b=this[r++]>>14,n=a*w+b*i;w=i*w+((n&16383)<<14)+e[d]+t,t=(w>>28)+(n>>14)+a*b,e[d++]=w&268435455}return t}const bm=typeof navigator<"u";bm&&wm&&navigator.appName==="Microsoft Internet Explorer"?(rr.prototype.am=tD,Ye=30):bm&&wm&&navigator.appName!=="Netscape"?(rr.prototype.am=dD,Ye=26):(rr.prototype.am=lD,Ye=28),rr.prototype.DB=Ye,rr.prototype.DM=(1<<Ye)-1,rr.prototype.DV=1<<Ye;const O4=52;rr.prototype.FV=Math.pow(2,O4),rr.prototype.F1=O4-Ye,rr.prototype.F2=2*Ye-O4;const iD="0123456789abcdefghijklmnopqrstuvwxyz",oa=[];let Zd,$o;for(Zd=48,$o=0;$o<=9;++$o)oa[Zd++]=$o;for(Zd=97,$o=10;$o<36;++$o)oa[Zd++]=$o;for(Zd=65,$o=10;$o<36;++$o)oa[Zd++]=$o;function nm(r){return iD.charAt(r)}function aD(r,o){const e=oa[r.charCodeAt(o)];return e??-1}function wD(r){for(let o=this.t-1;o>=0;--o)r[o]=this[o];r.t=this.t,r.s=this.s}function bD(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0}function R4(r){const o=so();return o.fromInt(r),o}function nD(r,o){let e;if(o===16)e=4;else if(o===8)e=3;else if(o===2)e=1;else if(o===32)e=5;else if(o===4)e=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");this.t=0,this.s=0;let d=r.length,t=!1,l=0;for(;--d>=0;){const i=aD(r,d);if(i<0){r.charAt(d)==="-"&&(t=!0);continue}t=!1,l===0?this[this.t++]=i:l+e>this.DB?(this[this.t-1]|=(i&(1<<this.DB-l)-1)<<l,this[this.t++]=i>>this.DB-l):this[this.t-1]|=i<<l,l+=e,l>=this.DB&&(l-=this.DB)}this.clamp(),t&&rr.ZERO.subTo(this,this)}function sD(){const r=this.s&this.DM;for(;this.t>0&&this[this.t-1]==r;)--this.t}function pD(r){if(this.s<0)return"-"+this.negate().toString(r);let o;if(r==16)o=4;else if(r===8)o=3;else if(r===2)o=1;else if(r===32)o=5;else if(r===4)o=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");const e=(1<<o)-1;let d,t=!1,l="",i=this.t,a=this.DB-i*this.DB%o;if(i-- >0)for(a<this.DB&&(d=this[i]>>a)>0&&(t=!0,l=nm(d));i>=0;)a<o?(d=(this[i]&(1<<a)-1)<<o-a,d|=this[--i]>>(a+=this.DB-o)):(d=this[i]>>(a-=o)&e,a<=0&&(a+=this.DB,--i)),d>0&&(t=!0),t&&(l+=nm(d));return t?l:"0"}function fD(){const r=so();return rr.ZERO.subTo(this,r),r}function hD(){return this.s<0?this.negate():this}function mD(r){let o=this.s-r.s;if(o!=0)return o;let e=this.t;if(o=e-r.t,o!=0)return this.s<0?-o:o;for(;--e>=0;)if((o=this[e]-r[e])!=0)return o;return 0}function M4(r){let o=1,e;return(e=r>>>16)!==0&&(r=e,o+=16),(e=r>>8)!==0&&(r=e,o+=8),(e=r>>4)!==0&&(r=e,o+=4),(e=r>>2)!==0&&(r=e,o+=2),(e=r>>1)!==0&&(r=e,o+=1),o}function kD(){return this.t<=0?0:this.DB*(this.t-1)+M4(this[this.t-1]^this.s&this.DM)}function xD(r,o){let e;for(e=this.t-1;e>=0;--e)o[e+r]=this[e];for(e=r-1;e>=0;--e)o[e]=0;o.t=this.t+r,o.s=this.s}function gD(r,o){for(let e=r;e<this.t;++e)o[e-r]=this[e];o.t=Math.max(this.t-r,0),o.s=this.s}function cD(r,o){const e=r%this.DB,d=this.DB-e,t=(1<<d)-1,l=Math.floor(r/this.DB);let i=this.s<<e&this.DM,a;for(a=this.t-1;a>=0;--a)o[a+l+1]=this[a]>>d|i,i=(this[a]&t)<<e;for(a=l-1;a>=0;--a)o[a]=0;o[l]=i,o.t=this.t+l+1,o.s=this.s,o.clamp()}function uD(r,o){o.s=this.s;const e=Math.floor(r/this.DB);if(e>=this.t){o.t=0;return}const d=r%this.DB,t=this.DB-d,l=(1<<d)-1;o[0]=this[e]>>d;for(let i=e+1;i<this.t;++i)o[i-e-1]|=(this[i]&l)<<t,o[i-e]=this[i]>>d;d>0&&(o[this.t-e-1]|=(this.s&l)<<t),o.t=this.t-e,o.clamp()}function FD(r,o){let e=0,d=0;const t=Math.min(r.t,this.t);for(;e<t;)d+=this[e]-r[e],o[e++]=d&this.DM,d>>=this.DB;if(r.t<this.t){for(d-=r.s;e<this.t;)d+=this[e],o[e++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;e<r.t;)d-=r[e],o[e++]=d&this.DM,d>>=this.DB;d-=r.s}o.s=d<0?-1:0,d<-1?o[e++]=this.DV+d:d>0&&(o[e++]=d),o.t=e,o.clamp()}function AD(r,o){const e=this.abs(),d=r.abs();let t=e.t;for(o.t=t+d.t;--t>=0;)o[t]=0;for(t=0;t<d.t;++t)o[t+e.t]=e.am(0,d[t],o,t,0,e.t);o.s=0,o.clamp(),this.s!==r.s&&rr.ZERO.subTo(o,o)}function yD(r){const o=this.abs();let e=r.t=2*o.t;for(;--e>=0;)r[e]=0;for(e=0;e<o.t-1;++e){const d=o.am(e,o[e],r,2*e,0,1);(r[e+o.t]+=o.am(e+1,2*o[e],r,2*e+1,d,o.t-e-1))>=o.DV&&(r[e+o.t]-=o.DV,r[e+o.t+1]=1)}r.t>0&&(r[r.t-1]+=o.am(e,o[e],r,2*e,0,1)),r.s=0,r.clamp()}function ED(r,o,e){const d=r.abs();if(d.t<=0)return;const t=this.abs();if(t.t<d.t){o?.fromInt(0),e!=null&&this.copyTo(e);return}e===null&&(e=so());const l=so(),i=this.s,a=r.s,w=this.DB-M4(d[d.t-1]);w>0?(d.lShiftTo(w,l),t.lShiftTo(w,e)):(d.copyTo(l),t.copyTo(e));const b=l.t,n=l[b-1];if(n===0)return;const s=n*(1<<this.F1)+(b>1?l[b-2]>>this.F2:0),p=this.FV/s,m=(1<<this.F1)/s,h=1<<this.F2;let f=e.t,k=f-b;const x=o===null?so():o;for(l.dlShiftTo(k,x),e.compareTo(x)>=0&&(e[e.t++]=1,e.subTo(x,e)),rr.ONE.dlShiftTo(b,x),x.subTo(l,l);l.t<b;)l[l.t++]=0;for(;--k>=0;){let c=e[--f]===n?this.DM:Math.floor(e[f]*p+(e[f-1]+h)*m);if((e[f]+=l.am(0,c,e,k,0,b))<c)for(l.dlShiftTo(k,x),e.subTo(x,e);e[f]<--c;)e.subTo(x,e)}o!==null&&(e.drShiftTo(b,o),i!==a&&rr.ZERO.subTo(o,o)),e.t=b,e.clamp(),w>0&&e.rShiftTo(w,e),i<0&&rr.ZERO.subTo(e,e)}function DD(r){const o=so();return this.abs().divRemTo(r,null,o),this.s<0&&o.compareTo(rr.ZERO)>0&&r.subTo(o,o),o}function vD(){if(this.t<1)return 0;const r=this[0];if((r&1)===0)return 0;let o=r&3;return o=o*(2-(r&15)*o)&15,o=o*(2-(r&255)*o)&255,o=o*(2-((r&65535)*o&65535))&65535,o=o*(2-r*o%this.DV)%this.DV,o>0?this.DV-o:-o}function SD(r){return this.compareTo(r)===0}function _D(r,o){let e=0,d=0;const t=Math.min(r.t,this.t);for(;e<t;)d+=this[e]+r[e],o[e++]=d&this.DM,d>>=this.DB;if(r.t<this.t){for(d+=r.s;e<this.t;)d+=this[e],o[e++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;e<r.t;)d+=r[e],o[e++]=d&this.DM,d>>=this.DB;d+=r.s}o.s=d<0?-1:0,d>0?o[e++]=d:d<-1&&(o[e++]=this.DV+d),o.t=e,o.clamp()}function CD(r){const o=so();return this.addTo(r,o),o}function BD(r){const o=so();return this.subTo(r,o),o}function ID(r){const o=so();return this.multiplyTo(r,o),o}function TD(r){const o=so();return this.divRemTo(r,o,null),o}function Jd(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<r.DB-15)-1,this.mt2=2*r.t}function ND(r){const o=so();return r.abs().dlShiftTo(this.m.t,o),o.divRemTo(this.m,null,o),r.s<0&&o.compareTo(rr.ZERO)>0&&this.m.subTo(o,o),o}function PD(r){const o=so();return r.copyTo(o),this.reduce(o),o}function OD(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(let o=0;o<this.m.t;++o){let e=r[o]&32767;const d=e*this.mpl+((e*this.mph+(r[o]>>15)*this.mpl&this.um)<<15)&r.DM;for(e=o+this.m.t,r[e]+=this.m.am(0,d,r,o,0,this.m.t);r[e]>=r.DV;)r[e]-=r.DV,r[++e]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)}function RD(r,o){r.squareTo(o),this.reduce(o)}function MD(r,o,e){r.multiplyTo(o,e),this.reduce(e)}Jd.prototype.convert=ND,Jd.prototype.revert=PD,Jd.prototype.reduce=OD,Jd.prototype.mulTo=MD,Jd.prototype.sqrTo=RD;function $D(r,o,e){let d=r.bitLength(),t,l=R4(1);const i=new Jd(o);if(d<=0)return l;d<18?t=1:d<48?t=3:d<144?t=4:d<768?t=5:t=6;const a=[];let w=3;const b=t-1,n=(1<<t)-1;if(a[1]=i.convert(this),t>1){const x=so();for(i.sqrTo(a[1],x);w<=n;)a[w]=so(),i.mulTo(x,a[w-2],a[w]),w+=2}let s=r.t-1,p,m=!0,h=so(),f;for(d=M4(r[s])-1;s>=0;){for(d>=b?p=r[s]>>d-b&n:(p=(r[s]&(1<<d+1)-1)<<b-d,s>0&&(p|=r[s-1]>>this.DB+d-b)),w=t;(p&1)===0;)p>>=1,--w;if((d-=w)<0&&(d+=this.DB,--s),m)a[p].copyTo(l),m=!1;else{for(;w>1;)i.sqrTo(l,h),i.sqrTo(h,l),w-=2;w>0?i.sqrTo(l,h):(f=l,l=h,h=f),i.mulTo(h,a[p],l)}for(;s>=0&&(r[s]&1<<d)===0;)i.sqrTo(l,h),f=l,l=h,h=f,--d<0&&(d=this.DB-1,--s)}const k=i.revert(l);return e(null,k),k}rr.prototype.copyTo=wD,rr.prototype.fromInt=bD,rr.prototype.fromString=nD,rr.prototype.clamp=sD,rr.prototype.dlShiftTo=xD,rr.prototype.drShiftTo=gD,rr.prototype.lShiftTo=cD,rr.prototype.rShiftTo=uD,rr.prototype.subTo=FD,rr.prototype.multiplyTo=AD,rr.prototype.squareTo=yD,rr.prototype.divRemTo=ED,rr.prototype.invDigit=vD,rr.prototype.addTo=_D,rr.prototype.toString=pD,rr.prototype.negate=fD,rr.prototype.abs=hD,rr.prototype.compareTo=mD,rr.prototype.bitLength=kD,rr.prototype.mod=DD,rr.prototype.equals=SD,rr.prototype.add=CD,rr.prototype.subtract=BD,rr.prototype.multiply=ID,rr.prototype.divide=TD,rr.prototype.modPow=$D,rr.ZERO=R4(0),rr.ONE=R4(1);const UD=async({a:r,g:o,k:e,x:d,B:t,N:l,U:i})=>new Promise((a,w)=>{o.modPow(d,l,(b,n)=>{if(b){w(b);return}t.subtract(e.multiply(n)).modPow(r.add(i.multiply(d)),l,(s,p)=>{if(s){w(s);return}a(p.mod(l))})})}),jD="FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",sm={},$4={};for(let r=0;r<256;r++){let o=r.toString(16).toLowerCase();o.length===1&&(o=`0${o}`),sm[r]=o,$4[o]=r}const Qd=r=>{if(r.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const o=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2){const d=r.slice(e,e+2).toLowerCase();if(d in $4)o[e/2]=$4[d];else throw new Error(`Cannot decode unrecognized sequence ${d} as hexadecimal`)}return o},U4=r=>{let o="";for(let e=0;e<r.byteLength;e++)o+=sm[r[e]];return o},j4=r=>{const o=new Vi;o.update(r);const e=o.digestSync(),d=U4(e);return new Array(64-d.length).join("0")+d},ea=r=>j4(Qd(r)),LD=/^[89a-f]/i,Ee=r=>{if(!(r instanceof rr))throw new Error("Not a BigInteger");const o=r.compareTo(rr.ZERO)<0;let e=r.abs().toString(16);if(e=e.length%2!==0?`0${e}`:e,e=LD.test(e)?`00${e}`:e,o){const d=e.split("").map(l=>{const i=~parseInt(l,16)&15;return"0123456789ABCDEF".charAt(i)}).join("");e=new rr(d,16).add(rr.ONE).toString(16),e.toUpperCase().startsWith("FF8")&&(e=e.substring(2))}return e},zD=({A:r,B:o})=>{const e=new rr(ea(Ee(r)+Ee(o)),16);if(e.equals(rr.ZERO))throw new Error("U cannot be zero.");return e},VD=(r,o,e)=>{const d=new Vi(o);d.update(r);const t=d.digestSync(),l=new Vi(t);return l.update(e),l.digestSync().slice(0,16)},L4=r=>{const o=new S4().random(r).toString();return Qd(o)},HD=()=>dl.convert(L4(40));class qD{constructor({userPoolName:o,a:e,g:d,A:t,N:l}){this.encoder=ra,this.userPoolName=o,this.a=e,this.g=d,this.A=t,this.N=l,this.k=new rr(ea(`${Ee(l)}${Ee(d)}`),16)}getRandomPassword(){if(!this.randomPassword)throw new ar({name:"EmptyBigIntegerRandomPassword",message:"random password is empty"});return this.randomPassword}getSaltToHashDevices(){if(!this.saltToHashDevices)throw new ar({name:"EmptyBigIntegersaltToHashDevices",message:"saltToHashDevices is empty"});return this.saltToHashDevices}getVerifierDevices(){if(!this.verifierDevices)throw new ar({name:"EmptyBigIntegerVerifierDevices",message:"verifyDevices is empty"});return this.verifierDevices}async generateHashDevice(o,e){this.randomPassword=HD();const d=`${o}${e}:${this.randomPassword}`,t=j4(d),l=U4(L4(16));return this.saltToHashDevices=Ee(new rr(l,16)),new Promise((i,a)=>{this.g.modPow(new rr(ea(this.saltToHashDevices+t),16),this.N,(w,b)=>{if(w){a(w);return}this.verifierDevices=Ee(b),i()})})}async getPasswordAuthenticationKey({username:o,password:e,serverBValue:d,salt:t}){if(d.mod(this.N).equals(rr.ZERO))throw new Error("B cannot be zero.");const l=zD({A:this.A,B:d}),i=`${this.userPoolName}${o}:${e}`,a=j4(i),w=new rr(ea(Ee(t)+a),16),b=await UD({a:this.a,g:this.g,k:this.k,x:w,B:d,N:this.N,U:l}),n=this.encoder.convert("Caldera Derived Key"),s=this.encoder.convert(""),p=new Uint8Array(n.byteLength+s.byteLength);return p.set(n,0),p.set(s,n.byteLength),VD(Qd(Ee(b)),Qd(Ee(l)),p)}}const WD=async({a:r,g:o,N:e})=>new Promise((d,t)=>{o.modPow(r,e,(l,i)=>{if(l){t(l);return}if(i.mod(e).equals(rr.ZERO)){t(new Error("Illegal parameter. A mod N cannot be 0."));return}d(i)})}),da=async r=>{const o=new rr(jD,16),e=new rr("2",16),d=KD(),t=await WD({a:d,g:e,N:o});return new qD({userPoolName:r,a:d,g:e,A:t,N:o})},KD=()=>{const r=U4(L4(128));return new rr(r,16)};async function rt({userPoolId:r,userPoolEndpoint:o,newDeviceMetadata:e,accessToken:d}){if(!e)return;const t=r.split("_")[1]||"",l=await da(t),i=e?.DeviceKey,a=e?.DeviceGroupKey;try{await l.generateHashDevice(a??"",i??"")}catch{return}const w={Salt:dl.convert(Qd(l.getSaltToHashDevices())),PasswordVerifier:dl.convert(Qd(l.getVerifierDevices()))},b=l.getRandomPassword();try{return await eD({endpointResolver:Yr({endpointOverride:o})})({region:Kr(r)},{AccessToken:d,DeviceName:await aE(),DeviceKey:e?.DeviceKey,DeviceSecretVerifierConfig:w}),{deviceKey:i,deviceGroupKey:a,randomPassword:b}}catch{return}}async function YD(r){const o=Tr.getConfig().Auth?.Cognito;Sr(o);const{username:e,signInSession:d,signInDetails:t,challengeName:l}=Ke.getState();if(l!=="WEB_AUTHN"||!e)throw new ar({name:Wd.SignInException,message:"Unable to proceed due to invalid sign in state."});const{CREDENTIAL_REQUEST_OPTIONS:i}=r;P4(!!i,Hr.InvalidPasskeyAuthenticationOptions);const a=await oD(JSON.parse(i)),w=Gi({endpointResolver:Yr({endpointOverride:o.userPoolEndpoint})}),{ChallengeName:b,ChallengeParameters:n,AuthenticationResult:s,Session:p}=await w({region:Kr(o.userPoolId),userAgentValue:xo(wo.ConfirmSignIn)},{ChallengeName:"WEB_AUTHN",ChallengeResponses:{USERNAME:e,CREDENTIAL:JSON.stringify(a)},ClientId:o.userPoolClientId,Session:d});if(Xd({signInSession:p,username:e,challengeName:b,signInDetails:t}),s)return await Yd({...s,username:e,NewDeviceMetadata:await rt({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:s.NewDeviceMetadata,accessToken:s.AccessToken}),signInDetails:t}),Ke.dispatch({type:"RESET_STATE"}),await Gd(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};if(b==="WEB_AUTHN")throw new ar({name:Wd.SignInException,message:"Sequential WEB_AUTHN challenges returned from underlying service cannot be handled."});return{challengeName:b,challengeParameters:n}}function Uo({username:r,userPoolId:o,userPoolClientId:e}){if(typeof window>"u")return;const d=window.AmazonCognitoAdvancedSecurityData;if(typeof d>"u")return;const t=d.getData(r,o,e);return t?{EncodedData:t}:{}}const GD=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],XD=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],pm=()=>{const r=new Date,o=XD[r.getUTCDay()],e=GD[r.getUTCMonth()],d=r.getUTCDate();let t=r.getUTCHours();t<10&&(t=`0${t}`);let l=r.getUTCMinutes();l<10&&(l=`0${l}`);let i=r.getUTCSeconds();i<10&&(i=`0${i}`);const a=r.getUTCFullYear();return`${o} ${e} ${d} ${t}:${l}:${i} UTC ${a}`},fm=({userPoolName:r,username:o,challengeParameters:e,dateNow:d,hkdf:t})=>{const l=ra.convert(r),i=ra.convert(o),a=ZD(e.SECRET_BLOCK),w=ra.convert(d),b=new Uint8Array(l.byteLength+i.byteLength+a.byteLength+w.byteLength);b.set(l,0),b.set(i,l.byteLength),b.set(a,l.byteLength+i.byteLength),b.set(w,l.byteLength+i.byteLength+a.byteLength);const n=new Vi(t);n.update(b);const s=n.digestSync();return dl.convert(s)},ZD=r=>{const o="=".repeat((4-r.length%4)%4),e=(r+o).replace(/-/g,"+").replace(/_/g,"/"),d=g4.convert(e),t=new Uint8Array(d.length);for(let l=0;l<d.length;++l)t[l]=d.charCodeAt(l);return t};async function z4({username:r,config:o,clientMetadata:e,session:d,tokenOrchestrator:t}){const{userPoolId:l,userPoolEndpoint:i}=o,a=o.userPoolClientId,w=await t?.getDeviceMetadata(r);Gh(w);const b=await da(w.deviceGroupKey),n={USERNAME:r,SRP_A:b.A.toString(16),DEVICE_KEY:w.deviceKey},s={ChallengeName:"DEVICE_SRP_AUTH",ClientId:a,ChallengeResponses:n,ClientMetadata:e,Session:d},p=Gi({endpointResolver:Yr({endpointOverride:i})}),{ChallengeParameters:m,Session:h}=await p({region:Kr(l)},s);return JD(r,m,e,h,b,o,t)}async function JD(r,o,e,d,t,{userPoolId:l,userPoolClientId:i,userPoolEndpoint:a},w){const b=await w?.getDeviceMetadata(r);Gh(b);const n=new rr(o?.SRP_B,16),s=new rr(o?.SALT,16),{deviceKey:p}=b,{deviceGroupKey:m}=b,h=await t.getPasswordAuthenticationKey({username:b.deviceKey,password:b.randomPassword,serverBValue:n,salt:s}),f=pm(),k={USERNAME:o?.USERNAME??r,PASSWORD_CLAIM_SECRET_BLOCK:o?.SECRET_BLOCK,TIMESTAMP:f,PASSWORD_CLAIM_SIGNATURE:fm({username:p,userPoolName:m,challengeParameters:o,dateNow:f,hkdf:h}),DEVICE_KEY:p},x=Uo({username:r,userPoolId:l,userPoolClientId:i}),c={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:i,ChallengeResponses:k,Session:d,ClientMetadata:e,UserContextData:x};return Gi({endpointResolver:Yr({endpointOverride:a})})({region:Kr(l)},c)}async function hm(r,o,e,d,t,l,i){const{userPoolId:a,userPoolClientId:w,userPoolEndpoint:b}=l,n=a?.split("_")[1]||"",s=new rr(o?.SRP_B,16),p=new rr(o?.SALT,16),m=o?.USER_ID_FOR_SRP;if(!m)throw new ar({name:"EmptyUserIdForSRPException",message:"USER_ID_FOR_SRP was not found in challengeParameters"});const h=await t.getPasswordAuthenticationKey({username:m,password:r,serverBValue:s,salt:p}),f=pm(),k={USERNAME:m,PASSWORD_CLAIM_SECRET_BLOCK:o?.SECRET_BLOCK,TIMESTAMP:f,PASSWORD_CLAIM_SIGNATURE:fm({username:m,userPoolName:n,challengeParameters:o,dateNow:f,hkdf:h})},x=await i.getDeviceMetadata(m);x&&x.deviceKey&&(k.DEVICE_KEY=x.deviceKey);const c=Uo({username:m,userPoolId:a,userPoolClientId:w}),A={ChallengeName:"PASSWORD_VERIFIER",ChallengeResponses:k,ClientMetadata:e,Session:d,ClientId:w,UserContextData:c},g=await Gi({endpointResolver:Yr({endpointOverride:b})})({region:Kr(a)},A);return g.ChallengeName==="DEVICE_SRP_AUTH"?z4({username:m,config:l,clientMetadata:e,session:g.Session,tokenOrchestrator:i}):g}async function ta(r,o,e,d){try{return await r(...o)}catch(t){if(t instanceof ar&&t.name==="ResourceNotFoundException"&&t.message.includes("Device does not exist."))return await d.clearDeviceMetadata(e),r(...o);throw t}}function il(r){const{dispatch:o}=Ke;o({type:"SET_USERNAME",value:r})}async function mm({username:r,password:o,clientMetadata:e,config:d,tokenOrchestrator:t,authFlow:l,preferredChallenge:i}){const{userPoolId:a,userPoolClientId:w,userPoolEndpoint:b}=d,n=a?.split("_")[1]||"",s=await da(n),p={USERNAME:r,SRP_A:s.A.toString(16)};l==="USER_AUTH"&&i&&(p.PREFERRED_CHALLENGE=i);const m=Uo({username:r,userPoolId:a,userPoolClientId:w}),h={AuthFlow:l,AuthParameters:p,ClientMetadata:e,ClientId:w,UserContextData:m},k=await tl({endpointResolver:Yr({endpointOverride:b})})({region:Kr(a),userAgentValue:xo(wo.SignIn)},h),{ChallengeParameters:x,Session:c}=k,A=x?.USERNAME??r;return il(A),k.ChallengeName==="PASSWORD_VERIFIER"?ta(hm,[o,x,e,c,s,d,t],A,t):k}const km="userAttributes.";function QD(r){return"isSignedIn"in r&&"nextStep"in r}async function r7(r,o,e,d,t){const{userPoolClientId:l,userPoolId:i,userPoolEndpoint:a}=d,w={USERNAME:r,PASSWORD:o},b=await t.getDeviceMetadata(r);b&&b.deviceKey&&(w.DEVICE_KEY=b.deviceKey);const n=Uo({username:r,userPoolId:i,userPoolClientId:l}),s={AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:w,ClientMetadata:e,ClientId:l,UserContextData:n},m=await tl({endpointResolver:Yr({endpointOverride:a})})({region:Kr(i),userAgentValue:xo(wo.SignIn)},s),h=m.ChallengeParameters?.USERNAME??m.ChallengeParameters?.USER_ID_FOR_SRP??r;return il(h),m.ChallengeName==="DEVICE_SRP_AUTH"?z4({username:h,config:d,clientMetadata:e,session:m.Session,tokenOrchestrator:t}):m}async function o7(r,o,e,d,t){return mm({username:r,password:o,clientMetadata:e,config:d,tokenOrchestrator:t,authFlow:"USER_SRP_AUTH"})}async function e7(r,o,e,d){const{userPoolClientId:t,userPoolId:l,userPoolEndpoint:i}=e,a={USERNAME:r},w=await d.getDeviceMetadata(r);w&&w.deviceKey&&(a.DEVICE_KEY=w.deviceKey);const b=Uo({username:r,userPoolId:l,userPoolClientId:t}),n={AuthFlow:"CUSTOM_AUTH",AuthParameters:a,ClientMetadata:o,ClientId:t,UserContextData:b},p=await tl({endpointResolver:Yr({endpointOverride:i})})({region:Kr(l),userAgentValue:xo(wo.SignIn)},n),m=p.ChallengeParameters?.USERNAME??r;return il(m),p.ChallengeName==="DEVICE_SRP_AUTH"?z4({username:m,config:e,clientMetadata:o,session:p.Session,tokenOrchestrator:d}):p}async function d7(r,o,e,d,t){Sr(d);const{userPoolId:l,userPoolClientId:i,userPoolEndpoint:a}=d,w=l?.split("_")[1]||"",b=await da(w),n={USERNAME:r,SRP_A:b.A.toString(16),CHALLENGE_NAME:"SRP_A"},s=Uo({username:r,userPoolId:l,userPoolClientId:i}),p={AuthFlow:"CUSTOM_AUTH",AuthParameters:n,ClientMetadata:e,ClientId:i,UserContextData:s},m=tl({endpointResolver:Yr({endpointOverride:a})}),{ChallengeParameters:h,Session:f}=await m({region:Kr(l),userAgentValue:xo(wo.SignIn)},p),k=h?.USERNAME??r;return il(k),ta(hm,[o,h,e,f,b,d,t],k,t)}async function ot(r){const{challengeName:o,challengeParameters:e,availableChallenges:d}=r,t=Tr.getConfig().Auth?.Cognito;switch(Sr(t),o){case"CUSTOM_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE",additionalInfo:e}};case"MFA_SETUP":{const{signInSession:l,username:i}=Ke.getState(),a=xm(gm(e.MFAS_CAN_SETUP))||[],w=a7(a),b=w.includes("TOTP"),n=w.includes("EMAIL");if(b&&n)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION",allowedMFATypes:w}};if(n)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_EMAIL_SETUP"}};if(b){const s=NE({endpointResolver:Yr({endpointOverride:t.userPoolEndpoint})}),{Session:p,SecretCode:m}=await s({region:Kr(t.userPoolId)},{Session:l});return Ke.dispatch({type:"SET_SIGN_IN_SESSION",value:p}),{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_TOTP_SETUP",totpSetupDetails:t7(m,i)}}}throw new ar({name:Wd.SignInException,message:`Cannot initiate MFA setup from available types: ${a}`})}case"NEW_PASSWORD_REQUIRED":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",missingAttributes:l7(e.requiredAttributes)}};case"SELECT_MFA_TYPE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SELECTION",allowedMFATypes:xm(gm(e.MFAS_CAN_CHOOSE))}};case"SMS_OTP":case"SMS_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_SMS_CODE",codeDeliveryDetails:{deliveryMedium:e.CODE_DELIVERY_DELIVERY_MEDIUM,destination:e.CODE_DELIVERY_DESTINATION}}};case"SOFTWARE_TOKEN_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_TOTP_CODE"}};case"EMAIL_OTP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_EMAIL_CODE",codeDeliveryDetails:{deliveryMedium:e.CODE_DELIVERY_DELIVERY_MEDIUM,destination:e.CODE_DELIVERY_DESTINATION}}};case"WEB_AUTHN":{const l=await YD(e);return QD(l)?l:ot(l)}case"PASSWORD":case"PASSWORD_SRP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_PASSWORD"}};case"SELECT_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION",availableChallenges:d}}}throw new ar({name:Wd.SignInException,message:`An error occurred during the sign in process. ${o} challengeName returned by the underlying service was not addressed.`})}function t7(r,o){return{sharedSecret:r,getSetupUri:(e,d)=>{const t=`otpauth://totp/${e}:${d??o}?secret=${r}&issuer=${e}`;return new rl(t)}}}function al(r){if(r===Ki.PasswordResetRequiredException)return{isSignedIn:!1,nextStep:{signInStep:"RESET_PASSWORD"}};if(r===Ki.UserNotConfirmedException)return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_UP"}}}function l7(r){return r?JSON.parse(r).map(e=>e.includes(km)?e.replace(km,""):e):[]}function i7(r){if(r==="SMS_MFA")return"SMS";if(r==="SOFTWARE_TOKEN_MFA")return"TOTP";if(r==="EMAIL_OTP")return"EMAIL"}function xm(r){if(r)return r.map(i7).filter(Boolean)}function gm(r){return r?JSON.parse(r):[]}function a7(r){return r.filter(o=>o==="EMAIL"||o==="TOTP")}async function w7(){let r;try{r=await Zh()}catch{}if(r&&r.userId&&r.username)throw new ar({name:sE,message:"There is already a signed in user.",recoverySuggestion:"Call signOut before calling signIn again."})}function wl(r){return Ke.getState().username??r}async function b7(r){const o=Tr.getConfig().Auth?.Cognito;Sr(o);const{username:e,password:d,options:t}=r,l={loginId:e,authFlowType:"CUSTOM_WITHOUT_SRP"},i=t?.clientMetadata;Vr(!!e,sr.EmptySignInUsername),Vr(!d,sr.CustomAuthSignInPassword);try{const{ChallengeName:a,ChallengeParameters:w,AuthenticationResult:b,Session:n}=await ta(e7,[e,i,o,Co],e,Co),s=wl(e);return Xd({signInSession:n,username:s,challengeName:a,signInDetails:l}),b?(await Yd({username:s,...b,NewDeviceMetadata:await rt({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:b.NewDeviceMetadata,accessToken:b.AccessToken}),signInDetails:l}),be(),await Gd(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):ot({challengeName:a,challengeParameters:w})}catch(a){be(),Xo(a);const w=al(a.name);if(w)return w;throw a}}async function n7(r){const{username:o,password:e,options:d}=r,t={loginId:o,authFlowType:"CUSTOM_WITH_SRP"},l=Tr.getConfig().Auth?.Cognito;Sr(l);const i=d?.clientMetadata;Vr(!!o,sr.EmptySignInUsername),Vr(!!e,sr.EmptySignInPassword);try{const{ChallengeName:a,ChallengeParameters:w,AuthenticationResult:b,Session:n}=await d7(o,e,i,l,Co),s=wl(o);return Xd({signInSession:n,username:s,challengeName:a,signInDetails:t}),b?(await Yd({username:s,...b,NewDeviceMetadata:await rt({userPoolId:l.userPoolId,userPoolEndpoint:l.userPoolEndpoint,newDeviceMetadata:b.NewDeviceMetadata,accessToken:b.AccessToken}),signInDetails:t}),be(),await Gd(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):ot({challengeName:a,challengeParameters:w})}catch(a){be(),Xo(a);const w=al(a.name);if(w)return w;throw a}}const cm=async()=>{throw new ar({name:Kh,message:"The autoSignIn flow has not started, or has been cancelled/completed.",recoverySuggestion:"Please try to use the signIn API or log out before starting a new autoSignIn flow."})};let V4=cm;function H4(r){V4=r}function go(r=!0){r&&(V4=cm),We.dispatch({type:"RESET"})}async function um(r){const{username:o,password:e}=r,d=Tr.getConfig().Auth?.Cognito,t={loginId:o,authFlowType:"USER_SRP_AUTH"};Sr(d);const l=r.options?.clientMetadata;Vr(!!o,sr.EmptySignInUsername),Vr(!!e,sr.EmptySignInPassword);try{const{ChallengeName:i,ChallengeParameters:a,AuthenticationResult:w,Session:b}=await o7(o,e,l,d,Co),n=wl(o);return Xd({signInSession:b,username:n,challengeName:i,signInDetails:t}),w?(await Yd({username:n,...w,NewDeviceMetadata:await rt({userPoolId:d.userPoolId,userPoolEndpoint:d.userPoolEndpoint,newDeviceMetadata:w.NewDeviceMetadata,accessToken:w.AccessToken}),signInDetails:t}),be(),await Gd(),go(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):ot({challengeName:i,challengeParameters:a})}catch(i){be(),go(),Xo(i);const a=al(i.name);if(a)return a;throw i}}async function s7(r){const{username:o,password:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito,l={loginId:o,authFlowType:"USER_PASSWORD_AUTH"};Sr(t);const i=d?.clientMetadata;Vr(!!o,sr.EmptySignInUsername),Vr(!!e,sr.EmptySignInPassword);try{const{ChallengeName:a,ChallengeParameters:w,AuthenticationResult:b,Session:n}=await ta(r7,[o,e,i,t,Co],o,Co),s=wl(o);return Xd({signInSession:n,username:s,challengeName:a,signInDetails:l}),b?(await Yd({...b,username:s,NewDeviceMetadata:await rt({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:b.NewDeviceMetadata,accessToken:b.AccessToken}),signInDetails:l}),be(),await Gd(),go(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):ot({challengeName:a,challengeParameters:w})}catch(a){be(),go(),Xo(a);const w=al(a.name);if(w)return w;throw a}}async function p7({username:r,clientMetadata:o,config:e,tokenOrchestrator:d,preferredChallenge:t,password:l,session:i}){const{userPoolId:a,userPoolClientId:w,userPoolEndpoint:b}=e,n=Uo({username:r,userPoolId:a,userPoolClientId:w}),s={USERNAME:r};if(t){if(t==="PASSWORD_SRP")return Vr(!!l,sr.EmptySignInPassword),mm({username:r,password:l,clientMetadata:o,config:e,tokenOrchestrator:d,authFlow:"USER_AUTH",preferredChallenge:t});t==="PASSWORD"&&(Vr(!!l,sr.EmptySignInPassword),s.PASSWORD=l),s.PREFERRED_CHALLENGE=t}const p={AuthFlow:"USER_AUTH",AuthParameters:s,ClientMetadata:o,ClientId:w,UserContextData:n};i&&(p.Session=i);const h=await tl({endpointResolver:Yr({endpointOverride:b})})({region:Kr(a),userAgentValue:xo(wo.SignIn)},p);return il(r),h}async function Fm(r){const{username:o,password:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito,l={loginId:o,authFlowType:"USER_AUTH"};Sr(t);const i=d?.clientMetadata,a=d?.preferredChallenge;Vr(!!o,sr.EmptySignInUsername);try{const w={username:o,config:t,tokenOrchestrator:Co,clientMetadata:i,preferredChallenge:a,password:e},b=We.getState();b.active&&b.username===o&&(w.session=b.session);const n=await p7(w),s=wl(o);return Xd({signInSession:n.Session,username:s,challengeName:n.ChallengeName,signInDetails:l}),n.AuthenticationResult?(await Yd({username:s,...n.AuthenticationResult,NewDeviceMetadata:await rt({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:n.AuthenticationResult.NewDeviceMetadata,accessToken:n.AuthenticationResult.AccessToken}),signInDetails:l}),be(),await Gd(),go(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):ot({challengeName:n.ChallengeName,challengeParameters:n.ChallengeParameters,availableChallenges:"AvailableChallenges"in n?n.AvailableChallenges:void 0})}catch(w){be(),go(),Xo(w);const b=al(w.name);if(b)return b;throw w}}async function q4(r){go(!1);const o=r.options?.authFlowType;switch(await w7(),o){case"USER_SRP_AUTH":return um(r);case"USER_PASSWORD_AUTH":return s7(r);case"CUSTOM_WITHOUT_SRP":return b7(r);case"CUSTOM_WITH_SRP":return n7(r);case"USER_AUTH":return Fm(r);default:return um(r)}}const Am=180*1e3;function f7(r){const o=ji.listen("auth-internal",async({payload:d})=>{switch(d.event){case"confirmSignUp":d.data?.isSignUpComplete&&(ji.dispatch("auth-internal",{event:"autoSignIn"}),H4(Em(r)),o())}}),e=setTimeout(()=>{o(),clearTimeout(e),go()},Am)}function ym(r,o){let e;return d=>{e||r(...d),clearTimeout(e),e=setTimeout(()=>{e=void 0},o)}}function h7(r,o,e){const d=Date.now(),t=setInterval(async()=>{if(Date.now()-d>Am)clearInterval(t),e(new ar({name:Kh,message:"The account was not confirmed on time.",recoverySuggestion:"Try to verify your account by clicking the link sent your email or phone and then login manually."})),go();else try{const a=await q4(r);a.nextStep.signInStep!=="CONFIRM_SIGN_UP"&&(o(a),clearInterval(t),go())}catch(a){clearInterval(t),e(a),go()}},5e3)}const m7=ym(h7,300),k7=ym(g7,300);function x7(r){return async()=>new Promise((o,e)=>{m7([r,o,e])})}async function g7(r,o,e){try{const d=r?.options?.authFlowType==="USER_AUTH"?await Fm(r):await q4(r);o(d),go()}catch(d){e(d),go()}}function Em(r){return async()=>new Promise((o,e)=>{k7([r,o,e])})}const c7=Em,u7=()=>async r=>{if(r.statusCode>=300){const o=await qd(r);if(Xo(o),o.name===C4.InvalidParameterException&&/'password'/.test(o.message)&&/Member must not be null/.test(o.message)){const e=sr.EmptySignUpPassword,{message:d,recoverySuggestion:t}=Ah[e];throw new ar({name:e,message:d,recoverySuggestion:t})}throw new ar({name:o.name,message:o.message})}return Qt(r)},F7=r=>no(So,vo("SignUp"),u7(),{..._o,...r});async function A7(r){const{username:o,password:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito,l=t?.signUpVerificationMethod??"code",{clientMetadata:i,validationData:a,autoSignIn:w}=r.options??{};Sr(t),Vr(!!o,sr.EmptySignUpUsername);const b=typeof w!="boolean"?w:void 0,n={username:o,options:b};b?.authFlowType!=="CUSTOM_WITHOUT_SRP"&&(n.password=e);const{userPoolId:s,userPoolClientId:p,userPoolEndpoint:m}=t,h=F7({endpointResolver:Yr({endpointOverride:m})}),f={Username:o,Password:void 0,UserAttributes:d?.userAttributes&&Eh(d?.userAttributes),ClientMetadata:i,ValidationData:a&&Eh(a),ClientId:p,UserContextData:Uo({username:o,userPoolId:s,userPoolClientId:p})};e&&(f.Password=e);const{UserSub:k,CodeDeliveryDetails:x,UserConfirmed:c,Session:A}=await h({region:Kr(s),userAgentValue:xo(wo.SignUp)},f);(b||w===!0)&&(We.dispatch({type:"START"}),We.dispatch({type:"SET_USERNAME",value:o}),We.dispatch({type:"SET_SESSION",value:A}));const u={destination:x?.Destination,deliveryMedium:x?.DeliveryMedium,attributeName:x?.AttributeName},g=!!c,B=We.getState().active;if(g)return B?(H4(c7(n)),{isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"},userId:k}):{isSignUpComplete:!0,nextStep:{signUpStep:"DONE"},userId:k};if(B){if(l==="link")return H4(x7(n)),{isSignUpComplete:!1,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN",codeDeliveryDetails:u},userId:k};f7(n)}return{isSignUpComplete:!1,nextStep:{signUpStep:"CONFIRM_SIGN_UP",codeDeliveryDetails:u},userId:k}}const y7=r=>no(So,vo("ForgotPassword"),Mo(),{..._o,...r});async function E7(r){const{username:o}=r;Vr(!!o,sr.EmptyResetPasswordUsername);const e=Tr.getConfig().Auth?.Cognito;Sr(e);const{userPoolClientId:d,userPoolId:t,userPoolEndpoint:l}=e,i=r.options?.clientMetadata,a=Uo({username:o,userPoolId:t,userPoolClientId:d}),n=(await y7({endpointResolver:Yr({endpointOverride:l})})({region:Kr(t),userAgentValue:xo(wo.ResetPassword)},{Username:o,ClientMetadata:i,ClientId:d,UserContextData:a})).CodeDeliveryDetails;return{isPasswordReset:!1,nextStep:{resetPasswordStep:"CONFIRM_RESET_PASSWORD_WITH_CODE",codeDeliveryDetails:{deliveryMedium:n?.DeliveryMedium,destination:n?.Destination,attributeName:n?.AttributeName}}}}const D7=r=>no(So,vo("ConfirmForgotPassword"),Mo(),{..._o,...r});async function v7(r){const o=Tr.getConfig().Auth?.Cognito;Sr(o);const{userPoolClientId:e,userPoolId:d,userPoolEndpoint:t}=o,{username:l,newPassword:i}=r;Vr(!!l,sr.EmptyConfirmResetPasswordUsername),Vr(!!i,sr.EmptyConfirmResetPasswordNewPassword);const a=r.confirmationCode;Vr(!!a,sr.EmptyConfirmResetPasswordConfirmationCode);const w=r.options?.clientMetadata,b=Uo({username:l,userPoolId:d,userPoolClientId:e});await D7({endpointResolver:Yr({endpointOverride:t})})({region:Kr(o.userPoolId),userAgentValue:xo(wo.ConfirmResetPassword)},{Username:l,ConfirmationCode:a,Password:i,ClientMetadata:w,ClientId:o.userPoolClientId,UserContextData:b})}const S7=r=>no(So,vo("ResendConfirmationCode"),Mo(),{..._o,...r});async function _7(r){const{username:o}=r;Vr(!!o,sr.EmptySignUpUsername);const e=Tr.getConfig().Auth?.Cognito;Sr(e);const{userPoolClientId:d,userPoolId:t,userPoolEndpoint:l}=e,i=r.options?.clientMetadata,a=Uo({username:o,userPoolId:t,userPoolClientId:d}),w=S7({endpointResolver:Yr({endpointOverride:l})}),{CodeDeliveryDetails:b}=await w({region:Kr(e.userPoolId),userAgentValue:xo(wo.ResendSignUpCode)},{Username:o,ClientMetadata:i,ClientId:e.userPoolClientId,UserContextData:a}),{DeliveryMedium:n,AttributeName:s,Destination:p}={...b};return{destination:p,deliveryMedium:n,attributeName:s||void 0}}const C7=r=>no(So,vo("ConfirmSignUp"),Mo(),{..._o,...r});async function B7(r){const{username:o,confirmationCode:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito;Sr(t);const{userPoolId:l,userPoolClientId:i,userPoolEndpoint:a}=t,w=d?.clientMetadata;Vr(!!o,sr.EmptyConfirmSignUpUsername),Vr(!!e,sr.EmptyConfirmSignUpCode);const b=Uo({username:o,userPoolId:l,userPoolClientId:i}),n=C7({endpointResolver:Yr({endpointOverride:a})}),{Session:s}=await n({region:Kr(t.userPoolId),userAgentValue:xo(wo.ConfirmSignUp)},{Username:o,ConfirmationCode:e,ClientMetadata:w,ForceAliasCreation:d?.forceAliasCreation,ClientId:t.userPoolClientId,UserContextData:b});return new Promise((p,m)=>{try{const h={isSignUpComplete:!0,nextStep:{signUpStep:"DONE"}},f=We.getState();if(!f.active||f.username!==o){p(h),go();return}We.dispatch({type:"SET_SESSION",value:s});const k=ji.listen("auth-internal",({payload:x})=>{switch(x.event){case"autoSignIn":p({isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"}}),k()}});ji.dispatch("auth-internal",{event:"confirmSignUp",data:h})}catch(h){m(h)}})}const I7=r=>no(So,vo("ChangePassword"),Mo(),{..._o,...r});async function T7(r){const o=Tr.getConfig().Auth?.Cognito;Sr(o);const{userPoolEndpoint:e,userPoolId:d}=o,{oldPassword:t,newPassword:l}=r;Vr(!!t,sr.EmptyUpdatePassword),Vr(!!l,sr.EmptyUpdatePassword);const{tokens:i}=await rh({forceRefresh:!1});B4(i),await I7({endpointResolver:Yr({endpointOverride:e})})({region:Kr(d),userAgentValue:xo(wo.UpdatePassword)},{AccessToken:i.accessToken.toString(),PreviousPassword:t,ProposedPassword:l})}function N7(r,o){if(o){const e=r?.find(d=>d===o);if(!e)throw xE;return e}else{const e=r?.find(P7)??r?.find(O7),d=r?.find(M7)??r?.find(R7);if(e)return e;throw d?cE:kE}}const P7=r=>r.startsWith(String(window.location.origin+(window.location.pathname||"/"))),O7=r=>r.includes(String(window.location.hostname)),R7=r=>r.startsWith("http://"),M7=r=>r.startsWith("https://"),$7=async r=>{window?.location&&(window.location.href=r.replace("http://","https://"))},U7=async r=>{await r.clearOAuthData(),Co.clearTokens(),await oh(),Vd.dispatch("auth",{event:"signedOut"},"Auth",sd)},j7=async(r,o=!1,e)=>{Cf(r);const{loginWith:d,userPoolClientId:t}=r,{domain:l,redirectSignOut:i}=d.oauth,a=N7(i,e),w=`https://${l}/logout?${Object.entries({client_id:t,logout_uri:encodeURIComponent(a)}).map(([b,n])=>`${b}=${n}`).join("&")}`;return $7(w)},L7=async(r,o,e,d)=>{const{isOAuthSignIn:t}=await o.loadOAuthSignIn(),l=await e.getOAuthMetadata();if(await U7(o),t||l?.oauthSignIn)return j7(r,!1,d)},z7=r=>no(So,vo("RevokeToken"),Mo(),{..._o,...r}),V7=r=>no(So,vo("GlobalSignOut"),Mo(),{..._o,...r}),Dm=new Do("Auth");async function H7(r){const o=Tr.getConfig().Auth?.Cognito;Sr(o),r?.global?await W7(o):await q7(o);let e;try{Cf(o),e=!0}catch{e=!1}if(e){const d=new om(el);d.setAuthConfig(o);const{type:t}=await L7(o,d,Co,r?.oauth?.redirectUrl)??{};if(t==="error")throw new ar({name:uE,message:"An error occurred when attempting to log out from OAuth provider."})}else Co.clearTokens(),await oh(),Vd.dispatch("auth",{event:"signedOut"},"Auth",sd)}async function q7(r){try{const{userPoolEndpoint:o,userPoolId:e,userPoolClientId:d}=r,t=await Co.getTokenStore().loadTokens();Yh(t),K7(t.accessToken)&&await z7({endpointResolver:Yr({endpointOverride:o})})({region:Kr(e),userAgentValue:xo(wo.SignOut)},{ClientId:d,Token:t.refreshToken})}catch{Dm.debug("Client signOut error caught but will proceed with token removal")}}async function W7(r){try{const{userPoolEndpoint:o,userPoolId:e}=r,d=await Co.getTokenStore().loadTokens();B4(d),await V7({endpointResolver:Yr({endpointOverride:o})})({region:Kr(e),userAgentValue:xo(wo.SignOut)},{AccessToken:d.accessToken.toString()})}catch{Dm.debug("Global signOut error caught but will proceed with token removal")}}const K7=r=>!!r?.payload?.origin_jti,Y7={identityId:"identityId"},G7=new Do("DefaultIdentityIdStore");class vm{setAuthConfig(o){Li(o.Cognito),this.authConfig=o,this._authKeys=X7("Cognito",o.Cognito.identityPoolId)}constructor(o){this._authKeys={},this._hasGuestIdentityId=!1,this.keyValueStorage=o}async loadIdentityId(){Li(this.authConfig?.Cognito);try{if(this._primaryIdentityId)return{id:this._primaryIdentityId,type:"primary"};{const o=await this.keyValueStorage.getItem(this._authKeys.identityId);return o?(this._hasGuestIdentityId=!0,{id:o,type:"guest"}):null}}catch(o){return G7.log("Error getting stored IdentityId.",o),null}}async storeIdentityId(o){Li(this.authConfig?.Cognito),o.type==="guest"?(this.keyValueStorage.setItem(this._authKeys.identityId,o.id),this._primaryIdentityId=void 0,this._hasGuestIdentityId=!0):(this._primaryIdentityId=o.id,this._hasGuestIdentityId&&(this.keyValueStorage.removeItem(this._authKeys.identityId),this._hasGuestIdentityId=!1))}async clearIdentityId(){this._primaryIdentityId=void 0,await this.keyValueStorage.removeItem(this._authKeys.identityId)}}const X7=(r,o)=>I4(Y7)(`com.amplify.${r}`,o),W4=({endpointOverride:r})=>o=>r?{url:new rl(r)}:rE(o);function Sm(r){const o=pd(r).payload.iss,e={};if(!o)throw new ar({name:"InvalidIdTokenException",message:"Invalid Idtoken."});const d=o.replace(/(^\w+:|^)\/\//,"");return e[d]=r,e}async function Z7({tokens:r,authConfig:o,identityIdStore:e}){e.setAuthConfig({Cognito:o});const d=await e.loadIdentityId();if(d)return d.id;const t=r?.idToken?Sm(r.idToken.toString()):{},l=await J7(t,o);return e.storeIdentityId({id:l,type:r?"primary":"guest"}),l}async function J7(r,o){const e=o?.identityPoolId,d=_4(e),t=Z8({endpointResolver:W4({endpointOverride:o.identityPoolEndpoint})});let l;try{l=(await t({region:d},{IdentityPoolId:e,Logins:r})).IdentityId}catch(i){throw Xo(i),new ar(i)}if(!l)throw new ar({name:"GetIdResponseException",message:"Received undefined response from getId operation",recoverySuggestion:"Make sure to pass a valid identityPoolId in the configuration."});return l}const la=new Do("CognitoCredentialsProvider"),_m=3e3*1e3;class Cm{constructor(o){this._nextCredentialsRefresh=0,this._identityIdStore=o}async clearCredentialsAndIdentityId(){la.debug("Clearing out credentials and identityId"),this._credentialsAndIdentityId=void 0,await this._identityIdStore.clearIdentityId()}async clearCredentials(){la.debug("Clearing out in-memory credentials"),this._credentialsAndIdentityId=void 0}async getCredentialsAndIdentityId(o){const e=o.authenticated,{tokens:d}=o,{authConfig:t}=o;try{Li(t?.Cognito)}catch{return}if(!e&&!t.Cognito.allowGuestAccess)return;const{forceRefresh:l}=o,i=this.hasTokenChanged(d),a=await Z7({tokens:d,authConfig:t.Cognito,identityIdStore:this._identityIdStore});return(l||i)&&this.clearCredentials(),e?(yE(d),this.credsForOIDCTokens(t.Cognito,d,a)):this.getGuestCredentials(a,t.Cognito)}async getGuestCredentials(o,e){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!1)return la.info("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const d=_4(e.identityPoolId),t=fh({endpointResolver:W4({endpointOverride:e.identityPoolEndpoint})});let l;try{l=await t({region:d},{IdentityId:o})}catch(i){throw Xo(i),new ar(i)}if(l?.Credentials?.AccessKeyId&&l?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+_m;const i={credentials:{accessKeyId:l.Credentials.AccessKeyId,secretAccessKey:l.Credentials.SecretKey,sessionToken:l.Credentials.SessionToken,expiration:l.Credentials.Expiration},identityId:o};return l.IdentityId&&(i.identityId=l.IdentityId,this._identityIdStore.storeIdentityId({id:l.IdentityId,type:"guest"})),this._credentialsAndIdentityId={...i,isAuthenticatedCreds:!1},i}else throw new ar({name:"CredentialsNotFoundException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}async credsForOIDCTokens(o,e,d){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!0)return la.debug("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const t=e.idToken?Sm(e.idToken.toString()):{},l=_4(o.identityPoolId),i=fh({endpointResolver:W4({endpointOverride:o.identityPoolEndpoint})});let a;try{a=await i({region:l},{IdentityId:d,Logins:t})}catch(w){throw Xo(w),new ar(w)}if(a?.Credentials?.AccessKeyId&&a?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+_m;const w={credentials:{accessKeyId:a.Credentials.AccessKeyId,secretAccessKey:a.Credentials.SecretKey,sessionToken:a.Credentials.SessionToken,expiration:a.Credentials.Expiration},identityId:d};return a.IdentityId&&(w.identityId=a.IdentityId,this._identityIdStore.storeIdentityId({id:a.IdentityId,type:"primary"})),this._credentialsAndIdentityId={...w,isAuthenticatedCreds:!0,associatedIdToken:e.idToken?.toString()},w}else throw new ar({name:"CredentialsException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}isPastTTL(){return this._nextCredentialsRefresh===void 0?!0:this._nextCredentialsRefresh<=Date.now()}hasTokenChanged(o){return!!o&&!!this._credentialsAndIdentityId?.associatedIdToken&&o.idToken?.toString()!==this._credentialsAndIdentityId.associatedIdToken}}const Q7=new Cm(new vm(el)),r9={configure(r,o){const e=Of(r),d=new uh({sameSite:"lax"}),t=o?.ssr?d:el,l=o?.ssr?new Cm(new vm(d)):Q7;if(!e.Auth){Tr.configure(e,o);return}if(o?.Auth){Tr.configure(e,o);return}if(!Tr.libraryOptions.Auth){Kd.setAuthConfig(e.Auth),Kd.setKeyValueStorage(t),Tr.configure(e,{...o,Auth:{tokenProvider:Kd,credentialsProvider:l}});return}if(o){const i=Tr.libraryOptions.Auth;o.ssr!==void 0&&(Kd.setKeyValueStorage(t),i.credentialsProvider=l),Tr.configure(e,{Auth:i,...o});return}Tr.configure(e)},getConfig(){return Tr.getConfig()}},o9={Auth:{Cognito:{userPoolId:"ap-south-1_es4yWY1O9",userPoolClientId:"7hte1nkjug6rqsf9air6021aqr",userPoolEndpoint:"https://cognito-idp.ap-south-1.amazonaws.com/"}}};r9.configure(o9),Kd.setKeyValueStorage(new uh({domain:"localhost",secure:!0,path:"/",expires:30}));const Bm={signIn:q4,autoSignIn:V4,signUp:A7,fetchAuthSession:rh,resetPassword:E7,confirmResetPassword:v7,resendSignUpCode:_7,confirmSignUp:B7,updatePassword:T7,signOut:H7},bl=r=>{if(typeof window<"u"){const{cookie:o}=document,e=o?.split(";")?.find(t=>t?.includes(r));if(!e)return["",""];const d=e?.split("=");return d.length<=1?["",""]:d}return["",""]},Im=(r,o,e)=>{const d=new Date;d.setTime(d.getTime()+e*24*60*60*1e3);const t="expires="+d.toUTCString();document.cookie=r+"="+o+";"+t+";domain=."+process.env.NEXT_PUBLIC_DOMAIN+";path=/"};async function e9(){try{await Bm.signOut()}catch(r){console.log("error signing out: ",r)}}const Tm={jwtExpired:"jwt expired",notLogin:"User must be logged in"},K4=Yt.get();typeof K4=="object"&&Object.entries(K4).length&&Object?.entries(K4)?.forEach(([r,o])=>{r.endsWith("accessToken")});let ia="";typeof window<"u"&&(ia=window.location.href),ia.includes("invite-user")||ia.includes("mailOpened")||ia.includes("/email?"),Rr.interceptors.request.use(async r=>{const o=window.location.pathname?.split("/").find(d=>parseInt(d))??bl(vf.workspaceId)[1];r.headers["x-tenant-id"]||(r.headers["x-tenant-id"]=o?o.toString():"");const e=bl("accessToken");return r.headers.authorization=`${e[1]}`,{...r}},r=>Promise.reject(r)),Rr.interceptors.response.use(r=>r,async r=>{const e=SA(r.config,"url","").split("/");return((r.response?.data?.message??"")===Tm.jwtExpired||(r.response?.data?.message??"")===Tm.notLogin)&&(bl("count")[1]==="1"&&(await e9(),Im("count","0",0),window.location.href.includes("auth/")||(window.location.pathname=my.login)),await Bm.fetchAuthSession(),window.location.href.includes("auth/")||(Im("count","1",1),window.location.reload())),r.response?.status===401&&!e.includes("validate-user")&&window.location.reload(),Promise.reject(r.response)});const d9=()=>{const r=window.location.pathname.split("/").find(e=>parseInt(e))??bl(vf.workspaceId)[1],o=bl("accessToken");return{"x-tenant-id":r?r.toString():"",authorization:`${o[1]}`}},Nm=fy((r,{headers:o})=>({headers:{...o,...d9()}})),t9=Jr.createHttpLink({uri:Jw.clientGraphqlUrl}),l9=Jr.createHttpLink({uri:Jw.serverGraphqlUrl}),Y4=new Jr.ApolloClient({cache:new Jr.InMemoryCache({}),link:Jr.ApolloLink.from([Nm,t9]),queryDeduplication:!1,devtools:{enabled:!0}}),Pm=new Jr.ApolloClient({cache:new Jr.InMemoryCache({}),link:Jr.ApolloLink.from([Nm,l9]),queryDeduplication:!1,devtools:{enabled:!0}}),i9=Jr.gql`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "work-workflow-test",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/workflow.cjs.js",
6
6
  "module": "./dist/workflow.es.js",