chordia-ui 3.3.3 → 3.3.4

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.
@@ -1,3 +1,3 @@
1
1
  "use strict";const l=require("react/jsx-runtime"),h=require("react"),qe=require("lucide-react");require("./colors.cjs.js");const Tn=h.createContext(void 0),an=e=>(...t)=>{if(!e)throw Error("You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component");return e(...t)},yo=()=>typeof window<"u"&&!!window.descopeBridge,Ze={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.26.7"},ln=typeof window<"u";var _e=function(){return _e=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_e.apply(this,arguments)};function F(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}function xo(e,t,n,o){function r(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function c(u){try{d(o.next(u))}catch(p){s(p)}}function a(u){try{d(o.throw(u))}catch(p){s(p)}}function d(u){u.done?i(u.value):r(u.value).then(c,a)}d((o=o.apply(e,t||[])).next())})}function bo(e,t,n){if(n||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}function ko(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)}function Io(e,t,n,o,r){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n}class Le extends Error{}Le.prototype.name="InvalidTokenError";function jo(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function So(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return jo(t)}catch{return atob(t)}}function Rt(e,t){if(typeof e!="string")throw new Le("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Le(`Invalid token specified: missing part #${n+1}`);let r;try{r=So(o)}catch(i){throw new Le(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(r)}catch(i){throw new Le(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var w={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const En="<region>",Co=`https://api.${En}descope.com`,cn=1e3,dn=6e5,Dn="dct",un=()=>{const e={};return{headers(t){const n=typeof t.entries=="function"?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap(t=>e[t]?[`${t!=="Title"?`${t}: `:""}${e[t]}`]:[]).join(`
2
- `)}},Oo=[521,524],pn=e=>async(...t)=>{let n=await e(...t);Oo.includes(n.status)&&(n=await e(...t),n.retries=1);const o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n},Uo=(e,t)=>{const n=t||fetch;return n||e==null||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...o)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((i=>un().title("Request").url(i[0]).method(i[1].method).headers(i[1].headers).body(i[1].body).build())(o));const r=await pn(n)(...o);return e[r.ok?"log":"error"](await(async i=>{const s=await i.text();return un().title("Response").url(i.url.toString()).status(`${i.status} ${i.statusText}`).headers(i.headers).body(s).retries(i.retries).build()})(r)),r}:pn(n)};let Ye;const Ao=()=>{if(Ye)return Ye;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return Ye=`${t}-${n}`,Ye};var ke;(function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"})(ke||(ke={}));const gn=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(En,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${e==null?void 0:e.replace(/^\//,"")}`:t;if(n){const s=Object.keys(n);s.forEach((c,a)=>{i=`${i}${a===0?"?":""}${c}=${encodeURIComponent(n[c])}${a===s.length-1?"":"&"}`})}return i},To=(...e)=>new Headers(e.reduce((t,n)=>((o=>Array.isArray(o)?o:o instanceof Headers?Array.from(o.entries()):o?Object.entries(o):[])(n).forEach(([o,r])=>{t[o]=typeof r=="function"?r():r}),t),{})),Eo={"Content-Type":"application/json"},Do=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Ro=(e,t)=>{const n={"x-descope-sdk-session-id":Ao(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.57.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},Po=e=>{try{e=JSON.parse(e)}catch{return!1}return typeof e=="object"&&e!==null};var No=(e=>t=>{var n;return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:o=>{var r;const i=[].concat(((r=t.hooks)===null||r===void 0?void 0:r.beforeRequest)||[]);return i==null?void 0:i.reduce((s,c)=>c(s),o)},afterRequest:async(o,r)=>{var i;const s=[].concat(((i=t.hooks)===null||i===void 0?void 0:i.afterRequest)||[]);s.length!=0&&(await Promise.allSettled(s==null?void 0:s.map(c=>c(o,r==null?void 0:r.clone())))).forEach(c=>{var a;return c.status==="rejected"&&((a=t.logger)===null||a===void 0?void 0:a.error(c.reason))})},transformResponse:(n=t.hooks)===null||n===void 0?void 0:n.transformResponse}}))})(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:o,logger:r,hooks:i,cookiePolicy:s,fetch:c})=>{const a=e||Co,d=Uo(r,c),u=async p=>{var g;const x=i!=null&&i.beforeRequest?i.beforeRequest(p):p,{path:m,body:v,headers:b,queryParams:C,method:O,token:U}=x,N=(H=>H===void 0?void 0:JSON.stringify(H))(v),z={headers:To(Do(t,U),Ro(t,o),(n==null?void 0:n.baseHeaders)||{},Po(N)?Eo:{},b),method:O,body:N};s!==null&&(z.credentials=s||"include");const B=await d(gn({path:m,baseUrl:a,queryParams:C,projectId:t}),z);if(i!=null&&i.afterRequest&&await i.afterRequest(p,B==null?void 0:B.clone()),i==null?void 0:i.transformResponse){const H=await B.json(),K=(((g=B.headers)===null||g===void 0?void 0:g.get("set-cookie"))||"").split(";").reduce((W,L)=>{const[$,X]=L.split("=");return Object.assign(Object.assign({},W),{[$.trim()]:X})},{}),J=Object.assign(Object.assign({},B),{json:()=>Promise.resolve(H),cookies:K});return J.clone=()=>J,i.transformResponse(J)}return B};return{get:(p,{headers:g,queryParams:x,token:m}={})=>u({path:p,headers:g,queryParams:x,body:void 0,method:ke.get,token:m}),post:(p,g,{headers:x,queryParams:m,token:v}={})=>u({path:p,headers:x,queryParams:m,body:g,method:ke.post,token:v}),patch:(p,g,{headers:x,queryParams:m,token:v}={})=>u({path:p,headers:x,queryParams:m,body:g,method:ke.patch,token:v}),put:(p,g,{headers:x,queryParams:m,token:v}={})=>u({path:p,headers:x,queryParams:m,body:g,method:ke.put,token:v}),delete:(p,{headers:g,queryParams:x,token:m}={})=>u({path:p,headers:g,queryParams:x,body:void 0,method:ke.delete,token:m}),hooks:i,buildUrl:(p,g)=>gn({projectId:t,baseUrl:a,path:p,queryParams:g})}}),Lo={TOO_MANY_REQUESTS:429};function Rn(e,t,n){var o;let r=tt(e);if(t){if(!(r!=null&&r.tenants)&&(r==null?void 0:r[Dn])===t)return(r==null?void 0:r[n])||[];r=(o=r==null?void 0:r.tenants)===null||o===void 0?void 0:o[t]}const i=r==null?void 0:r[n];return Array.isArray(i)?i:[]}function tt(e){if(typeof e!="string"||!e)throw new Error("Invalid token provided");return Rt(e)}function Fo(e){const{exp:t}=tt(e);return new Date().getTime()/1e3>t}function Bo(e){let t=tt(e);const n=Object.keys(t==null?void 0:t.tenants);return Array.isArray(n)?n:[]}function qo(e,t){return Rn(e,t,"permissions")}function zo(e,t){return Rn(e,t,"roles")}const Z=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function y(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===Lo.TOO_MANY_REQUESTS&&Object.assign(r.error,{retryAfter:Number.parseInt((n=o.headers)===null||n===void 0?void 0:n.get("retry-after"))||0})),r}function Jo(e){var t;return((t=tt(e))===null||t===void 0?void 0:t[Dn])||""}const fe=(e,t)=>(n=t)=>o=>!e(o)&&n.replace("{val}",o),Pn=(e,t)=>(n=t)=>o=>{const r=e.filter(i=>i(o));return!(r.length<e.length)&&(n?n.replace("{val}",o):r.join(" OR "))},Nn=(...e)=>({validate:t=>(e.forEach(n=>{const o=n(t);if(o)throw new Error(o)}),!0)}),Ln=e=>t=>e.test(t),Ho=Ln(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Ko=Ln(/^\+[1-9]{1}[0-9]{3,14}$/),Mo=(e,t)=>n=>Nn(...t).validate(((o,r,i)=>{const s=(Array.isArray(r)?r.join("."):String(r)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,(u,p,g)=>"."+g).split("."),c=s.length;let a=0,d=o===Object(o)?o:void 0;for(;d!=null&&a<c;)d=d[s[a++]];return a&&a===c&&d!==void 0?d:i})(n,e)),Vo=fe(Ho,'"{val}" is not a valid email'),Wo=fe(Ko,'"{val}" is not a valid phone number'),Yo=fe((hn=1,e=>e.length>=hn),"Minimum length is 1");var hn;const Ae=fe(e=>typeof e=="string","Input is not a string"),$o=fe(e=>Array.isArray(e),"Input is not an array"),Xo=fe(e=>typeof e=="boolean","Input is not a boolean"),Qo=fe(e=>e===void 0,"Input is defined"),It=Pn([Ae(),Qo()],"Input is not a string or undefined"),Go=Pn([$o(),Xo()],"Input is not an array or boolean"),j=(...e)=>t=>(...n)=>(e.forEach((o,r)=>Nn(...o).validate(n[r])),t(...n)),Fn=e=>[Ae(`"${e}" must be a string`)],Bn=e=>[It(`"${e}" must be string or undefined`)],D=e=>[Ae(`"${e}" must be a string`),Yo(`"${e}" must not be empty`)],Pt=e=>[Ae(`"${e}" must be a string`),Vo()],qn=e=>[Ae(`"${e}" must be a string`),Wo()],Zo=j(D("accessKey")),_o=e=>({exchange:Zo((t,n)=>y(e.post(w.accessKey.exchange,{loginOptions:n},{token:t})))}),Ee=(e,t,n)=>(t.forEach(o=>{const r=o.split(".");let i=r.shift(),s=e;for(;r.length>0;){if(s=s[i],!i||!s)throw Error(`Invalid path "${o}", "${i}" is missing or has no value`);i=r.shift()}if(typeof s[i]!="function")throw Error(`"${o}" is not a function`);const c=s[i];s[i]=n(c)}),e),zn=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||cn,cn),timeoutMs:Math.min(t||dn,dn)});var he,jt;(function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"})(he||(he={})),function(e){e.email="email"}(jt||(jt={}));const de=Object.assign(Object.assign({},he),jt);var fn;(function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"})(fn||(fn={}));const Jn=D("loginId"),er=j(D("token")),pt=j(Jn),tr=j(D("pendingRef")),nr=j(Jn,Pt("email")),or=e=>({verify:er(t=>y(e.post(w.enchantedLink.verify,{token:t}))),signIn:pt((t,n,o={},r)=>{var{providerId:i}=o,s=F(o,["providerId"]);return y(e.post(Z(w.enchantedLink.signIn,de.email),{loginId:t,URI:n,loginOptions:s,providerId:i},{token:r}))}),signUpOrIn:pt((t,n,o={})=>{var{providerId:r}=o,i=F(o,["providerId"]);return y(e.post(Z(w.enchantedLink.signUpOrIn,de.email),{loginId:t,URI:n,loginOptions:i,providerId:r}))}),signUp:pt((t,n,o,r={})=>{var{providerId:i}=r,s=F(r,["providerId"]);return y(e.post(Z(w.enchantedLink.signUp,de.email),{loginId:t,URI:n,user:o,loginOptions:s,providerId:i}))}),waitForSession:tr((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=zn(n);let s;const c=setInterval(async()=>{const a=await e.post(w.enchantedLink.session,{pendingRef:t});a.ok&&(clearInterval(c),s&&clearTimeout(s),o(y(Promise.resolve(a))))},r);s=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)})),update:{email:nr((t,n,o,r,i)=>y(e.post(w.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))}}),rr=j(D("flowId")),ir=j(D("executionId"),D("stepId"),D("interactionId")),sr=e=>({start:rr((t,n,o,r,i,s,c,a=!1)=>y(e.post(w.flow.start,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,componentsVersion:i,flowVersions:s,input:c,isCustomScreen:a}))),next:ir((t,n,o,r,i,s,c=!1)=>y(e.post(w.flow.next,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s,isCustomScreen:c})))}),Nt=D("loginId"),ar=j(D("token")),gt=j(Nt),lr=j(Nt,qn("phone")),cr=j(Nt,Pt("email")),ht=Object.keys(de).filter(e=>e!==he.voice&&e!==he.im),dr=e=>({verify:ar(t=>y(e.post(w.magicLink.verify,{token:t}))),signIn:ht.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:gt((o,r,i={},s)=>{var{providerId:c}=i,a=F(i,["providerId"]);return y(e.post(Z(w.magicLink.signIn,n),{loginId:o,URI:r,loginOptions:a,providerId:c},{token:s}))})}),{}),signUp:ht.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:gt((o,r,i,s={})=>{var{providerId:c}=s,a=F(s,["providerId"]);return y(e.post(Z(w.magicLink.signUp,n),{loginId:o,URI:r,user:i,loginOptions:a,providerId:c}))})}),{}),signUpOrIn:ht.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:gt((o,r,i={})=>{var{providerId:s}=i,c=F(i,["providerId"]);return y(e.post(Z(w.magicLink.signUpOrIn,n),{loginId:o,URI:r,loginOptions:c,providerId:s}))})}),{}),update:{email:cr((t,n,o,r,i)=>y(e.post(w.magicLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))),phone:Object.keys(he).filter(t=>t!==he.voice).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:lr((o,r,i,s,c)=>y(e.post(Z(w.magicLink.update.phone,n),Object.assign({loginId:o,phone:r,URI:i},c),{token:s})))}),{})}});var St;(function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple",e.discord="discord",e.linkedin="linkedin",e.slack="slack"})(St||(St={}));const ur=j(D("code")),pr=e=>({start:Object.assign((t,n,o,r,i)=>y(e.post(w.oauth.start,o||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),i&&{loginHint:i}),token:r})),Object.keys(St).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:(o,r,i,s)=>y(e.post(w.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},o&&{redirectURL:o}),s&&{loginHint:s}),token:i}))}),{})),exchange:ur(t=>y(e.post(w.oauth.exchange,{code:t}))),startNative:(t,n,o)=>y(e.post(w.oauth.startNative,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>y(e.post(w.oauth.finishNative,{provider:t,stateId:n,user:o,code:r,idToken:i})),getOneTapClientId:t=>y(e.get(w.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,o,r)=>y(e.post(w.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r})),exchangeOneTapIDToken:(t,n,o,r)=>y(e.post(w.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r}))}),gr=D("appId"),hr=j(gr),fr=e=>({connect:hr((t,n,o)=>{const r=n==null?void 0:n.tenantId,i=n==null?void 0:n.tenantLevel;return n==null||delete n.tenantId,n==null||delete n.tenantLevel,y(e.post(w.outbound.connect,{appId:t,tenantId:r,tenantLevel:i,options:n},{token:o}))})}),nt=D("loginId"),vr=j(nt,D("code")),ft=j(nt),mr=j(nt,qn("phone")),wr=j(nt,Pt("email")),yr=e=>({verify:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:vr((o,r)=>y(e.post(Z(w.otp.verify,n),{code:r,loginId:o})))}),{}),signIn:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ft((o,r={},i)=>{var{providerId:s}=r,c=F(r,["providerId"]);return y(e.post(Z(w.otp.signIn,n),{loginId:o,loginOptions:c,providerId:s},{token:i}))})}),{}),signUp:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ft((o,r,i={})=>{var{providerId:s}=i,c=F(i,["providerId"]);return y(e.post(Z(w.otp.signUp,n),{loginId:o,user:r,loginOptions:c,providerId:s}))})}),{}),signUpOrIn:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ft((o,r={})=>{var{providerId:i}=r,s=F(r,["providerId"]);return y(e.post(Z(w.otp.signUpOrIn,n),{loginId:o,loginOptions:s,providerId:i}))})}),{}),update:{email:wr((t,n,o,r)=>y(e.post(w.otp.update.email,Object.assign({loginId:t,email:n},r),{token:o}))),phone:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:mr((o,r,i,s)=>y(e.post(Z(w.otp.update.phone,n),Object.assign({loginId:o,phone:r},s),{token:i})))}),{})}}),xr=j(D("tenant")),br=j(D("code")),kr=e=>({start:xr((t,n,o,r,i,s,c,a)=>y(e.post(w.saml.start,o||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i}),s&&{forceAuthn:"true"}),c&&{loginHint:c}),a&&{initiatedEmail:t})},r&&{token:r})))),exchange:br(t=>y(e.post(w.saml.exchange,{code:t})))}),Lt=D("loginId"),Ir=j(Lt,D("code")),jr=j(Lt),Sr=j(Lt),Cr=e=>({signUp:jr((t,n)=>y(e.post(w.totp.signUp,{loginId:t,user:n}))),verify:Ir((t,n,o,r)=>y(e.post(w.totp.verify,{loginId:t,code:n,loginOptions:o},{token:r}))),update:Sr((t,n)=>y(e.post(w.totp.update,{loginId:t},{token:n})))}),ot=D("loginId"),Hn=D("newPassword"),vn=j(ot,D("password")),Or=j(ot),Ur=j(ot,Hn),Ar=j(ot,D("oldPassword"),Hn),Tr=e=>({signUp:vn((t,n,o,r={})=>{var{providerId:i}=r,s=F(r,["providerId"]);return y(e.post(w.password.signUp,{loginId:t,password:n,user:o,loginOptions:s,providerId:i}))}),signIn:vn((t,n,o={})=>{var{providerId:r}=o,i=F(o,["providerId"]);return y(e.post(w.password.signIn,{loginId:t,password:n,loginOptions:i,providerId:r}))}),sendReset:Or((t,n,o)=>y(e.post(w.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:o}))),update:Ur((t,n,o)=>y(e.post(w.password.update,{loginId:t,newPassword:n},{token:o}))),replace:Ar((t,n,o)=>y(e.post(w.password.replace,{loginId:t,oldPassword:n,newPassword:o}))),policy:()=>y(e.get(w.password.policy))}),Er=Fn("loginId"),Ft=D("loginId"),rt=D("origin"),Dr=j(Ft,rt,D("name")),Rr=j(Ft,rt),Pr=j(Er,rt),Nr=j(Ft,rt,Bn("token")),vt=j(D("transactionId"),D("response")),Lr=e=>({signUp:{start:Dr((t,n,o,r)=>y(e.post(w.webauthn.signUp.start,{user:{loginId:t,name:o},origin:n,passkeyOptions:r}))),finish:vt((t,n)=>y(e.post(w.webauthn.signUp.finish,{transactionId:t,response:n})))},signIn:{start:Pr((t,n,o,r,i)=>y(e.post(w.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:o,passkeyOptions:i},{token:r}))),finish:vt((t,n)=>y(e.post(w.webauthn.signIn.finish,{transactionId:t,response:n})))},signUpOrIn:{start:Rr((t,n,o)=>y(e.post(w.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:o})))},update:{start:Nr((t,n,o,r)=>y(e.post(w.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:o}))),finish:vt((t,n)=>y(e.post(w.webauthn.update.finish,{transactionId:t,response:n})))}}),Fr=Fn("loginId"),mt=j(Fr),Br=j(D("pendingRef")),qr=e=>({signUpOrIn:mt((t,n={})=>{var{providerId:o}=n,r=F(n,["providerId"]);return y(e.post(w.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:o}))}),signUp:mt((t,n,o={})=>{var{providerId:r}=o,i=F(o,["providerId"]);return y(e.post(w.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:i}))}),signIn:mt((t,n={},o)=>{var{providerId:r}=n,i=F(n,["providerId"]);return y(e.post(w.notp.signIn,{loginId:t,loginOptions:i,providerId:r},{token:o}))}),waitForSession:Br((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=zn(n);let s;const c=setInterval(async()=>{const a=await e.post(w.notp.session,{pendingRef:t});a.ok&&(clearInterval(c),s&&clearTimeout(s),o(y(Promise.resolve(a))))},r);s=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)}))}),De=j(D("token")),Re=j(Bn("token"));var mn,wn,zr=j([(mn="projectId",wn=D("projectId"),fe(Mo(mn,wn))())])(e=>{const{projectId:t,logger:n,baseUrl:o,cookiePolicy:r,baseHeaders:i={},refreshCookieName:s,fetch:c}=e;return a=No({baseUrl:o,projectId:t,logger:n,hooks:{get beforeRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.beforeRequest},get afterRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.afterRequest},get transformResponse(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:i},refreshCookieName:s,fetch:c}),{accessKey:_o(a),otp:yr(a),magicLink:dr(a),enchantedLink:or(a),oauth:pr(a),outbound:fr(a),saml:kr(a),totp:Cr(a),notp:qr(a),webauthn:Lr(a),password:Tr(a),flow:sr(a),refresh:Re((d,u,p,g)=>{const x={};p&&(x.externalToken=p);const m=g?w.tryRefresh:w.refresh;return y(a.post(m,x,{token:d,queryParams:u}))}),selectTenant:j([Ae("tenantId")],[It('"token" must be string or undefined')])((d,u)=>y(a.post(w.selectTenant,{tenant:d},{token:u}))),logout:Re(d=>y(a.post(w.logout,{},{token:d}))),logoutAll:Re(d=>y(a.post(w.logoutAll,{},{token:d}))),me:Re(d=>y(a.get(w.me,{token:d}))),myTenants:j([Go('"tenants" must a string array or a boolean')],[It('"token" must be string or undefined')])((d,u)=>{const p={};return typeof d=="boolean"?p.dct=d:p.ids=d,y(a.post(w.myTenants,p,{token:u}))}),history:Re(d=>y(a.get(w.history,{token:d}))),isJwtExpired:De(Fo),getTenants:De(Bo),getJwtPermissions:De(qo),getJwtRoles:De(zo),getCurrentTenant:De(Jo),httpClient:a};var a}),Jr=Object.assign(zr,{DeliveryMethods:de});/*! js-cookie v3.0.5 | MIT */function $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var Hr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Ct(e,t){function n(r,i,s){if(!(typeof document>"u")){s=$e({},t,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var a in s)s[a]&&(c+="; "+a,s[a]!==!0&&(c+="="+s[a].split(";")[0]));return document.cookie=r+"="+e.write(i,r)+c}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var i=document.cookie?document.cookie.split("; "):[],s={},c=0;c<i.length;c++){var a=i[c].split("="),d=a.slice(1).join("=");try{var u=decodeURIComponent(a[0]);if(s[u]=e.read(d,u),r===u)break}catch{}}return r?s[r]:s}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",$e({},i,{expires:-1}))},withAttributes:function(r){return Ct(this.converter,$e({},this.attributes,r))},withConverter:function(r){return Ct($e({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Ue=Ct(Hr,{path:"/"});function Kr(e,t){return function(n,o){return Object.prototype.hasOwnProperty.call(n,o)}(e,t)?e[t]:void 0}function Mr(e,t,n,o){var r,i=document,s="securitypolicyviolation",c=function(d){var u=new URL(e,location.href),p=d.blockedURI;p!==u.href&&p!==u.protocol.slice(0,-1)&&p!==u.origin||(r=d,a())};i.addEventListener(s,c);var a=function(){return i.removeEventListener(s,c)};return o==null||o.then(a,a),Promise.resolve().then(t).then(function(d){return a(),d},function(d){return new Promise(function(u){var p=new MessageChannel;p.port1.onmessage=function(){return u()},p.port2.postMessage(null)}).then(function(){if(a(),r)return n(r);throw d})})}var Vr={default:"endpoint"},Kn="Blocked by CSP",Mn="The endpoint parameter is not a valid URL",Wr="API key required",Yr="3.11.6",Bt="Failed to load the JS script of the agent",qt="9319";function $r(e,t){var n,o,r,i,s,c,a,d=[],u=(n=function(m){var v=bo([],m,!0);return{current:function(){return v[0]},postpone:function(){var b=v.shift();b!==void 0&&v.push(b)},exclude:function(){v.shift()}}}(e),i=100,s=3e3,c=0,o=function(){return Math.random()*Math.min(s,i*Math.pow(2,c++))},r=new Set,[n.current(),function(m,v){var b,C=v instanceof Error?v.message:"";if(C===Kn||C===Mn)n.exclude(),b=0;else if(C===qt)n.exclude();else if(C===Bt){var O=Date.now()-m.getTime()<50,U=n.current();U&&O&&!r.has(U)&&(r.add(U),b=0),n.postpone()}else n.postpone();var N=n.current();return N===void 0?void 0:[N,b??m.getTime()+o()-Date.now()]}]),p=u[0],g=u[1];if(p===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var x=function(m){var v=new Date,b=function(O){return d.push({url:m,startedAt:v,finishedAt:new Date,error:O})},C=t(m);return C.then(function(){return b()},b),C.catch(function(O){if(a!=null||(a=O),d.length>=5)throw a;var U=g(v,O);if(!U)throw a;var N,z=U[0],B=U[1];return(N=B,new Promise(function(H){return setTimeout(H,N)})).then(function(){return x(z)})})};return x(p).then(function(m){return[m,d]})}var Vn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Xr=Vn;function Qr(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=o===void 0?n:o,i=F(e,["scriptUrlPattern","token","apiKey"]),s=(t=Kr(e,"scriptUrlPattern"))!==null&&t!==void 0?t:Vn,c=function(){var u=[],p=function(){u.push({time:new Date,state:document.visibilityState})},g=function(x,m,v,b){return x.addEventListener(m,v,b),function(){return x.removeEventListener(m,v,b)}}(document,"visibilitychange",p);return p(),[u,g]}(),a=c[0],d=c[1];return Promise.resolve().then(function(){if(!r||typeof r!="string")throw new Error(Wr);var u=function(p,g){return(Array.isArray(p)?p:[p]).map(function(x){return function(m,v){var b=encodeURIComponent;return m.replace(/<[^<>]+>/g,function(C){return C==="<version>"?"3":C==="<apiKey>"?b(v):C==="<loaderVersion>"?b(Yr):C})}(String(x),g)})}(s,r);return $r(u,Gr)}).catch(function(u){throw d(),function(p){return p instanceof Error&&p.message===qt?new Error(Bt):p}(u)}).then(function(u){var p=u[0],g=u[1];return d(),p.load(_e(_e({},i),{ldi:{attempts:g,visibilityStates:a}}))})}function Gr(e){return Mr(e,function(){return function(t){return new Promise(function(n,o){if(function(c){if(URL.prototype)try{return new URL(c,location.href),!1}catch(a){if(a instanceof Error&&a.name==="TypeError")return!0;throw a}}(t))throw new Error(Mn);var r=document.createElement("script"),i=function(){var c;return(c=r.parentNode)===null||c===void 0?void 0:c.removeChild(r)},s=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),n()},r.onerror=function(){i(),o(new Error(Bt))},r.async=!0,r.src=t,s.appendChild(r)})}(e)},function(){throw new Error(Kn)}).then(Zr)}function Zr(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(o,r){var i,s=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,o,r);s!=null&&s.configurable?delete o[r]:s&&!s.writable||(o[r]=void 0)}(e,t),typeof(n==null?void 0:n.load)!="function")throw new Error(qt);return n}const Wn="3.2.0",Y=typeof window<"u",wt=Math.pow(2,31)-1,_r=`https://descopecdn.com/npm/oidc-client-ts@${Wn}/dist/browser/oidc-client-ts.min.js`,ei=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Wn}/dist/browser/oidc-client-ts.min.js`,ti=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let ae;const Yn=e=>{try{return Rt(e).exp}catch{return null}},ni=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Yn(n)},oi=e=>{const{expires_in:t,expires_at:n,access_token:o}=e;return n||(t?Math.floor(Date.now()/1e3)+t:o?Yn(o):void 0)},$n=e=>{const{access_token:t,id_token:n,refresh_token:o,refresh_expire_in:r}=e,i=F(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||o,sessionExpiration:e.sessionExpiration||oi(e),cookieExpiration:e.cookieExpiration||ni(e)},i)},Se=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce((o,r)=>{var i;return o[r]=[].concat(((i=e.hooks)===null||i===void 0?void 0:i[r])||[]).concat((t==null?void 0:t[r])||[]),o},(n=e.hooks)!==null&&n!==void 0?n:e.hooks={}),e},Xe=async e=>{if(!(e!=null&&e.ok))return{};const t=await(e==null?void 0:e.clone().json()),n=(t==null?void 0:t.authInfo)||t||{};return $n(n)},Ot=()=>Y&&!!window.descopeBridge,yt=(e,t)=>{if(!((t==null?void 0:t.status)>=400&&(t==null?void 0:t.status)<500))return!1;const n=(e==null?void 0:e.path)||"";return ti.includes(n)},ri=ae!==void 0||Y&&window.localStorage!==void 0,ce=(e,t)=>{var n,o;return(o=(n=ae||Y&&window.localStorage)===null||n===void 0?void 0:n.setItem)===null||o===void 0?void 0:o.call(n,e,t)},le=e=>{var t,n;return(n=(t=ae||Y&&window.localStorage)===null||t===void 0?void 0:t.getItem)===null||n===void 0?void 0:n.call(t,e)},ie=e=>{var t,n;return(n=(t=ae||Y&&window.localStorage)===null||t===void 0?void 0:t.removeItem)===null||n===void 0?void 0:n.call(t,e)},ii=e=>{var t,n,o,r,i;return(i=(n=(t=ae==null?void 0:ae.key)===null||t===void 0?void 0:t.call(ae,e))!==null&&n!==void 0?n:Y&&((r=(o=window.localStorage)===null||o===void 0?void 0:o.key)===null||r===void 0?void 0:r.call(o,e)))!==null&&i!==void 0?i:null},V=(...e)=>{console.debug(...e)},yn=(...e)=>{console.warn(...e)},si=(e,t)=>{let n;var o;return t>0?(n=1e3*t,V(`Using provided nextRefreshSeconds: ${t}s`)):n=((o=e)?o.getTime()-new Date().getTime():0)-2e4,n>wt&&(V(`Timeout is too large (${n}ms), setting it to ${wt}ms`),n=wt),n},it="DS",Je="DSR",zt="DSI";function xn(e,t,n){if(t){const{cookieDomain:o,cookiePath:r,cookieSameSite:i,cookieExpiration:s,cookieSecure:c}=n,a=new Date(1e3*s),d=Ut(o);Ue.set(e,t,{path:r,domain:d?o:void 0,expires:a,sameSite:i,secure:c})}}function Ut(e){const t=window.location.hostname.split("."),n=e==null?void 0:e.split(".");return t.slice(-(n==null?void 0:n.length)).join(".")===e}const Jt=e=>(e==null?void 0:e.cookieName)||it,et=e=>(e==null?void 0:e.cookieName)||Je;function Fe(e="",t){return Ue.get(et(t))||le(`${e}${Je}`)||""}function bn(e="",t){return Ue.get(Jt(t))||le(`${e}${it}`)||""}function Xn(e=""){return le(`${e}${zt}`)||""}function Qn(e="",t,n,o){ie(`${e}${Je}`),ie(`${e}${it}`),ie(`${e}${zt}`);const r=Jt(t);Ue.remove(r,o==null?void 0:o.session);const i=et(n);Ue.remove(i,o==null?void 0:o.refresh)}const ai=(e,t)=>n=>{const o=Object.assign(n,{token:n.token||Fe(e,t)}),r=function(i=""){return le(`${i}DTD`)||""}(e);return r&&(o.headers=Object.assign(Object.assign({},o.headers||{}),{"x-descope-trusted-device-token":r})),o},li=Y&&(localStorage==null?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",ci="vsid",di="vrid",Ht="fp",Gn=(e=!1)=>{const t=le(Ht);if(!t)return null;const n=JSON.parse(t);return new Date().getTime()>n.expiry&&!e?null:n.value},Zn=async(e,t=li)=>{try{if(Gn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Qr({apiKey:e,endpoint:[o.toString(),Vr],scriptUrlPattern:[i,Xr]}),c=await s,{requestId:a}=await c.get({linkedId:n}),d=((u,p)=>({[ci]:u,[di]:p}))(n,a);(u=>{const p={value:u,expiry:new Date().getTime()+864e5};ce(Ht,JSON.stringify(p))})(d)}catch(n){console.warn("Could not load fingerprint",n)}},ui=()=>{ie(Ht)},pi=e=>{const t=Gn(!0);return t&&e.body&&(e.body.fpData=t),e},Oe="descopeFlowNonce",kn="X-Descope-Flow-Nonce",In="/v1/flow/start",At="/v1/flow/next",Tt=(e,t=Oe)=>`${t}${e}`,gi=(e,t=Oe)=>{try{const n=Tt(e,t);ie(n)}catch(n){console.error("Error removing flow nonce:",n)}},_n=e=>{var t;return((t=/.*\|#\|(.*)/.exec(e))===null||t===void 0?void 0:t[1])||null},jn=e=>{var t;return e.path===At&&(!((t=e.body)===null||t===void 0)&&t.executionId)?_n(e.body.executionId):null},Kt="dls_last_user_login_id",Mt="dls_last_user_display_name",Sn=e=>ce(Kt,e),Et=()=>le(Kt),Dt=()=>le(Mt),hi=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Et(),i=Dt();return r&&((n=o.lastAuth)!==null&&n!==void 0||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},fi=e=>t=>async(...n)=>{const o=await t(...n);return e||(ie(Kt),ie(Mt)),o};function Qe(){const e=[];return{pub:t=>{e.forEach(n=>n(t))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const vi=(e,t,n,o)=>r=>async(...i)=>{const s=await r(...i);return Qn(e,t,n,o==null?void 0:o()),s};async function Ge(e){const t=function(r){var i;const s=JSON.parse(r);return s.publicKey.challenge=ze(s.publicKey.challenge),s.publicKey.user.id=ze(s.publicKey.user.id),(i=s.publicKey.excludeCredentials)===null||i===void 0||i.forEach(c=>{c.id=ze(c.id)}),s}(e);return o=await navigator.credentials.create(t),JSON.stringify({id:o.id,rawId:ge(o.rawId),type:o.type,response:{attestationObject:ge(o.response.attestationObject),clientDataJSON:ge(o.response.clientDataJSON)}});var o}async function xt(e){const t=to(e);return no(await navigator.credentials.get(t))}async function mi(e,t){const n=to(e);return n.signal=t.signal,n.mediation="conditional",no(await navigator.credentials.get(n))}async function eo(e=!1){var t,n;if(!Y)return Promise.resolve(!1);if(Ot()){const r=(n=(t=window.descopeBridge)===null||t===void 0?void 0:t.hostInfo)===null||n===void 0?void 0:n.webauthn;if(typeof r=="boolean")return r}const o=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return o&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():o}function to(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=ze(n.publicKey.challenge),(t=n.publicKey.allowCredentials)===null||t===void 0||t.forEach(o=>{o.id=ze(o.id)}),n}function no(e){return JSON.stringify({id:e.id,rawId:ge(e.rawId),type:e.type,response:{authenticatorData:ge(e.response.authenticatorData),clientDataJSON:ge(e.response.clientDataJSON),signature:ge(e.response.signature),userHandle:e.response.userHandle?ge(e.response.userHandle):void 0}})}function ze(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),n=>n.charCodeAt(0)).buffer}function ge(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Cn,wi=(Cn=e=>({async signUp(t,n,o){const r=await e.webauthn.signUp.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await Ge(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)},async signIn(t,n){const o=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!o.ok)return o;const r=await xt(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,r)},async signUpOrIn(t,n){var o;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(!((o=r.data)===null||o===void 0)&&o.create){const i=await Ge(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)}{const i=await xt(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)}},async update(t,n,o){const r=await e.webauthn.update.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await Ge(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,i)},helpers:{create:Ge,get:xt,isSupported:eo,conditional:mi}}),(...e)=>{const t=Cn(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const On={config:"/fedcm/config"},yi=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).substring(2)};async function Un(e,t){var n;try{await oo(e,t)}catch(o){(n=t==null?void 0:t.onFailed)===null||n===void 0||n.call(t,o)}}async function oo(e,t){var n,o;const r=await async function(i,s="google",c,a,d){const u=yi(),p=await async function(){return new Promise((m,v)=>{if(window.google)return void m(window.google.accounts.id);let b=document.getElementById("google-gsi-client-script");b||(b=document.createElement("script"),document.head.appendChild(b),b.async=!0,b.defer=!0,b.id="google-gsi-client-script",b.src="https://accounts.google.com/gsi/client"),b.onload=function(){window.google?m(window.google.accounts.id):v("Failed to load Google GSI client script - not loaded properly")},b.onerror=function(){v("Failed to load Google GSI client script - failed to load")}})}(),g=await i.oauth.getOneTapClientId(s);if(!g.ok)throw new Error("Failed to get OneTap client ID for provider "+s);const x=g.data.clientId;return new Promise(m=>{var v,b;const C=O=>{m({provider:s,nonce:u,credential:O==null?void 0:O.credential})};p.initialize(Object.assign(Object.assign({},c),{itp_support:(v=c==null?void 0:c.itp_support)===null||v===void 0||v,use_fedcm_for_prompt:(b=c==null?void 0:c.use_fedcm_for_prompt)===null||b===void 0||b,client_id:x,callback:C,nonce:u})),p.prompt(O=>{var U,N;if(d&&(O!=null&&O.isDismissedMoment())){const z=(U=O.getDismissedReason)===null||U===void 0?void 0:U.call(O);return d==null||d(z),void C()}if(a&&(O!=null&&O.isSkippedMoment())){const z=(N=O.getSkippedReason)===null||N===void 0?void 0:N.call(O);return a==null||a(z),void C()}})})}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(t!=null&&t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);(n=t==null?void 0:t.onCodeReceived)===null||n===void 0||n.call(t,i.data.code)}else{const i=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);(o=t==null?void 0:t.onAuthenticated)===null||o===void 0||o.call(t,i.data)}}var xi=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await eo(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const bi=()=>window.location.search.includes("code")&&window.location.search.includes("state");let bt;const ro=(e,t)=>new Promise((n,o)=>{if(!e.length)return o(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const i=e.shift(),s=document.createElement("script");s.src=i,s.id=(c=>{let a=0;for(let d=0;d<c.length;d++)a=(a<<5)-a+c.charCodeAt(d),a|=0;return Math.abs(a).toString(16)})(i),s.onload=()=>{const c=t();if(c)return n(c);throw new Error("Could not get entry after loading script from URL")},s.addEventListener("error",()=>{ro(e,t),s.setAttribute("data-error","true")}),document.body.appendChild(s)}),ki=async(e,t,n)=>{bt||(bt=(async()=>{try{return require("oidc-client-ts")}catch{return ro([_r,ei],()=>window.oidc)}})());const{OidcClient:o,WebStorageStateStore:r}=await bt;if(!o)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const i=(n==null?void 0:n.redirectUri)||window.location.href;let s,c,a,d;if(n!=null&&n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,c=n.clientId,a=`${c}_user`,d="openid"}else n!=null&&n.applicationId?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,c=t,a=`${c}_user`,d="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),c=t,a=`${c}_user`,d="openid email roles descope.custom_claims offline_access");const u={authority:s,client_id:c,redirect_uri:i,response_type:"code",scope:(n==null?void 0:n.scope)||d,stateStore:new r({store:window.localStorage,prefix:c}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return n!=null&&n.redirectUri&&(u.redirect_uri=n.redirectUri),{client:new o(u),stateUserKey:a}},Ii=(e,t,n)=>{const o=async()=>{let i,s;return i&&s||({client:i,stateUserKey:s}=await ki(e,t,n)),{client:i,stateUserKey:s}},r=async(i="")=>{var s;const{client:c,stateUserKey:a}=await o(),d=await c.processSigninResponse(i||window.location.href);var u;return await((s=e.httpClient.hooks)===null||s===void 0?void 0:s.afterRequest({},new Response(JSON.stringify(d)))),ce(a,JSON.stringify({id_token:(u=d).id_token,session_state:u.session_state,profile:u.profile})),(()=>{const p=new URL(window.location.href);p.searchParams.delete("code"),p.searchParams.delete("state"),window.history.replaceState({},document.title,p.toString())})(),d};return{loginWithRedirect:async(i={},s=!1)=>{const{client:c}=await o(),a=await c.createSigninRequest(i),{url:d}=a;return s||(window.location.href=d),{ok:!0,data:a}},finishLogin:r,finishLoginIfNeed:async(i="")=>{if(bi())return await r(i)},refreshToken:async i=>{var s;const{client:c,stateUserKey:a}=await o(),d=(g=>{const x=le(g);return x?JSON.parse(x):null})(a);if(!d)throw new Error("User not found in storage to refresh token");let u=i;if(!u){const g={};e.httpClient.hooks.beforeRequest(g),u=g.token}const p=await c.useRefreshToken({state:{refresh_token:u,session_state:d.session_state,profile:d.profile}});return await((s=e.httpClient.hooks)===null||s===void 0?void 0:s.afterRequest({},new Response(JSON.stringify(p)))),p},logout:async(i,s=!1)=>{const{client:c,stateUserKey:a}=await o();i||(i={}),i.id_token_hint=i.id_token_hint||Xn(),i.post_logout_redirect_uri=i.post_logout_redirect_uri||window.location.href;const d=await c.createSignoutRequest(i),{url:u}=d;return ie(a),s||window.location.replace(u),d}}},io=function(...e){return t=>e.reduce((n,o)=>o(n),t)}(e=>t=>{var n;return n=t.customStorage,ae=n,e(t)},e=>t=>{var{fpKey:n,fpLoad:o}=t,r=F(t,["fpKey","fpLoad"]);return Y?(n&&o&&Zn(n).catch(()=>null),e(Se(r,{beforeRequest:pi}))):e(r)},e=>t=>{var{autoRefresh:n}=t,o=F(t,["autoRefresh"]);if(!n||Ot())return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const d=[];return{clearAllTimers:()=>{for(;d.length;)clearTimeout(d.pop())},setTimer:(u,p)=>{d.push(setTimeout(u,p))}}})();let s,c;Y&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&s&&new Date>s&&(V("Expiration time passed, refreshing session"),a.refresh(Fe()||c))});const a=e(Se(o,{afterRequest:async(d,u)=>{const{sessionJwt:p,refreshJwt:g,sessionExpiration:x,nextRefreshSeconds:m}=await Xe(u);if(yt(d,u))V("Session invalidated, canceling all timers"),r();else if(p||x){if(s=((C,O)=>{if(O)return new Date(1e3*O);V("Could not extract expiration time from session token, trying to decode the token");try{const U=Rt(C);if(U.exp)return new Date(1e3*U.exp)}catch{return null}})(p,x),!s)return void V("Could not extract expiration time from session token");c=g;const v=si(s,m);if(r(),v<=2e4)return void V("Session is too close to expiration, not setting refresh timer");const b=new Date(Date.now()+v).toLocaleTimeString("en-US",{hour12:!1});V(`Setting refresh timer for ${b}. (${v}ms)`),i(()=>{Y&&document.visibilityState==="hidden"?V("Skipping refresh due to timer - document is hidden"):(V("Refreshing session due to timer"),a.refresh(Fe()||g))},v)}}}));return Ee(a,["logout","logoutAll","oidc.logout"],d=>async(...u)=>{const p=await d(...u);return V("Clearing all timers"),r(),p})},e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.45.0"},t.baseHeaders)})),e=>t=>{const n=Qe(),o=Qe(),r=Qe(),i=Qe(),s=e(Se(t,{afterRequest:async(a,d)=>{if(yt(a,d))V("Session invalidated, notifying subscribers with empty values"),o.pub(null),r.pub(null),n.pub(null),i.pub(null);else{const u=await(async m=>{const v=await Xe(m);return(v==null?void 0:v.user)||(v!=null&&v.hasOwnProperty("userId")?v:void 0)})(d);u&&r.pub(u);const{sessionJwt:p,sessionExpiration:g,claims:x}=await Xe(d);p&&o.pub(p),x&&i.pub(x),(g||p)&&n.pub(g||42)}}})),c=Ee(s,["logout","logoutAll","oidc.logout"],a=>async(...d)=>{const u=await a(...d);return o.pub(null),r.pub(null),n.pub(null),i.pub(null),u});return Object.assign(c,{onSessionTokenChange:o.sub,onUserChange:r.sub,onClaimsChange:i.sub,onIsAuthenticatedChange:a=>n.sub(d=>{a(!!d)})})},e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:o=Oe}=t,r=F(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((i=Oe)=>{try{if(!ri)return;for(let d=0;d<(s=void 0,c=void 0,a=void 0,(a=(s=ae==null?void 0:ae.length)!==null&&s!==void 0?s:Y&&((c=window.localStorage)===null||c===void 0?void 0:c.length))!==null&&a!==void 0?a:0);d++){const u=ii(d);if(u&&u.startsWith(i)){const p=le(u);if(p)try{JSON.parse(p).expiry<Date.now()&&ie(u)}catch{ie(u)}}}}catch(d){console.error("Error cleaning up expired nonces:",d)}var s,c,a})(o),e(Se(r,{afterRequest:async(i,s)=>{if(i.path!==In&&i.path!==At)return;const{nonce:c,executionId:a}=await(async(d,u)=>{try{const p=u.headers.get(kn);let g=await u.clone().json().then(x=>(x==null?void 0:x.executionId)||null).catch(()=>null);return g||(g=jn(d)),{nonce:p,executionId:_n(g)}}catch{return{nonce:null,executionId:null}}})(i,s);c&&a&&((d,u,p,g=Oe)=>{try{const x=Tt(d,g),m=p?172800:10800,v={value:u,expiry:Date.now()+1e3*m,isStart:p};ce(x,JSON.stringify(v))}catch(x){console.error("Error setting flow nonce:",x)}})(a,c,i.path===In,o)},beforeRequest:i=>{if(i.path===At){const s=jn(i);if(s){const c=((a,d=Oe)=>{try{const u=Tt(a,d),p=le(u);if(!p)return null;const g=JSON.parse(p);return g.expiry<Date.now()?(gi(a,d),null):g.value}catch(u){return console.error("Error getting flow nonce:",u),null}})(s,o);c&&(i.headers=i.headers||{},i.headers[kn]=c)}}return i}}))):e(r)},e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=F(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:Et,getLastUserDisplayName:Dt});const i=e(Se(r,{afterRequest:async(c,a)=>{var d;const{userInfo:u,lastAuth:p}=await(async m=>{if(!(m!=null&&m.ok))return{userInfo:void 0,lastAuth:void 0};const v=await(m==null?void 0:m.clone().json()),b=$n((v==null?void 0:v.authInfo)||v||{});return{userInfo:(b==null?void 0:b.user)||(b!=null&&b.hasOwnProperty("userId")?b:void 0),lastAuth:v.lastAuth}})(a),g=(d=u==null?void 0:u.loginIds)===null||d===void 0?void 0:d[0],x=u==null?void 0:u.name;g?(Sn(g),(m=>{ce(Mt,m)})(x)):p!=null&&p.loginId&&Sn(p.loginId)}}));let s=Ee(i,["flow.start"],hi);return s=Ee(s,["logout","logoutAll"],fi(o)),Object.assign(s,{getLastUserLoginId:Et,getLastUserDisplayName:Dt})},e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,refreshTokenViaCookie:r,storagePrefix:i}=t,s=F(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix"]);if(!n||!Y)return e(s);let c;const a=e(Se(s,{beforeRequest:ai(i,r),afterRequest:async(u,p)=>{if(yt(u,p))V("Session invalidated, clearing persisted tokens"),Qn(i,o,r,c);else{const g=((x={},m=!1,v="",b=!1)=>{var C,O,U,N;const{sessionJwt:z,refreshJwt:B,trustedDeviceJwt:H}=x;let K;if(B)if(b){ie(`${v}${Je}`);const J=b.sameSite||"Strict",W=(C=b.secure)===null||C===void 0||C,L=(O=b.domain)!==null&&O!==void 0?O:x.cookieDomain,$=et(b);W&&window.location.protocol!=="https:"&&yn("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const X=Object.assign(Object.assign({},x),{cookieSameSite:J,cookieSecure:W,cookieDomain:L});xn($,B,X);const _=Ut(L);K=Object.assign(Object.assign({},K),{refresh:{path:X.cookiePath,domain:_?L:void 0}})}else{const J=et(b);Ue.remove(J),ce(`${v}${Je}`,B)}if(z)if(m){const J=m.sameSite||"Strict",W=(U=m.secure)===null||U===void 0||U,L=(N=m.domain)!==null&&N!==void 0?N:x.cookieDomain,$=Jt(m);W&&window.location.protocol!=="https:"&&yn("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const X=Object.assign(Object.assign({},x),{cookieSameSite:J,cookieSecure:W,cookieDomain:L});xn($,z,X);const _=Ut(L);K=Object.assign(Object.assign({},K),{session:{path:X.cookiePath,domain:_?L:void 0}})}else ce(`${v}${it}`,z);return x.idToken&&ce(`${v}${zt}`,x.idToken),H&&ce(`${v}DTD`,H),K})(await Xe(p),o,i,r);g&&(c=g)}}})),d=Ee(a,["logout","logoutAll","oidc.logout"],vi(i,o,r,()=>c));return Object.assign(d,{getRefreshToken:()=>Fe(i,r),getSessionToken:()=>bn(i,o),getIdToken:()=>Xn(i)})})(e=>{const t=Jr(e),n=Ii(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,s)=>{var c;if(Ot())return V(`Refresh called in native flow: ${new Error().stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(p){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:p.toString()}})}const a=bn(),d=Fe();let u="";if(e.getExternalToken)try{u=await((c=e.getExternalToken)===null||c===void 0?void 0:c.call(e))}catch(p){V("Error getting external token while refreshing",p)}return t.refresh(i,{dcs:a?"t":"f",dcr:d?"t":"f"},u,s)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(s){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:s.toString()}})}return t.logout(i)},flow:xi(t),webauthn:wi(t),fedcm:(o=t,r=e.projectId,{onetap:{requestExchangeCode(i){Un(o,i)},requestAuthentication(i){Un(o,i)}},async oneTap(i,s,c,a,d){await oo(o,{provider:i,oneTapConfig:s,loginOptions:c,onSkipped:a,onDismissed:d})},async launch(i){var s;const c={identity:{context:i||"signin",providers:[{configURL:o.httpClient.buildUrl(r+On.config),clientId:r}]}},a=await((s=navigator.credentials)===null||s===void 0?void 0:s.get(c));return o.refresh(a.token)},isSupported:()=>Y&&"IdentityCredential"in window,async isLoggedIn(i){var s;const c=o.httpClient.buildUrl(r+On.config);try{const a={identity:{context:i||"signin",providers:[{configURL:c,clientId:r}]}},d=await((s=navigator.credentials)===null||s===void 0?void 0:s.get(a));return!!d&&!!d.token}catch{return!1}}}),oidc:n});var o,r});let Vt;const so=e=>{const t=io(Object.assign({persistTokens:ln,autoRefresh:ln},e));return Vt=t,t},ji=()=>so({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});Vt=ji();const Si=()=>Vt;var Ci=({projectId:e,baseUrl:t,persistTokens:n,autoRefresh:o,sessionTokenViaCookie:r,refreshTokenViaCookie:i,refreshCookieName:s,oidcConfig:c,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,getExternalToken:u,hooks:p,customStorage:g})=>h.useMemo(()=>{if(e)return so({projectId:e,baseUrl:t,sessionTokenViaCookie:r,refreshTokenViaCookie:i,baseHeaders:Ze,persistTokens:n,autoRefresh:o,refreshCookieName:s,oidcConfig:c,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,hooks:p,getExternalToken:u,customStorage:g})},[e,t,JSON.stringify(r),JSON.stringify(i),u,g]);const Oi=({projectId:e,baseUrl:t="",baseStaticUrl:n="",baseCdnUrl:o="",sessionTokenViaCookie:r=!1,refreshTokenViaCookie:i=!1,hooks:s,persistTokens:c=!0,autoRefresh:a=!0,oidcConfig:d,storeLastAuthenticatedUser:u=!0,keepLastAuthenticatedUserAfterLogout:p=!1,refreshCookieName:g="",getExternalToken:x,customStorage:m,children:v})=>{const[b,C]=h.useState(),[O,U]=h.useState(),[N,z]=h.useState(),[B,H]=h.useState(!1),[K,J]=h.useState(!1),[W,L]=h.useState(!1),[$,X]=h.useState(!!d),_=h.useRef(!1),R=Ci({projectId:e,baseUrl:t,persistTokens:c,autoRefresh:a,sessionTokenViaCookie:r,refreshTokenViaCookie:i,hooks:s,oidcConfig:d,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:g,getExternalToken:x,customStorage:m});h.useEffect(()=>{if(R){const me=R.onSessionTokenChange(U),ee=R.onUserChange(C),I=R.onIsAuthenticatedChange(H),je=R.onClaimsChange(z);return()=>{me(),ee(),I(),je()}}},[R]);const q=h.useRef(!1),M=h.useRef(!1);h.useEffect(()=>{R&&d&&!_.current&&(_.current=!0,R.oidc.finishLoginIfNeed().finally(()=>{X(!1),q.current=!0}))},[]);const ve=h.useCallback(()=>{yo()||q.current||(q.current=!0,L(!0),an(R==null?void 0:R.refresh)(void 0,!0).then(()=>{L(!1)}))},[R]),ue=h.useCallback(()=>{M.current||(M.current=!0,J(!0),an(R.me)().then(()=>{J(!1)}))},[R]),Ie=h.useMemo(()=>({fetchUser:ue,user:b,isUserLoading:K,isUserFetched:M.current,fetchSession:ve,session:O,isAuthenticated:B,isSessionLoading:W,isOidcLoading:$,isSessionFetched:q.current,projectId:e,baseUrl:t,baseStaticUrl:n,baseCdnUrl:o,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:g,customStorage:m,setUser:C,setSession:U,setIsAuthenticated:H,claims:N,sdk:R}),[ue,b,K,M.current,ve,O,B,W,$,q.current,e,t,n,o,p,g,m,C,U,H,N,R]);return h.createElement(Tn.Provider,{value:Ie},v)};function Ui(...e){return t=>e.reduce((n,o)=>o(n),t)}const Ai=(...e)=>e.join("/").replace(/\/+/g,"/"),An=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Ti=e=>{const t=Symbol((n=>{const o=n.toString();let r=0;for(let i=0;i<o.length;i++)r=(r<<5)-r+o.charCodeAt(i),r&=r;return r.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}},Ei=e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}},Di=e=>typeof e=="string"||e==null?e:JSON.stringify(e),Ri=e=>h.forwardRef((t,n)=>{const{prop:o,attr:r,rest:i}=h.useMemo(()=>Object.entries(t).reduce((a,[d,u])=>{const{trimmedKey:p,category:g}=Ei(d);return g==="prop"?a.prop.push([p,u]):g==="attr"?a.attr.push([An(p),Di(u)]):Object.assign(a.rest,{[An(p)]:u}),a},{attr:[],prop:[],rest:{}}),[t]),s=h.useRef(null),c=h.useCallback(a=>{s.current=a,a&&(o.forEach(([d,u])=>{s.current[d]=u}),r.forEach(([d,u])=>{u==null?a.removeAttribute(d):a.setAttribute(d,u)}))},[o,r,s]);return h.useImperativeHandle(n,()=>s.current),h.createElement(e,Object.assign({ref:c},i))}),Pi=h.lazy(async()=>(((customElements==null?void 0:customElements.get("descope-wc"))||await Promise.resolve().then(()=>require("./index.cjs3.js")).then(e=>e.index).then(e=>e.default)).sdkConfigOverrides={baseHeaders:Ze,persistTokens:!1,hooks:{get beforeRequest(){return Si().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:Ri(h.forwardRef((e,t)=>{var{"external-request-id":n}=e,o=F(e,["external-request-id"]);return h.useMemo(()=>{var r,i;r="x-external-rid",(i=n)?Ze[r]=i:delete Ze[r]},[n]),h.createElement("descope-wc",Object.assign({ref:t},o))}))})),Ni=h.forwardRef(({flowId:e,onSuccess:t,onError:n,onReady:o,logger:r,tenant:i,theme:s,nonce:c,locale:a,debug:d,client:u,form:p,telemetryKey:g,redirectUrl:x,autoFocus:m,validateOnBlur:v,restartOnError:b,errorTransformer:C,styleId:O,onScreenUpdate:U,dismissScreenErrorOnInput:N,outboundAppId:z,outboundAppScopes:B,popupOrigin:H,children:K,externalRequestId:J},W)=>{const[L,$]=h.useState(null);h.useImperativeHandle(W,()=>L);const{projectId:X,baseUrl:_,baseStaticUrl:R,baseCdnUrl:q,storeLastAuthenticatedUser:M,keepLastAuthenticatedUserAfterLogout:ve,refreshCookieName:ue,customStorage:Ie,sdk:me}=h.useContext(Tn),ee=h.useCallback(async I=>{await me.httpClient.hooks.afterRequest({},new Response(JSON.stringify(I.detail))),t&&t(I)},[t]);return h.useEffect(()=>{const I=L;return I==null||I.addEventListener("success",ee),n&&(I==null||I.addEventListener("error",n)),o&&(I==null||I.addEventListener("ready",o)),()=>{n&&(I==null||I.removeEventListener("error",n)),o&&(I==null||I.removeEventListener("ready",o)),I==null||I.removeEventListener("success",ee)}},[L,n,ee]),h.useEffect(()=>{const I=L;return I==null||I.addEventListener("success",ee),()=>{I==null||I.removeEventListener("success",ee)}},[L,ee]),h.useEffect(()=>{const I=L;return n&&(I==null||I.addEventListener("error",n)),()=>{n&&(I==null||I.removeEventListener("error",n))}},[L,n]),h.useEffect(()=>{const I=L;return o&&(I==null||I.addEventListener("ready",o)),()=>{o&&(I==null||I.removeEventListener("error",o))}},[L,o]),h.createElement("form",null,h.createElement(h.Suspense,{fallback:null},h.createElement(Pi,{projectId:X,flowId:e,baseUrl:_,baseStaticUrl:R,baseCdnUrl:q,ref:$,telemetryKey:g,redirectUrl:x,autoFocus:m,styleId:O,validateOnBlur:v,restartOnError:b,keepLastAuthenticatedUserAfterLogout:ve,tenant:i,externalRequestId:J,customStorage:Ie,"theme.attr":s,"nonce.attr":c,"locale.attr":a,"form.attr":p,"client.attr":u,"debug.attr":d,"outbound-app-id.attr":z,"outbound-app-scopes.attr":B,"popup-origin.attr":H,"store-last-authenticated-user.attr":M,"refreshCookieName.attr":ue,"dismiss-screen-error-on-input.attr":N,"errorTransformer.prop":C,"logger.prop":r,"onScreenUpdate.prop":U,"customStorage.prop":Ie},K)))}),Li="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK8AAAAwCAYAAABnoirjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGW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Qm/z1CMEsCl0UnqIvfCQWdGEjS9hCL9b1b73xyTUpKZpV1wFr7v21/9u8AlOiUO/fOi1GL3KMDXB+kYNrQxJ7KUB4kcidtUskzZ0Ll3IY5byRTEmU+CGcIkU2o9JXNZvlXl9seOhoZ2SpQ+/u7tVbR/mzwXriO+QN0klSsHNu5wpVfmJ2gM9QO+G0DpHErMXeZU2I+65Nuk8k+7HId6HP9U7npgYBe+++v1drl7K8C76VGgVZQqGJdtC3SarXydu2OG+ZTtKjWaq3Waq3Waq3W/svs/wHDkxYoFqn0jQAAAABJRU5ErkJggg==",Be="var(--color-green)",E="var(--font-sans)",ne={width:"100%",height:40,padding:"10px 14px",fontSize:16,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:"var(--color-text)",fontFamily:E,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},oe=e=>{e.target.style.borderColor="var(--color-green)",e.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},re=e=>{e.target.style.borderColor="var(--color-input-border)",e.target.style.boxShadow="none"};function Pe({title:e,subtitle:t}){return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsx("h2",{style:{fontFamily:E,fontWeight:600,fontSize:"36px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:e}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:t})]})}function xe({onClick:e,disabled:t,children:n,type:o="button"}){const r=!t;return l.jsx("button",{type:o,onClick:e,disabled:t,style:{width:"100%",height:40,display:"flex",justifyContent:"center",alignItems:"center",padding:"10px",background:r?"var(--color-green)":"var(--color-green-disabled)",color:"white",border:"none",borderRadius:4,fontSize:16,fontWeight:600,lineHeight:"23px",fontFamily:E,cursor:r?"pointer":"not-allowed",transition:"background 0.15s",boxSizing:"border-box"},onMouseEnter:i=>{r&&(i.currentTarget.style.background="var(--color-green-hover)")},onMouseLeave:i=>{r&&(i.currentTarget.style.background=r?"var(--color-green)":"var(--color-green-disabled)")},children:n})}function Q({label:e,gap:t=12,labelSize:n=16,labelStyle:o,children:r}){return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:t,width:"100%"},children:[l.jsx("label",{style:{fontSize:n,fontWeight:400,color:"var(--color-text)",fontFamily:E,lineHeight:"100%",...o},children:e}),r]})}function kt({show:e,onToggle:t}){return l.jsx("button",{type:"button",tabIndex:-1,onClick:t,style:{position:"absolute",right:14,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--color-text-secondary)",display:"flex",alignItems:"center"},children:e?l.jsx(qe.EyeOff,{size:16}):l.jsx(qe.Eye,{size:16})})}function Ne(){return l.jsx("hr",{style:{width:"100%",border:"none",borderTop:"1px solid var(--color-divider)",margin:0}})}function Ce({text:e,linkText:t,onClick:n}){return l.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:4,width:"100%"},children:[l.jsx("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:e}),l.jsx("button",{type:"button",onClick:n,style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"22px",color:Be,cursor:"pointer",fontFamily:E,textDecoration:"underline"},children:t})]})}function be({onTerms:e,onPrivacyPolicy:t,paddingTop:n}){return l.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",marginTop:"auto",paddingTop:n||40,flexShrink:0},children:l.jsxs("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E,textAlign:"center",whiteSpace:"nowrap"},children:["By continuing, you agree to our"," ",l.jsx("a",{href:"https://pages.chordia.ai/terms-of-use/",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:E,textDecoration:"underline",textUnderlineOffset:2},children:"Terms"})," ","and"," ",l.jsx("a",{href:"https://pages.chordia.ai/privacy-notice/",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:E,textDecoration:"underline",textUnderlineOffset:2},children:"Privacy Policy"}),"."]})})}function Fi({projectId:e,onSuccess:t,onError:n}){return e?l.jsx(Oi,{projectId:e,children:l.jsx(Ni,{flowId:"sign-up-or-in-otp-or-social",onSuccess:t,onError:n})}):null}function Bi({onLogin:e,onForgotPassword:t,onOneTimeCode:n,onVerifyCode:o,onResendCode:r,onSignUp:i,onResetPassword:s,onTerms:c,onPrivacyPolicy:a,onDescopeSuccess:d,onDescopeError:u,descopeProjectId:p,onGoToLogin:g,loading:x,error:m,codeError:v,defaultView:b="signin"}){var rn,sn;const[C,O]=h.useState(""),[U,N]=h.useState(""),[z,B]=h.useState(!1),[H,K]=h.useState(!1),[J,W]=h.useState(!1),[L,$]=h.useState(!1),[X,_]=h.useState(null),[R,q]=h.useState(b),[M,ve]=h.useState(""),[ue,Ie]=h.useState(""),[me,ee]=h.useState(""),[I,je]=h.useState(["","","","","",""]),Te=h.useRef([]),[st,ao]=h.useState(""),[at,lo]=h.useState(""),[He,co]=h.useState(""),[Ke,uo]=h.useState(""),[lt,po]=h.useState(""),[ct,go]=h.useState(!1),[dt,ho]=h.useState(!1),[Wt,Me]=h.useState(""),[ut,fo]=h.useState(""),[Yt,$t]=h.useState(0),Xt=3;h.useEffect(()=>{const f=setInterval(()=>$t(k=>(k+1)%Xt),4e3);return()=>clearInterval(f)},[]);const we=h.useRef(null),ye=h.useRef(null);h.useEffect(()=>{const f=G=>{if(!G)return!1;try{return G.matches(":-webkit-autofill, :autofill")}catch{return!1}},k=()=>{const G=we.current,We=ye.current;G&&G.value&&O(G.value),We&&We.value&&N(We.value),B(f(G)),K(f(We))},S=[100,300,600,1e3,2e3].map(G=>setTimeout(k,G)),P=G=>{(G.animationName==="onAutoFillStart"||G.target.matches(":-webkit-autofill"))&&setTimeout(k,50)},A=we.current,T=ye.current;A==null||A.addEventListener("animationstart",P),T==null||T.addEventListener("animationstart",P);const se=()=>setTimeout(k,0),te=()=>setTimeout(k,0);return A==null||A.addEventListener("input",se),T==null||T.addEventListener("input",se),A==null||A.addEventListener("change",te),T==null||T.addEventListener("change",te),()=>{S.forEach(clearTimeout),A==null||A.removeEventListener("animationstart",P),T==null||T.removeEventListener("animationstart",P),A==null||A.removeEventListener("input",se),T==null||T.removeEventListener("input",se),A==null||A.removeEventListener("change",te),T==null||T.removeEventListener("change",te)}},[]),h.useEffect(()=>{const f=P=>{if(!P)return!1;try{return P.matches(":-webkit-autofill, :autofill")}catch{return!1}},k=()=>{var T,se;const P=((T=we.current)==null?void 0:T.value)||"",A=((se=ye.current)==null?void 0:se.value)||"";P&&P!==C&&O(P),A&&A!==U&&N(A),B(f(we.current)),K(f(ye.current))},S=setInterval(k,250);return window.addEventListener("focus",k),document.addEventListener("visibilitychange",k),()=>{clearInterval(S),window.removeEventListener("focus",k),document.removeEventListener("visibilitychange",k)}},[C,U]),h.useEffect(()=>{v&&R==="verifycode"&&(je(["","","","","",""]),q("getcodewithname"))},[v]);const Qt=x??L,pe=m??X,vo=(C||((rn=we.current)==null?void 0:rn.value)||"").trim(),mo=U||((sn=ye.current)==null?void 0:sn.value)||"",Gt=!!(!!(vo||z)&&!!(mo||H)&&!Qt),Ve=R==="verifycode"||R==="getcodewithname"?pe:null,Zt=f=>{f.target.style.borderColor=pe?"var(--color-text)":"var(--color-green)",f.target.style.boxShadow=pe?"none":"0 0 0 3px var(--color-green-ring)"},_t=f=>{f.target.style.borderColor=pe?"var(--color-text)":"var(--color-input-border)",f.target.style.boxShadow="none"},en=(f,k)=>{var se;const S=(k||"").replace(/\D/g,"");if(!S)return;const P=[...I];let A=f;for(let te=0;te<S.length&&f+te<P.length;te+=1)P[f+te]=S[te],A=f+te;je(P);const T=Math.min(A+1,P.length-1);(se=Te.current[T])==null||se.focus()},tn=(f,k)=>{var T;const S=k.replace(/\D/g,"");if(S.length>1){en(f,S);return}const P=S.slice(-1),A=[...I];A[f]=P,je(A),P&&f<5&&((T=Te.current[f+1])==null||T.focus())},nn=(f,k)=>{var S;k.key==="Backspace"&&!I[f]&&f>0&&((S=Te.current[f-1])==null||S.focus())},on=(f,k)=>{var P;k.preventDefault();const S=((P=k.clipboardData)==null?void 0:P.getData("text"))||"";en(f,S)},wo=async f=>{var P,A;if(f.preventDefault(),!Gt)return;const k=C||((P=we.current)==null?void 0:P.value)||"",S=U||((A=ye.current)==null?void 0:A.value)||"";if(!(!k||!S)){_(null),$(!0);try{await(e==null?void 0:e(k,S))}catch(T){_((T==null?void 0:T.message)||"Something went wrong. Please try again.")}finally{$(!1)}}};return l.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",overflow:"hidden",fontFamily:E,background:"white"},children:[l.jsxs("div",{style:{flex:"0 0 628px",width:628,minHeight:0,background:"var(--surface-dark)",display:"flex",flexDirection:"column",padding:"48px 0 40px 48px",position:"relative",overflow:"hidden"},children:[l.jsx("img",{src:Li,alt:"Chordia",style:{width:175,height:48,objectFit:"contain",marginBottom:100,flexShrink:0}}),l.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:22},children:[l.jsx("h1",{style:{fontFamily:E,fontSize:"clamp(28px, 2.8vw, 28px)",fontWeight:800,color:"var(--color-text-inverse)",lineHeight:1.08,margin:0,letterSpacing:"-0.02em",paddingRight:48},children:"Three Solutions. One Platform."}),l.jsxs("div",{style:{position:"relative",width:412,height:320,overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)"},children:[l.jsx("div",{style:{display:"flex",gap:16,height:"100%",transform:`translateX(${-Yt*280}px)`,transition:"transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:[{Icon:qe.CircleCheckBig,title:"Evaluation Quality Monitoring",info:"Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."},{Icon:qe.ShieldCheck,title:"Compliance Monitoring",info:"Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."},{Icon:qe.Radar,title:"Signal Intelligence",info:"Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."}].map(({Icon:f,title:k,info:S},P)=>l.jsxs("div",{style:{flexShrink:0,width:264,height:320,padding:32,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,borderRadius:16,border:"1px solid var(--surface-card-dark-border)",background:"var(--surface-card-dark)"},children:[l.jsx(f,{width:36,height:36,color:"var(--color-card-icon)",strokeWidth:2.5}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[l.jsx("span",{style:{fontFamily:E,fontSize:24,fontStyle:"normal",fontWeight:600,lineHeight:"28px",color:"var(--color-card-text)"},children:k}),l.jsx("span",{style:{fontFamily:E,fontSize:12,fontStyle:"normal",fontWeight:400,lineHeight:"normal",color:"rgba(255,255,255,0.65)"},children:S})]})]},P))}),l.jsx("div",{style:{position:"absolute",top:0,left:280,right:0,height:"100%",background:"linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",pointerEvents:"none"}})]}),l.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,height:4,marginTop:"auto",flexShrink:0},children:Array.from({length:Xt}).map((f,k)=>l.jsx("button",{onClick:()=>$t(k),style:{width:80,height:4,borderRadius:6,border:"none",padding:0,cursor:"pointer",background:k===Yt?"rgba(255,255,255,0.7)":"rgba(255,255,255,0.25)",transition:"background 0.3s ease"}},k))})]})]}),l.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"32px 72px",position:"relative",background:"white",overflowY:"auto",minHeight:0},children:l.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",maxWidth:360,gap:28,flex:1},children:R==="signup"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Sign Up",subtitle:"Please enter your basic details to continue"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[l.jsx(Q,{label:"First Name",gap:8,children:l.jsx("input",{type:"text",value:st,onChange:f=>ao(f.target.value),placeholder:"First name",autoFocus:!0,autoComplete:"given-name",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Last Name",gap:8,children:l.jsx("input",{type:"text",value:at,onChange:f=>lo(f.target.value),placeholder:"Last name",autoComplete:"family-name",style:ne,onFocus:oe,onBlur:re})})]}),l.jsx(Q,{label:"Email",gap:8,children:l.jsx("input",{type:"email",value:He,onChange:f=>co(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Create Password",gap:8,children:l.jsxs("div",{style:{position:"relative"},children:[l.jsx("input",{type:ct?"text":"password",value:Ke,onChange:f=>{uo(f.target.value),Me("")},placeholder:"Enter password",autoComplete:"new-password",style:{...ne,padding:"10px 44px 10px 14px"},onFocus:oe,onBlur:re}),l.jsx(kt,{show:ct,onToggle:()=>go(!ct)})]})}),l.jsx(Q,{label:"Confirm Password",gap:8,children:l.jsxs("div",{style:{position:"relative"},children:[l.jsx("input",{type:dt?"text":"password",value:lt,onChange:f=>{po(f.target.value),Me("")},placeholder:"Enter password",autoComplete:"new-password",style:{...ne,padding:"10px 44px 10px 14px"},onFocus:oe,onBlur:re}),l.jsx(kt,{show:dt,onToggle:()=>ho(!dt)})]})}),Wt&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Wt]}),(()=>{const f=st&&at&&He&&Ke&&lt;return l.jsx(xe,{onClick:()=>{if(Me(""),Ke!==lt){Me("Password and Confirm Password do not match!");return}i==null||i({firstName:st,lastName:at,email:He,password:Ke}),q("verifyemail")},disabled:!f,children:"Create Account"})})(),l.jsx(Ce,{text:"I am already a member",linkText:"Sign In",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a})]})]}):R==="verifyemail"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[l.jsx("h2",{style:{fontFamily:E,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Verify Email"}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:"Verify your email to continue the signup process."})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:24},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"We have sent a verification link to:"}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:600,lineHeight:"24px",color:"var(--color-text)",margin:0},children:He||"youremail@workemail.com"})]}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"Click on the link to complete the verification process. You might need to check your Spam folder"}),l.jsx(xe,{onClick:()=>{q("signin"),g==null||g()},children:"Go To Login"})]}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]}):R==="verifycode"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsx("h2",{style:{fontFamily:E,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Sign In with code"}),l.jsxs("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:["We have sent a one-time code to your email:"," ",l.jsx("span",{style:{color:"var(--color-text)"},children:me||"workemail@example.com"})," ",l.jsx("button",{type:"button",onClick:()=>q("getcode"),style:{background:"none",border:"none",padding:0,fontSize:18,fontWeight:400,color:Be,cursor:"pointer",fontFamily:E,textDecoration:"underline"},children:"Change email"})]})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Enter one-time code",gap:12,children:l.jsx("div",{style:{display:"flex",gap:8},children:I.map((f,k)=>l.jsx("input",{ref:S=>{Te.current[k]=S},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:S=>tn(k,S.target.value),onKeyDown:S=>nn(k,S),onPaste:S=>on(k,S),autoFocus:k===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:E,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:Be},onFocus:oe,onBlur:re},k))})}),l.jsx(xe,{onClick:()=>o==null?void 0:o(me,I.join("")),disabled:I.some(f=>!f),children:"Verify Code"}),Ve&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Ve]}),l.jsx(Ne,{}),l.jsx(Ce,{text:"Not received yet?",linkText:"Resend",onClick:()=>r==null?void 0:r(me)}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):R==="getcode"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Get code",subtitle:"We'll send a one time pass-code to your email"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{type:"email",value:M,onChange:f=>ve(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(xe,{onClick:()=>{ee(M),je(["","","","","",""]),q("verifycode"),n==null||n(M)},disabled:!M,children:"Send One-time Code"}),l.jsx(Ne,{}),l.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):R==="getcodewithname"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Complete your sign in",subtitle:"We’ve sent a one-time code to your email. Please enter the code and your full name to sign in"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{type:"email",value:M,onChange:f=>ve(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Full Name",gap:12,children:l.jsx("input",{type:"text",value:ue,onChange:f=>Ie(f.target.value),placeholder:"Enter your full name",autoComplete:"name",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Enter one-time code",gap:12,children:l.jsx("div",{style:{display:"flex",gap:8},children:I.map((f,k)=>l.jsx("input",{ref:S=>{Te.current[k]=S},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:S=>tn(k,S.target.value),onKeyDown:S=>nn(k,S),onPaste:S=>on(k,S),autoFocus:k===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:E,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:Be},onFocus:oe,onBlur:re},k))})}),l.jsx(xe,{onClick:()=>{ee(M),n==null||n(M,ue,I.join(""))},disabled:!M||!ue||I.some(f=>!f),children:"Verify & Sign In"}),Ve&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Ve]}),l.jsx(Ne,{}),l.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):R==="resetpassword"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Reset Password",subtitle:"We'll send an email to reset your password"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{type:"email",value:ut,onChange:f=>fo(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(xe,{onClick:()=>s==null?void 0:s(ut),disabled:!ut,children:"Send Reset Link"}),l.jsx(Ne,{}),l.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:48},children:[l.jsx(Pe,{title:"Sign in",subtitle:"Enter your email & password to continue"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:8},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:16},children:[l.jsxs("form",{onSubmit:wo,style:{width:"100%",display:"flex",flexDirection:"column",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{ref:we,type:"email",value:C,onChange:f=>O(f.target.value),placeholder:"workemail@example.com",required:!0,autoComplete:"email",style:{...ne,border:`1px solid ${pe?"var(--color-text)":"var(--color-input-border)"}`},onFocus:Zt,onBlur:_t})}),l.jsx(Q,{label:"Password",gap:12,children:l.jsxs("div",{style:{position:"relative"},children:[l.jsx("input",{ref:ye,type:J?"text":"password",value:U,onChange:f=>N(f.target.value),placeholder:"Enter password",required:!0,autoComplete:"current-password",style:{...ne,padding:"10px 44px 10px 16px",border:`1px solid ${pe?"var(--color-text)":"var(--color-input-border)"}`},onFocus:Zt,onBlur:_t}),l.jsx(kt,{show:J,onToggle:()=>W(!J)})]})}),l.jsx(xe,{type:"submit",disabled:!Gt,children:Qt?"Signing in…":"Sign In"})]}),pe&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),pe]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[l.jsx("button",{type:"button",onClick:()=>{q("resetpassword"),t==null||t()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:400,lineHeight:"100%",color:"var(--color-text)",cursor:"pointer",fontFamily:E,textDecoration:"underline"},children:"Forgot Password?"}),l.jsx("button",{type:"button",onClick:()=>{q("getcode"),n==null||n()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"100%",color:Be,cursor:"pointer",fontFamily:E,textDecoration:"underline solid",textUnderlineOffset:0,textDecorationSkipInk:"none"},children:"Sign in with one-time code"})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:2},children:[l.jsx(Ne,{}),l.jsx(Fi,{projectId:p,onSuccess:d,onError:u})]})]}),l.jsx(Ce,{text:"Not a member yet?",linkText:"Sign Up",onClick:()=>{q("signup"),i==null||i()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:0})]})]})})})]})}exports.$e=io;exports.LoginPage=Bi;exports.W=Zn;exports.X=ui;exports.__awaiter=xo;exports.__classPrivateFieldGet=ko;exports.__classPrivateFieldSet=Io;exports.__rest=F;exports.h=Ti;exports.r=Ui;exports.s=Ai;
2
+ `)}},Oo=[521,524],pn=e=>async(...t)=>{let n=await e(...t);Oo.includes(n.status)&&(n=await e(...t),n.retries=1);const o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n},Uo=(e,t)=>{const n=t||fetch;return n||e==null||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...o)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((i=>un().title("Request").url(i[0]).method(i[1].method).headers(i[1].headers).body(i[1].body).build())(o));const r=await pn(n)(...o);return e[r.ok?"log":"error"](await(async i=>{const s=await i.text();return un().title("Response").url(i.url.toString()).status(`${i.status} ${i.statusText}`).headers(i.headers).body(s).retries(i.retries).build()})(r)),r}:pn(n)};let Ye;const Ao=()=>{if(Ye)return Ye;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return Ye=`${t}-${n}`,Ye};var ke;(function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"})(ke||(ke={}));const gn=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(En,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${e==null?void 0:e.replace(/^\//,"")}`:t;if(n){const s=Object.keys(n);s.forEach((c,a)=>{i=`${i}${a===0?"?":""}${c}=${encodeURIComponent(n[c])}${a===s.length-1?"":"&"}`})}return i},To=(...e)=>new Headers(e.reduce((t,n)=>((o=>Array.isArray(o)?o:o instanceof Headers?Array.from(o.entries()):o?Object.entries(o):[])(n).forEach(([o,r])=>{t[o]=typeof r=="function"?r():r}),t),{})),Eo={"Content-Type":"application/json"},Do=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Ro=(e,t)=>{const n={"x-descope-sdk-session-id":Ao(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.57.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},Po=e=>{try{e=JSON.parse(e)}catch{return!1}return typeof e=="object"&&e!==null};var No=(e=>t=>{var n;return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:o=>{var r;const i=[].concat(((r=t.hooks)===null||r===void 0?void 0:r.beforeRequest)||[]);return i==null?void 0:i.reduce((s,c)=>c(s),o)},afterRequest:async(o,r)=>{var i;const s=[].concat(((i=t.hooks)===null||i===void 0?void 0:i.afterRequest)||[]);s.length!=0&&(await Promise.allSettled(s==null?void 0:s.map(c=>c(o,r==null?void 0:r.clone())))).forEach(c=>{var a;return c.status==="rejected"&&((a=t.logger)===null||a===void 0?void 0:a.error(c.reason))})},transformResponse:(n=t.hooks)===null||n===void 0?void 0:n.transformResponse}}))})(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:o,logger:r,hooks:i,cookiePolicy:s,fetch:c})=>{const a=e||Co,d=Uo(r,c),u=async p=>{var g;const x=i!=null&&i.beforeRequest?i.beforeRequest(p):p,{path:m,body:v,headers:b,queryParams:C,method:O,token:U}=x,N=(H=>H===void 0?void 0:JSON.stringify(H))(v),z={headers:To(Do(t,U),Ro(t,o),(n==null?void 0:n.baseHeaders)||{},Po(N)?Eo:{},b),method:O,body:N};s!==null&&(z.credentials=s||"include");const B=await d(gn({path:m,baseUrl:a,queryParams:C,projectId:t}),z);if(i!=null&&i.afterRequest&&await i.afterRequest(p,B==null?void 0:B.clone()),i==null?void 0:i.transformResponse){const H=await B.json(),K=(((g=B.headers)===null||g===void 0?void 0:g.get("set-cookie"))||"").split(";").reduce((W,L)=>{const[$,X]=L.split("=");return Object.assign(Object.assign({},W),{[$.trim()]:X})},{}),J=Object.assign(Object.assign({},B),{json:()=>Promise.resolve(H),cookies:K});return J.clone=()=>J,i.transformResponse(J)}return B};return{get:(p,{headers:g,queryParams:x,token:m}={})=>u({path:p,headers:g,queryParams:x,body:void 0,method:ke.get,token:m}),post:(p,g,{headers:x,queryParams:m,token:v}={})=>u({path:p,headers:x,queryParams:m,body:g,method:ke.post,token:v}),patch:(p,g,{headers:x,queryParams:m,token:v}={})=>u({path:p,headers:x,queryParams:m,body:g,method:ke.patch,token:v}),put:(p,g,{headers:x,queryParams:m,token:v}={})=>u({path:p,headers:x,queryParams:m,body:g,method:ke.put,token:v}),delete:(p,{headers:g,queryParams:x,token:m}={})=>u({path:p,headers:g,queryParams:x,body:void 0,method:ke.delete,token:m}),hooks:i,buildUrl:(p,g)=>gn({projectId:t,baseUrl:a,path:p,queryParams:g})}}),Lo={TOO_MANY_REQUESTS:429};function Rn(e,t,n){var o;let r=tt(e);if(t){if(!(r!=null&&r.tenants)&&(r==null?void 0:r[Dn])===t)return(r==null?void 0:r[n])||[];r=(o=r==null?void 0:r.tenants)===null||o===void 0?void 0:o[t]}const i=r==null?void 0:r[n];return Array.isArray(i)?i:[]}function tt(e){if(typeof e!="string"||!e)throw new Error("Invalid token provided");return Rt(e)}function Fo(e){const{exp:t}=tt(e);return new Date().getTime()/1e3>t}function Bo(e){let t=tt(e);const n=Object.keys(t==null?void 0:t.tenants);return Array.isArray(n)?n:[]}function qo(e,t){return Rn(e,t,"permissions")}function zo(e,t){return Rn(e,t,"roles")}const Z=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function y(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===Lo.TOO_MANY_REQUESTS&&Object.assign(r.error,{retryAfter:Number.parseInt((n=o.headers)===null||n===void 0?void 0:n.get("retry-after"))||0})),r}function Jo(e){var t;return((t=tt(e))===null||t===void 0?void 0:t[Dn])||""}const fe=(e,t)=>(n=t)=>o=>!e(o)&&n.replace("{val}",o),Pn=(e,t)=>(n=t)=>o=>{const r=e.filter(i=>i(o));return!(r.length<e.length)&&(n?n.replace("{val}",o):r.join(" OR "))},Nn=(...e)=>({validate:t=>(e.forEach(n=>{const o=n(t);if(o)throw new Error(o)}),!0)}),Ln=e=>t=>e.test(t),Ho=Ln(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Ko=Ln(/^\+[1-9]{1}[0-9]{3,14}$/),Mo=(e,t)=>n=>Nn(...t).validate(((o,r,i)=>{const s=(Array.isArray(r)?r.join("."):String(r)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,(u,p,g)=>"."+g).split("."),c=s.length;let a=0,d=o===Object(o)?o:void 0;for(;d!=null&&a<c;)d=d[s[a++]];return a&&a===c&&d!==void 0?d:i})(n,e)),Vo=fe(Ho,'"{val}" is not a valid email'),Wo=fe(Ko,'"{val}" is not a valid phone number'),Yo=fe((hn=1,e=>e.length>=hn),"Minimum length is 1");var hn;const Ae=fe(e=>typeof e=="string","Input is not a string"),$o=fe(e=>Array.isArray(e),"Input is not an array"),Xo=fe(e=>typeof e=="boolean","Input is not a boolean"),Qo=fe(e=>e===void 0,"Input is defined"),It=Pn([Ae(),Qo()],"Input is not a string or undefined"),Go=Pn([$o(),Xo()],"Input is not an array or boolean"),j=(...e)=>t=>(...n)=>(e.forEach((o,r)=>Nn(...o).validate(n[r])),t(...n)),Fn=e=>[Ae(`"${e}" must be a string`)],Bn=e=>[It(`"${e}" must be string or undefined`)],D=e=>[Ae(`"${e}" must be a string`),Yo(`"${e}" must not be empty`)],Pt=e=>[Ae(`"${e}" must be a string`),Vo()],qn=e=>[Ae(`"${e}" must be a string`),Wo()],Zo=j(D("accessKey")),_o=e=>({exchange:Zo((t,n)=>y(e.post(w.accessKey.exchange,{loginOptions:n},{token:t})))}),Ee=(e,t,n)=>(t.forEach(o=>{const r=o.split(".");let i=r.shift(),s=e;for(;r.length>0;){if(s=s[i],!i||!s)throw Error(`Invalid path "${o}", "${i}" is missing or has no value`);i=r.shift()}if(typeof s[i]!="function")throw Error(`"${o}" is not a function`);const c=s[i];s[i]=n(c)}),e),zn=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||cn,cn),timeoutMs:Math.min(t||dn,dn)});var he,jt;(function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"})(he||(he={})),function(e){e.email="email"}(jt||(jt={}));const de=Object.assign(Object.assign({},he),jt);var fn;(function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"})(fn||(fn={}));const Jn=D("loginId"),er=j(D("token")),pt=j(Jn),tr=j(D("pendingRef")),nr=j(Jn,Pt("email")),or=e=>({verify:er(t=>y(e.post(w.enchantedLink.verify,{token:t}))),signIn:pt((t,n,o={},r)=>{var{providerId:i}=o,s=F(o,["providerId"]);return y(e.post(Z(w.enchantedLink.signIn,de.email),{loginId:t,URI:n,loginOptions:s,providerId:i},{token:r}))}),signUpOrIn:pt((t,n,o={})=>{var{providerId:r}=o,i=F(o,["providerId"]);return y(e.post(Z(w.enchantedLink.signUpOrIn,de.email),{loginId:t,URI:n,loginOptions:i,providerId:r}))}),signUp:pt((t,n,o,r={})=>{var{providerId:i}=r,s=F(r,["providerId"]);return y(e.post(Z(w.enchantedLink.signUp,de.email),{loginId:t,URI:n,user:o,loginOptions:s,providerId:i}))}),waitForSession:tr((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=zn(n);let s;const c=setInterval(async()=>{const a=await e.post(w.enchantedLink.session,{pendingRef:t});a.ok&&(clearInterval(c),s&&clearTimeout(s),o(y(Promise.resolve(a))))},r);s=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)})),update:{email:nr((t,n,o,r,i)=>y(e.post(w.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))}}),rr=j(D("flowId")),ir=j(D("executionId"),D("stepId"),D("interactionId")),sr=e=>({start:rr((t,n,o,r,i,s,c,a=!1)=>y(e.post(w.flow.start,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,componentsVersion:i,flowVersions:s,input:c,isCustomScreen:a}))),next:ir((t,n,o,r,i,s,c=!1)=>y(e.post(w.flow.next,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s,isCustomScreen:c})))}),Nt=D("loginId"),ar=j(D("token")),gt=j(Nt),lr=j(Nt,qn("phone")),cr=j(Nt,Pt("email")),ht=Object.keys(de).filter(e=>e!==he.voice&&e!==he.im),dr=e=>({verify:ar(t=>y(e.post(w.magicLink.verify,{token:t}))),signIn:ht.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:gt((o,r,i={},s)=>{var{providerId:c}=i,a=F(i,["providerId"]);return y(e.post(Z(w.magicLink.signIn,n),{loginId:o,URI:r,loginOptions:a,providerId:c},{token:s}))})}),{}),signUp:ht.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:gt((o,r,i,s={})=>{var{providerId:c}=s,a=F(s,["providerId"]);return y(e.post(Z(w.magicLink.signUp,n),{loginId:o,URI:r,user:i,loginOptions:a,providerId:c}))})}),{}),signUpOrIn:ht.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:gt((o,r,i={})=>{var{providerId:s}=i,c=F(i,["providerId"]);return y(e.post(Z(w.magicLink.signUpOrIn,n),{loginId:o,URI:r,loginOptions:c,providerId:s}))})}),{}),update:{email:cr((t,n,o,r,i)=>y(e.post(w.magicLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))),phone:Object.keys(he).filter(t=>t!==he.voice).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:lr((o,r,i,s,c)=>y(e.post(Z(w.magicLink.update.phone,n),Object.assign({loginId:o,phone:r,URI:i},c),{token:s})))}),{})}});var St;(function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple",e.discord="discord",e.linkedin="linkedin",e.slack="slack"})(St||(St={}));const ur=j(D("code")),pr=e=>({start:Object.assign((t,n,o,r,i)=>y(e.post(w.oauth.start,o||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),i&&{loginHint:i}),token:r})),Object.keys(St).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:(o,r,i,s)=>y(e.post(w.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},o&&{redirectURL:o}),s&&{loginHint:s}),token:i}))}),{})),exchange:ur(t=>y(e.post(w.oauth.exchange,{code:t}))),startNative:(t,n,o)=>y(e.post(w.oauth.startNative,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>y(e.post(w.oauth.finishNative,{provider:t,stateId:n,user:o,code:r,idToken:i})),getOneTapClientId:t=>y(e.get(w.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,o,r)=>y(e.post(w.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r})),exchangeOneTapIDToken:(t,n,o,r)=>y(e.post(w.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r}))}),gr=D("appId"),hr=j(gr),fr=e=>({connect:hr((t,n,o)=>{const r=n==null?void 0:n.tenantId,i=n==null?void 0:n.tenantLevel;return n==null||delete n.tenantId,n==null||delete n.tenantLevel,y(e.post(w.outbound.connect,{appId:t,tenantId:r,tenantLevel:i,options:n},{token:o}))})}),nt=D("loginId"),vr=j(nt,D("code")),ft=j(nt),mr=j(nt,qn("phone")),wr=j(nt,Pt("email")),yr=e=>({verify:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:vr((o,r)=>y(e.post(Z(w.otp.verify,n),{code:r,loginId:o})))}),{}),signIn:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ft((o,r={},i)=>{var{providerId:s}=r,c=F(r,["providerId"]);return y(e.post(Z(w.otp.signIn,n),{loginId:o,loginOptions:c,providerId:s},{token:i}))})}),{}),signUp:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ft((o,r,i={})=>{var{providerId:s}=i,c=F(i,["providerId"]);return y(e.post(Z(w.otp.signUp,n),{loginId:o,user:r,loginOptions:c,providerId:s}))})}),{}),signUpOrIn:Object.keys(de).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ft((o,r={})=>{var{providerId:i}=r,s=F(r,["providerId"]);return y(e.post(Z(w.otp.signUpOrIn,n),{loginId:o,loginOptions:s,providerId:i}))})}),{}),update:{email:wr((t,n,o,r)=>y(e.post(w.otp.update.email,Object.assign({loginId:t,email:n},r),{token:o}))),phone:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:mr((o,r,i,s)=>y(e.post(Z(w.otp.update.phone,n),Object.assign({loginId:o,phone:r},s),{token:i})))}),{})}}),xr=j(D("tenant")),br=j(D("code")),kr=e=>({start:xr((t,n,o,r,i,s,c,a)=>y(e.post(w.saml.start,o||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i}),s&&{forceAuthn:"true"}),c&&{loginHint:c}),a&&{initiatedEmail:t})},r&&{token:r})))),exchange:br(t=>y(e.post(w.saml.exchange,{code:t})))}),Lt=D("loginId"),Ir=j(Lt,D("code")),jr=j(Lt),Sr=j(Lt),Cr=e=>({signUp:jr((t,n)=>y(e.post(w.totp.signUp,{loginId:t,user:n}))),verify:Ir((t,n,o,r)=>y(e.post(w.totp.verify,{loginId:t,code:n,loginOptions:o},{token:r}))),update:Sr((t,n)=>y(e.post(w.totp.update,{loginId:t},{token:n})))}),ot=D("loginId"),Hn=D("newPassword"),vn=j(ot,D("password")),Or=j(ot),Ur=j(ot,Hn),Ar=j(ot,D("oldPassword"),Hn),Tr=e=>({signUp:vn((t,n,o,r={})=>{var{providerId:i}=r,s=F(r,["providerId"]);return y(e.post(w.password.signUp,{loginId:t,password:n,user:o,loginOptions:s,providerId:i}))}),signIn:vn((t,n,o={})=>{var{providerId:r}=o,i=F(o,["providerId"]);return y(e.post(w.password.signIn,{loginId:t,password:n,loginOptions:i,providerId:r}))}),sendReset:Or((t,n,o)=>y(e.post(w.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:o}))),update:Ur((t,n,o)=>y(e.post(w.password.update,{loginId:t,newPassword:n},{token:o}))),replace:Ar((t,n,o)=>y(e.post(w.password.replace,{loginId:t,oldPassword:n,newPassword:o}))),policy:()=>y(e.get(w.password.policy))}),Er=Fn("loginId"),Ft=D("loginId"),rt=D("origin"),Dr=j(Ft,rt,D("name")),Rr=j(Ft,rt),Pr=j(Er,rt),Nr=j(Ft,rt,Bn("token")),vt=j(D("transactionId"),D("response")),Lr=e=>({signUp:{start:Dr((t,n,o,r)=>y(e.post(w.webauthn.signUp.start,{user:{loginId:t,name:o},origin:n,passkeyOptions:r}))),finish:vt((t,n)=>y(e.post(w.webauthn.signUp.finish,{transactionId:t,response:n})))},signIn:{start:Pr((t,n,o,r,i)=>y(e.post(w.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:o,passkeyOptions:i},{token:r}))),finish:vt((t,n)=>y(e.post(w.webauthn.signIn.finish,{transactionId:t,response:n})))},signUpOrIn:{start:Rr((t,n,o)=>y(e.post(w.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:o})))},update:{start:Nr((t,n,o,r)=>y(e.post(w.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:o}))),finish:vt((t,n)=>y(e.post(w.webauthn.update.finish,{transactionId:t,response:n})))}}),Fr=Fn("loginId"),mt=j(Fr),Br=j(D("pendingRef")),qr=e=>({signUpOrIn:mt((t,n={})=>{var{providerId:o}=n,r=F(n,["providerId"]);return y(e.post(w.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:o}))}),signUp:mt((t,n,o={})=>{var{providerId:r}=o,i=F(o,["providerId"]);return y(e.post(w.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:i}))}),signIn:mt((t,n={},o)=>{var{providerId:r}=n,i=F(n,["providerId"]);return y(e.post(w.notp.signIn,{loginId:t,loginOptions:i,providerId:r},{token:o}))}),waitForSession:Br((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=zn(n);let s;const c=setInterval(async()=>{const a=await e.post(w.notp.session,{pendingRef:t});a.ok&&(clearInterval(c),s&&clearTimeout(s),o(y(Promise.resolve(a))))},r);s=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)}))}),De=j(D("token")),Re=j(Bn("token"));var mn,wn,zr=j([(mn="projectId",wn=D("projectId"),fe(Mo(mn,wn))())])(e=>{const{projectId:t,logger:n,baseUrl:o,cookiePolicy:r,baseHeaders:i={},refreshCookieName:s,fetch:c}=e;return a=No({baseUrl:o,projectId:t,logger:n,hooks:{get beforeRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.beforeRequest},get afterRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.afterRequest},get transformResponse(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:i},refreshCookieName:s,fetch:c}),{accessKey:_o(a),otp:yr(a),magicLink:dr(a),enchantedLink:or(a),oauth:pr(a),outbound:fr(a),saml:kr(a),totp:Cr(a),notp:qr(a),webauthn:Lr(a),password:Tr(a),flow:sr(a),refresh:Re((d,u,p,g)=>{const x={};p&&(x.externalToken=p);const m=g?w.tryRefresh:w.refresh;return y(a.post(m,x,{token:d,queryParams:u}))}),selectTenant:j([Ae("tenantId")],[It('"token" must be string or undefined')])((d,u)=>y(a.post(w.selectTenant,{tenant:d},{token:u}))),logout:Re(d=>y(a.post(w.logout,{},{token:d}))),logoutAll:Re(d=>y(a.post(w.logoutAll,{},{token:d}))),me:Re(d=>y(a.get(w.me,{token:d}))),myTenants:j([Go('"tenants" must a string array or a boolean')],[It('"token" must be string or undefined')])((d,u)=>{const p={};return typeof d=="boolean"?p.dct=d:p.ids=d,y(a.post(w.myTenants,p,{token:u}))}),history:Re(d=>y(a.get(w.history,{token:d}))),isJwtExpired:De(Fo),getTenants:De(Bo),getJwtPermissions:De(qo),getJwtRoles:De(zo),getCurrentTenant:De(Jo),httpClient:a};var a}),Jr=Object.assign(zr,{DeliveryMethods:de});/*! js-cookie v3.0.5 | MIT */function $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var Hr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Ct(e,t){function n(r,i,s){if(!(typeof document>"u")){s=$e({},t,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var a in s)s[a]&&(c+="; "+a,s[a]!==!0&&(c+="="+s[a].split(";")[0]));return document.cookie=r+"="+e.write(i,r)+c}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var i=document.cookie?document.cookie.split("; "):[],s={},c=0;c<i.length;c++){var a=i[c].split("="),d=a.slice(1).join("=");try{var u=decodeURIComponent(a[0]);if(s[u]=e.read(d,u),r===u)break}catch{}}return r?s[r]:s}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",$e({},i,{expires:-1}))},withAttributes:function(r){return Ct(this.converter,$e({},this.attributes,r))},withConverter:function(r){return Ct($e({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Ue=Ct(Hr,{path:"/"});function Kr(e,t){return function(n,o){return Object.prototype.hasOwnProperty.call(n,o)}(e,t)?e[t]:void 0}function Mr(e,t,n,o){var r,i=document,s="securitypolicyviolation",c=function(d){var u=new URL(e,location.href),p=d.blockedURI;p!==u.href&&p!==u.protocol.slice(0,-1)&&p!==u.origin||(r=d,a())};i.addEventListener(s,c);var a=function(){return i.removeEventListener(s,c)};return o==null||o.then(a,a),Promise.resolve().then(t).then(function(d){return a(),d},function(d){return new Promise(function(u){var p=new MessageChannel;p.port1.onmessage=function(){return u()},p.port2.postMessage(null)}).then(function(){if(a(),r)return n(r);throw d})})}var Vr={default:"endpoint"},Kn="Blocked by CSP",Mn="The endpoint parameter is not a valid URL",Wr="API key required",Yr="3.11.6",Bt="Failed to load the JS script of the agent",qt="9319";function $r(e,t){var n,o,r,i,s,c,a,d=[],u=(n=function(m){var v=bo([],m,!0);return{current:function(){return v[0]},postpone:function(){var b=v.shift();b!==void 0&&v.push(b)},exclude:function(){v.shift()}}}(e),i=100,s=3e3,c=0,o=function(){return Math.random()*Math.min(s,i*Math.pow(2,c++))},r=new Set,[n.current(),function(m,v){var b,C=v instanceof Error?v.message:"";if(C===Kn||C===Mn)n.exclude(),b=0;else if(C===qt)n.exclude();else if(C===Bt){var O=Date.now()-m.getTime()<50,U=n.current();U&&O&&!r.has(U)&&(r.add(U),b=0),n.postpone()}else n.postpone();var N=n.current();return N===void 0?void 0:[N,b??m.getTime()+o()-Date.now()]}]),p=u[0],g=u[1];if(p===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var x=function(m){var v=new Date,b=function(O){return d.push({url:m,startedAt:v,finishedAt:new Date,error:O})},C=t(m);return C.then(function(){return b()},b),C.catch(function(O){if(a!=null||(a=O),d.length>=5)throw a;var U=g(v,O);if(!U)throw a;var N,z=U[0],B=U[1];return(N=B,new Promise(function(H){return setTimeout(H,N)})).then(function(){return x(z)})})};return x(p).then(function(m){return[m,d]})}var Vn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Xr=Vn;function Qr(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=o===void 0?n:o,i=F(e,["scriptUrlPattern","token","apiKey"]),s=(t=Kr(e,"scriptUrlPattern"))!==null&&t!==void 0?t:Vn,c=function(){var u=[],p=function(){u.push({time:new Date,state:document.visibilityState})},g=function(x,m,v,b){return x.addEventListener(m,v,b),function(){return x.removeEventListener(m,v,b)}}(document,"visibilitychange",p);return p(),[u,g]}(),a=c[0],d=c[1];return Promise.resolve().then(function(){if(!r||typeof r!="string")throw new Error(Wr);var u=function(p,g){return(Array.isArray(p)?p:[p]).map(function(x){return function(m,v){var b=encodeURIComponent;return m.replace(/<[^<>]+>/g,function(C){return C==="<version>"?"3":C==="<apiKey>"?b(v):C==="<loaderVersion>"?b(Yr):C})}(String(x),g)})}(s,r);return $r(u,Gr)}).catch(function(u){throw d(),function(p){return p instanceof Error&&p.message===qt?new Error(Bt):p}(u)}).then(function(u){var p=u[0],g=u[1];return d(),p.load(_e(_e({},i),{ldi:{attempts:g,visibilityStates:a}}))})}function Gr(e){return Mr(e,function(){return function(t){return new Promise(function(n,o){if(function(c){if(URL.prototype)try{return new URL(c,location.href),!1}catch(a){if(a instanceof Error&&a.name==="TypeError")return!0;throw a}}(t))throw new Error(Mn);var r=document.createElement("script"),i=function(){var c;return(c=r.parentNode)===null||c===void 0?void 0:c.removeChild(r)},s=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),n()},r.onerror=function(){i(),o(new Error(Bt))},r.async=!0,r.src=t,s.appendChild(r)})}(e)},function(){throw new Error(Kn)}).then(Zr)}function Zr(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(o,r){var i,s=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,o,r);s!=null&&s.configurable?delete o[r]:s&&!s.writable||(o[r]=void 0)}(e,t),typeof(n==null?void 0:n.load)!="function")throw new Error(qt);return n}const Wn="3.2.0",Y=typeof window<"u",wt=Math.pow(2,31)-1,_r=`https://descopecdn.com/npm/oidc-client-ts@${Wn}/dist/browser/oidc-client-ts.min.js`,ei=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Wn}/dist/browser/oidc-client-ts.min.js`,ti=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let ae;const Yn=e=>{try{return Rt(e).exp}catch{return null}},ni=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Yn(n)},oi=e=>{const{expires_in:t,expires_at:n,access_token:o}=e;return n||(t?Math.floor(Date.now()/1e3)+t:o?Yn(o):void 0)},$n=e=>{const{access_token:t,id_token:n,refresh_token:o,refresh_expire_in:r}=e,i=F(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||o,sessionExpiration:e.sessionExpiration||oi(e),cookieExpiration:e.cookieExpiration||ni(e)},i)},Se=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce((o,r)=>{var i;return o[r]=[].concat(((i=e.hooks)===null||i===void 0?void 0:i[r])||[]).concat((t==null?void 0:t[r])||[]),o},(n=e.hooks)!==null&&n!==void 0?n:e.hooks={}),e},Xe=async e=>{if(!(e!=null&&e.ok))return{};const t=await(e==null?void 0:e.clone().json()),n=(t==null?void 0:t.authInfo)||t||{};return $n(n)},Ot=()=>Y&&!!window.descopeBridge,yt=(e,t)=>{if(!((t==null?void 0:t.status)>=400&&(t==null?void 0:t.status)<500))return!1;const n=(e==null?void 0:e.path)||"";return ti.includes(n)},ri=ae!==void 0||Y&&window.localStorage!==void 0,ce=(e,t)=>{var n,o;return(o=(n=ae||Y&&window.localStorage)===null||n===void 0?void 0:n.setItem)===null||o===void 0?void 0:o.call(n,e,t)},le=e=>{var t,n;return(n=(t=ae||Y&&window.localStorage)===null||t===void 0?void 0:t.getItem)===null||n===void 0?void 0:n.call(t,e)},ie=e=>{var t,n;return(n=(t=ae||Y&&window.localStorage)===null||t===void 0?void 0:t.removeItem)===null||n===void 0?void 0:n.call(t,e)},ii=e=>{var t,n,o,r,i;return(i=(n=(t=ae==null?void 0:ae.key)===null||t===void 0?void 0:t.call(ae,e))!==null&&n!==void 0?n:Y&&((r=(o=window.localStorage)===null||o===void 0?void 0:o.key)===null||r===void 0?void 0:r.call(o,e)))!==null&&i!==void 0?i:null},V=(...e)=>{console.debug(...e)},yn=(...e)=>{console.warn(...e)},si=(e,t)=>{let n;var o;return t>0?(n=1e3*t,V(`Using provided nextRefreshSeconds: ${t}s`)):n=((o=e)?o.getTime()-new Date().getTime():0)-2e4,n>wt&&(V(`Timeout is too large (${n}ms), setting it to ${wt}ms`),n=wt),n},it="DS",Je="DSR",zt="DSI";function xn(e,t,n){if(t){const{cookieDomain:o,cookiePath:r,cookieSameSite:i,cookieExpiration:s,cookieSecure:c}=n,a=new Date(1e3*s),d=Ut(o);Ue.set(e,t,{path:r,domain:d?o:void 0,expires:a,sameSite:i,secure:c})}}function Ut(e){const t=window.location.hostname.split("."),n=e==null?void 0:e.split(".");return t.slice(-(n==null?void 0:n.length)).join(".")===e}const Jt=e=>(e==null?void 0:e.cookieName)||it,et=e=>(e==null?void 0:e.cookieName)||Je;function Fe(e="",t){return Ue.get(et(t))||le(`${e}${Je}`)||""}function bn(e="",t){return Ue.get(Jt(t))||le(`${e}${it}`)||""}function Xn(e=""){return le(`${e}${zt}`)||""}function Qn(e="",t,n,o){ie(`${e}${Je}`),ie(`${e}${it}`),ie(`${e}${zt}`);const r=Jt(t);Ue.remove(r,o==null?void 0:o.session);const i=et(n);Ue.remove(i,o==null?void 0:o.refresh)}const ai=(e,t)=>n=>{const o=Object.assign(n,{token:n.token||Fe(e,t)}),r=function(i=""){return le(`${i}DTD`)||""}(e);return r&&(o.headers=Object.assign(Object.assign({},o.headers||{}),{"x-descope-trusted-device-token":r})),o},li=Y&&(localStorage==null?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",ci="vsid",di="vrid",Ht="fp",Gn=(e=!1)=>{const t=le(Ht);if(!t)return null;const n=JSON.parse(t);return new Date().getTime()>n.expiry&&!e?null:n.value},Zn=async(e,t=li)=>{try{if(Gn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Qr({apiKey:e,endpoint:[o.toString(),Vr],scriptUrlPattern:[i,Xr]}),c=await s,{requestId:a}=await c.get({linkedId:n}),d=((u,p)=>({[ci]:u,[di]:p}))(n,a);(u=>{const p={value:u,expiry:new Date().getTime()+864e5};ce(Ht,JSON.stringify(p))})(d)}catch(n){console.warn("Could not load fingerprint",n)}},ui=()=>{ie(Ht)},pi=e=>{const t=Gn(!0);return t&&e.body&&(e.body.fpData=t),e},Oe="descopeFlowNonce",kn="X-Descope-Flow-Nonce",In="/v1/flow/start",At="/v1/flow/next",Tt=(e,t=Oe)=>`${t}${e}`,gi=(e,t=Oe)=>{try{const n=Tt(e,t);ie(n)}catch(n){console.error("Error removing flow nonce:",n)}},_n=e=>{var t;return((t=/.*\|#\|(.*)/.exec(e))===null||t===void 0?void 0:t[1])||null},jn=e=>{var t;return e.path===At&&(!((t=e.body)===null||t===void 0)&&t.executionId)?_n(e.body.executionId):null},Kt="dls_last_user_login_id",Mt="dls_last_user_display_name",Sn=e=>ce(Kt,e),Et=()=>le(Kt),Dt=()=>le(Mt),hi=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Et(),i=Dt();return r&&((n=o.lastAuth)!==null&&n!==void 0||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},fi=e=>t=>async(...n)=>{const o=await t(...n);return e||(ie(Kt),ie(Mt)),o};function Qe(){const e=[];return{pub:t=>{e.forEach(n=>n(t))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const vi=(e,t,n,o)=>r=>async(...i)=>{const s=await r(...i);return Qn(e,t,n,o==null?void 0:o()),s};async function Ge(e){const t=function(r){var i;const s=JSON.parse(r);return s.publicKey.challenge=ze(s.publicKey.challenge),s.publicKey.user.id=ze(s.publicKey.user.id),(i=s.publicKey.excludeCredentials)===null||i===void 0||i.forEach(c=>{c.id=ze(c.id)}),s}(e);return o=await navigator.credentials.create(t),JSON.stringify({id:o.id,rawId:ge(o.rawId),type:o.type,response:{attestationObject:ge(o.response.attestationObject),clientDataJSON:ge(o.response.clientDataJSON)}});var o}async function xt(e){const t=to(e);return no(await navigator.credentials.get(t))}async function mi(e,t){const n=to(e);return n.signal=t.signal,n.mediation="conditional",no(await navigator.credentials.get(n))}async function eo(e=!1){var t,n;if(!Y)return Promise.resolve(!1);if(Ot()){const r=(n=(t=window.descopeBridge)===null||t===void 0?void 0:t.hostInfo)===null||n===void 0?void 0:n.webauthn;if(typeof r=="boolean")return r}const o=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return o&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():o}function to(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=ze(n.publicKey.challenge),(t=n.publicKey.allowCredentials)===null||t===void 0||t.forEach(o=>{o.id=ze(o.id)}),n}function no(e){return JSON.stringify({id:e.id,rawId:ge(e.rawId),type:e.type,response:{authenticatorData:ge(e.response.authenticatorData),clientDataJSON:ge(e.response.clientDataJSON),signature:ge(e.response.signature),userHandle:e.response.userHandle?ge(e.response.userHandle):void 0}})}function ze(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),n=>n.charCodeAt(0)).buffer}function ge(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Cn,wi=(Cn=e=>({async signUp(t,n,o){const r=await e.webauthn.signUp.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await Ge(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)},async signIn(t,n){const o=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!o.ok)return o;const r=await xt(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,r)},async signUpOrIn(t,n){var o;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(!((o=r.data)===null||o===void 0)&&o.create){const i=await Ge(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)}{const i=await xt(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)}},async update(t,n,o){const r=await e.webauthn.update.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await Ge(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,i)},helpers:{create:Ge,get:xt,isSupported:eo,conditional:mi}}),(...e)=>{const t=Cn(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const On={config:"/fedcm/config"},yi=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).substring(2)};async function Un(e,t){var n;try{await oo(e,t)}catch(o){(n=t==null?void 0:t.onFailed)===null||n===void 0||n.call(t,o)}}async function oo(e,t){var n,o;const r=await async function(i,s="google",c,a,d){const u=yi(),p=await async function(){return new Promise((m,v)=>{if(window.google)return void m(window.google.accounts.id);let b=document.getElementById("google-gsi-client-script");b||(b=document.createElement("script"),document.head.appendChild(b),b.async=!0,b.defer=!0,b.id="google-gsi-client-script",b.src="https://accounts.google.com/gsi/client"),b.onload=function(){window.google?m(window.google.accounts.id):v("Failed to load Google GSI client script - not loaded properly")},b.onerror=function(){v("Failed to load Google GSI client script - failed to load")}})}(),g=await i.oauth.getOneTapClientId(s);if(!g.ok)throw new Error("Failed to get OneTap client ID for provider "+s);const x=g.data.clientId;return new Promise(m=>{var v,b;const C=O=>{m({provider:s,nonce:u,credential:O==null?void 0:O.credential})};p.initialize(Object.assign(Object.assign({},c),{itp_support:(v=c==null?void 0:c.itp_support)===null||v===void 0||v,use_fedcm_for_prompt:(b=c==null?void 0:c.use_fedcm_for_prompt)===null||b===void 0||b,client_id:x,callback:C,nonce:u})),p.prompt(O=>{var U,N;if(d&&(O!=null&&O.isDismissedMoment())){const z=(U=O.getDismissedReason)===null||U===void 0?void 0:U.call(O);return d==null||d(z),void C()}if(a&&(O!=null&&O.isSkippedMoment())){const z=(N=O.getSkippedReason)===null||N===void 0?void 0:N.call(O);return a==null||a(z),void C()}})})}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(t!=null&&t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);(n=t==null?void 0:t.onCodeReceived)===null||n===void 0||n.call(t,i.data.code)}else{const i=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);(o=t==null?void 0:t.onAuthenticated)===null||o===void 0||o.call(t,i.data)}}var xi=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await eo(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const bi=()=>window.location.search.includes("code")&&window.location.search.includes("state");let bt;const ro=(e,t)=>new Promise((n,o)=>{if(!e.length)return o(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const i=e.shift(),s=document.createElement("script");s.src=i,s.id=(c=>{let a=0;for(let d=0;d<c.length;d++)a=(a<<5)-a+c.charCodeAt(d),a|=0;return Math.abs(a).toString(16)})(i),s.onload=()=>{const c=t();if(c)return n(c);throw new Error("Could not get entry after loading script from URL")},s.addEventListener("error",()=>{ro(e,t),s.setAttribute("data-error","true")}),document.body.appendChild(s)}),ki=async(e,t,n)=>{bt||(bt=(async()=>{try{return require("oidc-client-ts")}catch{return ro([_r,ei],()=>window.oidc)}})());const{OidcClient:o,WebStorageStateStore:r}=await bt;if(!o)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const i=(n==null?void 0:n.redirectUri)||window.location.href;let s,c,a,d;if(n!=null&&n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,c=n.clientId,a=`${c}_user`,d="openid"}else n!=null&&n.applicationId?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,c=t,a=`${c}_user`,d="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),c=t,a=`${c}_user`,d="openid email roles descope.custom_claims offline_access");const u={authority:s,client_id:c,redirect_uri:i,response_type:"code",scope:(n==null?void 0:n.scope)||d,stateStore:new r({store:window.localStorage,prefix:c}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return n!=null&&n.redirectUri&&(u.redirect_uri=n.redirectUri),{client:new o(u),stateUserKey:a}},Ii=(e,t,n)=>{const o=async()=>{let i,s;return i&&s||({client:i,stateUserKey:s}=await ki(e,t,n)),{client:i,stateUserKey:s}},r=async(i="")=>{var s;const{client:c,stateUserKey:a}=await o(),d=await c.processSigninResponse(i||window.location.href);var u;return await((s=e.httpClient.hooks)===null||s===void 0?void 0:s.afterRequest({},new Response(JSON.stringify(d)))),ce(a,JSON.stringify({id_token:(u=d).id_token,session_state:u.session_state,profile:u.profile})),(()=>{const p=new URL(window.location.href);p.searchParams.delete("code"),p.searchParams.delete("state"),window.history.replaceState({},document.title,p.toString())})(),d};return{loginWithRedirect:async(i={},s=!1)=>{const{client:c}=await o(),a=await c.createSigninRequest(i),{url:d}=a;return s||(window.location.href=d),{ok:!0,data:a}},finishLogin:r,finishLoginIfNeed:async(i="")=>{if(bi())return await r(i)},refreshToken:async i=>{var s;const{client:c,stateUserKey:a}=await o(),d=(g=>{const x=le(g);return x?JSON.parse(x):null})(a);if(!d)throw new Error("User not found in storage to refresh token");let u=i;if(!u){const g={};e.httpClient.hooks.beforeRequest(g),u=g.token}const p=await c.useRefreshToken({state:{refresh_token:u,session_state:d.session_state,profile:d.profile}});return await((s=e.httpClient.hooks)===null||s===void 0?void 0:s.afterRequest({},new Response(JSON.stringify(p)))),p},logout:async(i,s=!1)=>{const{client:c,stateUserKey:a}=await o();i||(i={}),i.id_token_hint=i.id_token_hint||Xn(),i.post_logout_redirect_uri=i.post_logout_redirect_uri||window.location.href;const d=await c.createSignoutRequest(i),{url:u}=d;return ie(a),s||window.location.replace(u),d}}},io=function(...e){return t=>e.reduce((n,o)=>o(n),t)}(e=>t=>{var n;return n=t.customStorage,ae=n,e(t)},e=>t=>{var{fpKey:n,fpLoad:o}=t,r=F(t,["fpKey","fpLoad"]);return Y?(n&&o&&Zn(n).catch(()=>null),e(Se(r,{beforeRequest:pi}))):e(r)},e=>t=>{var{autoRefresh:n}=t,o=F(t,["autoRefresh"]);if(!n||Ot())return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const d=[];return{clearAllTimers:()=>{for(;d.length;)clearTimeout(d.pop())},setTimer:(u,p)=>{d.push(setTimeout(u,p))}}})();let s,c;Y&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&s&&new Date>s&&(V("Expiration time passed, refreshing session"),a.refresh(Fe()||c))});const a=e(Se(o,{afterRequest:async(d,u)=>{const{sessionJwt:p,refreshJwt:g,sessionExpiration:x,nextRefreshSeconds:m}=await Xe(u);if(yt(d,u))V("Session invalidated, canceling all timers"),r();else if(p||x){if(s=((C,O)=>{if(O)return new Date(1e3*O);V("Could not extract expiration time from session token, trying to decode the token");try{const U=Rt(C);if(U.exp)return new Date(1e3*U.exp)}catch{return null}})(p,x),!s)return void V("Could not extract expiration time from session token");c=g;const v=si(s,m);if(r(),v<=2e4)return void V("Session is too close to expiration, not setting refresh timer");const b=new Date(Date.now()+v).toLocaleTimeString("en-US",{hour12:!1});V(`Setting refresh timer for ${b}. (${v}ms)`),i(()=>{Y&&document.visibilityState==="hidden"?V("Skipping refresh due to timer - document is hidden"):(V("Refreshing session due to timer"),a.refresh(Fe()||g))},v)}}}));return Ee(a,["logout","logoutAll","oidc.logout"],d=>async(...u)=>{const p=await d(...u);return V("Clearing all timers"),r(),p})},e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.45.0"},t.baseHeaders)})),e=>t=>{const n=Qe(),o=Qe(),r=Qe(),i=Qe(),s=e(Se(t,{afterRequest:async(a,d)=>{if(yt(a,d))V("Session invalidated, notifying subscribers with empty values"),o.pub(null),r.pub(null),n.pub(null),i.pub(null);else{const u=await(async m=>{const v=await Xe(m);return(v==null?void 0:v.user)||(v!=null&&v.hasOwnProperty("userId")?v:void 0)})(d);u&&r.pub(u);const{sessionJwt:p,sessionExpiration:g,claims:x}=await Xe(d);p&&o.pub(p),x&&i.pub(x),(g||p)&&n.pub(g||42)}}})),c=Ee(s,["logout","logoutAll","oidc.logout"],a=>async(...d)=>{const u=await a(...d);return o.pub(null),r.pub(null),n.pub(null),i.pub(null),u});return Object.assign(c,{onSessionTokenChange:o.sub,onUserChange:r.sub,onClaimsChange:i.sub,onIsAuthenticatedChange:a=>n.sub(d=>{a(!!d)})})},e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:o=Oe}=t,r=F(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((i=Oe)=>{try{if(!ri)return;for(let d=0;d<(s=void 0,c=void 0,a=void 0,(a=(s=ae==null?void 0:ae.length)!==null&&s!==void 0?s:Y&&((c=window.localStorage)===null||c===void 0?void 0:c.length))!==null&&a!==void 0?a:0);d++){const u=ii(d);if(u&&u.startsWith(i)){const p=le(u);if(p)try{JSON.parse(p).expiry<Date.now()&&ie(u)}catch{ie(u)}}}}catch(d){console.error("Error cleaning up expired nonces:",d)}var s,c,a})(o),e(Se(r,{afterRequest:async(i,s)=>{if(i.path!==In&&i.path!==At)return;const{nonce:c,executionId:a}=await(async(d,u)=>{try{const p=u.headers.get(kn);let g=await u.clone().json().then(x=>(x==null?void 0:x.executionId)||null).catch(()=>null);return g||(g=jn(d)),{nonce:p,executionId:_n(g)}}catch{return{nonce:null,executionId:null}}})(i,s);c&&a&&((d,u,p,g=Oe)=>{try{const x=Tt(d,g),m=p?172800:10800,v={value:u,expiry:Date.now()+1e3*m,isStart:p};ce(x,JSON.stringify(v))}catch(x){console.error("Error setting flow nonce:",x)}})(a,c,i.path===In,o)},beforeRequest:i=>{if(i.path===At){const s=jn(i);if(s){const c=((a,d=Oe)=>{try{const u=Tt(a,d),p=le(u);if(!p)return null;const g=JSON.parse(p);return g.expiry<Date.now()?(gi(a,d),null):g.value}catch(u){return console.error("Error getting flow nonce:",u),null}})(s,o);c&&(i.headers=i.headers||{},i.headers[kn]=c)}}return i}}))):e(r)},e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=F(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:Et,getLastUserDisplayName:Dt});const i=e(Se(r,{afterRequest:async(c,a)=>{var d;const{userInfo:u,lastAuth:p}=await(async m=>{if(!(m!=null&&m.ok))return{userInfo:void 0,lastAuth:void 0};const v=await(m==null?void 0:m.clone().json()),b=$n((v==null?void 0:v.authInfo)||v||{});return{userInfo:(b==null?void 0:b.user)||(b!=null&&b.hasOwnProperty("userId")?b:void 0),lastAuth:v.lastAuth}})(a),g=(d=u==null?void 0:u.loginIds)===null||d===void 0?void 0:d[0],x=u==null?void 0:u.name;g?(Sn(g),(m=>{ce(Mt,m)})(x)):p!=null&&p.loginId&&Sn(p.loginId)}}));let s=Ee(i,["flow.start"],hi);return s=Ee(s,["logout","logoutAll"],fi(o)),Object.assign(s,{getLastUserLoginId:Et,getLastUserDisplayName:Dt})},e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,refreshTokenViaCookie:r,storagePrefix:i}=t,s=F(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix"]);if(!n||!Y)return e(s);let c;const a=e(Se(s,{beforeRequest:ai(i,r),afterRequest:async(u,p)=>{if(yt(u,p))V("Session invalidated, clearing persisted tokens"),Qn(i,o,r,c);else{const g=((x={},m=!1,v="",b=!1)=>{var C,O,U,N;const{sessionJwt:z,refreshJwt:B,trustedDeviceJwt:H}=x;let K;if(B)if(b){ie(`${v}${Je}`);const J=b.sameSite||"Strict",W=(C=b.secure)===null||C===void 0||C,L=(O=b.domain)!==null&&O!==void 0?O:x.cookieDomain,$=et(b);W&&window.location.protocol!=="https:"&&yn("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const X=Object.assign(Object.assign({},x),{cookieSameSite:J,cookieSecure:W,cookieDomain:L});xn($,B,X);const _=Ut(L);K=Object.assign(Object.assign({},K),{refresh:{path:X.cookiePath,domain:_?L:void 0}})}else{const J=et(b);Ue.remove(J),ce(`${v}${Je}`,B)}if(z)if(m){const J=m.sameSite||"Strict",W=(U=m.secure)===null||U===void 0||U,L=(N=m.domain)!==null&&N!==void 0?N:x.cookieDomain,$=Jt(m);W&&window.location.protocol!=="https:"&&yn("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const X=Object.assign(Object.assign({},x),{cookieSameSite:J,cookieSecure:W,cookieDomain:L});xn($,z,X);const _=Ut(L);K=Object.assign(Object.assign({},K),{session:{path:X.cookiePath,domain:_?L:void 0}})}else ce(`${v}${it}`,z);return x.idToken&&ce(`${v}${zt}`,x.idToken),H&&ce(`${v}DTD`,H),K})(await Xe(p),o,i,r);g&&(c=g)}}})),d=Ee(a,["logout","logoutAll","oidc.logout"],vi(i,o,r,()=>c));return Object.assign(d,{getRefreshToken:()=>Fe(i,r),getSessionToken:()=>bn(i,o),getIdToken:()=>Xn(i)})})(e=>{const t=Jr(e),n=Ii(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,s)=>{var c;if(Ot())return V(`Refresh called in native flow: ${new Error().stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(p){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:p.toString()}})}const a=bn(),d=Fe();let u="";if(e.getExternalToken)try{u=await((c=e.getExternalToken)===null||c===void 0?void 0:c.call(e))}catch(p){V("Error getting external token while refreshing",p)}return t.refresh(i,{dcs:a?"t":"f",dcr:d?"t":"f"},u,s)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(s){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:s.toString()}})}return t.logout(i)},flow:xi(t),webauthn:wi(t),fedcm:(o=t,r=e.projectId,{onetap:{requestExchangeCode(i){Un(o,i)},requestAuthentication(i){Un(o,i)}},async oneTap(i,s,c,a,d){await oo(o,{provider:i,oneTapConfig:s,loginOptions:c,onSkipped:a,onDismissed:d})},async launch(i){var s;const c={identity:{context:i||"signin",providers:[{configURL:o.httpClient.buildUrl(r+On.config),clientId:r}]}},a=await((s=navigator.credentials)===null||s===void 0?void 0:s.get(c));return o.refresh(a.token)},isSupported:()=>Y&&"IdentityCredential"in window,async isLoggedIn(i){var s;const c=o.httpClient.buildUrl(r+On.config);try{const a={identity:{context:i||"signin",providers:[{configURL:c,clientId:r}]}},d=await((s=navigator.credentials)===null||s===void 0?void 0:s.get(a));return!!d&&!!d.token}catch{return!1}}}),oidc:n});var o,r});let Vt;const so=e=>{const t=io(Object.assign({persistTokens:ln,autoRefresh:ln},e));return Vt=t,t},ji=()=>so({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});Vt=ji();const Si=()=>Vt;var Ci=({projectId:e,baseUrl:t,persistTokens:n,autoRefresh:o,sessionTokenViaCookie:r,refreshTokenViaCookie:i,refreshCookieName:s,oidcConfig:c,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,getExternalToken:u,hooks:p,customStorage:g})=>h.useMemo(()=>{if(e)return so({projectId:e,baseUrl:t,sessionTokenViaCookie:r,refreshTokenViaCookie:i,baseHeaders:Ze,persistTokens:n,autoRefresh:o,refreshCookieName:s,oidcConfig:c,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,hooks:p,getExternalToken:u,customStorage:g})},[e,t,JSON.stringify(r),JSON.stringify(i),u,g]);const Oi=({projectId:e,baseUrl:t="",baseStaticUrl:n="",baseCdnUrl:o="",sessionTokenViaCookie:r=!1,refreshTokenViaCookie:i=!1,hooks:s,persistTokens:c=!0,autoRefresh:a=!0,oidcConfig:d,storeLastAuthenticatedUser:u=!0,keepLastAuthenticatedUserAfterLogout:p=!1,refreshCookieName:g="",getExternalToken:x,customStorage:m,children:v})=>{const[b,C]=h.useState(),[O,U]=h.useState(),[N,z]=h.useState(),[B,H]=h.useState(!1),[K,J]=h.useState(!1),[W,L]=h.useState(!1),[$,X]=h.useState(!!d),_=h.useRef(!1),R=Ci({projectId:e,baseUrl:t,persistTokens:c,autoRefresh:a,sessionTokenViaCookie:r,refreshTokenViaCookie:i,hooks:s,oidcConfig:d,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:g,getExternalToken:x,customStorage:m});h.useEffect(()=>{if(R){const me=R.onSessionTokenChange(U),ee=R.onUserChange(C),I=R.onIsAuthenticatedChange(H),je=R.onClaimsChange(z);return()=>{me(),ee(),I(),je()}}},[R]);const q=h.useRef(!1),M=h.useRef(!1);h.useEffect(()=>{R&&d&&!_.current&&(_.current=!0,R.oidc.finishLoginIfNeed().finally(()=>{X(!1),q.current=!0}))},[]);const ve=h.useCallback(()=>{yo()||q.current||(q.current=!0,L(!0),an(R==null?void 0:R.refresh)(void 0,!0).then(()=>{L(!1)}))},[R]),ue=h.useCallback(()=>{M.current||(M.current=!0,J(!0),an(R.me)().then(()=>{J(!1)}))},[R]),Ie=h.useMemo(()=>({fetchUser:ue,user:b,isUserLoading:K,isUserFetched:M.current,fetchSession:ve,session:O,isAuthenticated:B,isSessionLoading:W,isOidcLoading:$,isSessionFetched:q.current,projectId:e,baseUrl:t,baseStaticUrl:n,baseCdnUrl:o,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:g,customStorage:m,setUser:C,setSession:U,setIsAuthenticated:H,claims:N,sdk:R}),[ue,b,K,M.current,ve,O,B,W,$,q.current,e,t,n,o,p,g,m,C,U,H,N,R]);return h.createElement(Tn.Provider,{value:Ie},v)};function Ui(...e){return t=>e.reduce((n,o)=>o(n),t)}const Ai=(...e)=>e.join("/").replace(/\/+/g,"/"),An=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Ti=e=>{const t=Symbol((n=>{const o=n.toString();let r=0;for(let i=0;i<o.length;i++)r=(r<<5)-r+o.charCodeAt(i),r&=r;return r.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}},Ei=e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}},Di=e=>typeof e=="string"||e==null?e:JSON.stringify(e),Ri=e=>h.forwardRef((t,n)=>{const{prop:o,attr:r,rest:i}=h.useMemo(()=>Object.entries(t).reduce((a,[d,u])=>{const{trimmedKey:p,category:g}=Ei(d);return g==="prop"?a.prop.push([p,u]):g==="attr"?a.attr.push([An(p),Di(u)]):Object.assign(a.rest,{[An(p)]:u}),a},{attr:[],prop:[],rest:{}}),[t]),s=h.useRef(null),c=h.useCallback(a=>{s.current=a,a&&(o.forEach(([d,u])=>{s.current[d]=u}),r.forEach(([d,u])=>{u==null?a.removeAttribute(d):a.setAttribute(d,u)}))},[o,r,s]);return h.useImperativeHandle(n,()=>s.current),h.createElement(e,Object.assign({ref:c},i))}),Pi=h.lazy(async()=>(((customElements==null?void 0:customElements.get("descope-wc"))||await Promise.resolve().then(()=>require("./index.cjs3.js")).then(e=>e.index).then(e=>e.default)).sdkConfigOverrides={baseHeaders:Ze,persistTokens:!1,hooks:{get beforeRequest(){return Si().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:Ri(h.forwardRef((e,t)=>{var{"external-request-id":n}=e,o=F(e,["external-request-id"]);return h.useMemo(()=>{var r,i;r="x-external-rid",(i=n)?Ze[r]=i:delete Ze[r]},[n]),h.createElement("descope-wc",Object.assign({ref:t},o))}))})),Ni=h.forwardRef(({flowId:e,onSuccess:t,onError:n,onReady:o,logger:r,tenant:i,theme:s,nonce:c,locale:a,debug:d,client:u,form:p,telemetryKey:g,redirectUrl:x,autoFocus:m,validateOnBlur:v,restartOnError:b,errorTransformer:C,styleId:O,onScreenUpdate:U,dismissScreenErrorOnInput:N,outboundAppId:z,outboundAppScopes:B,popupOrigin:H,children:K,externalRequestId:J},W)=>{const[L,$]=h.useState(null);h.useImperativeHandle(W,()=>L);const{projectId:X,baseUrl:_,baseStaticUrl:R,baseCdnUrl:q,storeLastAuthenticatedUser:M,keepLastAuthenticatedUserAfterLogout:ve,refreshCookieName:ue,customStorage:Ie,sdk:me}=h.useContext(Tn),ee=h.useCallback(async I=>{await me.httpClient.hooks.afterRequest({},new Response(JSON.stringify(I.detail))),t&&t(I)},[t]);return h.useEffect(()=>{const I=L;return I==null||I.addEventListener("success",ee),n&&(I==null||I.addEventListener("error",n)),o&&(I==null||I.addEventListener("ready",o)),()=>{n&&(I==null||I.removeEventListener("error",n)),o&&(I==null||I.removeEventListener("ready",o)),I==null||I.removeEventListener("success",ee)}},[L,n,ee]),h.useEffect(()=>{const I=L;return I==null||I.addEventListener("success",ee),()=>{I==null||I.removeEventListener("success",ee)}},[L,ee]),h.useEffect(()=>{const I=L;return n&&(I==null||I.addEventListener("error",n)),()=>{n&&(I==null||I.removeEventListener("error",n))}},[L,n]),h.useEffect(()=>{const I=L;return o&&(I==null||I.addEventListener("ready",o)),()=>{o&&(I==null||I.removeEventListener("error",o))}},[L,o]),h.createElement("form",null,h.createElement(h.Suspense,{fallback:null},h.createElement(Pi,{projectId:X,flowId:e,baseUrl:_,baseStaticUrl:R,baseCdnUrl:q,ref:$,telemetryKey:g,redirectUrl:x,autoFocus:m,styleId:O,validateOnBlur:v,restartOnError:b,keepLastAuthenticatedUserAfterLogout:ve,tenant:i,externalRequestId:J,customStorage:Ie,"theme.attr":s,"nonce.attr":c,"locale.attr":a,"form.attr":p,"client.attr":u,"debug.attr":d,"outbound-app-id.attr":z,"outbound-app-scopes.attr":B,"popup-origin.attr":H,"store-last-authenticated-user.attr":M,"refreshCookieName.attr":ue,"dismiss-screen-error-on-input.attr":N,"errorTransformer.prop":C,"logger.prop":r,"onScreenUpdate.prop":U,"customStorage.prop":Ie},K)))}),Li="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK8AAAAwCAYAAABnoirjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAI6lJREFUeAHtfQd8FsX29pTdfXtCeoBQAsHQAkIiVZSioFKkCCooiCD2ggXUq4Kici8qol4VkHJB6YIKFyki5AoIIkFASuihpJGet26Zme9sCgYMmgT1u/dPzu8Xfcvu7OzMM+c85zmzLwjVWq3VWq3V2l9rGP3/Mdy9e3d67tw5Wv6BoigiMvIQT05GDN4KVGu19jv2l4G3ZcuWSl5enhzjcEgbt8yIEQF/ksAikjNu44gjgkmAEnHeSh0pjia3n4uOjtbCwsL0Q4cO6agWzLVWif3Z4MWNGze2HEqZEeHL9t2tMeNGLnh7mdIQhLGhM5aPBPYjAugUwmYhEnwuZIxIYcDQ98iSvD24btRnzRJGnQcvHUC1IK61CvangRdAaz2S8lGTouzCR5Hgw+FKBoA0mXC8mzG+x65b9l7T90lvZtnxMZmZYsfB9TYbOn+tysR1MpUTAas3ApitHKNlIZFB7zVu/eCpzMxMH6q1WkN/AnjBNWKv59tI35nMN4VAdyGgApzhj2mOsvCnBnlcNiztKCJJ4GrbMYPHAjhtJedxFKAKPU0JTtEDYo/baaQk5XNGFdu9hJJHoKf1OSZfRkVEPYfDe2WgWi981dsfCt7ExER569pJid5CzzzBRBin6MWok3krNje2xE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sXL1wc5AvXOkLJMAISIWIYxGulRmpW4/zj0+tNF4uT32woYTwCEol7gO96IR99xuXP+6G+HP48ZPPjVYzfHzbw8de2H8l1o1q7Ku0P/nHpuvb1yz4YQbn+BmiGHkOizyY2vWud+euPhsc7ApSbJ0AeCYZk7AdJRttl2ZbiMwLFxNyrS6gdspo4qLgkwPftQJppD8LLj1DuXWgo2hdtdaWz4PI7lOJ6GqaT+984/pOUWqpwVduf8TSq7PdviCk+mTMN5MbbQfr4TiFodoTPt2F7oJBrURFdFCR1gZJnVwBygixJDlMS1VRNBd3yBEgqB4hE92scb+5xTdbx3NS6PUDWHAMi5K1Q49nsdDif7T54yrG/4hdZau2/2/60R6lBXnH+56vXeuia9jgV7AYAaC5I68skhr9nVmlf227DMjIzETp48CABeQmB9FMiraQm/z1CMEsCl0UnqIvfCQWdGEjS9hCL9b1b73xyTUpKZpV1wFr7v21/9u8AlOiUO/fOi1GL3KMDXB+kYNrQxJ7KUB4kcidtUskzZ0Ll3IY5byRTEmU+CGcIkU2o9JXNZvlXl9seOhoZ2SpQ+/u7tVbR/mzwXriO+QN0klSsHNu5wpVfmJ2gM9QO+G0DpHErMXeZU2I+65Nuk8k+7HId6HP9U7npgYBe+++v1drl7K8C76VGgVZQqGJdtC3SarXydu2OG+ZTtKjWaq3Waq3Waq3W/svs/wHDkxYoFqn0jQAAAABJRU5ErkJggg==",Be="var(--color-green)",E="var(--font-sans)",ne={width:"100%",height:40,padding:"10px 14px",fontSize:16,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:"var(--color-text)",fontFamily:E,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},oe=e=>{e.target.style.borderColor="var(--color-green)",e.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},re=e=>{e.target.style.borderColor="var(--color-input-border)",e.target.style.boxShadow="none"};function Pe({title:e,subtitle:t}){return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsx("h2",{style:{fontFamily:E,fontWeight:600,fontSize:"36px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:e}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:t})]})}function xe({onClick:e,disabled:t,children:n,type:o="button"}){const r=!t;return l.jsx("button",{type:o,onClick:e,disabled:t,style:{width:"100%",height:40,display:"flex",justifyContent:"center",alignItems:"center",padding:"10px",background:r?"var(--color-green)":"var(--color-green-disabled)",color:"white",border:"none",borderRadius:4,fontSize:16,fontWeight:600,lineHeight:"23px",fontFamily:E,cursor:r?"pointer":"not-allowed",transition:"background 0.15s",boxSizing:"border-box"},onMouseEnter:i=>{r&&(i.currentTarget.style.background="var(--color-green-hover)")},onMouseLeave:i=>{r&&(i.currentTarget.style.background=r?"var(--color-green)":"var(--color-green-disabled)")},children:n})}function Q({label:e,gap:t=12,labelSize:n=16,labelStyle:o,children:r}){return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:t,width:"100%"},children:[l.jsx("label",{style:{fontSize:n,fontWeight:400,color:"var(--color-text)",fontFamily:E,lineHeight:"100%",...o},children:e}),r]})}function kt({show:e,onToggle:t}){return l.jsx("button",{type:"button",tabIndex:-1,onClick:t,style:{position:"absolute",right:14,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--color-text-secondary)",display:"flex",alignItems:"center"},children:e?l.jsx(qe.EyeOff,{size:16}):l.jsx(qe.Eye,{size:16})})}function Ne(){return l.jsx("hr",{style:{width:"100%",border:"none",borderTop:"1px solid var(--color-divider)",margin:0}})}function Ce({text:e,linkText:t,onClick:n}){return l.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:4,width:"100%"},children:[l.jsx("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:e}),l.jsx("button",{type:"button",onClick:n,style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"22px",color:Be,cursor:"pointer",fontFamily:E,textDecoration:"underline"},children:t})]})}function be({onTerms:e,onPrivacyPolicy:t,paddingTop:n}){return l.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",marginTop:"auto",paddingTop:n||40,flexShrink:0},children:l.jsxs("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E,textAlign:"center",whiteSpace:"nowrap"},children:["By continuing, you agree to our"," ",l.jsx("a",{href:"https://pages.chordia.ai/terms-of-use/",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:E,textDecoration:"underline",textUnderlineOffset:2},children:"Terms"})," ","and"," ",l.jsx("a",{href:"https://pages.chordia.ai/privacy-notice/",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:E,textDecoration:"underline",textUnderlineOffset:2},children:"Privacy Policy"}),"."]})})}function Fi({projectId:e,onSuccess:t,onError:n}){return e?l.jsx(Oi,{projectId:e,children:l.jsx(Ni,{flowId:"sign-up-or-in-otp-or-social",onSuccess:t,onError:n})}):null}function Bi({onLogin:e,onForgotPassword:t,onOneTimeCode:n,onVerifyCode:o,onResendCode:r,onSignUp:i,onResetPassword:s,onTerms:c,onPrivacyPolicy:a,onDescopeSuccess:d,onDescopeError:u,descopeProjectId:p,onGoToLogin:g,loading:x,error:m,codeError:v,defaultView:b="signin"}){var rn,sn;const[C,O]=h.useState(""),[U,N]=h.useState(""),[z,B]=h.useState(!1),[H,K]=h.useState(!1),[J,W]=h.useState(!1),[L,$]=h.useState(!1),[X,_]=h.useState(null),[R,q]=h.useState(b),[M,ve]=h.useState(""),[ue,Ie]=h.useState(""),[me,ee]=h.useState(""),[I,je]=h.useState(["","","","","",""]),Te=h.useRef([]),[st,ao]=h.useState(""),[at,lo]=h.useState(""),[He,co]=h.useState(""),[Ke,uo]=h.useState(""),[lt,po]=h.useState(""),[ct,go]=h.useState(!1),[dt,ho]=h.useState(!1),[Wt,Me]=h.useState(""),[ut,fo]=h.useState(""),[Yt,$t]=h.useState(0),Xt=3;h.useEffect(()=>{const f=setInterval(()=>$t(k=>(k+1)%Xt),4e3);return()=>clearInterval(f)},[]);const we=h.useRef(null),ye=h.useRef(null);h.useEffect(()=>{const f=G=>{if(!G)return!1;try{return G.matches(":-webkit-autofill, :autofill")}catch{return!1}},k=()=>{const G=we.current,We=ye.current;G&&G.value&&O(G.value),We&&We.value&&N(We.value),B(f(G)),K(f(We))},S=[100,300,600,1e3,2e3].map(G=>setTimeout(k,G)),P=G=>{(G.animationName==="onAutoFillStart"||G.target.matches(":-webkit-autofill"))&&setTimeout(k,50)},A=we.current,T=ye.current;A==null||A.addEventListener("animationstart",P),T==null||T.addEventListener("animationstart",P);const se=()=>setTimeout(k,0),te=()=>setTimeout(k,0);return A==null||A.addEventListener("input",se),T==null||T.addEventListener("input",se),A==null||A.addEventListener("change",te),T==null||T.addEventListener("change",te),()=>{S.forEach(clearTimeout),A==null||A.removeEventListener("animationstart",P),T==null||T.removeEventListener("animationstart",P),A==null||A.removeEventListener("input",se),T==null||T.removeEventListener("input",se),A==null||A.removeEventListener("change",te),T==null||T.removeEventListener("change",te)}},[]),h.useEffect(()=>{const f=P=>{if(!P)return!1;try{return P.matches(":-webkit-autofill, :autofill")}catch{return!1}},k=()=>{var T,se;const P=((T=we.current)==null?void 0:T.value)||"",A=((se=ye.current)==null?void 0:se.value)||"";P&&P!==C&&O(P),A&&A!==U&&N(A),B(f(we.current)),K(f(ye.current))},S=setInterval(k,250);return window.addEventListener("focus",k),document.addEventListener("visibilitychange",k),()=>{clearInterval(S),window.removeEventListener("focus",k),document.removeEventListener("visibilitychange",k)}},[C,U]),h.useEffect(()=>{v&&R==="verifycode"&&(je(["","","","","",""]),q("getcodewithname"))},[v]);const Qt=x??L,pe=m??X,vo=(C||((rn=we.current)==null?void 0:rn.value)||"").trim(),mo=U||((sn=ye.current)==null?void 0:sn.value)||"",Gt=!!(!!(vo||z)&&!!(mo||H)&&!Qt),Ve=R==="verifycode"||R==="getcodewithname"?pe:null,Zt=f=>{f.target.style.borderColor=pe?"var(--color-text)":"var(--color-green)",f.target.style.boxShadow=pe?"none":"0 0 0 3px var(--color-green-ring)"},_t=f=>{f.target.style.borderColor=pe?"var(--color-text)":"var(--color-input-border)",f.target.style.boxShadow="none"},en=(f,k)=>{var se;const S=(k||"").replace(/\D/g,"");if(!S)return;const P=[...I];let A=f;for(let te=0;te<S.length&&f+te<P.length;te+=1)P[f+te]=S[te],A=f+te;je(P);const T=Math.min(A+1,P.length-1);(se=Te.current[T])==null||se.focus()},tn=(f,k)=>{var T;const S=k.replace(/\D/g,"");if(S.length>1){en(f,S);return}const P=S.slice(-1),A=[...I];A[f]=P,je(A),P&&f<5&&((T=Te.current[f+1])==null||T.focus())},nn=(f,k)=>{var S;k.key==="Backspace"&&!I[f]&&f>0&&((S=Te.current[f-1])==null||S.focus())},on=(f,k)=>{var P;k.preventDefault();const S=((P=k.clipboardData)==null?void 0:P.getData("text"))||"";en(f,S)},wo=async f=>{var P,A;if(f.preventDefault(),!Gt)return;const k=C||((P=we.current)==null?void 0:P.value)||"",S=U||((A=ye.current)==null?void 0:A.value)||"";if(!(!k||!S)){_(null),$(!0);try{await(e==null?void 0:e(k,S))}catch(T){_((T==null?void 0:T.message)||"Something went wrong. Please try again.")}finally{$(!1)}}};return l.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",overflow:"hidden",fontFamily:E,background:"white"},children:[l.jsxs("div",{style:{flex:"0 0 628px",width:628,minHeight:0,background:"var(--surface-dark)",display:"flex",flexDirection:"column",padding:"48px 0 40px 48px",position:"relative",overflow:"hidden"},children:[l.jsx("img",{src:Li,alt:"Chordia",style:{width:175,height:48,objectFit:"contain",marginBottom:100,flexShrink:0}}),l.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:22},children:[l.jsx("h1",{style:{fontFamily:E,fontSize:"clamp(28px, 2.8vw, 28px)",fontWeight:800,color:"var(--color-text-inverse)",lineHeight:1.08,margin:0,letterSpacing:"-0.02em",paddingRight:48},children:"Three Solutions. One Platform."}),l.jsxs("div",{style:{position:"relative",width:412,height:320,overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)"},children:[l.jsx("div",{style:{display:"flex",gap:16,height:"100%",transform:`translateX(${-Yt*280}px)`,transition:"transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:[{Icon:qe.CircleCheckBig,title:"Evaluation Quality Monitoring",info:"Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."},{Icon:qe.ShieldCheck,title:"Compliance Monitoring",info:"Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."},{Icon:qe.Radar,title:"Signal Intelligence",info:"Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."}].map(({Icon:f,title:k,info:S},P)=>l.jsxs("div",{style:{flexShrink:0,width:264,height:320,padding:32,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,borderRadius:16,border:"1px solid var(--surface-card-dark-border)",background:"var(--surface-card-dark)"},children:[l.jsx(f,{width:36,height:36,color:"var(--color-card-icon)",strokeWidth:2.5}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[l.jsx("span",{style:{fontFamily:E,fontSize:24,fontStyle:"normal",fontWeight:600,lineHeight:"28px",color:"var(--color-card-text)"},children:k}),l.jsx("span",{style:{fontFamily:E,fontSize:12,fontStyle:"normal",fontWeight:400,lineHeight:"normal",color:"rgba(255,255,255,0.65)"},children:S})]})]},P))}),l.jsx("div",{style:{position:"absolute",top:0,left:280,right:0,height:"100%",background:"linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",pointerEvents:"none"}})]}),l.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,height:4,marginTop:"auto",flexShrink:0},children:Array.from({length:Xt}).map((f,k)=>l.jsx("button",{onClick:()=>$t(k),style:{width:80,height:4,borderRadius:6,border:"none",padding:0,cursor:"pointer",background:k===Yt?"rgba(255,255,255,0.7)":"rgba(255,255,255,0.25)",transition:"background 0.3s ease"}},k))})]})]}),l.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"32px 72px",position:"relative",background:"white",overflowY:"auto",minHeight:0},children:l.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",maxWidth:360,gap:28},children:R==="signup"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Sign Up",subtitle:"Please enter your basic details to continue"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[l.jsx(Q,{label:"First Name",gap:8,children:l.jsx("input",{type:"text",value:st,onChange:f=>ao(f.target.value),placeholder:"First name",autoFocus:!0,autoComplete:"given-name",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Last Name",gap:8,children:l.jsx("input",{type:"text",value:at,onChange:f=>lo(f.target.value),placeholder:"Last name",autoComplete:"family-name",style:ne,onFocus:oe,onBlur:re})})]}),l.jsx(Q,{label:"Email",gap:8,children:l.jsx("input",{type:"email",value:He,onChange:f=>co(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Create Password",gap:8,children:l.jsxs("div",{style:{position:"relative"},children:[l.jsx("input",{type:ct?"text":"password",value:Ke,onChange:f=>{uo(f.target.value),Me("")},placeholder:"Enter password",autoComplete:"new-password",style:{...ne,padding:"10px 44px 10px 14px"},onFocus:oe,onBlur:re}),l.jsx(kt,{show:ct,onToggle:()=>go(!ct)})]})}),l.jsx(Q,{label:"Confirm Password",gap:8,children:l.jsxs("div",{style:{position:"relative"},children:[l.jsx("input",{type:dt?"text":"password",value:lt,onChange:f=>{po(f.target.value),Me("")},placeholder:"Enter password",autoComplete:"new-password",style:{...ne,padding:"10px 44px 10px 14px"},onFocus:oe,onBlur:re}),l.jsx(kt,{show:dt,onToggle:()=>ho(!dt)})]})}),Wt&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Wt]}),(()=>{const f=st&&at&&He&&Ke&&lt;return l.jsx(xe,{onClick:()=>{if(Me(""),Ke!==lt){Me("Password and Confirm Password do not match!");return}i==null||i({firstName:st,lastName:at,email:He,password:Ke}),q("verifyemail")},disabled:!f,children:"Create Account"})})(),l.jsx(Ce,{text:"I am already a member",linkText:"Sign In",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a})]})]}):R==="verifyemail"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[l.jsx("h2",{style:{fontFamily:E,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Verify Email"}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:"Verify your email to continue the signup process."})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:24},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"We have sent a verification link to:"}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:600,lineHeight:"24px",color:"var(--color-text)",margin:0},children:He||"youremail@workemail.com"})]}),l.jsx("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"Click on the link to complete the verification process. You might need to check your Spam folder"}),l.jsx(xe,{onClick:()=>{q("signin"),g==null||g()},children:"Go To Login"})]}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]}):R==="verifycode"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsx("h2",{style:{fontFamily:E,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Sign In with code"}),l.jsxs("p",{style:{fontFamily:E,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:["We have sent a one-time code to your email:"," ",l.jsx("span",{style:{color:"var(--color-text)"},children:me||"workemail@example.com"})," ",l.jsx("button",{type:"button",onClick:()=>q("getcode"),style:{background:"none",border:"none",padding:0,fontSize:18,fontWeight:400,color:Be,cursor:"pointer",fontFamily:E,textDecoration:"underline"},children:"Change email"})]})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Enter one-time code",gap:12,children:l.jsx("div",{style:{display:"flex",gap:8},children:I.map((f,k)=>l.jsx("input",{ref:S=>{Te.current[k]=S},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:S=>tn(k,S.target.value),onKeyDown:S=>nn(k,S),onPaste:S=>on(k,S),autoFocus:k===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:E,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:Be},onFocus:oe,onBlur:re},k))})}),l.jsx(xe,{onClick:()=>o==null?void 0:o(me,I.join("")),disabled:I.some(f=>!f),children:"Verify Code"}),Ve&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Ve]}),l.jsx(Ne,{}),l.jsx(Ce,{text:"Not received yet?",linkText:"Resend",onClick:()=>r==null?void 0:r(me)}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:24})]})]}):R==="getcode"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Get code",subtitle:"We'll send a one time pass-code to your email"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{type:"email",value:M,onChange:f=>ve(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(xe,{onClick:()=>{ee(M),je(["","","","","",""]),q("verifycode"),n==null||n(M)},disabled:!M,children:"Send One-time Code"}),l.jsx(Ne,{}),l.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):R==="getcodewithname"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Complete your sign in",subtitle:"We’ve sent a one-time code to your email. Please enter the code and your full name to sign in"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{type:"email",value:M,onChange:f=>ve(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Full Name",gap:12,children:l.jsx("input",{type:"text",value:ue,onChange:f=>Ie(f.target.value),placeholder:"Enter your full name",autoComplete:"name",style:ne,onFocus:oe,onBlur:re})}),l.jsx(Q,{label:"Enter one-time code",gap:12,children:l.jsx("div",{style:{display:"flex",gap:8},children:I.map((f,k)=>l.jsx("input",{ref:S=>{Te.current[k]=S},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:S=>tn(k,S.target.value),onKeyDown:S=>nn(k,S),onPaste:S=>on(k,S),autoFocus:k===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:E,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:Be},onFocus:oe,onBlur:re},k))})}),l.jsx(xe,{onClick:()=>{ee(M),n==null||n(M,ue,I.join(""))},disabled:!M||!ue||I.some(f=>!f),children:"Verify & Sign In"}),Ve&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Ve]}),l.jsx(Ne,{}),l.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):R==="resetpassword"?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{title:"Reset Password",subtitle:"We'll send an email to reset your password"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{type:"email",value:ut,onChange:f=>fo(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:ne,onFocus:oe,onBlur:re})}),l.jsx(xe,{onClick:()=>s==null?void 0:s(ut),disabled:!ut,children:"Send Reset Link"}),l.jsx(Ne,{}),l.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{q("signin"),g==null||g()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:40})]})]}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:48},children:[l.jsx(Pe,{title:"Sign in",subtitle:"Enter your email & password to continue"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:8},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:16},children:[l.jsxs("form",{onSubmit:wo,style:{width:"100%",display:"flex",flexDirection:"column",gap:16},children:[l.jsx(Q,{label:"Email",gap:12,children:l.jsx("input",{ref:we,type:"email",value:C,onChange:f=>O(f.target.value),placeholder:"workemail@example.com",required:!0,autoComplete:"email",style:{...ne,border:`1px solid ${pe?"var(--color-text)":"var(--color-input-border)"}`},onFocus:Zt,onBlur:_t})}),l.jsx(Q,{label:"Password",gap:12,children:l.jsxs("div",{style:{position:"relative"},children:[l.jsx("input",{ref:ye,type:J?"text":"password",value:U,onChange:f=>N(f.target.value),placeholder:"Enter password",required:!0,autoComplete:"current-password",style:{...ne,padding:"10px 44px 10px 16px",border:`1px solid ${pe?"var(--color-text)":"var(--color-input-border)"}`},onFocus:Zt,onBlur:_t}),l.jsx(kt,{show:J,onToggle:()=>W(!J)})]})}),l.jsx(xe,{type:"submit",disabled:!Gt,children:Qt?"Signing in…":"Sign In"})]}),pe&&l.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:E},children:[l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:l.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),pe]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[l.jsx("button",{type:"button",onClick:()=>{q("resetpassword"),t==null||t()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:400,lineHeight:"100%",color:"var(--color-text)",cursor:"pointer",fontFamily:E,textDecoration:"underline"},children:"Forgot Password?"}),l.jsx("button",{type:"button",onClick:()=>{q("getcode"),n==null||n()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"100%",color:Be,cursor:"pointer",fontFamily:E,textDecoration:"underline solid",textUnderlineOffset:0,textDecorationSkipInk:"none"},children:"Sign in with one-time code"})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:2},children:[l.jsx(Ne,{}),l.jsx(Fi,{projectId:p,onSuccess:d,onError:u})]})]}),l.jsx(Ce,{text:"Not a member yet?",linkText:"Sign Up",onClick:()=>{q("signup"),i==null||i()}}),l.jsx(be,{onTerms:c,onPrivacyPolicy:a,paddingTop:22})]})]})})})]})}exports.$e=io;exports.LoginPage=Bi;exports.W=Zn;exports.X=ui;exports.__awaiter=xo;exports.__classPrivateFieldGet=ko;exports.__classPrivateFieldSet=Io;exports.__rest=F;exports.h=Ti;exports.r=Ui;exports.s=Ai;
3
3
  //# sourceMappingURL=index.cjs2.js.map