@descope/react-sdk 2.0.40 → 2.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Descope={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);const r=o.default.createContext(void 0),i=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)},s=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},a={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.0.40"},d="undefined"!=typeof window;var l=function(){return l=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},l.apply(this,arguments)};function c(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(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 u(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{d(o.next(e))}catch(e){i(e)}}function a(e){try{d(o.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((o=o.apply(e,t||[])).next())}))}function h(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function p(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function f(e){this.message=e}"function"==typeof SuppressedError&&SuppressedError,f.prototype=new Error,f.prototype.name="InvalidCharacterError";var g="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new f("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,r=0,i=0,s="";o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?s+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function m(e){this.message=e}function v(e,t){if("string"!=typeof e)throw new m("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(g(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return g(t)}}(e.split(".")[n]))}catch(e){throw new m("Invalid token specified: "+e.message)}}m.prototype=new Error,m.prototype.name="InvalidTokenError";var b="/v1/auth/accesskey/exchange",y="/v1/auth/otp/verify",w="/v1/auth/otp/signin",$="/v1/auth/otp/signup",E={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},k="/v1/auth/otp/signup-in",C="/v1/auth/magiclink/verify",x="/v1/auth/magiclink/signin",I="/v1/auth/magiclink/signup",O={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},S="/v1/auth/magiclink/signup-in",j="/v1/auth/enchantedlink/verify",R="/v1/auth/enchantedlink/signin",A="/v1/auth/enchantedlink/signup",N="/v1/auth/enchantedlink/pending-session",M={email:"/v1/auth/enchantedlink/update/email"},U="/v1/auth/enchantedlink/signup-in",T="/v1/auth/oauth/authorize",D="/v1/auth/oauth/exchange",P="v1/auth/oauth/native/start",_="v1/auth/oauth/native/finish",L="/v1/auth/saml/authorize",W="/v1/auth/saml/exchange",F="/v1/auth/totp/verify",V="/v1/auth/totp/signup",q="/v1/auth/totp/update",B="/v1/auth/notp/whatsapp/signin",z="/v1/auth/notp/whatsapp/signup",K="/v1/auth/notp/whatsapp/signup-in",H="/v1/auth/notp/pending-session",G={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},J={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},Z={start:"/v1/auth/webauthn/signup-in/start"},X={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Y="/v1/auth/password/signup",Q="/v1/auth/password/signin",ee="/v1/auth/password/reset",te="/v1/auth/password/update",ne="/v1/auth/password/replace",oe="/v1/auth/password/policy",re="/v1/auth/refresh",ie="/v1/auth/tenant/select",se="/v1/auth/logout",ae="/v1/auth/logoutall",de="/v1/auth/me",le="/v1/auth/me/history",ce="/v1/flow/start",ue="/v1/flow/next";const he="<region>",pe=`https://api.${he}descope.com`,fe=6e5,ge=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var me;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(me||(me={}));const ve=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(he,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},be=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),ye=e=>void 0===e?void 0:JSON.stringify(e),we=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},$e=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||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(...t)=>{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((e=>ge().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return ge().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:c,headers:u,queryParams:h,method:p,token:f}=d,g={headers:be(we(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.19.2"},(null==n?void 0:n.baseHeaders)||{},u),method:p,body:ye(c)};null!==i&&(g.credentials=i||"include");const m=await a(ve({path:l,baseUrl:e,queryParams:h,projectId:t}),g);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==m?void 0:m.clone()),null==r?void 0:r.transformResponse){const e=await m.json(),t=((null===(s=m.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},m),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return m};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:me.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:me.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:me.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:me.delete,token:o}),hooks:r,buildUrl:(n,o)=>ve({projectId:t,baseUrl:e,path:n,queryParams:o})}};var Ee=429;function ke(e,t,n){var o;let r=Ce(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function Ce(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return v(e)}function xe(e){const{exp:t}=Ce(e);return(new Date).getTime()/1e3>t}function Ie(e){let t=Ce(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Oe(e,t){return ke(e,t,"permissions")}function Se(e,t){return ke(e,t,"roles")}const je=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Re(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===Ee&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Ae=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Ne=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Me=e=>t=>e.test(t),Ue=Me(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Te=Me(/^\+[1-9]{1}[0-9]{3,14}$/),De=Ae(Ue,'"{val}" is not a valid email'),Pe=Ae(Te,'"{val}" is not a valid phone number'),_e=Ae((1,e=>e.length>=1),"Minimum length is 1");const Le=Ae((e=>"string"==typeof e),"Input is not a string"),We=Ae((e=>void 0===e),"Input is defined"),Fe=(Ve=[Le(),We()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=Ve.filter((e=>e(t)));return!(n.length<Ve.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var Ve;const qe=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Ne(...e).validate(n[t]))),t(...n)),Be=e=>[Le(`"${e}" must be a string`)],ze=e=>[Le(`"${e}" must be a string`),_e(`"${e}" must not be empty`)],Ke=e=>[Le(`"${e}" must be a string`),De()],He=e=>[Le(`"${e}" must be a string`),Pe()],Ge=qe(ze("accessKey")),Je=e=>({exchange:Ge(((t,n)=>Re(e.post(b,{loginOptions:n},{token:t}))))}),Ze=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),Xe=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||fe,fe)});var Ye,Qe;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Ye||(Ye={})),function(e){e.email="email"}(Qe||(Qe={}));const et=Object.assign(Object.assign({},Ye),Qe);var tt;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(tt||(tt={}));const nt=ze("loginId"),ot=qe(ze("token")),rt=qe(nt),it=qe(ze("pendingRef")),st=qe(nt,Ke("email")),at=e=>({verify:ot((t=>Re(e.post(j,{token:t})))),signIn:rt(((t,n,o,r)=>Re(e.post(je(R,et.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:rt(((t,n,o)=>Re(e.post(je(U,et.email),{loginId:t,URI:n,loginOptions:o})))),signUp:rt(((t,n,o,r)=>Re(e.post(je(A,et.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:it(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Xe(n);let s;const a=setInterval((async()=>{const n=await e.post(N,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:st(((t,n,o,r,i)=>Re(e.post(M.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),dt=qe(ze("flowId")),lt=qe(ze("executionId"),ze("stepId"),ze("interactionId")),ct=e=>({start:dt(((t,n,o,r,i,s,a)=>Re(e.post(ce,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:lt(((t,n,o,r,i,s)=>Re(e.post(ue,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),ut=ze("loginId"),ht=qe(ze("token")),pt=qe(ut),ft=qe(ut,He("phone")),gt=qe(ut,Ke("email")),mt=Object.keys(et).filter((e=>e!==Ye.voice)),vt=e=>({verify:ht((t=>Re(e.post(C,{token:t})))),signIn:mt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r,i)=>Re(e.post(je(x,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:mt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r,i)=>Re(e.post(je(I,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:mt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r)=>Re(e.post(je(S,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:gt(((t,n,o,r,i)=>Re(e.post(O.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Ye).filter((e=>e!==Ye.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i,s)=>Re(e.post(je(O.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var bt;!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"}(bt||(bt={}));const yt=qe(ze("code")),wt=e=>({start:Object.assign(((t,n,o,r)=>Re(e.post(T,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(bt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>Re(e.post(T,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:yt((t=>Re(e.post(D,{code:t})))),startNative:(t,n)=>Re(e.post(P,{provider:t,loginOptions:n})),finishNative:(t,n,o,r,i)=>Re(e.post(_,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),$t=ze("loginId"),Et=qe($t,ze("code")),kt=qe($t),Ct=qe($t,He("phone")),xt=qe($t,Ke("email")),It=e=>({verify:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o)=>Re(e.post(je(y,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o,r)=>Re(e.post(je(w,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o,r)=>Re(e.post(je($,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o)=>Re(e.post(je(k,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:xt(((t,n,o,r)=>Re(e.post(E.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Ye).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o,r,i)=>Re(e.post(je(E.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Ot=qe(ze("tenant")),St=qe(ze("code")),jt=e=>({start:Ot(((t,n,o,r)=>Re(e.post(L,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:St((t=>Re(e.post(W,{code:t}))))}),Rt=ze("loginId"),At=qe(Rt,ze("code")),Nt=qe(Rt),Mt=qe(Rt),Ut=e=>({signUp:Nt(((t,n)=>Re(e.post(V,{loginId:t,user:n})))),verify:At(((t,n,o,r)=>Re(e.post(F,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Mt(((t,n)=>Re(e.post(q,{loginId:t},{token:n}))))}),Tt=ze("loginId"),Dt=ze("newPassword"),Pt=qe(Tt,ze("password")),_t=qe(Tt),Lt=qe(Tt,Dt),Wt=qe(Tt,ze("oldPassword"),Dt),Ft=e=>({signUp:Pt(((t,n,o,r)=>Re(e.post(Y,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Pt(((t,n,o)=>Re(e.post(Q,{loginId:t,password:n,loginOptions:o})))),sendReset:_t(((t,n,o)=>Re(e.post(ee,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Lt(((t,n,o)=>Re(e.post(te,{loginId:t,newPassword:n},{token:o})))),replace:Wt(((t,n,o)=>Re(e.post(ne,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Re(e.get(oe))}),Vt=Be("loginId"),qt=ze("loginId"),Bt=ze("origin"),zt=qe(qt,Bt,ze("name")),Kt=qe(qt,Bt),Ht=qe(Vt,Bt),Gt=qe(qt,Bt,ze("token")),Jt=qe(ze("transactionId"),ze("response")),Zt=e=>({signUp:{start:zt(((t,n,o)=>Re(e.post(G.start,{user:{loginId:t,name:o},origin:n})))),finish:Jt(((t,n)=>Re(e.post(G.finish,{transactionId:t,response:n}))))},signIn:{start:Ht(((t,n,o,r)=>Re(e.post(J.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Jt(((t,n)=>Re(e.post(J.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Kt(((t,n)=>Re(e.post(Z.start,{loginId:t,origin:n}))))},update:{start:Gt(((t,n,o)=>Re(e.post(X.start,{loginId:t,origin:n},{token:o})))),finish:Jt(((t,n)=>Re(e.post(X.finish,{transactionId:t,response:n}))))}}),Xt=Be("loginId"),Yt=qe(Xt),Qt=qe(ze("pendingRef")),en=e=>({signUpOrIn:Yt(((t,n)=>Re(e.post(K,{loginId:t,loginOptions:n})))),signUp:Yt(((t,n,o)=>Re(e.post(z,{loginId:t,user:n,loginOptions:o})))),signIn:Yt(((t,n,o)=>Re(e.post(B,{loginId:t,loginOptions:n},{token:o})))),waitForSession:Qt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Xe(n);let s;const a=setInterval((async()=>{const n=await e.post(H,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),tn=qe(ze("token")),nn=qe([Fe('"token" must be string or undefined')]);var on,rn=qe([("projectId",on=ze("projectId"),Ae(((e,t)=>n=>Ne(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",on))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=$e({baseUrl:n||pe,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Je(a),otp:It(a),magicLink:vt(a),enchantedLink:at(a),oauth:wt(a),saml:jt(a),totp:Ut(a),notp:en(a),webauthn:Zt(a),password:Ft(a),flow:ct(a),refresh:nn((e=>Re(a.post(re,{},{token:e})))),selectTenant:qe([Le("tenantId")],[Fe('"token" must be string or undefined')])(((e,t)=>Re(a.post(ie,{tenant:e},{token:t})))),logout:nn((e=>Re(a.post(se,{},{token:e})))),logoutAll:nn((e=>Re(a.post(ae,{},{token:e})))),me:nn((e=>Re(a.get(de,{token:e})))),history:nn((e=>Re(a.get(le,{token:e})))),isJwtExpired:tn(xe),getTenants:tn(Ie),getJwtPermissions:tn(Oe),getJwtRoles:tn(Se),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);(await Promise.allSettled(null==r?void 0:r.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),sn=Object.assign(rn,{DeliveryMethods:et});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function an(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dn={exports:{}};
2
- /*! js-cookie v3.0.5 | MIT */!function(e,t){e.exports=function(){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}function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+s}}function i(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=n.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}}return Object.create({set:r,get:i,remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}return t({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)}},{path:"/"})}()}(dn);var ln=an(dn.exports);var cn={default:"endpoint"},un="Blocked by CSP",hn="The endpoint parameter is not a valid URL",pn="Failed to load the JS script of the agent",fn="9319";function gn(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),100,3e3,i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===un||s===hn)n.exclude(),i=0;else if(s===fn)n.exclude();else if(s===pn){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),d=a[0],l=a[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var c=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return c(r)}))}))};return c(d).then((function(e){return[e,s]}))}var mn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",vn=mn;function bn(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:mn,a=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),d=a[0],u=a[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.9.6"):e}))}(String(e),t)}))}(s,r);return gn(e,yn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===fn?new Error(pn):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(l(l({},i),{ldi:{attempts:n,visibilityStates:d}}))}))}function yn(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,d())};i.addEventListener(s,a);var d=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return d(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(d(),r)return function(){throw new Error(un)}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(hn);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(pn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(wn)}function wn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(fn);return n}const $n=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},En=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},kn=async e=>{const t=await En(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Cn="undefined"!=typeof localStorage,xn=(e,t)=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),In=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),On=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Sn=(...e)=>{console.debug(...e)},jn="undefined"!=typeof window,Rn=Math.pow(2,31)-1,An="DS",Nn="DSR";function Mn(e=""){return In(`${e}${Nn}`)||""}function Un(e=""){On(`${e}${Nn}`),On(`${e}${An}`),ln.remove(An)}const Tn=jn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Dn="fp",Pn=(e=!1)=>{const t=localStorage.getItem(Dn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},_n=async(e,t=Tn)=>{try{if(Pn())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=bn({apiKey:e,endpoint:[o.toString(),cn],scriptUrlPattern:[i,vn]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Dn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Ln=e=>{const t=Pn(!0);return t&&e.body&&(e.body.fpData=t),e},Wn="dls_last_user_login_id",Fn="dls_last_user_display_name",Vn=()=>In(Wn),qn=()=>In(Fn),Bn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Vn(),i=qn();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},zn=e=>async(...t)=>{const n=await e(...t);return On(Wn),On(Fn),n};function Kn(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}async function Hn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),n.publicKey.user.id=Qn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:eo(n.rawId),type:n.type,response:{attestationObject:eo(n.response.attestationObject),clientDataJSON:eo(n.response.clientDataJSON)}});var n}async function Gn(e){const t=Xn(e);return Yn(await navigator.credentials.get(t))}async function Jn(e,t){const n=Xn(e);return n.signal=t.signal,n.mediation="conditional",Yn(await navigator.credentials.get(n))}async function Zn(e=!1){if(!jn)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Xn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}function Yn(e){return JSON.stringify({id:e.id,rawId:eo(e.rawId),type:e.type,response:{authenticatorData:eo(e.response.authenticatorData),clientDataJSON:eo(e.response.clientDataJSON),signature:eo(e.response.signature),userHandle:e.response.userHandle?eo(e.response.userHandle):void 0}})}function Qn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function eo(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var to,no=(to=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await Gn(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Gn(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Hn,get:Gn,isSupported:Zn,conditional:Jn}}),(...e)=>{const t=to(...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 oo="/fedcm/config",ro=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:l}=s.data,c=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var o,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+oo),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>jn&&"IdentityCredential"in window});var io=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Zn(),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 so=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=c(t,["fpKey","fpLoad"]);return jn?(n&&o&&_n(n).catch((()=>null)),e($n(r,{beforeRequest:Ln}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=c(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;jn&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Sn("Expiration time passed, refreshing session"),d.refresh(Mn()||a))}));const d=e($n(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await En(t);if(401===(null==t?void 0:t.status))Sn("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=v(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void Sn("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Rn&&(Sn(`Timeout is too large (${e}ms), setting it to ${Rn}ms`),e=Rn),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Sn(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{Sn("Refreshing session due to timer"),d.refresh(Mn()||n)}),e)}var l}}));return Ze(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Sn("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.12.2"},t.baseHeaders)}))),(e=>t=>{const n=Kn(),o=Kn(),r=e($n(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await kn(t);e&&o.pub(e);const{sessionJwt:r}=await En(t);r&&n.pub(r)}}})),i=Ze(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0}=t,o=c(t,["storeLastAuthenticatedUser"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:Vn,getLastUserDisplayName:qn});const r=e($n(o,{afterRequest:async(e,t)=>{var n;const o=await kn(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{xn(Wn,e)})(r),(e=>{xn(Fn,e)})(i))}}));let i=Ze(r,["flow.start"],Bn);return i=Ze(i,["logout","logoutAll"],zn),Object.assign(i,{getLastUserLoginId:Vn,getLastUserDisplayName:qn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!jn)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e($n(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Mn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Un(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&xn(`${n}${Nn}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);ln.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(An,r,i):xn(`${n}${An}`,r))})(await En(t),o,r)}}));var a;const d=Ze(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Un(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Mn(r),getSessionToken:()=>function(e=""){return ln.get(An)||In(`${e}${An}`)||""}(r)})}))(((...e)=>{const t=sn(...e);return Object.assign(Object.assign({},t),{flow:io(t),webauthn:no(t),fedcm:ro(t,e[0].projectId)})}));let ao;const lo=e=>{const t=so(Object.assign({persistTokens:d,autoRefresh:d},e));return ao=t,t},co=()=>lo({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});ao=co();const uo=()=>d?null==ao?void 0:ao.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),ho=()=>d?null==ao?void 0:ao.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),po=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtPermissions(e,t))),fo=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtRoles(e,t)));const go=t.lazy((async()=>((await Promise.resolve().then((function(){return sl}))).default.sdkConfigOverrides={baseHeaders:a,persistTokens:!1,hooks:{get beforeRequest(){return ao.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,baseStaticUrl:r,innerRef:i,tenant:s,theme:a,locale:d,debug:l,redirectUrl:c,client:u,form:h,autoFocus:p,validateOnBlur:f})=>o.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,"base-static-url":r,ref:i,tenant:s,theme:a,locale:d,debug:l,client:u,form:h,"redirect-url":c,"auto-focus":p,"validate-on-blur":f})}))),mo=o.default.forwardRef((({flowId:e,onSuccess:n,onError:i,onReady:s,logger:a,tenant:d,theme:l,locale:c,debug:u,client:h,form:p,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,errorTransformer:b},y)=>{const[w,$]=t.useState(null);t.useImperativeHandle(y,(()=>w));const{projectId:E,baseUrl:k,baseStaticUrl:C,storeLastAuthenticatedUser:x,sdk:I}=o.default.useContext(r),O=t.useCallback((async e=>{await I.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=w;return null==e||e.addEventListener("success",O),i&&(null==e||e.addEventListener("error",i)),s&&(null==e||e.addEventListener("ready",s)),()=>{i&&(null==e||e.removeEventListener("error",i)),s&&(null==e||e.removeEventListener("ready",s)),null==e||e.removeEventListener("success",O)}}),[w,i,O]),t.useEffect((()=>{const e=w;return null==e||e.addEventListener("success",O),()=>{null==e||e.removeEventListener("success",O)}}),[w,O]),t.useEffect((()=>{const e=w;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[w,i]),t.useEffect((()=>{const e=w;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[w,s]),t.useEffect((()=>{w&&(w.errorTransformer=b)}),[w,b]),t.useEffect((()=>{w&&a&&(w.logger=a)}),[w,a]);const{form:S,client:j}=t.useMemo((()=>({form:JSON.stringify(p||{}),client:JSON.stringify(h||{})})),[p,h]);return o.default.createElement("form",null,o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(go,{projectId:E,flowId:e,baseUrl:k,baseStaticUrl:C,innerRef:$,tenant:d,theme:l,locale:c,debug:u,form:S,client:j,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,storeLastAuthenticatedUser:x})))})),vo=t.lazy((async()=>(await Promise.resolve().then((function(){return ym})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),bo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(vo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),yo=t.lazy((async()=>(await Promise.resolve().then((function(){return Jb})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),wo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(yo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),$o=t.lazy((async()=>(await Promise.resolve().then((function(){return N$})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Eo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement($o,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),ko=t.lazy((async()=>(await Promise.resolve().then((function(){return Ik})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Co=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(ko,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),xo=t.lazy((async()=>(await Promise.resolve().then((function(){return qO})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":i,"base-url":t,"base-static-url":n,theme:s,debug:a,ref:r})}))),Io=o.default.forwardRef((({logger:e,theme:n,debug:i,widgetId:s,onLogout:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),t.useEffect((()=>{if(l&&a)return l.addEventListener("logout",a),()=>l.removeEventListener("logout",a)}),[l,a]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(xo,{projectId:u,widgetId:s,baseUrl:h,baseStaticUrl:p,innerRef:c,theme:n,debug:i}))}));var Oo=()=>{const e=t.useContext(r);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const So=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,jo={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],jo);if("function"==typeof e[t])return()=>{throw Error(So("function"))};throw Error(So("attribute"))}};var Ro="/v1/auth/accesskey/exchange",Ao="/v1/auth/otp/verify",No="/v1/auth/otp/signin",Mo="/v1/auth/otp/signup",Uo={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},To="/v1/auth/otp/signup-in",Do="/v1/auth/magiclink/verify",Po="/v1/auth/magiclink/signin",_o="/v1/auth/magiclink/signup",Lo={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},Wo="/v1/auth/magiclink/signup-in",Fo="/v1/auth/enchantedlink/verify",Vo="/v1/auth/enchantedlink/signin",qo="/v1/auth/enchantedlink/signup",Bo="/v1/auth/enchantedlink/pending-session",zo={email:"/v1/auth/enchantedlink/update/email"},Ko="/v1/auth/enchantedlink/signup-in",Ho="/v1/auth/oauth/authorize",Go="/v1/auth/oauth/exchange",Jo="v1/auth/oauth/native/start",Zo="v1/auth/oauth/native/finish",Xo="/v1/auth/saml/authorize",Yo="/v1/auth/saml/exchange",Qo="/v1/auth/totp/verify",er="/v1/auth/totp/signup",tr="/v1/auth/totp/update",nr="/v1/auth/notp/whatsapp/signin",or="/v1/auth/notp/whatsapp/signup",rr="/v1/auth/notp/whatsapp/signup-in",ir="/v1/auth/notp/pending-session",sr={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},ar={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},dr={start:"/v1/auth/webauthn/signup-in/start"},lr={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},cr="/v1/auth/password/signup",ur="/v1/auth/password/signin",hr="/v1/auth/password/reset",pr="/v1/auth/password/update",fr="/v1/auth/password/replace",gr="/v1/auth/password/policy",mr="/v1/auth/refresh",vr="/v1/auth/tenant/select",br="/v1/auth/logout",yr="/v1/auth/logoutall",wr="/v1/auth/me",$r="/v1/auth/me/history",Er="/v1/flow/start",kr="/v1/flow/next";const Cr="<region>",xr=`https://api.${Cr}descope.com`,Ir=6e5,Or=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var Sr;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(Sr||(Sr={}));const jr=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(Cr,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},Rr=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),Ar=e=>void 0===e?void 0:JSON.stringify(e),Nr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Mr=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||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(...t)=>{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((e=>Or().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return Or().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:c,headers:u,queryParams:h,method:p,token:f}=d,g={headers:Rr(Nr(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.20.0"},(null==n?void 0:n.baseHeaders)||{},u),method:p,body:Ar(c)};null!==i&&(g.credentials=i||"include");const m=await a(jr({path:l,baseUrl:e,queryParams:h,projectId:t}),g);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==m?void 0:m.clone()),null==r?void 0:r.transformResponse){const e=await m.json(),t=((null===(s=m.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},m),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return m};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:Sr.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:Sr.delete,token:o}),hooks:r,buildUrl:(n,o)=>jr({projectId:t,baseUrl:e,path:n,queryParams:o})}};var Ur=429;function Tr(e,t,n){var o;let r=Dr(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function Dr(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return v(e)}function Pr(e){const{exp:t}=Dr(e);return(new Date).getTime()/1e3>t}function _r(e){let t=Dr(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Lr(e,t){return Tr(e,t,"permissions")}function Wr(e,t){return Tr(e,t,"roles")}const Fr=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Vr(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===Ur&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const qr=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Br=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),zr=e=>t=>e.test(t),Kr=zr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Hr=zr(/^\+[1-9]{1}[0-9]{3,14}$/),Gr=qr(Kr,'"{val}" is not a valid email'),Jr=qr(Hr,'"{val}" is not a valid phone number'),Zr=qr((1,e=>e.length>=1),"Minimum length is 1");const Xr=qr((e=>"string"==typeof e),"Input is not a string"),Yr=qr((e=>void 0===e),"Input is defined"),Qr=(ei=[Xr(),Yr()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=ei.filter((e=>e(t)));return!(n.length<ei.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var ei;const ti=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Br(...e).validate(n[t]))),t(...n)),ni=e=>[Xr(`"${e}" must be a string`)],oi=e=>[Xr(`"${e}" must be a string`),Zr(`"${e}" must not be empty`)],ri=e=>[Xr(`"${e}" must be a string`),Gr()],ii=e=>[Xr(`"${e}" must be a string`),Jr()],si=ti(oi("accessKey")),ai=e=>({exchange:si(((t,n)=>Vr(e.post(Ro,{loginOptions:n},{token:t}))))}),di=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),li=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||Ir,Ir)});var ci,ui;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(ci||(ci={})),function(e){e.email="email"}(ui||(ui={}));const hi=Object.assign(Object.assign({},ci),ui);var pi;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(pi||(pi={}));const fi=oi("loginId"),gi=ti(oi("token")),mi=ti(fi),vi=ti(oi("pendingRef")),bi=ti(fi,ri("email")),yi=e=>({verify:gi((t=>Vr(e.post(Fo,{token:t})))),signIn:mi(((t,n,o,r)=>Vr(e.post(Fr(Vo,hi.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:mi(((t,n,o)=>Vr(e.post(Fr(Ko,hi.email),{loginId:t,URI:n,loginOptions:o})))),signUp:mi(((t,n,o,r)=>Vr(e.post(Fr(qo,hi.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:vi(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=li(n);let s;const a=setInterval((async()=>{const n=await e.post(Bo,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Vr(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:bi(((t,n,o,r,i)=>Vr(e.post(zo.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),wi=ti(oi("flowId")),$i=ti(oi("executionId"),oi("stepId"),oi("interactionId")),Ei=e=>({start:wi(((t,n,o,r,i,s,a)=>Vr(e.post(Er,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:$i(((t,n,o,r,i,s)=>Vr(e.post(kr,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),ki=oi("loginId"),Ci=ti(oi("token")),xi=ti(ki),Ii=ti(ki,ii("phone")),Oi=ti(ki,ri("email")),Si=Object.keys(hi).filter((e=>e!==ci.voice)),ji=e=>({verify:Ci((t=>Vr(e.post(Do,{token:t})))),signIn:Si.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xi(((t,o,r,i)=>Vr(e.post(Fr(Po,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:Si.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xi(((t,o,r,i)=>Vr(e.post(Fr(_o,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:Si.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xi(((t,o,r)=>Vr(e.post(Fr(Wo,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:Oi(((t,n,o,r,i)=>Vr(e.post(Lo.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(ci).filter((e=>e!==ci.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r,i,s)=>Vr(e.post(Fr(Lo.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var Ri;!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"}(Ri||(Ri={}));const Ai=ti(oi("code")),Ni=e=>({start:Object.assign(((t,n,o,r)=>Vr(e.post(Ho,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(Ri).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>Vr(e.post(Ho,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:Ai((t=>Vr(e.post(Go,{code:t})))),startNative:(t,n,o)=>Vr(e.post(Jo,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>Vr(e.post(Zo,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),Mi=oi("loginId"),Ui=ti(Mi,oi("code")),Ti=ti(Mi),Di=ti(Mi,ii("phone")),Pi=ti(Mi,ri("email")),_i=e=>({verify:Object.keys(hi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ui(((t,o)=>Vr(e.post(Fr(Ao,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(hi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ti(((t,o,r)=>Vr(e.post(Fr(No,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(hi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ti(((t,o,r)=>Vr(e.post(Fr(Mo,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(hi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ti(((t,o)=>Vr(e.post(Fr(To,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:Pi(((t,n,o,r)=>Vr(e.post(Uo.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(ci).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o,r,i)=>Vr(e.post(Fr(Uo.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Li=ti(oi("tenant")),Wi=ti(oi("code")),Fi=e=>({start:Li(((t,n,o,r)=>Vr(e.post(Xo,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:Wi((t=>Vr(e.post(Yo,{code:t}))))}),Vi=oi("loginId"),qi=ti(Vi,oi("code")),Bi=ti(Vi),zi=ti(Vi),Ki=e=>({signUp:Bi(((t,n)=>Vr(e.post(er,{loginId:t,user:n})))),verify:qi(((t,n,o,r)=>Vr(e.post(Qo,{loginId:t,code:n,loginOptions:o},{token:r})))),update:zi(((t,n)=>Vr(e.post(tr,{loginId:t},{token:n}))))}),Hi=oi("loginId"),Gi=oi("newPassword"),Ji=ti(Hi,oi("password")),Zi=ti(Hi),Xi=ti(Hi,Gi),Yi=ti(Hi,oi("oldPassword"),Gi),Qi=e=>({signUp:Ji(((t,n,o,r)=>Vr(e.post(cr,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Ji(((t,n,o)=>Vr(e.post(ur,{loginId:t,password:n,loginOptions:o})))),sendReset:Zi(((t,n,o)=>Vr(e.post(hr,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Xi(((t,n,o)=>Vr(e.post(pr,{loginId:t,newPassword:n},{token:o})))),replace:Yi(((t,n,o)=>Vr(e.post(fr,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Vr(e.get(gr))}),es=ni("loginId"),ts=oi("loginId"),ns=oi("origin"),os=ti(ts,ns,oi("name")),rs=ti(ts,ns),is=ti(es,ns),ss=ti(ts,ns,oi("token")),as=ti(oi("transactionId"),oi("response")),ds=e=>({signUp:{start:os(((t,n,o)=>Vr(e.post(sr.start,{user:{loginId:t,name:o},origin:n})))),finish:as(((t,n)=>Vr(e.post(sr.finish,{transactionId:t,response:n}))))},signIn:{start:is(((t,n,o,r)=>Vr(e.post(ar.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:as(((t,n)=>Vr(e.post(ar.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:rs(((t,n)=>Vr(e.post(dr.start,{loginId:t,origin:n}))))},update:{start:ss(((t,n,o)=>Vr(e.post(lr.start,{loginId:t,origin:n},{token:o})))),finish:as(((t,n)=>Vr(e.post(lr.finish,{transactionId:t,response:n}))))}}),ls=ni("loginId"),cs=ti(ls),us=ti(oi("pendingRef")),hs=e=>({signUpOrIn:cs(((t,n)=>Vr(e.post(rr,{loginId:t,loginOptions:n})))),signUp:cs(((t,n,o)=>Vr(e.post(or,{loginId:t,user:n,loginOptions:o})))),signIn:cs(((t,n,o)=>Vr(e.post(nr,{loginId:t,loginOptions:n},{token:o})))),waitForSession:us(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=li(n);let s;const a=setInterval((async()=>{const n=await e.post(ir,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Vr(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),ps=ti(oi("token")),fs=ti([Qr('"token" must be string or undefined')]);var gs,ms=ti([("projectId",gs=oi("projectId"),qr(((e,t)=>n=>Br(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",gs))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=Mr({baseUrl:n||xr,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:ai(a),otp:_i(a),magicLink:ji(a),enchantedLink:yi(a),oauth:Ni(a),saml:Fi(a),totp:Ki(a),notp:hs(a),webauthn:ds(a),password:Qi(a),flow:Ei(a),refresh:fs((e=>Vr(a.post(mr,{},{token:e})))),selectTenant:ti([Xr("tenantId")],[Qr('"token" must be string or undefined')])(((e,t)=>Vr(a.post(vr,{tenant:e},{token:t})))),logout:fs((e=>Vr(a.post(br,{},{token:e})))),logoutAll:fs((e=>Vr(a.post(yr,{},{token:e})))),me:fs((e=>Vr(a.get(wr,{token:e})))),history:fs((e=>Vr(a.get($r,{token:e})))),isJwtExpired:ps(Pr),getTenants:ps(_r),getJwtPermissions:ps(Lr),getJwtRoles:ps(Wr),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);(await Promise.allSettled(null==r?void 0:r.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),vs=Object.assign(ms,{DeliveryMethods:hi});const bs=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},ys=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},ws=async e=>{const t=await ys(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},$s="undefined"!=typeof localStorage,Es=(e,t)=>$s&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),ks=e=>$s&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Cs=e=>$s&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),xs=(...e)=>{console.debug(...e)},Is="undefined"!=typeof window,Os=Math.pow(2,31)-1,Ss="DS",js="DSR";function Rs(e=""){return ks(`${e}${js}`)||""}function As(e=""){Cs(`${e}${js}`),Cs(`${e}${Ss}`),ln.remove(Ss)}const Ns=Is&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Ms="fp",Us=(e=!1)=>{const t=localStorage.getItem(Ms);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Ts=async(e,t=Ns)=>{try{if(Us())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=bn({apiKey:e,endpoint:[o.toString(),cn],scriptUrlPattern:[i,vn]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Ms,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Ds=e=>{const t=Us(!0);return t&&e.body&&(e.body.fpData=t),e},Ps="dls_last_user_login_id",_s="dls_last_user_display_name",Ls=()=>ks(Ps),Ws=()=>ks(_s),Fs=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Ls(),i=Ws();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},Vs=e=>async(...t)=>{const n=await e(...t);return Cs(Ps),Cs(_s),n};function qs(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}async function Bs(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Zs(n.publicKey.challenge),n.publicKey.user.id=Zs(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Zs(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Xs(n.rawId),type:n.type,response:{attestationObject:Xs(n.response.attestationObject),clientDataJSON:Xs(n.response.clientDataJSON)}});var n}async function zs(e){const t=Gs(e);return Js(await navigator.credentials.get(t))}async function Ks(e,t){const n=Gs(e);return n.signal=t.signal,n.mediation="conditional",Js(await navigator.credentials.get(n))}async function Hs(e=!1){if(!Is)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Gs(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Zs(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Zs(e.id)})),n}function Js(e){return JSON.stringify({id:e.id,rawId:Xs(e.rawId),type:e.type,response:{authenticatorData:Xs(e.response.authenticatorData),clientDataJSON:Xs(e.response.clientDataJSON),signature:Xs(e.response.signature),userHandle:e.response.userHandle?Xs(e.response.userHandle):void 0}})}function Zs(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Xs(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Ys,Qs=(Ys=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Bs(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await zs(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await Bs(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await zs(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Bs(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Bs,get:zs,isSupported:Hs,conditional:Ks}}),(...e)=>{const t=Ys(...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 ea="/fedcm/config",ta=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o,!0);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:l}=s.data,c=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var o,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+ea),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>Is&&"IdentityCredential"in window});var na=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Hs(),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 oa=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=c(t,["fpKey","fpLoad"]);return Is?(n&&o&&Ts(n).catch((()=>null)),e(bs(r,{beforeRequest:Ds}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=c(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;Is&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(xs("Expiration time passed, refreshing session"),d.refresh(Rs()||a))}));const d=e(bs(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await ys(t);if(401===(null==t?void 0:t.status))xs("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=v(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void xs("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Os&&(xs(`Timeout is too large (${e}ms), setting it to ${Os}ms`),e=Os),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});xs(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{xs("Refreshing session due to timer"),d.refresh(Rs()||n)}),e)}var l}}));return di(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return xs("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.1"},t.baseHeaders)}))),(e=>t=>{const n=qs(),o=qs(),r=e(bs(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await ws(t);e&&o.pub(e);const{sessionJwt:r}=await ys(t);r&&n.pub(r)}}})),i=di(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0}=t,o=c(t,["storeLastAuthenticatedUser"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:Ls,getLastUserDisplayName:Ws});const r=e(bs(o,{afterRequest:async(e,t)=>{var n;const o=await ws(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{Es(Ps,e)})(r),(e=>{Es(_s,e)})(i))}}));let i=di(r,["flow.start"],Fs);return i=di(i,["logout","logoutAll"],Vs),Object.assign(i,{getLastUserLoginId:Ls,getLastUserDisplayName:Ws})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!Is)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e(bs(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Rs(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||As(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&Es(`${n}${js}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);ln.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(Ss,r,i):Es(`${n}${Ss}`,r))})(await ys(t),o,r)}}));var a;const d=di(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return As(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Rs(r),getSessionToken:()=>function(e=""){return ln.get(Ss)||ks(`${e}${Ss}`)||""}(r)})}))(((...e)=>{const t=vs(...e);return Object.assign(Object.assign({},t),{flow:na(t),webauthn:Qs(t),fedcm:ta(t,e[0].projectId)})})),ra="undefined"!=typeof localStorage,ia=ra&&localStorage.getItem("base.content.url")||"",sa="config.json",aa="base.ui.components.url",da=ra&&localStorage.getItem(aa)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",la=ra&&localStorage.getItem(aa)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ca="descope-login-flow",ua="code",ha="ra-challenge",pa="ra-callback",fa="ra-backup-callback",ga="ra-initiator",ma="data-exclude-field",va="dls_last_auth",ba="state_id",ya="saml_idp_state_id",wa="saml_idp_username",$a="descope_idp_initiated",Ea="sso_app_id",ka="oidc_login_hint",Ca="data-type",xa="poll",Ia="webauthnCreate",Oa="submit",Sa="polling",ja=["descope-multi-select-combo-box","descope-text-area"];var Ra;function Aa(e){return new URLSearchParams(window.location.search).get(e)}function Na(e){if(window.history.replaceState&&Aa(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}function Ma(e,t){return u(this,void 0,void 0,(function*(){const n=yield fetch(e,{cache:"default"});if(!n.ok)throw Error(`Error fetching URL ${e} [${n.status}]`);return{body:yield n[t||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function Ua({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(ia||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function Ta(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?Ra.forward:n<o?Ra.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(Ra||(Ra={}));const Da=()=>{const[e="",t=""]=(Aa(ca)||"").split("_");return{executionId:e,stepId:t}};function Pa(){Na(ca)}const _a=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),La=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},Wa=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,Fa=e=>null==e?void 0:e.submit(),Va=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},qa=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function Ba(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var za,Ka,Ha,Ga;function Ja(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!Ja(i,s))return!1}else if(i!==s)return!1}return!0}class Za{constructor(e={},{updateOnlyOnChange:t=!0}={}){za.set(this,void 0),Ka.set(this,{}),Ha.set(this,0),Ga.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,za,"f")):e,n=Object.assign(Object.assign({},h(this,za,"f")),t);if(!h(this,Ga,"f")||!Ja(h(this,za,"f"),n)){const e=h(this,za,"f");p(this,za,n,"f"),Object.freeze(h(this,za,"f")),setTimeout((()=>{Object.values(h(this,Ka,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,za,e,"f"),p(this,Ga,t,"f")}get current(){return Object.assign({},h(this,za,"f"))}subscribe(e){return p(this,Ha,h(this,Ha,"f")+1,"f"),h(this,Ka,"f")[h(this,Ha,"f")]=e,h(this,Ha,"f").toString()}unsubscribe(e){const t=!!h(this,Ka,"f")[e];return t&&delete h(this,Ka,"f")[e],t}unsubscribeAll(){return p(this,Ka,{},"f"),!0}}za=new WeakMap,Ka=new WeakMap,Ha=new WeakMap,Ga=new WeakMap;const Xa=["disabled"],Ya=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${ma}])`)).forEach((e=>{e.value=n}))}))},Qa=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),ed=(e,t,n)=>{e.querySelectorAll(`[${Ca}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},td=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},nd=La((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=Promise.all([null===(e=window.PublicKeyCredential)||void 0===e?void 0:e.isConditionalMediationAvailable(),null===(t=window.PublicKeyCredential)||void 0===t?void 0:t.isUserVerifyingPlatformAuthenticatorAvailable()]).then((e=>e.every((e=>!!e)))),i=(()=>{var e;const t=null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===e?void 0:e.brands,n=null==t?void 0:t.find((({brand:e,version:t})=>"Chromium"===e&&parseFloat(t)));return n?n.version:0})()>=108;return yield(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),od={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function rd(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(va)))}catch(e){}return t}const id="dls_ab_testing_id",sd=document.createElement("template");var ad,dd,ld,cd,ud,hd,pd,fd,gd,md,vd,bd,yd,wd,$d,Ed,kd,Cd,xd,Id,Od,Sd,jd,Rd,Ad,Nd,Md,Ud,Td,Dd,Pd,_d,Ld,Wd,Fd,Vd,qd,Bd,zd,Kd,Hd,Gd,Jd,Zd,Xd,Yd,Qd,el,tl,nl,ol;sd.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class rl extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","validate-on-blur"]}constructor(e){super(),ad.add(this),this.logger=console,dd.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,ad,"m",Td).call(this,e,t)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",n={})=>{this.logger.info(e,t,n)},debug:(e,t="")=>{this.logger.debug(e,t)}},ld.set(this,new Za({deferredRedirect:!1})),cd.set(this,new Za),ud.set(this,{}),this.getComponentsContext=()=>h(this,ud,"f"),this.nextRequestStatus=new Za({isLoading:!1}),hd.set(this,void 0),pd.set(this,{popstate:h(this,ad,"m",yd).bind(this),visibilitychange:h(this,ad,"m",wd).bind(this),componentsContext:h(this,ad,"m",Ad).bind(this)}),fd.set(this,void 0),xd.set(this,La((()=>u(this,void 0,void 0,(function*(){const e=Ua({projectId:this.projectId,filename:sa,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield Ma(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Od.set(this,void 0),p(this,fd,e,"f"),h(this,ad,"m",gd).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){return this.getAttribute("tenant")||void 0}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light":n||"light"}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield h(this,xd,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,xd,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(h(this,cd,"f").subscribe(h(this,ad,"m",Ud).bind(this)),h(this,cd,"f").update({isDebug:this.debug}),h(this,ad,"m",md).call(this))return void h(this,ad,"m",vd).call(this);if(h(this,ad,"m",bd).call(this),p(this,Od,h(this,ad,"m",Id).call(this),"f"),yield h(this,ad,"m",kd).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");if((yield h(this,xd,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,ad,"m",Sd).call(this),yield h(this,ad,"m",_d).call(this),yield h(this,ad,"m",jd).call(this),h(this,ad,"m",Dd).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:f,ssoAppId:g,oidcLoginHint:m}=(()=>{const{executionId:e,stepId:t}=Da();(e||t)&&Pa();const n=Aa("t")||void 0;n&&Na("t");const o=Aa(ua)||void 0;o&&Na(ua);const r=Aa("err")||void 0;r&&Na("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:Aa(ha),redirectAuthCallbackUrl:Aa(pa),redirectAuthBackupCallbackUri:Aa(fa),redirectAuthInitiator:Aa(ga)};(i||s||a||d)&&(Na(ha),Na(pa),Na(fa),Na(ga));const l=Aa(ba);l&&Na(ba);const c=Aa(ya);c&&Na(ya);const u=Aa(wa);c&&Na(wa);const h=Aa($a);h&&Na($a);const p=Aa(Ea);p&&Na(Ea);const f=Aa(ka);return f&&Na(ka),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}})();window.addEventListener("popstate",h(this,pd,"f").popstate),window.addEventListener("components-context",h(this,pd,"f").componentsContext),window.addEventListener("visibilitychange",h(this,pd,"f").visibilitychange),h(this,ld,"f").subscribe(h(this,ad,"m",Ed).bind(this)),h(this,ld,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:f,ssoAppId:g,oidcLoginHint:m}),p(this,dd,!0,"f")}}))}disconnectedCallback(){h(this,ld,"f").unsubscribeAll(),h(this,cd,"f").unsubscribeAll(),h(this,ad,"m",Md).call(this),window.removeEventListener("popstate",h(this,pd,"f").popstate),window.removeEventListener("visibilitychange",h(this,pd,"f").visibilitychange),window.removeEventListener("components-context",h(this,pd,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,dd,"f")&&t!==n&&rl.observedAttributes.includes(e)){h(this,ad,"m",bd).call(this);const o=null===t;h(this,ld,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,Pa()),{[_a(e)]:n,stepId:i,executionId:s}})),h(this,cd,"f").update({isDebug:this.debug})}}}dd=new WeakMap,ld=new WeakMap,cd=new WeakMap,ud=new WeakMap,hd=new WeakMap,pd=new WeakMap,fd=new WeakMap,xd=new WeakMap,Od=new WeakMap,ad=new WeakSet,gd=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(sd.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},md=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},vd=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",t.style.height="100%",e.parentElement.appendChild(t),t.appendChild(e)},bd=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client","validate-on-blur"];if(rl.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[_a(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},yd=function(){const{stepId:e,executionId:t}=Da();h(this,ld,"f").update({stepId:e,executionId:t})},wd=function(){document.hidden||setTimeout((()=>{h(this,ld,"f").update({deferredRedirect:!1})}),300)},$d=function(e,t){this.sdk=oa(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},rl.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},Ed=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;h(this,ad,"m",$d).call(this,t,o)}h(this,fd,"f").call(this,e)}))},kd=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,xd,"f").call(this)).isMissingConfig&&(yield h(this,ad,"m",Cd).call(this))}))},Cd=function(){return u(this,void 0,void 0,(function*(){const e=Ua({projectId:this.projectId,filename:sa,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield Ma(e,"json"),!0}catch(e){return!1}}))},Id=function(){return u(this,void 0,void 0,(function*(){const e=Ua({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield Ma(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},Sd=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,xd,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},jd=function(){return u(this,void 0,void 0,(function*(){yield h(this,ad,"m",Rd).call(this),yield h(this,ad,"m",Nd).call(this)}))},Rd=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield h(this,Od,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield rl.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},Ad=function(e){p(this,ud,Object.assign(Object.assign({},h(this,ud,"f")),e.detail),"f")},Nd=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield rl.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},Md=function(){var e;null===(e=h(this,hd,"f"))||void 0===e||e.remove(),p(this,hd,null,"f")},Ud=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,hd,document.createElement("descope-debugger"),"f"),Object.assign(h(this,hd,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return oS})),document.body.appendChild(h(this,hd,"f"))):h(this,ad,"m",Md).call(this)}))},Td=function(e,t){var n;e&&this.debug&&(null===(n=h(this,hd,"f"))||void 0===n||n.updateData({title:e,description:t}))},Dd=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=ja.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)return;e.preventDefault();const s=this.rootElement.querySelectorAll("descope-button");if(1===s.length&&"false"!==s[0].getAttribute("auto-submit"))return void s[0].click();const a=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const d=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===d.length)"false"!==d[0].getAttribute("auto-submit")&&d[0].click();else if(0===d.length){const e=Array.from(s).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}},Pd=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,xd,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},_d=function(){return u(this,void 0,void 0,(function*(){rl.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):rl.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield h(this,ad,"m",Pd).call(this),i=t(n(da,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(la,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},rl.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.16.2"}};class il extends rl{static set sdkConfigOverrides(e){rl.sdkConfigOverrides=e}constructor(){const e=new Za;super(e.update.bind(e)),Ld.add(this),this.stepState=new Za({},{updateOnlyOnChange:!1}),Wd.set(this,void 0),Fd.set(this,null),Vd.set(this,((e,t,n,o,r)=>{n===xa&&p(this,Wd,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,Sa,o,r,{});h(this,Bd,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,Vd,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),qd.set(this,(()=>{clearTimeout(h(this,Wd,"f")),p(this,Wd,null,"f")})),Bd.set(this,(e=>{var t,n,o,r,i,s,a,d,l;if(!(null==e?void 0:e.ok)){h(this,Ld,"m",ol).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}const c=null===(d=null===(a=null===(s=e.data)||void 0===s?void 0:s.screen)||void 0===a?void 0:a.state)||void 0===d?void 0:d.errorText;(null===(l=e.data)||void 0===l?void 0:l.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${c?`${c} - `:""}${e.data.error.message}`):c&&this.loggerWrapper.error(c);const{status:u,authInfo:p,lastAuth:f}=e.data;if("completed"===u)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&ra&&localStorage.setItem(va,JSON.stringify(e))}(f),void h(this,Ld,"m",ol).call(this,"success",p);const{executionId:g,stepId:m,stepName:v,action:b,screen:y,redirect:w,openInNewTabUrl:$,webauthn:E,error:k,samlIdpResponse:C}=e.data;b!==xa?(this.loggerWrapper.info(`Step "${v||`#${m}`}" is ${u}`,"",{screen:y,status:u,stepId:m,stepName:v,action:b,error:k}),this.flowState.update({stepId:m,executionId:g,action:b,redirectTo:null==w?void 0:w.url,openInNewTabUrl:$,screenId:null==y?void 0:y.id,screenState:null==y?void 0:y.state,webauthnTransactionId:null==E?void 0:E.transactionId,webauthnOptions:null==E?void 0:E.options,samlIdpResponseUrl:null==C?void 0:C.url,samlIdpResponseSamlResponse:null==C?void 0:C.samlResponse,samlIdpResponseRelayState:null==C?void 0:C.relayState})):this.flowState.update({action:b})})),zd.set(this,La((()=>u(this,void 0,void 0,(function*(){var e;try{const t=yield this.sdk.webauthn.signIn.start("",window.location.origin);return t.ok||this.loggerWrapper.warn("Webauthn start failed",null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.errorMessage),t.data}catch(e){this.loggerWrapper.warn("Webauthn start failed",e.message)}}))))),Qd.set(this,qa(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,Ld,"m",Jd).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,Ld,"m",Xd).call(this,e);const r=yield h(this,Ld,"m",Zd).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(o,d.version,l.componentsVersion,a);h(this,Bd,"f").call(this,c),h(this,Ld,"m",Yd).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=h(this,Fd,"f"))||void 0===e||e.abort(),p(this,Fd,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=Ba(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield Ma(t,"text");return e}catch(n){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,n)}try{const{body:t}=yield Ma(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:l,action:c,screenId:u,screenState:f,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:b,code:y,exchangeError:w,webauthnTransactionId:$,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:I,oidcIdpStateId:O,locale:S,samlIdpStateId:j,samlIdpUsername:R,descopeIdpInitiated:A,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,_;const L=(()=>{const e=localStorage.getItem(id);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(id,e.toString()),e}return Number(e)})(),W=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(F.fingerprintEnabled&&F.fingerprintKey?yield Ts(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Ms),F.conditions?({startScreenId:P,conditionInteractionId:_}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=od[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:W,code:y,token:b,abTestingKey:L},F.conditions)):F.condition?({startScreenId:P,conditionInteractionId:_}=((e,t)=>{var n;const o=null===(n=od[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:W,code:y,token:b,abTestingKey:L})):P=F.startScreenId,!Wa(P,O,j,R,T,D))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:D,client:this.client},v&&{redirectUrl:v}),{lastAuth:rd(W),abTestingKey:L,locale:Ba(S)}),_,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),A&&{idpInitiated:!0}),b?{token:b}:{}),D?{externalId:D}:{}));return h(this,Bd,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&b||n("code")&&y||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(l,d,Oa,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return h(this,Bd,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===c&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!N||!M)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.innerHTML=`\n <input type="hidden" role="saml-response" name="SAMLResponse" value="${t}" />\n <input type="hidden" role="saml-relay-state" name="RelayState" value="${n}" />\n <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />\n `,document.body.appendChild(r),o(r)})(N,M,U||"",Fa)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===I&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===Ia||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=h(this,Fd,"f"))||void 0===r||r.abort(),p(this,Fd,null,"f");try{e=c===Ia?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(l,d,Oa,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});h(this,Bd,"f").call(this,n)}if(h(this,Vd,"f").call(this,l,d,c,F.version,V.componentsVersion),!u&&!P)return void this.loggerWrapper.warn("No screen was found to show");const B=P||u,z=yield this.getHtmlFilenameWithLocale(S,B),K={direction:Ta(d,t.stepId),screenState:Object.assign(Object.assign({},f),{form:Object.assign(Object.assign({},this.formConfigValues),null==f?void 0:f.form),lastAuth:{loginId:W,name:this.sdk.getLastUserDisplayName()||W}}),htmlUrl:Ua({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&Ua({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:R,oidcLoginHint:D,openInNewTabUrl:m},H=rd(W);Wa(P,O,j,R,T,D)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:D,lastAuth:H,preview:this.preview,abTestingKey:L,client:this.client},v&&{redirectUrl:v}),{locale:Ba(S)}),_,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),y&&{exchangeCode:y,idpInitiated:!0}),A&&{idpInitiated:!0}),b&&{token:b})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield rl.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const p=c.content.cloneNode(!0),f=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield h(this,Ld,"m",Gd).call(this,p,a):p.querySelectorAll(`descope-button[${Ca}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Ca}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),ed(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),ed(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=Qa(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",Qa(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Qa(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{Xa.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(p,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(p,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,td(r,"descope-totp-image",i),((e,t)=>{td(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(p),setTimeout((()=>{((e,t)=>{Ya(e,null==t?void 0:t.inputs),Ya(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-password"),t=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t].forEach((e=>h(this,Ld,"m",Hd).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),h(this,Ld,"m",tl).call(this,a),s&&h(this,Ld,"m",ol).call(this,"ready",{}),h(this,Ld,"m",ol).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Ca}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(Sa,e.version,t.componentsVersion,{});h(this,Bd,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?h(this,Ld,"m",nl).call(this,m,s):m()}))}}Wd=new WeakMap,Fd=new WeakMap,Vd=new WeakMap,qd=new WeakMap,Bd=new WeakMap,zd=new WeakMap,Qd=new WeakMap,Ld=new WeakSet,Kd=function(e){const t=e.getAttribute("name");if(!["email"].includes(t)){const n=`user-${t}`;e.setAttribute("name",n),e.addEventListener("input",(()=>{e.setAttribute("name",e.value?t:n)}))}},Hd=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},Gd=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,Fd,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield nd())){const{options:e,transactionId:n}=(yield h(this,zd,"f").call(this))||{};if(e&&n){h(this,Ld,"m",Kd).call(this,o),p(this,Fd,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,Fd,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});h(this,Bd,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},Jd=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).every((e=>{var t,n;return"slot"===e.localName||(null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e))}))},Zd=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${ma}])`));return(yield Promise.all(e.map((e=>u(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},Xd=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Yd=function(e={}){var t,n;const o=Va(e,["externalId","email","phone"]),r=Va(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,password:r});null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.store)||void 0===n||n.call(t,e)}catch(e){this.loggerWrapper.error("Could not store credentials",e.message)}},el=function(e){this.rootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.addEventListener("input",(()=>{var n;(null===(n=t.checkValidity)||void 0===n?void 0:n.call(t))&&h(this,Qd,"f").call(this,t,e)}))}))},tl=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,Qd,"f").call(this,t,e)}})),h(this,Ld,"m",el).call(this,e)},nl=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===Ra.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},ol=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",il);var sl=Object.freeze({__proto__:null,default:il});function al(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const dl=e=>{const t=document.createElement("template");return t.innerHTML=e,t},ll=(...e)=>e.join("/").replace(/\/+/g,"/"),cl=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),ul=e=>{let t,n;return(...o)=>(t&&cl(t,o)||(t=o,n=e(...o)),n)},hl=e=>(t,...n)=>t.reduce(((t,o,r)=>{var i;return`${t}${o}${(null===(i=null==n?void 0:n[r])||void 0===i?void 0:i[e>1?1:0])||""}`}),""),pl=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},fl=e=>{const t=Symbol((e=>{const t=e.toString();let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return n.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}};var gl,ml,vl,bl,yl,wl;function $l(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!$l(i,s))return!1}else if(i!==s)return!1}return!0}class El{constructor(e={},{updateOnlyOnChange:t=!0}={}){gl.set(this,void 0),ml.set(this,{}),vl.set(this,0),bl.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,gl,"f")):e,n=Object.assign(Object.assign({},h(this,gl,"f")),t);if(!h(this,bl,"f")||!$l(h(this,gl,"f"),n)){const e=h(this,gl,"f");p(this,gl,n,"f"),Object.freeze(h(this,gl,"f")),setTimeout((()=>{Object.values(h(this,ml,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,gl,e,"f"),p(this,bl,t,"f")}get current(){return Object.assign({},h(this,gl,"f"))}subscribe(e){return p(this,vl,h(this,vl,"f")+1,"f"),h(this,ml,"f")[h(this,vl,"f")]=e,h(this,vl,"f").toString()}unsubscribe(e){const t=!!h(this,ml,"f")[e];return t&&delete h(this,ml,"f")[e],t}unsubscribeAll(){return p(this,ml,{},"f"),!0}}gl=new WeakMap,ml=new WeakMap,vl=new WeakMap,bl=new WeakMap;class kl{constructor(e,t){yl.set(this,void 0),this.nodeName="",p(this,yl,e,"f"),this.logger=t.logger}get asyncEle(){return(async(e,t)=>new Promise((t=>{const n=setInterval((()=>{const o="function"==typeof e?e():e;o&&(clearInterval(n),t(o))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(h(this,yl,"f"))}get ele(){var e,t;const n="function"==typeof h(this,yl,"f")?h(this,yl,"f").call(this):h(this,yl,"f");return n?(null==n?void 0:n.localName)!==this.nodeName?(null===(t=this.logger)||void 0===t||t.debug(`node name do not match, expected "${this.nodeName}", received "${n.localName}" `,Error()),null):n:(null===(e=this.logger)||void 0===e||e.debug("no element for driver ",this.constructor.name,new Error),null)}}yl=new WeakMap;const Cl=/^descope-grid-([^-]+)-column$/,xl={text:class extends kl{constructor(){super(...arguments),this.nodeName="descope-grid-text-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}},custom:class extends kl{constructor(){super(...arguments),this.nodeName="descope-grid-custom-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}}};class Il extends kl{constructor(){super(...arguments),this.nodeName="descope-grid",wl.set(this,void 0)}onSelectedItemsChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("selected-items-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}get ele(){return super.ele}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}set data(e){this.ele&&(this.ele.data=e)}get columns(){return this.ele?Array.from(this.ele.children).reduce(((e,t)=>{var n;const o=null===(n=Cl.exec(t.localName))||void 0===n?void 0:n[1],r=xl[o];return r?(e.push(new r(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const o=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);cl(o,this.ele.columns)||(this.ele.columns=o,null===(n=h(this,wl,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){p(this,wl,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}wl=new WeakMap;class Ol extends kl{constructor(){super(...arguments),this.nodeName="descope-button"}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}}var Sl;class jl extends kl{constructor(){super(...arguments),Sl.set(this,void 0),this.nodeName="descope-modal"}close(){var e,t;null===(e=this.ele)||void 0===e||e.removeAttribute("opened"),null===(t=this.afterClose)||void 0===t||t.call(this)}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),h(this,Sl,"f")&&(null===(e=this.ele)||void 0===e||e.append(h(this,Sl,"f").content.cloneNode(!0)))}setContent(e){p(this,Sl,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Sl=new WeakMap;class Rl extends kl{constructor(){super(...arguments),this.nodeName="descope-multi-select-combo-box"}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}}class Al extends kl{constructor(){super(...arguments),this.nodeName="descope-combo-box"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}}class Nl extends kl{constructor(){super(...arguments),this.nodeName="descope-notification"}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}show(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("opened","true")}setContent(e){this.ele.innerHTML="",this.ele.appendChild(e.content.cloneNode(!0))}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}class Ml extends kl{constructor(){super(...arguments),this.nodeName="descope-text"}get ele(){return super.ele}get text(){var e;return null===(e=this.ele)||void 0===e?void 0:e.innerText}set text(e){this.ele&&(this.ele.innerText=e)}}class Ul extends kl{constructor(){super(...arguments),this.nodeName="descope-text-field"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}}class Tl extends kl{constructor(){super(...arguments),this.nodeName="descope-avatar"}set displayName(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("display-name",e)}set image(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("img",e)}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}}class Dl extends kl{constructor(){super(...arguments),this.nodeName="descope-user-attribute"}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",e)}set badgeLabel(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("badge-label",e)}get label(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("label"))||""}get editFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("edit-flow-id"))||""}get deleteFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("delete-flow-id"))||""}onEditClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("edit-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("edit-clicked",e)}}onDeleteClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("delete-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("delete-clicked",e)}}}class Pl extends kl{constructor(){super(...arguments),this.nodeName="descope-user-auth-method"}set fulfilled(e){var t,n;e?null===(t=this.ele)||void 0===t||t.setAttribute("fulfilled","true"):null===(n=this.ele)||void 0===n||n.removeAttribute("fulfilled")}onButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}}class _l extends kl{constructor(){super(...arguments),this.nodeName="descope-wc"}set projectId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("project-id",e)}set baseUrl(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("base-url",e)}set flowId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("flow-id",e)}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}}function Ll(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Wl=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Fl=()=>Math.random().toString(36).substring(7).split("").join("."),Vl={INIT:`@@redux/INIT${Fl()}`,REPLACE:`@@redux/REPLACE${Fl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Fl()}`};function ql(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Bl(e){if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";const n=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function zl(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Bl(e)),t}function Kl(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ll(2):`Expected the root reducer to be a function. Instead, received: '${zl(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Ll(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("production"===process.env.NODE_ENV?Ll(1):`Expected the enhancer to be a function. Instead, received: '${zl(n)}'`);return n(Kl)(e,t)}let o=e,r=t,i=new Map,s=i,a=0,d=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("production"===process.env.NODE_ENV?Ll(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return r}function u(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ll(4):`Expected the listener to be a function. Instead, received: '${zl(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Ll(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(d)throw new Error("production"===process.env.NODE_ENV?Ll(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,l(),s.delete(n),i=null}}}function h(e){if(!ql(e))throw new Error("production"===process.env.NODE_ENV?Ll(7):`Actions must be plain objects. Instead, the actual type was: '${zl(e)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(void 0===e.type)throw new Error("production"===process.env.NODE_ENV?Ll(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if("string"!=typeof e.type)throw new Error("production"===process.env.NODE_ENV?Ll(17):`Action "type" property must be a string. Instead, the actual type was: '${zl(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Ll(9):"Reducers may not dispatch actions.");try{d=!0,r=o(r,e)}finally{d=!1}return(i=s).forEach((e=>{e()})),e}function p(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ll(10):`Expected the nextReducer to be a function. Instead, received: '${zl(e)}`);o=e,h({type:Vl.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Ll(11):`Expected the observer to be an object. Instead, received: '${zl(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Wl](){return this}}}h({type:Vl.INIT});const g={dispatch:h,subscribe:u,getState:c,replaceReducer:p,[Wl]:f};return g}function Hl(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Gl(e){const t=Object.keys(e),n={};for(let o=0;o<t.length;o++){const r=t[o];"production"!==process.env.NODE_ENV&&void 0===e[r]&&Hl(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const o=Object.keys(n);let r,i;"production"!==process.env.NODE_ENV&&(r={});try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Vl.INIT}))throw new Error("production"===process.env.NODE_ENV?Ll(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(void 0===n(void 0,{type:Vl.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Ll(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Vl.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)}))}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;if("production"!==process.env.NODE_ENV){const o=function(e,t,n,o){const r=Object.keys(t),i=n&&n.type===Vl.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===r.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!ql(e))return`The ${i} has unexpected type of "${zl(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!o[e]));return s.forEach((e=>{o[e]=!0})),n&&n.type===Vl.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);o&&Hl(o)}let s=!1;const a={};for(let r=0;r<o.length;r++){const i=o[r],d=n[i],l=e[i],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?Ll(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${i}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[i]=c,s=s||c!==l}return s=s||o.length!==Object.keys(e).length,s?a:e}}function Jl(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Zl(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?Ll(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:r.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map((e=>e(s)));return i=Jl(...a)(r.dispatch),{...r,dispatch:i}}}function Xl(e){return ql(e)&&"type"in e&&"string"==typeof e.type}var Yl=Symbol.for("immer-nothing"),Ql=Symbol.for("immer-draftable"),ec=Symbol.for("immer-state"),tc="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function nc(e,...t){if("production"!==process.env.NODE_ENV){const n=tc[e],o="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var oc=Object.getPrototypeOf;function rc(e){return!!e&&!!e[ec]}function ic(e){return!!e&&(ac(e)||Array.isArray(e)||!!e[Ql]||!!e.constructor?.[Ql]||hc(e)||pc(e))}var sc=Object.prototype.constructor.toString();function ac(e){if(!e||"object"!=typeof e)return!1;const t=oc(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===sc}function dc(e,t){0===lc(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function lc(e){const t=e[ec];return t?t.type_:Array.isArray(e)?1:hc(e)?2:pc(e)?3:0}function cc(e,t){return 2===lc(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function uc(e,t,n){const o=lc(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function hc(e){return e instanceof Map}function pc(e){return e instanceof Set}function fc(e){return e.copy_||e.base_}function gc(e,t){if(hc(e))return new Map(e);if(pc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&ac(e)){if(!oc(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ec];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(oc(e),n)}function mc(e,t=!1){return bc(e)||rc(e)||!ic(e)||(lc(e)>1&&(e.set=e.add=e.clear=e.delete=vc),Object.freeze(e),t&&dc(e,((e,t)=>mc(t,!0)))),e}function vc(){nc(2)}function bc(e){return Object.isFrozen(e)}var yc,wc={};function $c(e){const t=wc[e];return t||nc(0,e),t}function Ec(){return yc}function kc(e,t){t&&($c("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Cc(e){xc(e),e.drafts_.forEach(Oc),e.drafts_=null}function xc(e){e===yc&&(yc=e.parent_)}function Ic(e){return yc={drafts_:[],parent_:yc,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Oc(e){const t=e[ec];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Sc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ec].modified_&&(Cc(t),nc(4)),ic(e)&&(e=jc(t,e),t.parent_||Ac(t,e)),t.patches_&&$c("Patches").generateReplacementPatches_(n[ec].base_,e,t.patches_,t.inversePatches_)):e=jc(t,n,[]),Cc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Yl?e:void 0}function jc(e,t,n){if(bc(t))return t;const o=t[ec];if(!o)return dc(t,((r,i)=>Rc(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Ac(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),dc(r,((r,s)=>Rc(e,o,t,r,s,n,i))),Ac(e,t,!1),n&&e.patches_&&$c("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Rc(e,t,n,o,r,i,s){if("production"!==process.env.NODE_ENV&&r===n&&nc(5),rc(r)){const s=jc(e,r,i&&t&&3!==t.type_&&!cc(t.assigned_,o)?i.concat(o):void 0);if(uc(n,o,s),!rc(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(ic(r)&&!bc(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;jc(e,r),t&&t.scope_.parent_||Ac(e,r)}}function Ac(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&mc(t,n)}var Nc={get(e,t){if(t===ec)return e;const n=fc(e);if(!cc(n,t))return function(e,t,n){const o=Tc(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!ic(o)?o:o===Uc(e.base_,t)?(Pc(e),e.copy_[t]=_c(o,e)):o},has:(e,t)=>t in fc(e),ownKeys:e=>Reflect.ownKeys(fc(e)),set(e,t,n){const o=Tc(fc(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Uc(fc(e),t),r=o?.[ec];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,o)&&(void 0!==n||cc(e.base_,t)))return!0;Pc(e),Dc(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Uc(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Pc(e),Dc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=fc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){nc(11)},getPrototypeOf:e=>oc(e.base_),setPrototypeOf(){nc(12)}},Mc={};function Uc(e,t){const n=e[ec];return(n?fc(n):e)[t]}function Tc(e,t){if(!(t in e))return;let n=oc(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=oc(n)}}function Dc(e){e.modified_||(e.modified_=!0,e.parent_&&Dc(e.parent_))}function Pc(e){e.copy_||(e.copy_=gc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}dc(Nc,((e,t)=>{Mc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Mc.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&nc(13),Mc.set.call(this,e,t,void 0)},Mc.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&nc(14),Nc.set.call(this,e[0],t,n,e[0])};function _c(e,t){const n=hc(e)?$c("MapSet").proxyMap_(e,t):pc(e)?$c("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Ec(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Nc;n&&(r=[o],i=Mc);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:Ec()).drafts_.push(n),n}function Lc(e){return rc(e)||nc(10,e),Wc(e)}function Wc(e){if(!ic(e)||bc(e))return e;const t=e[ec];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=gc(e,t.scope_.immer_.useStrictShallowCopy_)}else n=gc(e,!0);return dc(n,((e,t)=>{uc(n,e,Wc(t))})),t&&(t.finalized_=!1),n}var Fc=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&nc(6),void 0!==n&&"function"!=typeof n&&nc(7),ic(e)){const r=Ic(this),i=_c(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Cc(r):xc(r)}return kc(r,n),Sc(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===Yl&&(o=void 0),this.autoFreeze_&&mc(o,!0),n){const t=[],r=[];$c("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}nc(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;const r=this.produce(e,t,((e,t)=>{n=e,o=t}));return[r,n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ic(e)||nc(8),rc(e)&&(e=Lc(e));const t=Ic(this),n=_c(e,void 0);return n[ec].isManual_=!0,xc(t),n}finishDraft(e,t){const n=e&&e[ec];n&&n.isManual_||nc(9);const{scope_:o}=n;return kc(o,t),Sc(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=$c("Patches").applyPatches_;return rc(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},Vc=Fc.produce;Fc.produceWithPatches.bind(Fc),Fc.setAutoFreeze.bind(Fc),Fc.setUseStrictShallowCopy.bind(Fc),Fc.applyPatches.bind(Fc),Fc.createDraft.bind(Fc),Fc.finishDraft.bind(Fc);var qc=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},Bc=(e,t,n)=>{const{memoize:o,memoizeOptions:r}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=o((()=>({})),...r);if(!(a.apply(null,i)===a.apply(null,s))){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:i,secondInputs:s,stack:e})}},zc={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Kc=e=>Array.isArray(e)?e:[e];function Hc(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Gc(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var Jc=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...zc,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:qc},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:Bc}}},Zc="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function Xc(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:o}=t;let r,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}else{let e=t.p;null===e&&(t.p=e=new Map);const o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}}const a=t;let d;if(1===t.s?d=t.v:(d=e.apply(null,arguments),i++),a.s=1,o){const e=r?.deref?.()??r;null!=e&&o(e,d)&&(d=e,0!==i&&i--);r="object"==typeof d&&null!==d||"function"==typeof d?new Zc(d):d}return a.v=d,d}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Yc(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,o=(...e)=>{let t,o=0,r=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:d,memoizeOptions:l=[],argsMemoize:c=Xc,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=Kc(l),f=Kc(u),g=Hc(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const b=c((function(){r++;const e=Gc(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=Jc(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=Gc(g,arguments);o.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:p},arguments)}v&&(v=!1)}return t}),...f);return Object.assign(b,{resultFunc:s,memoizedResultFunc:m,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:c})};return Object.assign(o,{withTypes:()=>o}),o}var Qc=Yc(Xc),eu=Object.assign(((e,t=Qc)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e),o=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,o)=>(e[n[o]]=t,e)),{})));return o}),{withTypes:()=>eu});function tu(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var nu=tu(),ou=tu;((...e)=>{const t=Yc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(rc(e)?Lc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Xc);var ru="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Jl:Jl.apply(null,arguments)},iu=e=>e&&"function"==typeof e.match;function su(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?zu(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Xl(t)&&t.type===e,n}function au(e){return"function"==typeof e&&"type"in e&&iu(e)}function du(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var lu=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function cu(e){return ic(e)?Vc(e,(()=>{})):e}function uu(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?zu(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function hu(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function pu(e,t,n){const o=fu(e,t,n);return{detectMutations:()=>gu(e,t,o,n)}}function fu(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=fu(e,t,n[r],s))}}return i}function gu(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=gu(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function mu(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ql(e)}function vu(e,t="",n=mu,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=vu(l,a,n,o,r,i),s))return s}return i&&bu(e)&&i.add(e),!1}function bu(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!bu(t))return!1;return!0}function yu(e){return"boolean"==typeof e}var wu=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new lu;if(t&&(yu(t)?i.push(nu):i.push(ou(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};yu(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=hu,ignoredPaths:r,warnAfter:i=32}=e;const s=pu.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=du(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?zu(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?zu(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};yu(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=mu,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!Xl(u))return l(u);const h=l(u),p=du(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=vu(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=vu(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};yu(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=au}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},$u=e=>t=>{setTimeout(t,e)},Eu="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:$u(10),ku=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new lu(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Eu:"callback"===e.type?e.queueNotification:$u(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Cu="production"===process.env.NODE_ENV;function xu(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?zu(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?zu(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?zu(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?zu(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?zu(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?zu(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Iu=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Ou(...e){return t=>e.some((e=>((e,t)=>iu(e)?e.match(t):e(t))(e,t)))}var Su=["name","message","stack","code"],ju=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ru=class{constructor(e,t){this.payload=e,this.meta=t}_type},Au=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Su)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Nu=(()=>{function e(e,t,n){const o=su(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=su(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=su(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Au)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):Iu(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new ju(e,t),fulfillWithValue:(e,t)=>new Ru(e,t)})).then((t=>{if(t instanceof ju)throw t;return t instanceof Ru?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof ju?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(Mu)})}}),{pending:r,rejected:i,fulfilled:o,settled:Ou(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Mu(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Uu=Symbol.for("rtk-slice-createasyncthunk");function Tu(e,t){return`${e}/${t}`}function Du({creators:e}={}){const t=e?.asyncThunk?.[Uu];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?zu(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?zu(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?zu(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?zu(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?xu(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?zu(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=xu(t);if(function(e){return"function"==typeof e}(e))n=()=>cu(e());else{const t=cu(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(rc(e)){const o=n(e,t);return void 0===o?e:o}if(ic(e))return Vc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?zu(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Tu(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?zu(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?su(e,s):su(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?zu(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||Lu,pending:a||Lu,rejected:d||Lu,settled:l||Lu})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?zu(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=uu(c,n,{insert:()=>new WeakMap});return uu(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Pu(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function Pu(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?zu(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var _u=Du();function Lu(){}var Wu="listenerMiddleware",Fu=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=su(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?zu(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?zu(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Vu=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Fu(e);return{id:Iu(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?zu(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Vu}),qu=Object.assign(su(`${Wu}/add`),{withTypes:()=>qu});su(`${Wu}/removeAll`);var Bu=Object.assign(su(`${Wu}/remove`),{withTypes:()=>Bu});function zu(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Ku=["error","warn","info","debug"],Hu=fl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return Ku.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),Gu="undefined"!=typeof localStorage,Ju=Gu&&localStorage.getItem("base.content.url")||"",Zu=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Xu=fl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Yu=fl((e=>{var t,n;const o=al(Hu,Xu)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),Qu=e=>t=>{var n,o,r;const i=al(Hu,Xu,Yu)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};Qu.missingAttrValidator=Zu;const eh=fl((e=>{const t=al(Qu({"project-id":Zu}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),th=fl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const nh=fl((e=>{const t=al(Hu,eh,th)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Ju||o||"https://static.descope.com/pages");return r.pathname=ll(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),oh=fl((e=>{var t,n,o;const r=al(nh)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),rh=fl((e=>{var t,n,o,r,i,s,a;return a=class extends(al(Xu,Hu)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Dh})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),ih="load-descope-ui",sh="base.ui.components.url",ah=Gu&&localStorage.getItem(sh)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",dh=Gu&&localStorage.getItem(sh)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",lh=e=>{const t=document.createElement("script");return t.id=e,t},ch=(e,t)=>e.replace("<version>",t),uh=fl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=al(Hu,oh)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return h(this,l,"f")||p(this,l,h(this,t,"m",u).call(this),"f"),h(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>h(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=lh("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=ch(dh,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${ih}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=lh(ih);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=ch(ah,await h(this,t,"m",r).call(this))}return document.getElementById(ih)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),hh="content-root",ph="root",fh=fl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${ph}, #${hh} {\n height: 100%;\n }\n #${ph} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${ph}">\n <div id="${hh}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(hh),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(ph)}})),gh="descope-modal",mh=fl((e=>{var t,n;const o=al(Xu,fh,uh)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends jl{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(gh);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([gh]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),vh="descope-notification",bh=fl((e=>{var t,n;const o=al(Xu,fh,uh)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Nl{setContent(t){const n="string"==typeof t?dl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(vh);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([vh])}},t=new WeakMap,n})),yh=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',wh=fl((e=>{var t,n,o,r,i,s,a,d,l;const c=al(Qu({theme:yh}),nh,Xu,uh,oh,fh,Yu)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(sh)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(sh),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),$h=e=>fl((t=>{const n=_u(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(al(Hu)(t)){constructor(...e){super(...e);const t=function(e){const t=wu(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!ql(n))throw new Error("production"===process.env.NODE_ENV?zu(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Gl(n)}if(!Cu&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?zu(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Cu&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?zu(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Cu&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?zu(4):"each middleware provided to configureStore must be a function");let l=Jl;r&&(l=ru({trace:!Cu,..."object"==typeof r&&r}));const c=Zl(...d),u=ku(c);if(!Cu&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?zu(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Cu&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?zu(6):"`enhancers` callback must return an array");if(!Cu&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?zu(7):"each enhancer provided to configureStore must be a function");return Cu||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Kl(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{Mu(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Eh=fl((e=>class extends(Hu(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));fl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const kh=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Ch,xh,Ih,Oh,Sh,jh,Rh,Ah,Nh,Mh;const Uh=document.createElement("template");Uh.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Th extends HTMLElement{constructor(){var e;super(),Ch.add(this),xh.set(this,new El({messages:[]})),Ih.set(this,void 0),Oh.set(this,void 0),Sh.set(this,void 0),jh.set(this,{resize:h(this,Ch,"m",Mh).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Uh.content.cloneNode(!0)),p(this,Ih,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Oh,h(this,Ih,"f").querySelector(".content"),"f"),p(this,Sh,h(this,Ih,"f").querySelector(".header"),"f")}updateData(e){h(this,xh,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=kh(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,Ih,"f"),h(this,Sh,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,jh,"f").resize),(e=h(this,Ih,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,Ih,"f").onresize=h(this,Ch,"m",Nh).bind(this),h(this,xh,"f").subscribe(h(this,Ch,"m",Rh).bind(this))}disconnectedCallback(){h(this,xh,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,jh,"f").resize)}}xh=new WeakMap,Ih=new WeakMap,Oh=new WeakMap,Sh=new WeakMap,jh=new WeakMap,Ch=new WeakSet,Rh=function(e){h(this,Ch,"m",Ah).call(this,e),h(this,Ch,"m",Nh).call(this)},Ah=function(e){h(this,Oh,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Nh=function(){h(this,Oh,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Mh=function(){const[e,t]=kh(h(this,Ih,"f"),Number.parseInt(h(this,Ih,"f").style.left,10),Number.parseInt(h(this,Ih,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Ih,"f").style.top=`${t}px`,h(this,Ih,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Th);var Dh=Object.freeze({__proto__:null}),Ph={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:1[3-79]|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:22|44|7[27]|87|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-689]|8[1-69]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","2[0-24-9]\\d{8}|[78]\\d{10,13}|[7-9]\\d{9}|[1-9]\\d{7}|[124-7]\\d{6}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-6]|7(?:0[0-689]|[1-79])|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","810","(?:20|33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function _h(e,t){var n=Array.prototype.slice.call(t);return n.push(Ph),e.apply(this,n)}function Lh(e){return Lh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lh(e)}function Wh(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Fh(e,t){if(t&&("object"===Lh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Vh(e)}function Vh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qh(e){var t="function"==typeof Map?new Map:void 0;return qh=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return Bh(e,arguments,Hh(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Kh(o,e)},qh(e)}function Bh(e,t,n){return Bh=zh()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&Kh(r,n.prototype),r},Bh.apply(null,arguments)}function zh(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Kh(e,t){return Kh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Kh(e,t)}function Hh(e){return Hh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Hh(e)}var Gh=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Kh(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=zh(),function(){var e,o=Hh(t);if(n){var r=Hh(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return Fh(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=s.call(this,e),Object.setPrototypeOf(Vh(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&Wh(o.prototype,r),i&&Wh(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(qh(Error)),Jh="0-90-9٠-٩۰-۹",Zh="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function Xh(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),o=t[0].split("."),r=0;r<3;r++){var i=Number(n[r]),s=Number(o[r]);if(i>s)return 1;if(s>i)return-1;if(!isNaN(i)&&isNaN(s))return 1;if(isNaN(i)&&!isNaN(s))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}var Yh={}.constructor;function Qh(e){return null!=e&&e.constructor===Yh}function ep(e){return ep="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ep(e)}function tp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function np(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function op(e,t,n){return t&&np(e.prototype,t),n&&np(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var rp=" ext. ",ip=/^\d+$/,sp=function(){function e(t){tp(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Qh(e)||!Qh(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Qh(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+hp(e)+": "+e,"."))}(t),this.metadata=t,fp.call(this,t)}return op(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&ip.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new ap(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new ap(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var n=this.nonGeographic()[e];if(n)return n}else{var o=this.countryCallingCodes()[e];if(o&&1===o.length&&"001"===o[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),ap=function(){function e(t,n){tp(this,e),this.globalMetadataObject=n,this.metadata=t,fp.call(this,n.metadata)}return op(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this,t=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return t.map((function(t){return new dp(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(e){if(this.hasTypes()&&up(this.types(),e))return new cp(up(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?rp:this.metadata[13]||rp}}]),e}(),dp=function(){function e(t,n){tp(this,e),this._format=t,this.metadata=n}return op(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||lp.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),lp=/^\(?\$1\)?$/,cp=function(){function e(t,n){tp(this,e),this.type=t,this.metadata=n}return op(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function up(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var hp=function(e){return ep(e)};function pp(e,t){if((t=new sp(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function fp(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===Xh(t,"1.2.0")?this.v2=!0:-1===Xh(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var gp=function(e){return"([".concat(Jh,"]{1,").concat(e,"})")};function mp(e){var t="[  \\t,]*",n="[:\\..]?[  \\t,-]*",o="#?",r="[  \\t]*";return";ext="+gp("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+gp("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+gp("9")+o)+"|"+("[- ]+"+gp("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+gp("15")+o)+"|"+(r+"(?:,)+"+n+gp("9")+o)}var vp="["+Jh+"]{2}",bp="[++]{0,1}(?:["+Zh+"]*["+Jh+"]){3,}["+Zh+Jh+"]*",yp=new RegExp("^[++]{0,1}(?:["+Zh+"]*["+Jh+"]){1,2}$","i"),wp=bp+"(?:"+mp()+")?",$p=new RegExp("^"+vp+"$|^"+wp+"$","i");var Ep=new RegExp("(?:"+mp()+")$","i");var kp={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Cp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ip(e){for(var t,n="",o=Cp(e.split(""));!(t=o()).done;){n+=Op(t.value,n)||""}return n}function Op(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return kp[e]}(e)}function Sp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return jp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function jp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Rp(e,t){return Ap(e,void 0,t)}function Ap(e,t,n){var o=n.type(t),r=o&&o.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!n.type("FIXED_LINE"))return Ap(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=Sp(t);!(n=r()).done;){var i=n.value;e.indexOf(i)<0&&o.push(i)}return o.sort((function(e,t){return e-t}))}(r,i.possibleLengths()))}else if(t&&!o)return"INVALID_LENGTH";var s=e.length,a=r[0];return a===s?"IS_POSSIBLE":a>s?"TOO_SHORT":r[r.length-1]<s?"TOO_LONG":r.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function Np(e,t){return"IS_POSSIBLE"===Rp(e,t)}function Mp(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Up(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Tp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var Dp=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Pp(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new sp(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(Mp(o,n.nationalNumberPattern())){if(_p(o,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?_p(o,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,i=Up(Dp);!(r=i()).done;){var s=r.value;if(_p(o,s,n))return s}}}}function _p(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Mp(e,t.pattern()))}function Lp(e,t,n){var o=new sp(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new sp(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var Wp=/(\$\d)/;function Fp(e,t,n){var o=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var i=e.replace(new RegExp(t.pattern()),o?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(Wp,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(Zh,"]+"),"g")," ").trim()}(i):i}var Vp=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function qp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Bp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function zp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Kp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zp(Object(n),!0).forEach((function(t){Hp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gp={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function Jp(e,t,n,o){if(n=n?Kp(Kp({},Gp),n):Gp,o=new sp(o),e.country&&"001"!==e.country){if(!o.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));o.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";o.selectNumberingPlan(e.countryCallingCode)}var r,i=o.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?Xp(r=Zp(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=Zp(s,null,"INTERNATIONAL",o,n),Xp(r="+".concat(i," ").concat(r),e.ext,o,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(s);case"RFC3966":return function(e){var t=e.number,n=e.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(n?";ext="+n:"")}({number:"+".concat(i).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,o,r){var i=pp(o,r.metadata);if(i===n){var s=Zp(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new sp(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():Vp.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(Zp(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return Xp(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function Zp(e,t,n,o,r){var i=function(e,t){for(var n,o=qp(e);!(n=o()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var i=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(i))continue}if(Mp(t,r.pattern()))return r}}(o.formats(),e);return i?Fp(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function Xp(e,t,n,o){return t?o(e,t,n):e}function Yp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Qp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yp(Object(n),!0).forEach((function(t){ef(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ef(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tf(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var nf=function(){function e(t,n,o){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!n)throw new TypeError("`nationalNumber` not passed");if(!o)throw new TypeError("`metadata` not passed");var r=function(e,t){var n,o,r=new sp(t);i=e,/^[A-Z]{2}$/.test(i)?(n=e,r.selectNumberingPlan(n),o=r.countryCallingCode()):o=e;var i;return{country:n,countryCallingCode:o}}(t,o),i=r.country,s=r.countryCallingCode;this.country=i,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}var t,n,o;return t=e,n=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Lp(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new sp(n),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!n.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}}if(n.possibleLengths())return Np(e.phone||e.nationalNumber,n);if(e.countryCallingCode&&n.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return function(e,t,n){return t=t||{},(n=new sp(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Pp(e,t,n.metadata):Mp(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new sp(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Pp(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Jp(this,e,t?Qp(Qp({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],n&&tf(t.prototype,n),o&&tf(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var of=new RegExp("(["+Jh+"])");function rf(e,t){var n=function(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),o=n.exec(e);if(o){var r,i,s,a=o.length-1,d=a>0&&o[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(i=o[1]);else{var l=o[0];r=e.slice(l.length),d&&(i=o[1])}if(d){var c=e.indexOf(o[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=o[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:i}}}return{nationalNumber:e}}(e,t),o=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Mp(e,n.nationalNumberPattern())&&!Mp(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Rp(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:o}}function sf(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new sp(o);r.selectNumberingPlan(t,n);var i=new RegExp(r.IDDPrefix());if(0===e.search(i)){var s=(e=e.slice(e.match(i)[0].length)).match(of);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}(e,t,n,o);if(!i||i===e){if(t||n){var s=function(e,t,n,o){var r=t?pp(t,o):n;if(0===e.indexOf(r)){(o=new sp(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=rf(i,o).nationalNumber,a=rf(e,o).nationalNumber;if(!Mp(a,o.nationalNumberPattern())&&Mp(s,o.nationalNumberPattern())||"TOO_LONG"===Rp(a,o))return{countryCallingCode:r,number:i}}return{number:e}}(e,t,n,o),a=s.countryCallingCode,d=s.number;if(a)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:d}}return{number:e}}r=!0,e="+"+i}if("0"===e[1])return{};o=new sp(o);for(var l=2;l-1<=3&&l<=e.length;){var c=e.slice(1,l);if(o.hasCallingCode(c))return o.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function af(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return df(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return df(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function df(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function lf(e,t){var n=t.nationalNumber,o=t.defaultCountry,r=t.metadata,i=r.getCountryCodesForCallingCode(e);if(i)return 1===i.length?i[0]:function(e,t){var n=t.countries,o=t.defaultCountry,r=t.metadata;r=new sp(r);for(var i,s=[],a=af(n);!(i=a()).done;){var d=i.value;if(r.country(d),r.leadingDigits()){if(e&&0===e.search(r.leadingDigits()))return d}else if(Pp({phone:e,country:d},void 0,r.metadata)){if(!o)return d;if(d===o)return d;s.push(d)}}if(s.length>0)return s[0]}(n,{countries:i,defaultCountry:o,metadata:r.metadata})}var cf="(["+Jh+"]|[\\-\\.\\(\\)]?)",uf=new RegExp("^\\+"+cf+"*["+Jh+"]"+cf+"*$","g"),hf=new RegExp("^("+("["+Jh+"]+((\\-)*["+Jh+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Jh+"])*")+"\\.?$","g"),pf="tel:",ff=";phone-context=";function gf(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(ff);if(t<0)return null;var n=t+ff.length;if(n>=e.length)return"";var o=e.indexOf(";",n);return o>=0?e.substring(n,o):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(uf.test(e)||hf.test(e))}(r))throw new Gh("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(pf);i=s>=0?s+pf.length:0;var a=e.indexOf(ff);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var mf=new RegExp("[++"+Jh+"]"),vf=new RegExp("[^"+Jh+"#]+$");function bf(e,t,n){if(t=t||{},n=new sp(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Gh("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=gf(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new Gh("TOO_LONG");return}if(!1===t)return e;var o=e.search(mf);if(o<0)return;return e.slice(o).replace(vf,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&$p.test(e)}(o))return function(e){return yp.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Ep);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(Ep),r=1;r<o.length;){if(o[r])return{number:n,ext:o[r]};r++}}(o);if(r.ext)return r;return{number:o}}(e,t.v2,t.extract),r=o.number,i=o.ext,s=o.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new Gh("TOO_SHORT");throw new Gh("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=sf(Ip(e),t,n,o.metadata),s=i.countryCallingCodeSource,a=i.countryCallingCode,d=i.number;if(a)o.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};o.selectNumberingPlan(t,n),t&&(r=t),a=n||pp(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=rf(Ip(d),o),c=l.nationalNumber,u=l.carrierCode,h=lf(a,{nationalNumber:c,defaultCountry:t,metadata:o});h&&(r=h,"001"===h||o.country(r));return{country:r,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(r,t.defaultCountry,t.defaultCallingCode,n),d=a.country,l=a.nationalNumber,c=a.countryCallingCode,u=a.countryCallingCodeSource,h=a.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2)throw new Gh("INVALID_COUNTRY");return{}}if(!l||l.length<2){if(t.v2)throw new Gh("TOO_SHORT");return{}}if(l.length>17){if(t.v2)throw new Gh("TOO_LONG");return{}}if(t.v2){var p=new nf(c,l,n.metadata);return d&&(p.country=d),h&&(p.carrierCode=h),i&&(p.ext=i),p.__countryCallingCodeSource=u,p}var f=!!(t.extended?n.hasSelectedNumberingPlan():d)&&Mp(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!Np(l,n)),phone:l,ext:i}:f?function(e,t,n){var o={country:e,phone:t};n&&(o.ext=n);return o}(d,l,i):{}}function yf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yf(Object(n),!0).forEach((function(t){$f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ef(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function kf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,r,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return xf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function If(e){var t,n,o,r=Cf(Array.prototype.slice.call(e),4),i=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof i)throw new TypeError("A text for parsing must be a string.");if(t=i,s&&"string"!=typeof s){if(!Qh(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,o=a):o=s}else d?(n=a,o=d):(n=void 0,o=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ef(Object(n),!0).forEach((function(t){kf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ef(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:o}}function Of(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Sf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Of(Object(n),!0).forEach((function(t){jf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Of(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rf(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=Sf(Sf({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return bf(e,wf(wf({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Gh))throw e}}function Af(){var e=If(arguments),t=e.text,n=e.options,o=e.metadata;return Rf(t,n,o)}const Nf=(e,t)=>Object.entries(e).reduce(((e,[n,o])=>{const[r,...i]=n.split(".");return t!==r?Object.assign(e,{[n]:o}):(e[r]||(e[r]={}),e[r][i.join(".")]=o,e)}),{}),Mf=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Uf={enabled:"active",disabled:"disabled",invited:"invited"},Tf=e=>e.tenantRoles.data,Df=e=>e.selectedUsersLoginIds,Pf=e=>e.notifications,_f=e=>e.customAttributes.data,Lf=Qc((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Mf(null==e?void 0:e.customAttributes,"customAttributes")),{status:Uf[e.status]||e.status,roles:e.roleNames}))))),Wf=Qc(Df,Lf,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Ff=Qc(Wf,(e=>e.map((e=>e.userId)))),Vf=Qc(Wf,(e=>e.map((e=>e.status)))),qf=Qc(Wf,(e=>e.every((e=>e.editable)))),Bf=Qc(Df,(e=>!!e.length)),zf=Qc(Df,(e=>1===e.length)),Kf=Qc(Df,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),Hf=Qc(zf,Vf,((e,t)=>e&&t.every((e=>e===Uf.enabled)))),Gf=Qc(Vf,(e=>e.every((e=>e===Uf.disabled)))),Jf=Qc(Wf,(e=>{var t;return 1===e.length?e[0].name||e[0].email||(null===(t=e[0].loginIds)||void 0===t?void 0:t[0]):`${e.length} users`})),Zf=Qc(zf,Gf,qf,((e,t,n)=>e&&t&&n)),Xf=Qc(zf,Hf,qf,((e,t,n)=>e&&t&&n)),Yf=Qc(zf,qf,((e,t)=>e&&t)),Qf=Qc(zf,qf,((e,t)=>e&&t)),eg=Qc(zf,qf,((e,t)=>e&&t)),tg=Qc(Bf,(e=>e)),ng=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},og=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),rg=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),ig=Nu("users/create",((e,{extra:{api:t}})=>t.user.create(e))),sg=ng(ig)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},og((e=>e.createUser)),rg({getSuccessMsg:()=>"User created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),ag={action:ig,reducer:sg},dg=Nu("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),lg=ng(dg)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},og((e=>e.deleteUser)),rg({getSuccessMsg:e=>hl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>hl(e.meta.arg.length)`Failed to delete user${["","s"]}`})),cg={action:dg,reducer:lg},ug=Nu("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),hg=ng(ug)(og((e=>e.setTempUserPassword)),rg({getSuccessMsg:()=>"Successfully reset user password",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to reset user's password</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),pg={action:ug,reducer:hg},fg=Nu("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),gg=ng(fg)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},og((e=>e.customAttributes))),mg={action:fg,reducer:gg},vg=Nu("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),bg=ng(vg)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},og((e=>e.usersList))),yg={action:vg,reducer:bg},wg=Nu("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),$g=ng(wg)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},og((e=>e.tenantRoles))),Eg={action:wg,reducer:$g},kg=Nu("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Cg=ng(kg)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>cl(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},og((e=>e.updateUser)),rg({getSuccessMsg:()=>"User updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),xg={action:kg,reducer:Cg},Ig=Nu("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Og=ng(Ig)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return cl(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},og((e=>e.enableUser)),rg({getSuccessMsg:()=>"User enabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to enable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Sg={action:Ig,reducer:Og},jg=Nu("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Rg=ng(jg)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return cl(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},og((e=>e.disableUser)),rg({getSuccessMsg:()=>"User disabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to disable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Ag={action:jg,reducer:Rg},Ng=Nu("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Mg={action:Ng,reducer:ng(Ng)(og((e=>e.removePasskey)),rg({getSuccessMsg:()=>"Successfully removed user's passkey",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to remove user's passkey</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}}))},Ug={usersList:{data:[],loading:!1,error:null},createUser:{loading:!1,error:null},updateUser:{loading:!1,error:null},deleteUser:{loading:!1,error:null},enableUser:{loading:!1,error:null},disableUser:{loading:!1,error:null},removePasskey:{loading:!1,error:null},setTempUserPassword:{loading:!1,error:null},customAttributes:{loading:!1,error:null,data:[]},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]},Tg="/v1/mgmt/user/search",Dg="/v1/mgmt/user/delete/batch",Pg="/v1/mgmt/user/create",_g="/v1/mgmt/user/update",Lg="/v1/mgmt/user/update/status",Wg="/v1/mgmt/user/password/set/temporary",Fg="/v1/mgmt/user/passkeys/delete",Vg="/v1/mgmt/user/customattributes",qg="/v1/mgmt/role/all",Bg=e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),zg=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.push({loginIds:[`user${e}@company.com`],externalIds:[`user${e}@company.com`],userId:`user-${e}`,name:`User ${e}`,email:`user${e}@company.com`,roleNames:[`Role ${e}`],phone:`+1-202-555-010${e}`,verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.phone.toLowerCase().includes(e.toLowerCase())||t.status.toLowerCase().includes(e.toLowerCase())||"active"===e.toLowerCase()||t.familyName.toLowerCase().includes(e.toLowerCase())||t.givenName.toLowerCase().includes(e.toLowerCase())||t.middleName.toLowerCase().includes(e.toLowerCase())||t.email.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c});const h=yield e.post(Tg,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c},{queryParams:{tenant:t}});return yield Bg(h),(yield h.json()).users})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Dg,{userIds:o},{queryParams:{tenant:t}});return yield Bg(r),r.json()})),create:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{const p=Math.random().toString(10).substring(15);u({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w});const $=yield e.post(Pg,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w},{queryParams:{tenant:t}});return yield Bg($),(yield $.json()).user})),update:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{u({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m});const v=yield e.post(_g,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:m},{queryParams:{tenant:t}});return yield Bg(v),(yield v.json()).user})),enable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(o);const r=yield e.post(Lg,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield Bg(r),r.json()})),disable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(o);const r=yield e.post(Lg,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield Bg(r),r.json()})),removePasskey:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Fg,{loginId:o},{queryParams:{tenant:t}});return yield Bg(r),r.json()})),setTempPassword:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(Wg,{loginId:o},{queryParams:{tenant:t}});return yield Bg(r),r.json()})),getCustomAttributes:()=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const o=yield e.get(Vg,{queryParams:{tenant:t}});return yield Bg(o),(yield o.json()).data}))}),Kg=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>new Promise((t=>{const n=[];for(let t=1;t<5;t+=1)n.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:n})})))(t);const o=yield e.get(qg,{queryParams:{tenant:t}});return yield Bg(o),o.json()}))}),Hg=fl((e=>{var t,n,o,r;const i=al(eh,Yu,Hu,th,Qu({tenant:Qu.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.4.88"}}));return{user:zg({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Kg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Gg=fl((e=>{const t=al($h({name:"widget",initialState:Ug,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{ag.reducer(e),xg.reducer(e),Sg.reducer(e),Ag.reducer(e),cg.reducer(e),yg.reducer(e),pg.reducer(e),Mg.reducer(e),mg.reducer(e),Eg.reducer(e)},asyncActions:{searchUsers:yg.action,createUser:ag.action,updateUser:xg.action,enableUser:Sg.action,disableUser:Ag.action,deleteUsers:cg.action,removePasskey:Mg.action,getCustomAttributes:mg.action,getTenantRoles:Eg.action,setTempUserPassword:pg.action}}),Xu,Hu,Hg)(e);return class extends t{constructor(...e){super(...e),this.state=Ug,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Jg=fl((e=>{const t=al(nh,Qu({"widget-id":Qu.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Zg=fl((e=>{var t,n,o;return o=class extends(al(Hu,Xu,uh,fh,Jg,Gg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=dl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Xg=fl((e=>{var t,n,o,r,i,s;return s=class extends(al(Gg,mh,Eh,Hu,Zg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){yield h(this,n,"f").setData(Tf(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(dl(yield this.fetchWidgetPage("create-user-modal.html")));new Ol((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}));const e=new Ol((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele);this.actions.createUser(Object.assign(Object.assign({},Nf(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),p(this,n,new Rl((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),h(this,i,"f").call(this),this.createUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield h(this,i,"f").call(this),h(this,t,"m",r).call(this)}))}))},r=function(){const e=_f(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),Yg=fl((e=>{var t,n,o;return o=class extends(al(Hu,Xg,Zg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},o})),Qg=fl((e=>{var t,n,o;return o=class extends(al(Gg,mh,Hu,Zg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(dl(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Ol((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteUsersModal.close()));const n=new Ol((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Ff(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new Ml(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Jf(this.state);o.text=`Delete ${e}?`}}))},o})),em=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg,Qg)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),tg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-users"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteUsersModal.open()}))},r})),tm=fl((e=>{var t,n,o,r,i;return i=class extends(al(Gg,mh,Hu,Eh,Zg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ol((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.disableUserModal.close()))},o=function(){new Ol((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=Kf(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.disableUserModal=this.createModal(),this.disableUserModal.setContent(dl(yield this.fetchWidgetPage("disable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ml(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=Jf(this.state);r.text=`Disable ${e}?`}))}))},i})),nm=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg,tm,Eh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Xf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="disable-user"]'),{logger:this.logger}),this.disableButton.disable(),this.disableButton.onClick((()=>{this.disableUserModal.open()}))},r})),om=e=>{if(!e)return e;const t=function(){return _h(Af,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},rm=fl((e=>{var t,n,o,r,i,s,a,d,l,f;return f=class extends(al(Gg,mh,Hu,Eh,Zg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),s.set(this,(()=>u(this,void 0,void 0,(function*(){yield h(this,o,"f").setData(Tf(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=Wf(this.state))||void 0===e?void 0:e[0],o=Object.assign({loginId:null===(t=null==n?void 0:n.loginIds)||void 0===t?void 0:t.join(", "),displayName:null==n?void 0:n.name,email:null==n?void 0:n.email,phone:om(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},Mf(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,o)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",l).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){new Ol((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editUserModal.close()))},i=function(){new Ol((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{if(this.validateForm(this.editUserModal.ele)){const e=this.getFormData(this.editUserModal.ele),{loginId:t}=e,n=c(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Nf(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=_f(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},l=function(){var e;return u(this,void 0,void 0,(function*(){this.editUserModal=this.createModal(),this.editUserModal.setContent(dl(yield this.fetchWidgetPage("edit-user-modal.html"))),h(this,t,"m",r).call(this),h(this,t,"m",i).call(this),p(this,n,new Ul(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),p(this,o,new Rl((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield h(this,s,"f").call(this),h(this,n,"f").disable(),h(this,d,"f").call(this),h(this,t,"m",a).call(this)}))}))},f})),im=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg,rm,Eh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Yf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-user"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editUserModal.open()}))},r})),sm=fl((e=>{var t,n,o,r,i;return i=class extends(al(Gg,mh,Hu,Eh,Zg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ol((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.enableUserModal.close()))},o=function(){new Ol((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=Kf(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.enableUserModal=this.createModal(),this.enableUserModal.setContent(dl(yield this.fetchWidgetPage("enable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ml(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=Jf(this.state);r.text=`Activate ${e}?`}))}))},i})),am=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg,sm,Eh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Zf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="enable-user"]'),{logger:this.logger}),this.enableButton.disable(),this.enableButton.onClick((()=>{this.enableUserModal.open()}))},r})),dm=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,pl((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Ul(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r})),lm={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},cm=fl((e=>{var t,n,o,r,i;return i=class extends(al(Hu,Gg,bh,Xu)(e)){constructor(){super(...arguments),t.add(this),r.set(this,ul((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=h(this,t,"m",o).call(this,e);i.setContent(h(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(h(this,r,"f").bind(this),Pf)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=lm[e],o=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),um=fl((e=>{var t,n,o,r,i;return i=class extends(al(Gg,mh,Hu,Eh,Zg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ol((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.removePasskeyModal.close()))},o=function(){new Ol((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=Kf(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(dl(yield this.fetchWidgetPage("remove-passkey-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ml(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=Jf(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),hm=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg,um,Eh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Qf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="remove-passkey"]'),{logger:this.logger}),this.removePasskeyButton.disable(),this.removePasskeyButton.onClick((()=>{this.removePasskeyModal.open()}))},r})),pm=fl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(al(Gg,Hu,Zg)(e)){constructor(){super(...arguments),t.add(this),r.set(this,ul((e=>{this.usersTable.data=e}))),i.set(this,pl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchUsers({sort:n})}))),s.set(this,ul((e=>{this.usersTable.filterColumns((t=>{var n;const[o,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==o||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this),h(this,r,"f").call(this,Lf(this.state)),h(this,s,"f").call(this,_f(this.state)),this.subscribe(h(this,s,"f").bind(this),_f),this.subscribe(h(this,r,"f").bind(this),Lf)}))}},r=new WeakMap,i=new WeakMap,s=new WeakMap,t=new WeakSet,n=function(){const e=e=>{var t;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(`[path="${e}"]`)},t=e=>{var t;const n=`descope-grid-${e}-column`;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(n)},n=this.usersTable.renderColumn;this.usersTable.renderColumn=({path:o,header:r,type:i,attrs:s})=>{const a=e(o)||t(i);if(!a)return n({path:o,header:r,type:i,attrs:s});const d=a.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:r});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},o=function(){var e;this.usersTable=new Il(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="users-table"]'),{logger:this.logger}),this.usersTable.onSelectedItemsChange((e=>{this.actions.setSelectedUsersIds(e.detail.value.map((({loginIds:e})=>e)))})),this.usersTable.onColumnsChange(h(this,t,"m",a).bind(this)),h(this,t,"m",n).call(this),h(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,i,"f").call(this,e.target,e.detail)}))}))},d})),fm=fl((e=>{var t,n,o;return o=class extends(al(Gg,mh,Hu,Eh,Zg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(dl(yield this.fetchWidgetPage("generated-password-modal.html")));new Ol((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.generatedPasswordModal.ele)["generated-password"]),this.resetFormData(this.generatedPasswordModal.ele),this.generatedPasswordModal.close()}))}))},o})),gm=fl((e=>{var t,n,o,r,i;return i=class extends(al(Gg,mh,Hu,Eh,Zg,fm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ol((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.resetPasswordModal.close()))},o=function(){new Ol((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>u(this,void 0,void 0,(function*(){var e;const t=Kf(this.state),n=yield this.actions.setTempUserPassword(t);this.resetPasswordModal.close(),this.setFormData(this.generatedPasswordModal.ele,{"generated-password":null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext}),this.generatedPasswordModal.open()}))))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(dl(yield this.fetchWidgetPage("reset-password-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ml(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=Jf(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),mm=fl((e=>{var t,n,o,r;return r=class extends(al(Hu,Zg,Gg,gm,Eh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),eg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="reset-password"]'),{logger:this.logger}),this.resetPasswordButton.disable(),this.resetPasswordButton.onClick((()=>{this.resetPasswordModal.open()}))},r})),vm=fl((e=>class extends(al(rh,wh,pm,Yg,em,im,am,nm,mm,hm,dm,cm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),bm=al((e=>class extends(vm(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",bm);var ym=Object.freeze({__proto__:null,default:bm});((...e)=>{const t=Yc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(rc(e)?Lc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Xc);var wm="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Jl:Jl.apply(null,arguments)},$m=e=>e&&"function"==typeof e.match;function Em(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?av(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Xl(t)&&t.type===e,n}function km(e){return"function"==typeof e&&"type"in e&&$m(e)}function Cm(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var xm=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Im(e){return ic(e)?Vc(e,(()=>{})):e}function Om(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?av(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Sm(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function jm(e,t,n){const o=Rm(e,t,n);return{detectMutations:()=>Am(e,t,o,n)}}function Rm(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Rm(e,t,n[r],s))}}return i}function Am(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Am(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Nm(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ql(e)}function Mm(e,t="",n=Nm,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Mm(l,a,n,o,r,i),s))return s}return i&&Um(e)&&i.add(e),!1}function Um(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Um(t))return!1;return!0}function Tm(e){return"boolean"==typeof e}var Dm=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new xm;if(t&&(Tm(t)?i.push(nu):i.push(ou(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Tm(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Sm,ignoredPaths:r,warnAfter:i=32}=e;const s=jm.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Cm(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?av(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?av(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};Tm(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Nm,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!Xl(u))return l(u);const h=l(u),p=Cm(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Mm(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=Mm(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};Tm(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=km}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},Pm=e=>t=>{setTimeout(t,e)},_m="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Pm(10),Lm=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new xm(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?_m:"callback"===e.type?e.queueNotification:Pm(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Wm="production"===process.env.NODE_ENV;function Fm(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?av(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?av(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?av(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?av(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?av(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?av(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Vm=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function qm(...e){return t=>e.some((e=>((e,t)=>$m(e)?e.match(t):e(t))(e,t)))}var Bm=["name","message","stack","code"],zm=class{constructor(e,t){this.payload=e,this.meta=t}_type},Km=class{constructor(e,t){this.payload=e,this.meta=t}_type},Hm=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Bm)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Gm=(()=>{function e(e,t,n){const o=Em(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Em(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Em(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Hm)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):Vm(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new zm(e,t),fulfillWithValue:(e,t)=>new Km(e,t)})).then((t=>{if(t instanceof zm)throw t;return t instanceof Km?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof zm?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(Jm)})}}),{pending:r,rejected:i,fulfilled:o,settled:qm(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Jm(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Zm=Symbol.for("rtk-slice-createasyncthunk");function Xm(e,t){return`${e}/${t}`}function Ym({creators:e}={}){const t=e?.asyncThunk?.[Zm];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?av(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?av(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?av(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?av(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?Fm(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?av(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=Fm(t);if(function(e){return"function"==typeof e}(e))n=()=>Im(e());else{const t=Im(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(rc(e)){const o=n(e,t);return void 0===o?e:o}if(ic(e))return Vc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?av(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Xm(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?av(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Em(e,s):Em(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?av(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||tv,pending:a||tv,rejected:d||tv,settled:l||tv})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?av(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Om(c,n,{insert:()=>new WeakMap});return Om(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Qm(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function Qm(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?av(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var ev=Ym();function tv(){}var nv="listenerMiddleware",ov=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Em(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?av(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?av(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},rv=Object.assign((e=>{const{type:t,predicate:n,effect:o}=ov(e);return{id:Vm(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?av(22):"Unsubscribe not initialized")}}}),{withTypes:()=>rv}),iv=Object.assign(Em(`${nv}/add`),{withTypes:()=>iv});Em(`${nv}/removeAll`);var sv=Object.assign(Em(`${nv}/remove`),{withTypes:()=>sv});function av(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const dv=["error","warn","info","debug"],lv=fl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return dv.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),cv="undefined"!=typeof localStorage,uv=cv&&localStorage.getItem("base.content.url")||"",hv=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,pv=fl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),fv=fl((e=>{var t,n;const o=al(lv,pv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),gv=e=>t=>{var n,o,r;const i=al(lv,pv,fv)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};gv.missingAttrValidator=hv;const mv=fl((e=>{const t=al(gv({"project-id":hv}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),vv=fl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const bv=fl((e=>{const t=al(lv,mv,vv)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(uv||o||"https://static.descope.com/pages");return r.pathname=ll(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),yv=fl((e=>{var t,n,o;const r=al(bv)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),wv=fl((e=>{var t,n,o,r,i,s,a;return a=class extends(al(pv,lv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Yv})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),$v="load-descope-ui",Ev="base.ui.components.url",kv=cv&&localStorage.getItem(Ev)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Cv=cv&&localStorage.getItem(Ev)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",xv=e=>{const t=document.createElement("script");return t.id=e,t},Iv=(e,t)=>e.replace("<version>",t),Ov=fl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=al(lv,yv)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return h(this,l,"f")||p(this,l,h(this,t,"m",u).call(this),"f"),h(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>h(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=xv("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=Iv(Cv,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${$v}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=xv($v);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Iv(kv,await h(this,t,"m",r).call(this))}return document.getElementById($v)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),Sv="content-root",jv="root",Rv=fl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${jv}, #${Sv} {\n height: 100%;\n }\n #${jv} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${jv}">\n <div id="${Sv}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Sv),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(jv)}})),Av="descope-modal",Nv=fl((e=>{var t,n;const o=al(pv,Rv,Ov)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends jl{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Av);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Av]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Mv="descope-notification",Uv=fl((e=>{var t,n;const o=al(pv,Rv,Ov)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Nl{setContent(t){const n="string"==typeof t?dl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Mv);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([Mv])}},t=new WeakMap,n})),Tv=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Dv=fl((e=>{var t,n,o,r,i,s,a,d,l;const c=al(gv({theme:Tv}),bv,pv,Ov,yv,Rv,fv)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Ev)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(Ev),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),Pv=e=>fl((t=>{const n=ev(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(al(lv)(t)){constructor(...e){super(...e);const t=function(e){const t=Dm(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!ql(n))throw new Error("production"===process.env.NODE_ENV?av(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Gl(n)}if(!Wm&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?av(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Wm&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?av(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Wm&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?av(4):"each middleware provided to configureStore must be a function");let l=Jl;r&&(l=wm({trace:!Wm,..."object"==typeof r&&r}));const c=Zl(...d),u=Lm(c);if(!Wm&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?av(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Wm&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?av(6):"`enhancers` callback must return an array");if(!Wm&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?av(7):"each enhancer provided to configureStore must be a function");return Wm||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Kl(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{Jm(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),_v=fl((e=>class extends(lv(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));fl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Lv=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Wv,Fv,Vv,qv,Bv,zv,Kv,Hv,Gv,Jv;const Zv=document.createElement("template");Zv.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Xv extends HTMLElement{constructor(){var e;super(),Wv.add(this),Fv.set(this,new El({messages:[]})),Vv.set(this,void 0),qv.set(this,void 0),Bv.set(this,void 0),zv.set(this,{resize:h(this,Wv,"m",Jv).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Zv.content.cloneNode(!0)),p(this,Vv,this.shadowRoot.querySelector(".debugger"),"f"),p(this,qv,h(this,Vv,"f").querySelector(".content"),"f"),p(this,Bv,h(this,Vv,"f").querySelector(".header"),"f")}updateData(e){h(this,Fv,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Lv(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,Vv,"f"),h(this,Bv,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,zv,"f").resize),(e=h(this,Vv,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,Vv,"f").onresize=h(this,Wv,"m",Gv).bind(this),h(this,Fv,"f").subscribe(h(this,Wv,"m",Kv).bind(this))}disconnectedCallback(){h(this,Fv,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,zv,"f").resize)}}Fv=new WeakMap,Vv=new WeakMap,qv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakSet,Kv=function(e){h(this,Wv,"m",Hv).call(this,e),h(this,Wv,"m",Gv).call(this)},Hv=function(e){h(this,qv,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Gv=function(){h(this,qv,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Jv=function(){const[e,t]=Lv(h(this,Vv,"f"),Number.parseInt(h(this,Vv,"f").style.left,10),Number.parseInt(h(this,Vv,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Vv,"f").style.top=`${t}px`,h(this,Vv,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Xv);var Yv=Object.freeze({__proto__:null});const Qv=e=>e.selectedRolesIds,eb=e=>e.notifications,tb=e=>e.tenantPermissions.data||[],nb=Qc((e=>e.rolesList.data),(e=>e.map((e=>{var t;return Object.assign(Object.assign({},e),{editable:0===(null===(t=null==e?void 0:e.tenantId)||void 0===t?void 0:t.length)?"no":"yes"})})))),ob=Qc(Qv,nb,((e,t)=>t.filter((t=>e.includes(t.name))))),rb=Qc(Qv,(e=>!!e.length)),ib=Qc(Qv,(e=>1===e.length)),sb=Qc(ob,(e=>1===e.length?e[0].name:`${e.length} roles`)),ab=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},db=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),lb=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),cb=Gm("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),ub=ab(cb)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},db((e=>e.createRole)),lb({getSuccessMsg:()=>"Role created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),hb={action:cb,reducer:ub},pb=Gm("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),fb=ab(pb)({onFulfilled:(e,t)=>{e.rolesList.data=e.rolesList.data.filter((e=>{var n;return 0===(null===(n=null==e?void 0:e.tenantId)||void 0===n?void 0:n.length)||!t.meta.arg.includes(e.name)})),e.selectedRolesIds=[]}},db((e=>e.deleteRole)),lb({getSuccessMsg:e=>hl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>hl(e.meta.arg.length)`Failed to delete role${["","s"]}`})),gb={action:pb,reducer:fb},mb=Gm("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),vb=ab(mb)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},db((e=>e.rolesList))),bb={action:mb,reducer:vb},yb=Gm("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),wb=ab(yb)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},db((e=>e.updateRole)),lb({getSuccessMsg:()=>"Role updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),$b={action:yb,reducer:wb},Eb=Gm("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),kb={action:Eb,reducer:ab(Eb)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},db((e=>e.tenantPermissions)))},Cb={rolesList:{data:[],loading:!1,error:null},createRole:{loading:!1,error:null},updateRole:{loading:!1,error:null},deleteRole:{loading:!1,error:null},tenantPermissions:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedRolesIds:[],notifications:[]},xb="/v1/mgmt/role/search",Ib="/v1/mgmt/role/delete/batch",Ob="/v1/mgmt/role/create",Sb="/v1/mgmt/role/update",jb="/v1/mgmt/permission/all",Rb=e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),Ab=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t},n)=>u(void 0,void 0,void 0,(function*(){return new Promise((o=>{const r=[];for(let e=1;e<10;e+=1)r.push({name:`Role ${e}`,description:`Role description ${e}`,permissionNames:[`Permission ${e}`],createdTime:new Date,tenantId:n});t.forEach((e=>{r.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),o(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s},t);const a=yield e.post(xb,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Rb(a),(yield a.json()).roles})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Ib,{roleNames:o},{queryParams:{tenant:t}});return yield Rb(r),r.json()})),create:({name:o,description:r,permissionNames:i})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,description:t,permissionNames:n},o)=>u(void 0,void 0,void 0,(function*(){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:o})}))})))({name:o,description:r,permissionNames:i},t);const s=yield e.post(Ob,{name:o,description:r,permissionNames:i,tenantId:t},{queryParams:{tenant:t}});return yield Rb(s),yield s.json()})),update:({name:o,newName:r,description:i,permissionNames:s})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,newName:t,description:n,permissionNames:o},r)=>u(void 0,void 0,void 0,(function*(){return new Promise((i=>{i({name:t,description:n,permissionNames:o,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:o,newName:r,description:i,permissionNames:s},t);const a=yield e.post(Sb,{name:o,newName:r,description:i,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Rb(a);const d=yield a.json();return d.oldName=o,d}))}),Nb=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>u(void 0,void 0,void 0,(function*(){if(n)return new Promise((e=>{const t=[];for(let e=1;e<5;e+=1)t.push({name:`Permission ${e}`});e({permissions:t})}));const o=yield e.get(jb,{queryParams:{tenant:t}});return yield Rb(o),o.json()}))}),Mb=fl((e=>{var t,n,o,r;const i=al(mv,fv,lv,vv,gv({tenant:gv.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.85"}}));return{role:Ab({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Nb({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Ub=fl((e=>{const t=al(Pv({name:"widget",initialState:Cb,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{hb.reducer(e),$b.reducer(e),gb.reducer(e),bb.reducer(e),kb.reducer(e)},asyncActions:{searchRoles:bb.action,createRole:hb.action,updateRole:$b.action,deleteRoles:gb.action,getTenantPermissions:kb.action}}),pv,lv,Mb)(e);return class extends t{constructor(...e){super(...e),this.state=Cb,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Tb=fl((e=>{const t=al(bv,gv({"widget-id":gv.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Db=fl((e=>{var t,n,o;return o=class extends(al(lv,pv,Ov,Rv,Tb,Ub)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=dl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Pb=fl((e=>{var t,n,o,r,i;return i=class extends(al(Ub,Nv,_v,lv,Db)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield h(this,n,"f").setData(null===(e=tb(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(dl(yield this.fetchWidgetPage("create-role-modal.html")));new Ol((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele)}));const e=new Ol((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(this,void 0,void 0,(function*(){this.validateForm(this.createRoleModal.ele)&&(this.actions.createRole(Object.assign({},this.getFormData(this.createRoleModal.ele))),this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele))})))),p(this,n,new Rl((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),h(this,r,"f").call(this)}))},i})),_b=fl((e=>{var t,n,o;return o=class extends(al(lv,Pb,Db)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},o})),Lb=fl((e=>{var t,n,o;return o=class extends(al(Ub,Nv,lv,Db)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(dl(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Ol((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteRolesModal.close()));const n=new Ol((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=ob(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new Ml(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=sb(this.state);o.text=`Delete ${e}?`}}))},o})),Wb=fl((e=>{var t,n,o,r;return r=class extends(al(lv,Db,Ub,Lb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),rb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-roles"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteRolesModal.open()}))},r})),Fb=fl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(al(Ub,Nv,lv,_v,Db)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield h(this,n,"f").setData(null===(e=tb(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=ob(this.state))||void 0===e?void 0:e[0],n={name:null==t?void 0:t.name,description:null==t?void 0:t.description,permissionNames:null==t?void 0:t.permissionNames};this.setFormData(this.editRoleModal.ele,n)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,t=new WeakSet,o=function(){new Ol((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editRoleModal.close()))},r=function(){new Ol((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{var e;if(this.validateForm(this.editRoleModal.ele)){const t=this.getFormData(this.editRoleModal.ele),{name:n}=t,o=c(t,["name"]),r=null===(e=ob(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},o)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return u(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(dl(yield this.fetchWidgetPage("edit-role-modal.html"))),h(this,t,"m",o).call(this),h(this,t,"m",r).call(this),p(this,n,new Rl((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),this.editRoleModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield h(this,i,"f").call(this),h(this,s,"f").call(this)}))}))},d})),Vb=fl((e=>{var t,n,o,r;return r=class extends(al(lv,Db,Ub,Fb,_v)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),ib)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-role"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editRoleModal.open()}))},r})),qb=fl((e=>{var t,n,o,r;return r=class extends(al(lv,Db,Ub)(e)){constructor(){super(...arguments),t.add(this),n.set(this,pl((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Ul(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r})),Bb={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},zb=fl((e=>{var t,n,o,r,i;return i=class extends(al(lv,Ub,Uv,pv)(e)){constructor(){super(...arguments),t.add(this),r.set(this,ul((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=h(this,t,"m",o).call(this,e);i.setContent(h(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(h(this,r,"f").bind(this),eb)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Bb[e],o=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),Kb=fl((e=>{var t,n,o,r,i;return i=class extends(al(Ub,lv,Db)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{this.rolesTable.data=e}))),r.set(this,pl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchRoles({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),h(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,r,"f").call(this,e.target,e.detail)}))})),h(this,o,"f").call(this,nb(this.state)),this.subscribe(h(this,o,"f").bind(this),nb)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Il(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="roles-table"]'),{logger:this.logger}),this.rolesTable.onSelectedItemsChange((e=>{this.actions.setSelectedRolesIds(e.detail.value.map((({name:e})=>e)))}))},i})),Hb=fl((e=>class extends(al(wv,Dv,Kb,_b,Wb,Vb,qb,zb)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Gb=al((e=>class extends(Hb(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Gb);var Jb=Object.freeze({__proto__:null,default:Gb});((...e)=>{const t=Yc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(rc(e)?Lc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Xc);var Zb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Jl:Jl.apply(null,arguments)},Xb=e=>e&&"function"==typeof e.match;function Yb(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Py(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Xl(t)&&t.type===e,n}function Qb(e){return"function"==typeof e&&"type"in e&&Xb(e)}function ey(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var ty=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function ny(e){return ic(e)?Vc(e,(()=>{})):e}function oy(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?Py(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function ry(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function iy(e,t,n){const o=sy(e,t,n);return{detectMutations:()=>ay(e,t,o,n)}}function sy(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=sy(e,t,n[r],s))}}return i}function ay(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=ay(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function dy(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ql(e)}function ly(e,t="",n=dy,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=ly(l,a,n,o,r,i),s))return s}return i&&cy(e)&&i.add(e),!1}function cy(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!cy(t))return!1;return!0}function uy(e){return"boolean"==typeof e}var hy=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new ty;if(t&&(uy(t)?i.push(nu):i.push(ou(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};uy(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=ry,ignoredPaths:r,warnAfter:i=32}=e;const s=iy.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=ey(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Py(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Py(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};uy(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=dy,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!Xl(u))return l(u);const h=l(u),p=ey(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=ly(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=ly(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};uy(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Qb}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},py=e=>t=>{setTimeout(t,e)},fy="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:py(10),gy=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new ty(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?fy:"callback"===e.type?e.queueNotification:py(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},my="production"===process.env.NODE_ENV;function vy(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Py(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Py(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?Py(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Py(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Py(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Py(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var by=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function yy(...e){return t=>e.some((e=>((e,t)=>Xb(e)?e.match(t):e(t))(e,t)))}var wy=["name","message","stack","code"],$y=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ey=class{constructor(e,t){this.payload=e,this.meta=t}_type},ky=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of wy)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Cy=(()=>{function e(e,t,n){const o=Yb(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Yb(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Yb(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||ky)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):by(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new $y(e,t),fulfillWithValue:(e,t)=>new Ey(e,t)})).then((t=>{if(t instanceof $y)throw t;return t instanceof Ey?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof $y?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(xy)})}}),{pending:r,rejected:i,fulfilled:o,settled:yy(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function xy(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Iy=Symbol.for("rtk-slice-createasyncthunk");function Oy(e,t){return`${e}/${t}`}function Sy({creators:e}={}){const t=e?.asyncThunk?.[Iy];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Py(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?Py(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Py(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?Py(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?vy(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?Py(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=vy(t);if(function(e){return"function"==typeof e}(e))n=()=>ny(e());else{const t=ny(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(rc(e)){const o=n(e,t);return void 0===o?e:o}if(ic(e))return Vc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?Py(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Oy(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?Py(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Yb(e,s):Yb(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Py(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||Ay,pending:a||Ay,rejected:d||Ay,settled:l||Ay})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Py(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=oy(c,n,{insert:()=>new WeakMap});return oy(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=jy(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function jy(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Py(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Ry=Sy();function Ay(){}var Ny="listenerMiddleware",My=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Yb(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?Py(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Py(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Uy=Object.assign((e=>{const{type:t,predicate:n,effect:o}=My(e);return{id:by(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Py(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Uy}),Ty=Object.assign(Yb(`${Ny}/add`),{withTypes:()=>Ty});Yb(`${Ny}/removeAll`);var Dy=Object.assign(Yb(`${Ny}/remove`),{withTypes:()=>Dy});function Py(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const _y=["error","warn","info","debug"],Ly=fl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return _y.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),Wy="undefined"!=typeof localStorage,Fy=Wy&&localStorage.getItem("base.content.url")||"",Vy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,qy=fl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),By=fl((e=>{var t,n;const o=al(Ly,qy)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),zy=e=>t=>{var n,o,r;const i=al(Ly,qy,By)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};zy.missingAttrValidator=Vy;const Ky=fl((e=>{const t=al(zy({"project-id":Vy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Hy=fl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Gy=fl((e=>{const t=al(Ly,Ky,Hy)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Fy||o||"https://static.descope.com/pages");return r.pathname=ll(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),Jy=fl((e=>{var t,n,o;const r=al(Gy)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),Zy=fl((e=>{var t,n,o,r,i,s,a;return a=class extends(al(qy,Ly)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Sw})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),Xy="load-descope-ui",Yy="base.ui.components.url",Qy=Wy&&localStorage.getItem(Yy)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ew=Wy&&localStorage.getItem(Yy)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",tw=e=>{const t=document.createElement("script");return t.id=e,t},nw=(e,t)=>e.replace("<version>",t),ow=fl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=al(Ly,Jy)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return h(this,l,"f")||p(this,l,h(this,t,"m",u).call(this),"f"),h(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>h(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=tw("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=nw(ew,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Xy}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=tw(Xy);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=nw(Qy,await h(this,t,"m",r).call(this))}return document.getElementById(Xy)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),rw="content-root",iw="root",sw=fl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${iw}, #${rw} {\n height: 100%;\n }\n #${iw} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${iw}">\n <div id="${rw}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(rw),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(iw)}})),aw="descope-modal",dw=fl((e=>{var t,n;const o=al(qy,sw,ow)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends jl{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(aw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([aw]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),lw="descope-notification",cw=fl((e=>{var t,n;const o=al(qy,sw,ow)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Nl{setContent(t){const n="string"==typeof t?dl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(lw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([lw])}},t=new WeakMap,n})),uw=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',hw=fl((e=>{var t,n,o,r,i,s,a,d,l;const c=al(zy({theme:uw}),Gy,qy,ow,Jy,sw,By)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Yy)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(Yy),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),pw=e=>fl((t=>{const n=Ry(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(al(Ly)(t)){constructor(...e){super(...e);const t=function(e){const t=hy(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!ql(n))throw new Error("production"===process.env.NODE_ENV?Py(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Gl(n)}if(!my&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Py(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!my&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Py(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!my&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Py(4):"each middleware provided to configureStore must be a function");let l=Jl;r&&(l=Zb({trace:!my,..."object"==typeof r&&r}));const c=Zl(...d),u=gy(c);if(!my&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Py(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!my&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Py(6):"`enhancers` callback must return an array");if(!my&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Py(7):"each enhancer provided to configureStore must be a function");return my||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Kl(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{xy(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),fw=fl((e=>class extends(Ly(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));fl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const gw=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var mw,vw,bw,yw,ww,$w,Ew,kw,Cw,xw;const Iw=document.createElement("template");Iw.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Ow extends HTMLElement{constructor(){var e;super(),mw.add(this),vw.set(this,new El({messages:[]})),bw.set(this,void 0),yw.set(this,void 0),ww.set(this,void 0),$w.set(this,{resize:h(this,mw,"m",xw).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Iw.content.cloneNode(!0)),p(this,bw,this.shadowRoot.querySelector(".debugger"),"f"),p(this,yw,h(this,bw,"f").querySelector(".content"),"f"),p(this,ww,h(this,bw,"f").querySelector(".header"),"f")}updateData(e){h(this,vw,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=gw(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,bw,"f"),h(this,ww,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,$w,"f").resize),(e=h(this,bw,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,bw,"f").onresize=h(this,mw,"m",Cw).bind(this),h(this,vw,"f").subscribe(h(this,mw,"m",Ew).bind(this))}disconnectedCallback(){h(this,vw,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,$w,"f").resize)}}vw=new WeakMap,bw=new WeakMap,yw=new WeakMap,ww=new WeakMap,$w=new WeakMap,mw=new WeakSet,Ew=function(e){h(this,mw,"m",kw).call(this,e),h(this,mw,"m",Cw).call(this)},kw=function(e){h(this,yw,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Cw=function(){h(this,yw,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},xw=function(){const[e,t]=gw(h(this,bw,"f"),Number.parseInt(h(this,bw,"f").style.left,10),Number.parseInt(h(this,bw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,bw,"f").style.top=`${t}px`,h(this,bw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Ow);var Sw=Object.freeze({__proto__:null});const jw=e=>e.selectedAccessKeysIds,Rw=e=>e.notifications,Aw=Qc((e=>e.accessKeysList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{expireTimeFormatted:(null==e?void 0:e.expireTime)?new Date(1e3*((null==e?void 0:e.expireTime)||0)).toLocaleString():"Never",createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:(null==e?void 0:e.expireTime)&&new Date(1e3*((null==e?void 0:e.expireTime)||0))<new Date?"expired":null==e?void 0:e.status}))))),Nw=Qc(jw,Aw,((e,t)=>t.filter((t=>e.includes(t.id))))),Mw=Qc(jw,(e=>!!e.length)),Uw=Qc(Nw,(e=>e.every((e=>e.editable)))),Tw=Qc(Uw,Mw,((e,t)=>e&&t));Qc(jw,(e=>1===e.length));const Dw=Qc(Nw,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Pw=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},_w=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),Lw=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),Ww=Cy("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),Fw=Pw(Ww)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},_w((e=>e.createAccessKey)),Lw({getSuccessMsg:()=>"Access Key created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create access key</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Vw={action:Ww,reducer:Fw},qw=Cy("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),Bw=Pw(qw)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},_w((e=>e.deleteAccessKey)),Lw({getSuccessMsg:e=>hl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>hl(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),zw={action:qw,reducer:Bw},Kw=Cy("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),Hw=Pw(Kw)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},_w((e=>e.accessKeysList))),Gw={action:Kw,reducer:Hw},Jw=Cy("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),Zw=Pw(Jw)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},_w((e=>e.activateAccessKey)),Lw({getSuccessMsg:e=>hl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>hl(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),Xw={action:Jw,reducer:Zw},Yw=Cy("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),Qw=Pw(Yw)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},_w((e=>e.deactivateAccessKey)),Lw({getSuccessMsg:e=>hl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>hl(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),e$={action:Yw,reducer:Qw},t$=Cy("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),n$={action:t$,reducer:Pw(t$)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},_w((e=>e.tenantRoles)))},o$={accessKeysList:{data:[],loading:!1,error:null},createAccessKey:{loading:!1,error:null},activateAccessKey:{loading:!1,error:null},deactivateAccessKey:{loading:!1,error:null},deleteAccessKey:{loading:!1,error:null},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedAccessKeysIds:[],notifications:[]},r$="/v1/mgmt/accesskey/search",i$="/v1/mgmt/accesskey/delete/batch",s$="/v1/mgmt/accesskey/create",a$="/v1/mgmt/accesskey/deactivate/batch",d$="/v1/mgmt/accesskey/activate/batch",l$="/v1/mgmt/role/all",c$=e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),u$=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t}={})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.push({id:`access-key-id-${e}`,name:`Access Key ${e}`,createdBy:`User ${e}`,editable:!0,expireTime:(new Date).getTime()/1e3+2592e3,createdTime:(new Date).getTime()/1e3,roleNames:[`Role ${e}`],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s});const a=yield e.post(r$,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield c$(a),(yield a.json()).keys})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(i$,{ids:o},{queryParams:{tenant:t}});return yield c$(r),r.json()})),create:({name:o,expiration:r,roleNames:i,userId:s})=>u(void 0,void 0,void 0,(function*(){const a=new Date;a.setDate(a.getDate()+ +r);const d="0"===r[0]?0:Math.floor(a.getTime()/1e3);if(n)return(({name:e,roleNames:t,userId:n},o)=>u(void 0,void 0,void 0,(function*(){const r=Math.random().toString(10).substring(15);return new Promise((i=>{i({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${r}`,name:e||`Access Key ${r}`,createdBy:n||`User ${r}`,editable:!0,expireTime:o,createdTime:(new Date).getTime()/1e3,roleNames:t,status:"active",clientId:`Client ID ${r}`,boundUserId:n||`User ${r}`}})}))})))({name:o,expiration:r,roleNames:i,userId:s},d);const l=yield e.post(s$,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield c$(l),yield l.json()})),activate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(d$,{ids:o},{queryParams:{tenant:t}});return yield c$(r),yield r.json()})),deactivate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(a$,{ids:o},{queryParams:{tenant:t}});return yield c$(r),yield r.json()}))}),h$=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>new Promise((t=>{const n=[];for(let t=1;t<5;t+=1)n.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:n})})))(t);const o=yield e.get(l$,{queryParams:{tenant:t}});return yield c$(o),o.json()}))}),p$=fl((e=>{var t,n,o,r;const i=al(Ky,By,Ly,Hy,zy({tenant:zy.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.87"}}));return{accesskey:u$({httpClient:r.httpClient,tenant:t,mock:n}),tenant:h$({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),f$=fl((e=>{const t=al(pw({name:"widget",initialState:o$,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Vw.reducer(e),zw.reducer(e),Gw.reducer(e),Xw.reducer(e),e$.reducer(e),n$.reducer(e)},asyncActions:{searchAccessKeys:Gw.action,createAccessKey:Vw.action,activateAccessKeys:Xw.action,deactivateAccessKeys:e$.action,deleteAccessKeys:zw.action,getTenantRoles:n$.action}}),qy,Ly,p$)(e);return class extends t{constructor(...e){super(...e),this.state=o$,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),g$=fl((e=>{const t=al(Gy,zy({"widget-id":zy.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),m$=fl((e=>{var t,n,o;return o=class extends(al(Ly,qy,ow,sw,g$,f$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=dl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),v$=fl((e=>{var t,n,o,r,i;return i=class extends(al(f$,Ly,m$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{this.accessKeysTable.data=e}))),r.set(this,pl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchAccessKeys({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),h(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,r,"f").call(this,e.target,e.detail)}))})),h(this,o,"f").call(this,Aw(this.state)),this.subscribe(h(this,o,"f").bind(this),Aw)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Il(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="access-keys-table"]'),{logger:this.logger}),this.accessKeysTable.onSelectedItemsChange((e=>{this.actions.setSelectedAccessKeysIds(e.detail.value.map((({id:e})=>e)))}))},i})),b$=fl((e=>{var t,n,o;return o=class extends(al(f$,dw,Ly,m$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(dl(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Ol((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.activateAccessKeysModal.close()));const n=new Ol((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Nw(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new Ml(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Dw(this.state);o.text=`Activate ${e}?`}}))},o})),y$=fl((e=>{var t,n,o,r;return r=class extends(al(Ly,m$,f$,b$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),Tw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="activate-access-keys"]'),{logger:this.logger}),this.activateButton.disable(),this.activateButton.onClick((()=>{this.activateAccessKeysModal.open()}))},r})),w$=fl((e=>{var t,n,o;return o=class extends(al(f$,dw,fw,Ly,m$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(dl(yield this.fetchWidgetPage("created-access-key-modal.html")));new Ol((()=>{var e;return null===(e=this.createdAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.createdAccessKeyModal.ele)["generated-key"]),this.resetFormData(this.createdAccessKeyModal.ele),this.createdAccessKeyModal.close()}))}))},o})),$$=fl((e=>{var t,n,o,r,i;return i=class extends(al(f$,dw,fw,Ly,m$,w$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e,t;yield h(this,n,"f").setData(null===(t=this.state,e=t.tenantRoles.data||[])||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function e(){return u(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(dl(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Ol((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});o.onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)}));const i=new Ol((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});i.onClick((()=>u(this,void 0,void 0,(function*(){var e;if(this.validateForm(this.createAccessKeyModal.ele)){const t=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(e=null==t?void 0:t.payload)||void 0===e?void 0:e.cleartext}),this.createdAccessKeyModal.open()}})))),p(this,n,new Rl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),h(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{h(this,t,"m",e).call(this)}}))},i})),E$=fl((e=>{var t,n,o;return o=class extends(al(Ly,$$,m$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-access-key"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createAccessKeyModal.open()))},o})),k$=fl((e=>{var t,n,o;return o=class extends(al(f$,dw,Ly,m$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(dl(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Ol((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deactivateAccessKeysModal.close()));const n=new Ol((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Nw(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new Ml(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Dw(this.state);o.text=`Deactivate ${e}?`}}))},o})),C$=fl((e=>{var t,n,o,r;return r=class extends(al(Ly,m$,f$,k$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),Tw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="deactivate-access-keys"]'),{logger:this.logger}),this.deactivateButton.disable(),this.deactivateButton.onClick((()=>{this.deactivateAccessKeysModal.open()}))},r})),x$=fl((e=>{var t,n,o;return o=class extends(al(f$,dw,Ly,m$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(dl(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Ol((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteAccessKeysModal.close()));const n=new Ol((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Nw(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new Ml(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Dw(this.state);o.text=`Delete ${e}?`}}))},o})),I$=fl((e=>{var t,n,o,r;return r=class extends(al(Ly,m$,f$,x$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),Tw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ol(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-access-keys"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteAccessKeysModal.open()}))},r})),O$=fl((e=>{var t,n,o,r;return r=class extends(al(Ly,m$,f$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,pl((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Ul(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r})),S$={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},j$=fl((e=>{var t,n,o,r,i;return i=class extends(al(Ly,f$,cw,qy)(e)){constructor(){super(...arguments),t.add(this),r.set(this,ul((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=h(this,t,"m",o).call(this,e);i.setContent(h(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(h(this,r,"f").bind(this),Rw)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=S$[e],o=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),R$=fl((e=>class extends(al(Zy,hw,v$,E$,I$,O$,y$,C$,j$)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),A$=al((e=>class extends(R$(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",A$);var N$=Object.freeze({__proto__:null,default:A$});((...e)=>{const t=Yc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(rc(e)?Lc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Xc);var M$="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Jl:Jl.apply(null,arguments)},U$=e=>e&&"function"==typeof e.match;function T$(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?wE(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Xl(t)&&t.type===e,n}function D$(e){return"function"==typeof e&&"type"in e&&U$(e)}function P$(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var _$=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function L$(e){return ic(e)?Vc(e,(()=>{})):e}function W$(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?wE(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function F$(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function V$(e,t,n){const o=q$(e,t,n);return{detectMutations:()=>B$(e,t,o,n)}}function q$(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=q$(e,t,n[r],s))}}return i}function B$(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=B$(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function z$(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ql(e)}function K$(e,t="",n=z$,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=K$(l,a,n,o,r,i),s))return s}return i&&H$(e)&&i.add(e),!1}function H$(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!H$(t))return!1;return!0}function G$(e){return"boolean"==typeof e}var J$=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new _$;if(t&&(G$(t)?i.push(nu):i.push(ou(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};G$(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=F$,ignoredPaths:r,warnAfter:i=32}=e;const s=V$.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=P$(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?wE(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?wE(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};G$(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=z$,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!Xl(u))return l(u);const h=l(u),p=P$(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=K$(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=K$(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};G$(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=D$}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},Z$=e=>t=>{setTimeout(t,e)},X$="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Z$(10),Y$=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new _$(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?X$:"callback"===e.type?e.queueNotification:Z$(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Q$="production"===process.env.NODE_ENV;function eE(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?wE(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?wE(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?wE(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?wE(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?wE(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?wE(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var tE=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function nE(...e){return t=>e.some((e=>((e,t)=>U$(e)?e.match(t):e(t))(e,t)))}var oE=["name","message","stack","code"],rE=class{constructor(e,t){this.payload=e,this.meta=t}_type},iE=class{constructor(e,t){this.payload=e,this.meta=t}_type},sE=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of oE)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},aE=(()=>{function e(e,t,n){const o=T$(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=T$(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=T$(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||sE)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):tE(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new rE(e,t),fulfillWithValue:(e,t)=>new iE(e,t)})).then((t=>{if(t instanceof rE)throw t;return t instanceof iE?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof rE?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(dE)})}}),{pending:r,rejected:i,fulfilled:o,settled:nE(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function dE(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var lE=Symbol.for("rtk-slice-createasyncthunk");function cE(e,t){return`${e}/${t}`}function uE({creators:e}={}){const t=e?.asyncThunk?.[lE];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?wE(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?wE(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?wE(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?wE(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?eE(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?wE(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=eE(t);if(function(e){return"function"==typeof e}(e))n=()=>L$(e());else{const t=L$(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(rc(e)){const o=n(e,t);return void 0===o?e:o}if(ic(e))return Vc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?wE(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:cE(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?wE(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?T$(e,s):T$(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?wE(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||fE,pending:a||fE,rejected:d||fE,settled:l||fE})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?wE(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=W$(c,n,{insert:()=>new WeakMap});return W$(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=hE(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function hE(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?wE(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var pE=uE();function fE(){}var gE="listenerMiddleware",mE=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=T$(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?wE(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?wE(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},vE=Object.assign((e=>{const{type:t,predicate:n,effect:o}=mE(e);return{id:tE(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?wE(22):"Unsubscribe not initialized")}}}),{withTypes:()=>vE}),bE=Object.assign(T$(`${gE}/add`),{withTypes:()=>bE});T$(`${gE}/removeAll`);var yE=Object.assign(T$(`${gE}/remove`),{withTypes:()=>yE});function wE(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const $E=["error","warn","info","debug"],EE=fl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return $E.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),kE="undefined"!=typeof localStorage,CE=kE&&localStorage.getItem("base.content.url")||"",xE=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,IE=fl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),OE=fl((e=>{var t,n;const o=al(EE,IE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),SE=e=>t=>{var n,o,r;const i=al(EE,IE,OE)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};SE.missingAttrValidator=xE;const jE=fl((e=>{const t=al(SE({"project-id":xE}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),RE=fl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const AE=fl((e=>{const t=al(EE,jE,RE)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(CE||o||"https://static.descope.com/pages");return r.pathname=ll(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),NE=fl((e=>{var t,n,o;const r=al(AE)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),ME=fl((e=>{var t,n,o,r,i,s,a;return a=class extends(al(IE,EE)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return dk})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),UE="load-descope-ui",TE="base.ui.components.url",DE=kE&&localStorage.getItem(TE)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",PE=kE&&localStorage.getItem(TE)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",_E=e=>{const t=document.createElement("script");return t.id=e,t},LE=(e,t)=>e.replace("<version>",t),WE=fl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=al(EE,NE)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return h(this,l,"f")||p(this,l,h(this,t,"m",u).call(this),"f"),h(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>h(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=_E("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=LE(PE,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${UE}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=_E(UE);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=LE(DE,await h(this,t,"m",r).call(this))}return document.getElementById(UE)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),FE="content-root",VE="root",qE=fl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${VE}, #${FE} {\n height: 100%;\n }\n #${VE} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${VE}">\n <div id="${FE}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(FE),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(VE)}})),BE="descope-modal";fl((e=>{var t,n;const o=al(IE,qE,WE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends jl{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(BE);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([BE]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const zE="descope-notification";fl((e=>{var t,n;const o=al(IE,qE,WE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Nl{setContent(t){const n="string"==typeof t?dl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(zE);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([zE])}},t=new WeakMap,n}));const KE=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',HE=fl((e=>{var t,n,o,r,i,s,a,d,l;const c=al(SE({theme:KE}),AE,IE,WE,NE,qE,OE)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(TE)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(TE),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),GE=e=>fl((t=>{const n=pE(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(al(EE)(t)){constructor(...e){super(...e);const t=function(e){const t=J$(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!ql(n))throw new Error("production"===process.env.NODE_ENV?wE(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Gl(n)}if(!Q$&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?wE(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Q$&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?wE(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Q$&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?wE(4):"each middleware provided to configureStore must be a function");let l=Jl;r&&(l=M$({trace:!Q$,..."object"==typeof r&&r}));const c=Zl(...d),u=Y$(c);if(!Q$&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?wE(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Q$&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?wE(6):"`enhancers` callback must return an array");if(!Q$&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?wE(7):"each enhancer provided to configureStore must be a function");return Q$||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Kl(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{dE(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));fl((e=>class extends(EE(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}})),fl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const JE=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var ZE,XE,YE,QE,ek,tk,nk,ok,rk,ik;const sk=document.createElement("template");sk.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class ak extends HTMLElement{constructor(){var e;super(),ZE.add(this),XE.set(this,new El({messages:[]})),YE.set(this,void 0),QE.set(this,void 0),ek.set(this,void 0),tk.set(this,{resize:h(this,ZE,"m",ik).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sk.content.cloneNode(!0)),p(this,YE,this.shadowRoot.querySelector(".debugger"),"f"),p(this,QE,h(this,YE,"f").querySelector(".content"),"f"),p(this,ek,h(this,YE,"f").querySelector(".header"),"f")}updateData(e){h(this,XE,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=JE(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,YE,"f"),h(this,ek,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,tk,"f").resize),(e=h(this,YE,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,YE,"f").onresize=h(this,ZE,"m",rk).bind(this),h(this,XE,"f").subscribe(h(this,ZE,"m",nk).bind(this))}disconnectedCallback(){h(this,XE,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,tk,"f").resize)}}XE=new WeakMap,YE=new WeakMap,QE=new WeakMap,ek=new WeakMap,tk=new WeakMap,ZE=new WeakSet,nk=function(e){h(this,ZE,"m",ok).call(this,e),h(this,ZE,"m",rk).call(this)},ok=function(e){h(this,QE,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},rk=function(){h(this,QE,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},ik=function(){const[e,t]=JE(h(this,YE,"f"),Number.parseInt(h(this,YE,"f").style.left,10),Number.parseInt(h(this,YE,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,YE,"f").style.top=`${t}px`,h(this,YE,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",ak);var dk=Object.freeze({__proto__:null});const lk=e=>e.selectedAuditId,ck=Qc((e=>e.auditList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{occurredFormatted:(null==e?void 0:e.occurred)?new Date(Number(null==e?void 0:e.occurred)||0).toLocaleString():"N/A"})))));Qc(lk,ck,((e,t)=>t.find((t=>e===t.id)))),Qc(lk,(e=>!!e));const uk=aE("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),hk=(e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))})(uk)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(pk=e=>e.auditList,{onFulfilled:e=>{pk(e).loading=!1},onPending:e=>{pk(e).loading=!0,pk(e).error=null},onRejected:(e,t)=>{pk(e).loading=!1,pk(e).error=t.error}}));var pk;const fk={action:uk,reducer:hk},gk={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},mk="/v1/mgmt/audit/search",vk=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s,from:a}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<9;e+=1)o.push({id:`Audit ${e}`,action:`Action ${e}`,actorId:`Actor ${e}`,type:"info",method:`Method ${e}`,userId:`User ${e}`,device:`Device ${e}`,geo:`Geo ${e}`,remoteAddress:`127.0.0.${e}`,externalIds:[`Login ID ${e}`],occurred:(new Date).getTime()});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.id.toLowerCase().includes(e.toLowerCase())||t.action.toLowerCase().includes(e.toLowerCase())||t.type.toLowerCase().includes(e.toLowerCase())||t.device.toLowerCase().includes(e.toLowerCase())||t.method.toLowerCase().includes(e.toLowerCase())||t.geo.toLowerCase().includes(e.toLowerCase())||t.remoteAddress.toLowerCase().includes(e.toLowerCase())||t.externalIds.includes(e.toLowerCase())||t.userId.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s});const d=yield e.post(mk,{limit:r,page:o,text:i,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})))(d),(yield d.json()).audits}))}),bk=fl((e=>{var t,n,o,r;const i=al(jE,OE,EE,RE,SE({tenant:SE.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.50"}}));return{audit:vk({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),yk=fl((e=>{const t=al(GE({name:"widget",initialState:gk,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{fk.reducer(e)},asyncActions:{searchAudit:fk.action}}),IE,EE,bk)(e);return class extends t{constructor(...e){super(...e),this.state=gk,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),wk=fl((e=>{const t=al(AE,SE({"widget-id":SE.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),$k=fl((e=>{var t,n,o;return o=class extends(al(EE,IE,WE,qE,wk,yk)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=dl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Ek=fl((e=>{var t,n,o,r,i;return i=class extends(al(EE,$k,yk)(e)){constructor(){super(...arguments),t.add(this),n.set(this,pl((()=>{const e=this.rangeInput.value,t=new Date;let n;switch(e){case"minuets15":n=t.setMinutes(t.getMinutes()-15);break;case"hour":n=t.setHours(t.getHours()-1);break;case"hour6":n=t.setHours(t.getHours()-6);break;case"day":default:n=t.setDate(t.getDate()-1);break;case"day3":n=t.setDate(t.getDate()-3);break;case"week":n=t.setDate(t.getDate()-7);break;case"week2":n=t.setDate(t.getDate()-14);break;case"month":n=t.setMonth(t.getMonth()-1)}this.actions.searchAudit({text:this.searchInput.value,from:Math.floor(new Date(n).getTime())})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this),h(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Ul(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r=function(){var e;this.rangeInput=new Al(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(h(this,n,"f"))},i})),kk=fl((e=>{var t,n,o,r;return r=class extends(al(yk,EE,$k)(e)){constructor(){super(...arguments),t.add(this),o.set(this,ul((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),h(this,o,"f").call(this,ck(this.state)),this.subscribe(h(this,o,"f").bind(this),ck)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Il(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="audit-table"]'),{logger:this.logger}),this.auditTable.onSelectedItemsChange((e=>{this.actions.setSelectedAuditId(e.detail.value.map((({id:e})=>e)))}))},r})),Ck=fl((e=>class extends(al(ME,HE,kk,Ek)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),xk=al((e=>class extends(Ck(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",xk);var Ik=Object.freeze({__proto__:null,default:xk});const Ok="undefined"!=typeof localStorage,Sk=Ok&&localStorage.getItem("base.content.url")||"",jk="config.json",Rk="base.ui.components.url",Ak=Ok&&localStorage.getItem(Rk)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Nk=Ok&&localStorage.getItem(Rk)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Mk="descope-login-flow",Uk="code",Tk="ra-challenge",Dk="ra-callback",Pk="ra-backup-callback",_k="ra-initiator",Lk="data-exclude-field",Wk="dls_last_auth",Fk="state_id",Vk="saml_idp_state_id",qk="saml_idp_username",Bk="descope_idp_initiated",zk="sso_app_id",Kk="oidc_login_hint",Hk="data-type",Gk="poll",Jk="webauthnCreate",Zk="submit",Xk="polling",Yk=["descope-multi-select-combo-box","descope-text-area"];var Qk;function eC(e){return new URLSearchParams(window.location.search).get(e)}function tC(e){if(window.history.replaceState&&eC(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}function nC(e,t){return u(this,void 0,void 0,(function*(){const n=yield fetch(e,{cache:"default"});if(!n.ok)throw Error(`Error fetching URL ${e} [${n.status}]`);return{body:yield n[t||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function oC({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Sk||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function rC(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?Qk.forward:n<o?Qk.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(Qk||(Qk={}));const iC=()=>{const[e="",t=""]=(eC(Mk)||"").split("_");return{executionId:e,stepId:t}};function sC(){tC(Mk)}const aC=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),dC=()=>{const{executionId:e,stepId:t}=iC();(e||t)&&sC();const n=eC("t")||void 0;n&&tC("t");const o=eC(Uk)||void 0;o&&tC(Uk);const r=eC("err")||void 0;r&&tC("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:eC(Tk),redirectAuthCallbackUrl:eC(Dk),redirectAuthBackupCallbackUri:eC(Pk),redirectAuthInitiator:eC(_k)};(i||s||a||d)&&(tC(Tk),tC(Dk),tC(Pk),tC(_k));const l=eC(Fk);l&&tC(Fk);const c=eC(Vk);c&&tC(Vk);const u=eC(qk);c&&tC(qk);const h=eC(Bk);h&&tC(Bk);const p=eC(zk);p&&tC(zk);const f=eC(Kk);return f&&tC(Kk),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}},lC=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},cC=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,uC=e=>null==e?void 0:e.submit(),hC=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},pC=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function fC(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var gC,mC,vC,bC;function yC(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!yC(i,s))return!1}else if(i!==s)return!1}return!0}class wC{constructor(e={},{updateOnlyOnChange:t=!0}={}){gC.set(this,void 0),mC.set(this,{}),vC.set(this,0),bC.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,gC,"f")):e,n=Object.assign(Object.assign({},h(this,gC,"f")),t);if(!h(this,bC,"f")||!yC(h(this,gC,"f"),n)){const e=h(this,gC,"f");p(this,gC,n,"f"),Object.freeze(h(this,gC,"f")),setTimeout((()=>{Object.values(h(this,mC,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,gC,e,"f"),p(this,bC,t,"f")}get current(){return Object.assign({},h(this,gC,"f"))}subscribe(e){return p(this,vC,h(this,vC,"f")+1,"f"),h(this,mC,"f")[h(this,vC,"f")]=e,h(this,vC,"f").toString()}unsubscribe(e){const t=!!h(this,mC,"f")[e];return t&&delete h(this,mC,"f")[e],t}unsubscribeAll(){return p(this,mC,{},"f"),!0}}gC=new WeakMap,mC=new WeakMap,vC=new WeakMap,bC=new WeakMap;const $C=["disabled"],EC=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Lk}])`)).forEach((e=>{e.value=n}))}))},kC=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),CC=(e,t,n)=>{e.querySelectorAll(`[${Hk}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},xC=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},IC=lC((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=Promise.all([null===(e=window.PublicKeyCredential)||void 0===e?void 0:e.isConditionalMediationAvailable(),null===(t=window.PublicKeyCredential)||void 0===t?void 0:t.isUserVerifyingPlatformAuthenticatorAvailable()]).then((e=>e.every((e=>!!e)))),i=(()=>{var e;const t=null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===e?void 0:e.brands,n=null==t?void 0:t.find((({brand:e,version:t})=>"Chromium"===e&&parseFloat(t)));return n?n.version:0})()>=108;return yield(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),OC={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function SC(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Wk)))}catch(e){}return t}const jC="dls_ab_testing_id",RC=document.createElement("template");var AC,NC,MC,UC,TC,DC,PC,_C,LC,WC,FC,VC,qC,BC,zC,KC,HC,GC,JC,ZC,XC,YC,QC,ex,tx,nx,ox,rx,ix,sx,ax,dx,lx,cx,ux,hx,px,fx,gx,mx,vx,bx,yx,wx,$x,Ex,kx,Cx,xx,Ix,Ox;RC.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class Sx extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","validate-on-blur"]}constructor(e){super(),AC.add(this),this.logger=console,NC.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,AC,"m",ix).call(this,e,t)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",n={})=>{this.logger.info(e,t,n)},debug:(e,t="")=>{this.logger.debug(e,t)}},MC.set(this,new wC({deferredRedirect:!1})),UC.set(this,new wC),TC.set(this,{}),this.getComponentsContext=()=>h(this,TC,"f"),this.nextRequestStatus=new wC({isLoading:!1}),DC.set(this,void 0),PC.set(this,{popstate:h(this,AC,"m",qC).bind(this),visibilitychange:h(this,AC,"m",BC).bind(this),componentsContext:h(this,AC,"m",tx).bind(this)}),_C.set(this,void 0),JC.set(this,lC((()=>u(this,void 0,void 0,(function*(){const e=oC({projectId:this.projectId,filename:jk,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield nC(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),XC.set(this,void 0),p(this,_C,e,"f"),h(this,AC,"m",LC).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){return this.getAttribute("tenant")||void 0}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light":n||"light"}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield h(this,JC,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,JC,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(h(this,UC,"f").subscribe(h(this,AC,"m",rx).bind(this)),h(this,UC,"f").update({isDebug:this.debug}),h(this,AC,"m",WC).call(this))return void h(this,AC,"m",FC).call(this);if(h(this,AC,"m",VC).call(this),p(this,XC,h(this,AC,"m",ZC).call(this),"f"),yield h(this,AC,"m",HC).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");if((yield h(this,JC,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,AC,"m",YC).call(this),yield h(this,AC,"m",dx).call(this),yield h(this,AC,"m",QC).call(this),h(this,AC,"m",sx).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:f,ssoAppId:g,oidcLoginHint:m}=dC();window.addEventListener("popstate",h(this,PC,"f").popstate),window.addEventListener("components-context",h(this,PC,"f").componentsContext),window.addEventListener("visibilitychange",h(this,PC,"f").visibilitychange),h(this,MC,"f").subscribe(h(this,AC,"m",KC).bind(this)),h(this,MC,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:f,ssoAppId:g,oidcLoginHint:m}),p(this,NC,!0,"f")}}))}disconnectedCallback(){h(this,MC,"f").unsubscribeAll(),h(this,UC,"f").unsubscribeAll(),h(this,AC,"m",ox).call(this),window.removeEventListener("popstate",h(this,PC,"f").popstate),window.removeEventListener("visibilitychange",h(this,PC,"f").visibilitychange),window.removeEventListener("components-context",h(this,PC,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,NC,"f")&&t!==n&&Sx.observedAttributes.includes(e)){h(this,AC,"m",VC).call(this);const o=null===t;h(this,MC,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,sC()),{[aC(e)]:n,stepId:i,executionId:s}})),h(this,UC,"f").update({isDebug:this.debug})}}}NC=new WeakMap,MC=new WeakMap,UC=new WeakMap,TC=new WeakMap,DC=new WeakMap,PC=new WeakMap,_C=new WeakMap,JC=new WeakMap,XC=new WeakMap,AC=new WeakSet,LC=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(RC.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},WC=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},FC=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",t.style.height="100%",e.parentElement.appendChild(t),t.appendChild(e)},VC=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client","validate-on-blur"];if(Sx.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[aC(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},qC=function(){const{stepId:e,executionId:t}=iC();h(this,MC,"f").update({stepId:e,executionId:t})},BC=function(){document.hidden||setTimeout((()=>{h(this,MC,"f").update({deferredRedirect:!1})}),300)},zC=function(e,t){this.sdk=so(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},Sx.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},KC=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;h(this,AC,"m",zC).call(this,t,o)}h(this,_C,"f").call(this,e)}))},HC=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,JC,"f").call(this)).isMissingConfig&&(yield h(this,AC,"m",GC).call(this))}))},GC=function(){return u(this,void 0,void 0,(function*(){const e=oC({projectId:this.projectId,filename:jk,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield nC(e,"json"),!0}catch(e){return!1}}))},ZC=function(){return u(this,void 0,void 0,(function*(){const e=oC({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield nC(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},YC=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,JC,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},QC=function(){return u(this,void 0,void 0,(function*(){yield h(this,AC,"m",ex).call(this),yield h(this,AC,"m",nx).call(this)}))},ex=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield h(this,XC,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield Sx.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},tx=function(e){p(this,TC,Object.assign(Object.assign({},h(this,TC,"f")),e.detail),"f")},nx=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Sx.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},ox=function(){var e;null===(e=h(this,DC,"f"))||void 0===e||e.remove(),p(this,DC,null,"f")},rx=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,DC,document.createElement("descope-debugger"),"f"),Object.assign(h(this,DC,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return vS})),document.body.appendChild(h(this,DC,"f"))):h(this,AC,"m",ox).call(this)}))},ix=function(e,t){var n;e&&this.debug&&(null===(n=h(this,DC,"f"))||void 0===n||n.updateData({title:e,description:t}))},sx=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=Yk.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)return;e.preventDefault();const s=this.rootElement.querySelectorAll("descope-button");if(1===s.length&&"false"!==s[0].getAttribute("auto-submit"))return void s[0].click();const a=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const d=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===d.length)"false"!==d[0].getAttribute("auto-submit")&&d[0].click();else if(0===d.length){const e=Array.from(s).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}},ax=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,JC,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},dx=function(){return u(this,void 0,void 0,(function*(){Sx.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Sx.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield h(this,AC,"m",ax).call(this),i=t(n(Ak,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Nk,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},Sx.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.16.0"}};class jx extends Sx{static set sdkConfigOverrides(e){Sx.sdkConfigOverrides=e}constructor(){const e=new wC;super(e.update.bind(e)),lx.add(this),this.stepState=new wC({},{updateOnlyOnChange:!1}),cx.set(this,void 0),ux.set(this,null),hx.set(this,((e,t,n,o,r)=>{n===Gk&&p(this,cx,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,Xk,o,r,{});h(this,fx,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,hx,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),px.set(this,(()=>{clearTimeout(h(this,cx,"f")),p(this,cx,null,"f")})),fx.set(this,(e=>{var t,n,o,r,i,s,a,d,l;if(!(null==e?void 0:e.ok)){h(this,lx,"m",Ox).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}const c=null===(d=null===(a=null===(s=e.data)||void 0===s?void 0:s.screen)||void 0===a?void 0:a.state)||void 0===d?void 0:d.errorText;(null===(l=e.data)||void 0===l?void 0:l.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${c?`${c} - `:""}${e.data.error.message}`):c&&this.loggerWrapper.error(c);const{status:u,authInfo:p,lastAuth:f}=e.data;if("completed"===u)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&Ok&&localStorage.setItem(Wk,JSON.stringify(e))}(f),void h(this,lx,"m",Ox).call(this,"success",p);const{executionId:g,stepId:m,stepName:v,action:b,screen:y,redirect:w,openInNewTabUrl:$,webauthn:E,error:k,samlIdpResponse:C}=e.data;b!==Gk?(this.loggerWrapper.info(`Step "${v||`#${m}`}" is ${u}`,"",{screen:y,status:u,stepId:m,stepName:v,action:b,error:k}),this.flowState.update({stepId:m,executionId:g,action:b,redirectTo:null==w?void 0:w.url,openInNewTabUrl:$,screenId:null==y?void 0:y.id,screenState:null==y?void 0:y.state,webauthnTransactionId:null==E?void 0:E.transactionId,webauthnOptions:null==E?void 0:E.options,samlIdpResponseUrl:null==C?void 0:C.url,samlIdpResponseSamlResponse:null==C?void 0:C.samlResponse,samlIdpResponseRelayState:null==C?void 0:C.relayState})):this.flowState.update({action:b})})),gx.set(this,lC((()=>u(this,void 0,void 0,(function*(){var e;try{const t=yield this.sdk.webauthn.signIn.start("",window.location.origin);return t.ok||this.loggerWrapper.warn("Webauthn start failed",null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.errorMessage),t.data}catch(e){this.loggerWrapper.warn("Webauthn start failed",e.message)}}))))),kx.set(this,pC(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,lx,"m",yx).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,lx,"m",$x).call(this,e);const r=yield h(this,lx,"m",wx).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(o,d.version,l.componentsVersion,a);h(this,fx,"f").call(this,c),h(this,lx,"m",Ex).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=h(this,ux,"f"))||void 0===e||e.abort(),p(this,ux,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=fC(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield nC(t,"text");return e}catch(n){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,n)}try{const{body:t}=yield nC(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:l,action:c,screenId:u,screenState:f,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:b,code:y,exchangeError:w,webauthnTransactionId:$,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:I,oidcIdpStateId:O,locale:S,samlIdpStateId:j,samlIdpUsername:R,descopeIdpInitiated:A,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,_;const L=(()=>{const e=localStorage.getItem(jC);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(jC,e.toString()),e}return Number(e)})(),W=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(F.fingerprintEnabled&&F.fingerprintKey?yield _n(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Dn),F.conditions?({startScreenId:P,conditionInteractionId:_}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=OC[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:W,code:y,token:b,abTestingKey:L},F.conditions)):F.condition?({startScreenId:P,conditionInteractionId:_}=((e,t)=>{var n;const o=null===(n=OC[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:W,code:y,token:b,abTestingKey:L})):P=F.startScreenId,!cC(P,O,j,R,T,D))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:D,client:this.client},v&&{redirectUrl:v}),{lastAuth:SC(W),abTestingKey:L,locale:fC(S)}),_,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),A&&{idpInitiated:!0}),b?{token:b}:{}),D?{externalId:D}:{}));return h(this,fx,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&b||n("code")&&y||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(l,d,Zk,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return h(this,fx,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===c&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!N||!M)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.innerHTML=`\n <input type="hidden" role="saml-response" name="SAMLResponse" value="${t}" />\n <input type="hidden" role="saml-relay-state" name="RelayState" value="${n}" />\n <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />\n `,document.body.appendChild(r),o(r)})(N,M,U||"",uC)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===I&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===Jk||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=h(this,ux,"f"))||void 0===r||r.abort(),p(this,ux,null,"f");try{e=c===Jk?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(l,d,Zk,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});h(this,fx,"f").call(this,n)}if(h(this,hx,"f").call(this,l,d,c,F.version,V.componentsVersion),!u&&!P)return void this.loggerWrapper.warn("No screen was found to show");const B=P||u,z=yield this.getHtmlFilenameWithLocale(S,B),K={direction:rC(d,t.stepId),screenState:Object.assign(Object.assign({},f),{form:Object.assign(Object.assign({},this.formConfigValues),null==f?void 0:f.form),lastAuth:{loginId:W,name:this.sdk.getLastUserDisplayName()||W}}),htmlUrl:oC({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&oC({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:R,oidcLoginHint:D,openInNewTabUrl:m},H=SC(W);cC(P,O,j,R,T,D)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:D,lastAuth:H,preview:this.preview,abTestingKey:L,client:this.client},v&&{redirectUrl:v}),{locale:fC(S)}),_,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),y&&{exchangeCode:y,idpInitiated:!0}),A&&{idpInitiated:!0}),b&&{token:b})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield Sx.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const p=c.content.cloneNode(!0),f=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield h(this,lx,"m",bx).call(this,p,a):p.querySelectorAll(`descope-button[${Hk}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Hk}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),CC(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),CC(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=kC(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",kC(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=kC(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{$C.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(p,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(p,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,xC(r,"descope-totp-image",i),((e,t)=>{xC(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(p),setTimeout((()=>{((e,t)=>{EC(e,null==t?void 0:t.inputs),EC(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-password"),t=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t].forEach((e=>h(this,lx,"m",vx).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),h(this,lx,"m",xx).call(this,a),s&&h(this,lx,"m",Ox).call(this,"ready",{}),h(this,lx,"m",Ox).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Hk}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(Xk,e.version,t.componentsVersion,{});h(this,fx,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?h(this,lx,"m",Ix).call(this,m,s):m()}))}}cx=new WeakMap,ux=new WeakMap,hx=new WeakMap,px=new WeakMap,fx=new WeakMap,gx=new WeakMap,kx=new WeakMap,lx=new WeakSet,mx=function(e){const t=e.getAttribute("name");if(!["email"].includes(t)){const n=`user-${t}`;e.setAttribute("name",n),e.addEventListener("input",(()=>{e.setAttribute("name",e.value?t:n)}))}},vx=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},bx=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,ux,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield IC())){const{options:e,transactionId:n}=(yield h(this,gx,"f").call(this))||{};if(e&&n){h(this,lx,"m",mx).call(this,o),p(this,ux,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,ux,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});h(this,fx,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},yx=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).every((e=>{var t,n;return"slot"===e.localName||(null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e))}))},wx=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Lk}])`));return(yield Promise.all(e.map((e=>u(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},$x=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Ex=function(e={}){var t,n;const o=hC(e,["externalId","email","phone"]),r=hC(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,password:r});null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.store)||void 0===n||n.call(t,e)}catch(e){this.loggerWrapper.error("Could not store credentials",e.message)}},Cx=function(e){this.rootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.addEventListener("input",(()=>{var n;(null===(n=t.checkValidity)||void 0===n?void 0:n.call(t))&&h(this,kx,"f").call(this,t,e)}))}))},xx=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,kx,"f").call(this,t,e)}})),h(this,lx,"m",Cx).call(this,e)},Ix=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===Qk.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},Ox=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",jx);((...e)=>{const t=Yc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(rc(e)?Lc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Xc);var Rx="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Jl:Jl.apply(null,arguments)},Ax=e=>e&&"function"==typeof e.match;function Nx(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?vI(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Xl(t)&&t.type===e,n}function Mx(e){return"function"==typeof e&&"type"in e&&Ax(e)}function Ux(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var Tx=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Dx(e){return ic(e)?Vc(e,(()=>{})):e}function Px(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?vI(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function _x(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Lx(e,t,n){const o=Wx(e,t,n);return{detectMutations:()=>Fx(e,t,o,n)}}function Wx(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Wx(e,t,n[r],s))}}return i}function Fx(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Fx(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Vx(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ql(e)}function qx(e,t="",n=Vx,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=qx(l,a,n,o,r,i),s))return s}return i&&Bx(e)&&i.add(e),!1}function Bx(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Bx(t))return!1;return!0}function zx(e){return"boolean"==typeof e}var Kx=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Tx;if(t&&(zx(t)?i.push(nu):i.push(ou(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};zx(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=_x,ignoredPaths:r,warnAfter:i=32}=e;const s=Lx.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Ux(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vI(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vI(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};zx(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Vx,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!Xl(u))return l(u);const h=l(u),p=Ux(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=qx(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=qx(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};zx(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Mx}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},Hx=e=>t=>{setTimeout(t,e)},Gx="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Hx(10),Jx=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Tx(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Gx:"callback"===e.type?e.queueNotification:Hx(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Zx="production"===process.env.NODE_ENV;function Xx(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?vI(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?vI(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?vI(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?vI(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?vI(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?vI(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Yx=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Qx(...e){return t=>e.some((e=>((e,t)=>Ax(e)?e.match(t):e(t))(e,t)))}var eI=["name","message","stack","code"],tI=class{constructor(e,t){this.payload=e,this.meta=t}_type},nI=class{constructor(e,t){this.payload=e,this.meta=t}_type},oI=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of eI)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},rI=(()=>{function e(e,t,n){const o=Nx(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Nx(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Nx(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||oI)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):Yx(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new tI(e,t),fulfillWithValue:(e,t)=>new nI(e,t)})).then((t=>{if(t instanceof tI)throw t;return t instanceof nI?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof tI?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(iI)})}}),{pending:r,rejected:i,fulfilled:o,settled:Qx(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function iI(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var sI=Symbol.for("rtk-slice-createasyncthunk");function aI(e,t){return`${e}/${t}`}function dI({creators:e}={}){const t=e?.asyncThunk?.[sI];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?vI(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?vI(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?vI(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?vI(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?Xx(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?vI(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=Xx(t);if(function(e){return"function"==typeof e}(e))n=()=>Dx(e());else{const t=Dx(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(rc(e)){const o=n(e,t);return void 0===o?e:o}if(ic(e))return Vc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?vI(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:aI(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?vI(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Nx(e,s):Nx(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?vI(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||uI,pending:a||uI,rejected:d||uI,settled:l||uI})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vI(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Px(c,n,{insert:()=>new WeakMap});return Px(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=lI(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function lI(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vI(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var cI=dI();function uI(){}var hI="listenerMiddleware",pI=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Nx(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?vI(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?vI(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},fI=Object.assign((e=>{const{type:t,predicate:n,effect:o}=pI(e);return{id:Yx(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?vI(22):"Unsubscribe not initialized")}}}),{withTypes:()=>fI}),gI=Object.assign(Nx(`${hI}/add`),{withTypes:()=>gI});Nx(`${hI}/removeAll`);var mI=Object.assign(Nx(`${hI}/remove`),{withTypes:()=>mI});function vI(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const bI=["error","warn","info","debug"],yI=fl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return bI.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),wI="undefined"!=typeof localStorage,$I=wI&&localStorage.getItem("base.content.url")||"",EI=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,kI=fl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),CI=fl((e=>{var t,n;const o=al(yI,kI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),xI=e=>t=>{var n,o,r;const i=al(yI,kI,CI)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};xI.missingAttrValidator=EI;const II=fl((e=>{const t=al(xI({"project-id":EI}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),OI=fl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const SI=fl((e=>{const t=al(yI,II,OI)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL($I||o||"https://static.descope.com/pages");return r.pathname=ll(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),jI=fl((e=>{var t,n,o;const r=al(SI)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),RI=fl((e=>{var t,n,o,r,i,s,a;return a=class extends(al(kI,yI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return aO})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),AI="load-descope-ui",NI="base.ui.components.url",MI=wI&&localStorage.getItem(NI)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",UI=wI&&localStorage.getItem(NI)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",TI=e=>{const t=document.createElement("script");return t.id=e,t},DI=(e,t)=>e.replace("<version>",t),PI=fl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=al(yI,jI)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return h(this,l,"f")||p(this,l,h(this,t,"m",u).call(this),"f"),h(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>h(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=TI("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=DI(UI,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${AI}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=TI(AI);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=DI(MI,await h(this,t,"m",r).call(this))}return document.getElementById(AI)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),_I="content-root",LI="root",WI=fl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${LI}, #${_I} {\n height: 100%;\n }\n #${LI} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${LI}">\n <div id="${_I}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(_I),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(LI)}})),FI="descope-modal",VI=fl((e=>{var t,n;const o=al(kI,WI,PI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends jl{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(FI);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([FI]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),qI="descope-notification";fl((e=>{var t,n;const o=al(kI,WI,PI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Nl{setContent(t){const n="string"==typeof t?dl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(qI);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([qI])}},t=new WeakMap,n}));const BI=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',zI=fl((e=>{var t,n,o,r,i,s,a,d,l;const c=al(xI({theme:BI}),SI,kI,PI,jI,WI,CI)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(NI)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(NI),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),KI=e=>fl((t=>{const n=cI(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(al(yI)(t)){constructor(...e){super(...e);const t=function(e){const t=Kx(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!ql(n))throw new Error("production"===process.env.NODE_ENV?vI(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Gl(n)}if(!Zx&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?vI(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Zx&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?vI(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Zx&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vI(4):"each middleware provided to configureStore must be a function");let l=Jl;r&&(l=Rx({trace:!Zx,..."object"==typeof r&&r}));const c=Zl(...d),u=Jx(c);if(!Zx&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?vI(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Zx&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?vI(6):"`enhancers` callback must return an array");if(!Zx&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vI(7):"each enhancer provided to configureStore must be a function");return Zx||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Kl(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{iI(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));fl((e=>class extends(yI(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));const HI=fl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}})),GI=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var JI,ZI,XI,YI,QI,eO,tO,nO,oO,rO;const iO=document.createElement("template");iO.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class sO extends HTMLElement{constructor(){var e;super(),JI.add(this),ZI.set(this,new El({messages:[]})),XI.set(this,void 0),YI.set(this,void 0),QI.set(this,void 0),eO.set(this,{resize:h(this,JI,"m",rO).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(iO.content.cloneNode(!0)),p(this,XI,this.shadowRoot.querySelector(".debugger"),"f"),p(this,YI,h(this,XI,"f").querySelector(".content"),"f"),p(this,QI,h(this,XI,"f").querySelector(".header"),"f")}updateData(e){h(this,ZI,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=GI(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,XI,"f"),h(this,QI,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,eO,"f").resize),(e=h(this,XI,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,XI,"f").onresize=h(this,JI,"m",oO).bind(this),h(this,ZI,"f").subscribe(h(this,JI,"m",tO).bind(this))}disconnectedCallback(){h(this,ZI,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,eO,"f").resize)}}ZI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,eO=new WeakMap,JI=new WeakSet,tO=function(e){h(this,JI,"m",nO).call(this,e),h(this,JI,"m",oO).call(this)},nO=function(e){h(this,YI,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},oO=function(){h(this,YI,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},rO=function(){const[e,t]=GI(h(this,XI,"f"),Number.parseInt(h(this,XI,"f").style.left,10),Number.parseInt(h(this,XI,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,XI,"f").style.top=`${t}px`,h(this,XI,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",sO);var aO=Object.freeze({__proto__:null});const dO=e=>e.me.data,lO=Qc(dO,(e=>e.picture)),cO=Qc(dO,(e=>e.email)),uO=Qc(dO,(e=>e.verifiedEmail)),hO=Qc(dO,(e=>e.name)),pO=Qc(dO,(e=>e.phone)),fO=Qc(dO,(e=>e.verifiedPhone)),gO=Qc(dO,(e=>e.webauthn));Qc(dO,(e=>e.password));const mO=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},vO=rI("users/me",((e,{extra:{api:t}})=>t.user.me())),bO=mO(vO)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(yO=e=>e.me,{onFulfilled:e=>{yO(e).loading=!1},onPending:e=>{yO(e).loading=!0,yO(e).error=null},onRejected:(e,t)=>{yO(e).loading=!1,yO(e).error=t.error}}));var yO;const wO={action:vO,reducer:bO},$O=rI("users/logout",((e,{extra:{api:t}})=>t.user.logout())),EO={action:$O,reducer:mO($O)({})},kO={me:{loading:!1,error:null,data:{}}},CO="/v1/auth/me",xO=({httpClient:e,mock:t})=>({me:()=>u(void 0,void 0,void 0,(function*(){if(t)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))}));const n=yield e.get(CO);return yield(e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})))(n),n.json()}))}),IO=fl((e=>{var t,n,o,r;const i=al(II,CI,yI,OI)(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n)=>{const o=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.0.59"}}));return{user:Object.assign(Object.assign({},xO({httpClient:o.httpClient,mock:t})),{logout:t?()=>u(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},r})),OO=fl((e=>{const t=al(KI({name:"widget",initialState:kO,reducers:{},extraReducers:e=>{wO.reducer(e),EO.reducer(e)},asyncActions:{getMe:wO.action,logout:EO.action}}),kI,yI,IO)(e);return class extends t{constructor(...e){super(...e),this.state=kO,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),SO=fl((e=>{const t=al(SI,xI({"widget-id":xI.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),jO=fl((e=>{var t,n,o;return o=class extends(al(yI,kI,PI,WI,SO,OO)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([this.actions.getMe(),h(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=dl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),RO=(e={})=>{const t=dl("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),n)})),t};function AO(e){return new URLSearchParams(window.location.search).get(e)}const NO=fl((e=>{var t,n,o,r,i,s,a,d,l;return l=class extends(al(OO,yI,jO,VI,HI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,ul((e=>{this.avatar.image=e}))),d.set(this,ul((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",s).call(this),h(this,t,"m",r).call(this),h(this,a,"f").call(this,lO(this.state)),h(this,d,"f").call(this,hO(this.state)),this.subscribe(h(this,a,"f").bind(this),lO),this.subscribe(h(this,d,"f").bind(this),hO)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){p(this,n,this.createModal({"data-id":"update-pic"}),"f"),p(this,o,new _l((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",i).bind(this),h(this,t,"m",i).call(this)},i=function(){h(this,n,"f").setContent(RO({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new Tl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{h(this,n,"f").open()}))},l})),MO=fl((e=>{var t,n,o,r,i,s,a,d,l,c,f,g,m;return m=class extends(al(OO,yI,jO,VI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),f.set(this,ul((e=>{this.emailUserAttr.value=e}))),g.set(this,ul((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",c).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,f,"f").call(this,cO(this.state)),h(this,g,"f").call(this,uO(this.state)),this.subscribe(h(this,f,"f").bind(this),cO),this.subscribe(h(this,g,"f").bind(this),uO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){p(this,n,this.createModal({"data-id":"edit-email"}),"f"),p(this,o,new _l((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",a).bind(this),h(this,t,"m",a).call(this)},a=function(){h(this,n,"f").setContent(RO({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},d=function(){p(this,r,this.createModal({"data-id":"delete-email"}),"f"),p(this,i,new _l((()=>{var e;return null===(e=h(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,r,"f").afterClose=h(this,t,"m",l).bind(this),h(this,t,"m",l).call(this)},l=function(){h(this,r,"f").setContent(RO({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.emailUserAttr=new Dl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{h(this,n,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{h(this,r,"f").open()}))},m})),UO=fl((e=>{var t,n,o,r,i,s,a,d,l,c,f,g;return g=class extends(al(OO,yI,jO,VI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),f.set(this,ul((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",c).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,f,"f").call(this,hO(this.state)),this.subscribe(h(this,f,"f").bind(this),hO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,f=new WeakMap,t=new WeakSet,s=function(){p(this,n,this.createModal({"data-id":"edit-name"}),"f"),p(this,o,new _l((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",a).bind(this),h(this,t,"m",a).call(this)},a=function(){h(this,n,"f").setContent(RO({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},d=function(){p(this,r,this.createModal({"data-id":"delete-name"}),"f"),p(this,i,new _l((()=>{var e;return null===(e=h(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,r,"f").afterClose=h(this,t,"m",l).bind(this),h(this,t,"m",l).call(this)},l=function(){h(this,r,"f").setContent(RO({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.nameUserAttr=new Dl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{h(this,n,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{h(this,r,"f").open()}))},g})),TO=fl((e=>{var t,n,o,r,i,s,a,d,l,c,f,g,m;return m=class extends(al(OO,yI,jO,VI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),f.set(this,ul((e=>{this.phoneUserAttr.value=e}))),g.set(this,ul((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",c).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,f,"f").call(this,pO(this.state)),h(this,g,"f").call(this,fO(this.state)),this.subscribe(h(this,f,"f").bind(this),pO),this.subscribe(h(this,g,"f").bind(this),fO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){p(this,n,this.createModal({"data-id":"edit-phone"}),"f"),p(this,o,new _l((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",a).bind(this),h(this,t,"m",a).call(this)},a=function(){h(this,n,"f").setContent(RO({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},d=function(){p(this,r,this.createModal({"data-id":"delete-phone"}),"f"),p(this,i,new _l((()=>{var e;return null===(e=h(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,r,"f").afterClose=h(this,t,"m",l).bind(this),h(this,t,"m",l).call(this)},l=function(){h(this,r,"f").setContent(RO({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.phoneUserAttr=new Dl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{h(this,n,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{h(this,r,"f").open()}))},m})),DO=fl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(al(OO,yI,jO,VI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,ul((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",s).call(this),h(this,t,"m",r).call(this),h(this,a,"f").call(this,gO(this.state)),this.subscribe(h(this,a,"f").bind(this),gO)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){p(this,n,this.createModal({"data-id":"passkey"}),"f"),p(this,o,new _l((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",i).bind(this),h(this,t,"m",i).call(this)},i=function(){h(this,n,"f").setContent(RO({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new Pl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{h(this,n,"f").open()}))},d})),PO=fl((e=>{var t,n,o,r,i,s,a;return a=class extends(al(OO,yI,jO,VI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",s).call(this),h(this,t,"m",r).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,r=function(){p(this,n,this.createModal({"data-id":"password"}),"f"),p(this,o,new _l((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",i).bind(this),h(this,t,"m",i).call(this)},i=function(){h(this,n,"f").setContent(RO({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new Pl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{h(this,n,"f").open()}))},a})),_O=fl((e=>{var t,n,o;return o=class extends(al(OO,yI,jO,VI)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Ol((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>u(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),LO="widget-flow",WO=fl((e=>{var t,n,o;return o=class extends(al(kI,VI,OO,yI)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this);const r=AO(LO);r&&(function(e){if(window.history.replaceState&&AO(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}(LO),h(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(RO({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));const n=new _l((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger});n.onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},o})),FO=fl((e=>class extends(al(RI,zI,WO,MO,NO,UO,TO,DO,PO,_O)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),VO=al((e=>class extends(FO(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),jx.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.59"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",VO);var qO=Object.freeze({__proto__:null,default:VO});const BO=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var zO,KO,HO,GO,JO,ZO,XO,YO,QO,eS;const tS=document.createElement("template");tS.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class nS extends HTMLElement{constructor(){super(),zO.add(this),KO.set(this,new Za({messages:[]})),HO.set(this,void 0),GO.set(this,void 0),JO.set(this,void 0),ZO.set(this,{resize:h(this,zO,"m",eS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(tS.content.cloneNode(!0)),p(this,HO,this.shadowRoot.querySelector(".debugger"),"f"),p(this,GO,h(this,HO,"f").querySelector(".content"),"f"),p(this,JO,h(this,HO,"f").querySelector(".header"),"f")}updateData(e){h(this,KO,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=BO(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,HO,"f"),h(this,JO,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,ZO,"f").resize),(e=h(this,HO,"f")).onmousemove=t=>{(t.target.w&&t.target.w!==t.target.offsetWidth||t.target.h&&t.target.h!==t.target.offsetHeight)&&e.onresize(t),t.target.w=t.target.offsetWidth,t.target.h=t.target.offsetHeight},h(this,HO,"f").onresize=h(this,zO,"m",QO).bind(this),h(this,KO,"f").subscribe(h(this,zO,"m",XO).bind(this))}disconnectedCallback(){h(this,KO,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,ZO,"f").resize)}}KO=new WeakMap,HO=new WeakMap,GO=new WeakMap,JO=new WeakMap,ZO=new WeakMap,zO=new WeakSet,XO=function(e){h(this,zO,"m",YO).call(this,e),h(this,zO,"m",QO).call(this)},YO=function(e){h(this,GO,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},QO=function(){h(this,GO,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},eS=function(){const[e,t]=BO(h(this,HO,"f"),Number.parseInt(h(this,HO,"f").style.left,10),Number.parseInt(h(this,HO,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,HO,"f").style.top=`${t}px`,h(this,HO,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",nS);var oS=Object.freeze({__proto__:null,default:nS});const rS=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var iS,sS,aS,dS,lS,cS,uS,hS,pS,fS;const gS=document.createElement("template");gS.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class mS extends HTMLElement{constructor(){super(),iS.add(this),sS.set(this,new wC({messages:[]})),aS.set(this,void 0),dS.set(this,void 0),lS.set(this,void 0),cS.set(this,{resize:h(this,iS,"m",fS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(gS.content.cloneNode(!0)),p(this,aS,this.shadowRoot.querySelector(".debugger"),"f"),p(this,dS,h(this,aS,"f").querySelector(".content"),"f"),p(this,lS,h(this,aS,"f").querySelector(".header"),"f")}updateData(e){h(this,sS,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=rS(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(h(this,aS,"f"),h(this,lS,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,cS,"f").resize),(e=h(this,aS,"f")).onmousemove=t=>{(t.target.w&&t.target.w!==t.target.offsetWidth||t.target.h&&t.target.h!==t.target.offsetHeight)&&e.onresize(t),t.target.w=t.target.offsetWidth,t.target.h=t.target.offsetHeight},h(this,aS,"f").onresize=h(this,iS,"m",pS).bind(this),h(this,sS,"f").subscribe(h(this,iS,"m",uS).bind(this))}disconnectedCallback(){h(this,sS,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,cS,"f").resize)}}sS=new WeakMap,aS=new WeakMap,dS=new WeakMap,lS=new WeakMap,cS=new WeakMap,iS=new WeakSet,uS=function(e){h(this,iS,"m",hS).call(this,e),h(this,iS,"m",pS).call(this)},hS=function(e){h(this,dS,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},pS=function(){h(this,dS,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},fS=function(){const[e,t]=rS(h(this,aS,"f"),Number.parseInt(h(this,aS,"f").style.left,10),Number.parseInt(h(this,aS,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,aS,"f").style.top=`${t}px`,h(this,aS,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",mS);var vS=Object.freeze({__proto__:null,default:mS});e.AccessKeyManagement=Eo,e.AuditManagement=Co,e.AuthProvider=({projectId:e,baseUrl:n="",baseStaticUrl:s="",sessionTokenViaCookie:d=!1,persistTokens:l=!0,storeLastAuthenticatedUser:c=!0,children:u})=>{const[h,p]=t.useState(),[f,g]=t.useState(),[m,v]=t.useState(!1),[b,y]=t.useState(!1),w=(({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,storeLastAuthenticatedUser:i})=>t.useMemo((()=>{if(e)return lo({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:a,persistTokens:o,storeLastAuthenticatedUser:i,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:l,sessionTokenViaCookie:d,storeLastAuthenticatedUser:c});t.useEffect((()=>{if(w){const e=w.onSessionTokenChange(g),t=w.onUserChange(p);return()=>{e(),t()}}}),[w]);const $=t.useRef(!1),E=t.useCallback((()=>{$.current||($.current=!0,y(!0),i(null==w?void 0:w.refresh)().then((()=>{y(!1)})))}),[w]),k=t.useCallback((()=>{v(!0),i(w.me)().then((()=>{v(!1)}))}),[w]),C=t.useMemo((()=>({fetchUser:k,user:h,isUserLoading:m,fetchSession:E,session:f,isSessionLoading:b,isSessionFetched:$.current,projectId:e,baseUrl:n,baseStaticUrl:s,storeLastAuthenticatedUser:c,setUser:p,setSession:g,sdk:w})),[k,h,m,E,f,b,$.current,e,n,s,p,g,w]);return o.default.createElement(r.Provider,{value:C},u)},e.Descope=mo,e.RoleManagement=wo,e.SignInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=bo,e.UserProfile=Io,e.baseHeaders=a,e.getJwtPermissions=po,e.getJwtRoles=fo,e.getRefreshToken=ho,e.getSessionToken=uo,e.isRefreshTokenExpired=(e=ho())=>null==ao?void 0:ao.isJwtExpired(e),e.isSessionTokenExpired=(e=uo())=>null==ao?void 0:ao.isJwtExpired(e),e.refresh=(e=ho())=>null==ao?void 0:ao.refresh(e),e.useDescope=()=>{const{sdk:e}=Oo();return t.useMemo((()=>e||new Proxy(co(),jo)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:o,isSessionFetched:r}=Oo(),i=t.useRef(n);t.useMemo((()=>{i.current=n}),[n]);const s=!e&&!n;return t.useMemo((()=>{s&&!r&&(i.current=!0)}),[r]),t.useEffect((()=>{s&&o()}),[o]),{isSessionLoading:i.current,sessionToken:e,isAuthenticated:!!e}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:o,session:r}=Oo(),[i,s]=t.useState(!1),a=t.useRef(o),d=t.useMemo((()=>!e&&!o&&r&&!i),[n,r,i]);return t.useMemo((()=>{a.current=o}),[o]),t.useMemo((()=>{d&&(a.current=!0)}),[d]),t.useEffect((()=>{d&&(s(!0),n())}),[d]),{isUserLoading:a.current,user:e}},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Descope={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);const r=o.default.createContext(void 0),i=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)},s=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},a={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.0.41"},d="undefined"!=typeof window;var l=function(){return l=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},l.apply(this,arguments)};function c(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(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 u(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{d(o.next(e))}catch(e){i(e)}}function a(e){try{d(o.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((o=o.apply(e,t||[])).next())}))}function h(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function p(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function f(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function g(e){this.message=e}"function"==typeof SuppressedError&&SuppressedError,g.prototype=new Error,g.prototype.name="InvalidCharacterError";var m="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new g("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,r=0,i=0,s="";o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?s+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function v(e){this.message=e}function b(e,t){if("string"!=typeof e)throw new v("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(m(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return m(t)}}(e.split(".")[n]))}catch(e){throw new v("Invalid token specified: "+e.message)}}v.prototype=new Error,v.prototype.name="InvalidTokenError";var y="/v1/auth/accesskey/exchange",w="/v1/auth/otp/verify",$="/v1/auth/otp/signin",E="/v1/auth/otp/signup",k={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},C="/v1/auth/otp/signup-in",x="/v1/auth/magiclink/verify",I="/v1/auth/magiclink/signin",O="/v1/auth/magiclink/signup",S={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},j="/v1/auth/magiclink/signup-in",A="/v1/auth/enchantedlink/verify",R="/v1/auth/enchantedlink/signin",N="/v1/auth/enchantedlink/signup",M="/v1/auth/enchantedlink/pending-session",U={email:"/v1/auth/enchantedlink/update/email"},T="/v1/auth/enchantedlink/signup-in",D="/v1/auth/oauth/authorize",P="/v1/auth/oauth/exchange",L="v1/auth/oauth/native/start",_="v1/auth/oauth/native/finish",W="/v1/auth/saml/authorize",F="/v1/auth/saml/exchange",V="/v1/auth/totp/verify",q="/v1/auth/totp/signup",B="/v1/auth/totp/update",z="/v1/auth/notp/whatsapp/signin",K="/v1/auth/notp/whatsapp/signup",H="/v1/auth/notp/whatsapp/signup-in",G="/v1/auth/notp/pending-session",J={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},Z={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},X={start:"/v1/auth/webauthn/signup-in/start"},Y={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Q="/v1/auth/password/signup",ee="/v1/auth/password/signin",te="/v1/auth/password/reset",ne="/v1/auth/password/update",oe="/v1/auth/password/replace",re="/v1/auth/password/policy",ie="/v1/auth/refresh",se="/v1/auth/tenant/select",ae="/v1/auth/logout",de="/v1/auth/logoutall",le="/v1/auth/me",ce="/v1/auth/me/history",ue="/v1/flow/start",he="/v1/flow/next";const pe="<region>",fe=`https://api.${pe}descope.com`,ge=6e5,me=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var ve;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(ve||(ve={}));const be=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(pe,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},ye=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),we=e=>void 0===e?void 0:JSON.stringify(e),$e=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Ee=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||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(...t)=>{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((e=>me().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return me().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:c,headers:u,queryParams:h,method:p,token:f}=d,g={headers:ye($e(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.19.2"},(null==n?void 0:n.baseHeaders)||{},u),method:p,body:we(c)};null!==i&&(g.credentials=i||"include");const m=await a(be({path:l,baseUrl:e,queryParams:h,projectId:t}),g);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==m?void 0:m.clone()),null==r?void 0:r.transformResponse){const e=await m.json(),t=((null===(s=m.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},m),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return m};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:ve.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:ve.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:ve.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:ve.delete,token:o}),hooks:r,buildUrl:(n,o)=>be({projectId:t,baseUrl:e,path:n,queryParams:o})}};var ke=429;function Ce(e,t,n){var o;let r=xe(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function xe(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return b(e)}function Ie(e){const{exp:t}=xe(e);return(new Date).getTime()/1e3>t}function Oe(e){let t=xe(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Se(e,t){return Ce(e,t,"permissions")}function je(e,t){return Ce(e,t,"roles")}const Ae=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Re(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===ke&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Ne=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Me=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ue=e=>t=>e.test(t),Te=Ue(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),De=Ue(/^\+[1-9]{1}[0-9]{3,14}$/),Pe=Ne(Te,'"{val}" is not a valid email'),Le=Ne(De,'"{val}" is not a valid phone number'),_e=Ne((1,e=>e.length>=1),"Minimum length is 1");const We=Ne((e=>"string"==typeof e),"Input is not a string"),Fe=Ne((e=>void 0===e),"Input is defined"),Ve=(qe=[We(),Fe()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=qe.filter((e=>e(t)));return!(n.length<qe.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var qe;const Be=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Me(...e).validate(n[t]))),t(...n)),ze=e=>[We(`"${e}" must be a string`)],Ke=e=>[We(`"${e}" must be a string`),_e(`"${e}" must not be empty`)],He=e=>[We(`"${e}" must be a string`),Pe()],Ge=e=>[We(`"${e}" must be a string`),Le()],Je=Be(Ke("accessKey")),Ze=e=>({exchange:Je(((t,n)=>Re(e.post(y,{loginOptions:n},{token:t}))))}),Xe=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),Ye=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||ge,ge)});var Qe,et;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Qe||(Qe={})),function(e){e.email="email"}(et||(et={}));const tt=Object.assign(Object.assign({},Qe),et);var nt;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(nt||(nt={}));const ot=Ke("loginId"),rt=Be(Ke("token")),it=Be(ot),st=Be(Ke("pendingRef")),at=Be(ot,He("email")),dt=e=>({verify:rt((t=>Re(e.post(A,{token:t})))),signIn:it(((t,n,o,r)=>Re(e.post(Ae(R,tt.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:it(((t,n,o)=>Re(e.post(Ae(T,tt.email),{loginId:t,URI:n,loginOptions:o})))),signUp:it(((t,n,o,r)=>Re(e.post(Ae(N,tt.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:st(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Ye(n);let s;const a=setInterval((async()=>{const n=await e.post(M,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:at(((t,n,o,r,i)=>Re(e.post(U.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),lt=Be(Ke("flowId")),ct=Be(Ke("executionId"),Ke("stepId"),Ke("interactionId")),ut=e=>({start:lt(((t,n,o,r,i,s,a)=>Re(e.post(ue,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:ct(((t,n,o,r,i,s)=>Re(e.post(he,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),ht=Ke("loginId"),pt=Be(Ke("token")),ft=Be(ht),gt=Be(ht,Ge("phone")),mt=Be(ht,He("email")),vt=Object.keys(tt).filter((e=>e!==Qe.voice)),bt=e=>({verify:pt((t=>Re(e.post(x,{token:t})))),signIn:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i)=>Re(e.post(Ae(I,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i)=>Re(e.post(Ae(O,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r)=>Re(e.post(Ae(j,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:mt(((t,n,o,r,i)=>Re(e.post(S.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Qe).filter((e=>e!==Qe.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:gt(((t,o,r,i,s)=>Re(e.post(Ae(S.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var yt;!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"}(yt||(yt={}));const wt=Be(Ke("code")),$t=e=>({start:Object.assign(((t,n,o,r)=>Re(e.post(D,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(yt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>Re(e.post(D,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:wt((t=>Re(e.post(P,{code:t})))),startNative:(t,n)=>Re(e.post(L,{provider:t,loginOptions:n})),finishNative:(t,n,o,r,i)=>Re(e.post(_,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),Et=Ke("loginId"),kt=Be(Et,Ke("code")),Ct=Be(Et),xt=Be(Et,Ge("phone")),It=Be(Et,He("email")),Ot=e=>({verify:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o)=>Re(e.post(Ae(w,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o,r)=>Re(e.post(Ae($,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o,r)=>Re(e.post(Ae(E,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o)=>Re(e.post(Ae(C,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:It(((t,n,o,r)=>Re(e.post(k.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xt(((t,o,r,i)=>Re(e.post(Ae(k.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),St=Be(Ke("tenant")),jt=Be(Ke("code")),At=e=>({start:St(((t,n,o,r)=>Re(e.post(W,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:jt((t=>Re(e.post(F,{code:t}))))}),Rt=Ke("loginId"),Nt=Be(Rt,Ke("code")),Mt=Be(Rt),Ut=Be(Rt),Tt=e=>({signUp:Mt(((t,n)=>Re(e.post(q,{loginId:t,user:n})))),verify:Nt(((t,n,o,r)=>Re(e.post(V,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Ut(((t,n)=>Re(e.post(B,{loginId:t},{token:n}))))}),Dt=Ke("loginId"),Pt=Ke("newPassword"),Lt=Be(Dt,Ke("password")),_t=Be(Dt),Wt=Be(Dt,Pt),Ft=Be(Dt,Ke("oldPassword"),Pt),Vt=e=>({signUp:Lt(((t,n,o,r)=>Re(e.post(Q,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Lt(((t,n,o)=>Re(e.post(ee,{loginId:t,password:n,loginOptions:o})))),sendReset:_t(((t,n,o)=>Re(e.post(te,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Wt(((t,n,o)=>Re(e.post(ne,{loginId:t,newPassword:n},{token:o})))),replace:Ft(((t,n,o)=>Re(e.post(oe,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Re(e.get(re))}),qt=ze("loginId"),Bt=Ke("loginId"),zt=Ke("origin"),Kt=Be(Bt,zt,Ke("name")),Ht=Be(Bt,zt),Gt=Be(qt,zt),Jt=Be(Bt,zt,Ke("token")),Zt=Be(Ke("transactionId"),Ke("response")),Xt=e=>({signUp:{start:Kt(((t,n,o)=>Re(e.post(J.start,{user:{loginId:t,name:o},origin:n})))),finish:Zt(((t,n)=>Re(e.post(J.finish,{transactionId:t,response:n}))))},signIn:{start:Gt(((t,n,o,r)=>Re(e.post(Z.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Zt(((t,n)=>Re(e.post(Z.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Ht(((t,n)=>Re(e.post(X.start,{loginId:t,origin:n}))))},update:{start:Jt(((t,n,o)=>Re(e.post(Y.start,{loginId:t,origin:n},{token:o})))),finish:Zt(((t,n)=>Re(e.post(Y.finish,{transactionId:t,response:n}))))}}),Yt=ze("loginId"),Qt=Be(Yt),en=Be(Ke("pendingRef")),tn=e=>({signUpOrIn:Qt(((t,n)=>Re(e.post(H,{loginId:t,loginOptions:n})))),signUp:Qt(((t,n,o)=>Re(e.post(K,{loginId:t,user:n,loginOptions:o})))),signIn:Qt(((t,n,o)=>Re(e.post(z,{loginId:t,loginOptions:n},{token:o})))),waitForSession:en(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Ye(n);let s;const a=setInterval((async()=>{const n=await e.post(G,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),nn=Be(Ke("token")),on=Be([Ve('"token" must be string or undefined')]);var rn,sn=Be([("projectId",rn=Ke("projectId"),Ne(((e,t)=>n=>Me(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",rn))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=Ee({baseUrl:n||fe,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Ze(a),otp:Ot(a),magicLink:bt(a),enchantedLink:dt(a),oauth:$t(a),saml:At(a),totp:Tt(a),notp:tn(a),webauthn:Xt(a),password:Vt(a),flow:ut(a),refresh:on((e=>Re(a.post(ie,{},{token:e})))),selectTenant:Be([We("tenantId")],[Ve('"token" must be string or undefined')])(((e,t)=>Re(a.post(se,{tenant:e},{token:t})))),logout:on((e=>Re(a.post(ae,{},{token:e})))),logoutAll:on((e=>Re(a.post(de,{},{token:e})))),me:on((e=>Re(a.get(le,{token:e})))),history:on((e=>Re(a.get(ce,{token:e})))),isJwtExpired:nn(Ie),getTenants:nn(Oe),getJwtPermissions:nn(Se),getJwtRoles:nn(je),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);(await Promise.allSettled(null==r?void 0:r.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),an=Object.assign(sn,{DeliveryMethods:tt});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ln={exports:{}};
2
+ /*! js-cookie v3.0.5 | MIT */!function(e,t){e.exports=function(){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}function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+s}}function i(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=n.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}}return Object.create({set:r,get:i,remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}return t({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)}},{path:"/"})}()}(ln);var cn=dn(ln.exports);var un={default:"endpoint"},hn="Blocked by CSP",pn="The endpoint parameter is not a valid URL",fn="Failed to load the JS script of the agent",gn="9319";var mn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",vn=mn;function bn(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:mn,a=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),d=a[0],u=a[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.9.6"):e}))}(String(e),t)}))}(s,r);return function(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=h([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===hn||s===pn)n.exclude(),i=0;else if(s===gn)n.exclude();else if(s===fn){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),d=a[0],l=a[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var c=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return c(r)}))}))};return c(d).then((function(e){return[e,s]}))}(e,yn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===gn?new Error(fn):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(l(l({},i),{ldi:{attempts:n,visibilityStates:d}}))}))}function yn(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,d())};i.addEventListener(s,a);var d=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return d(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(d(),r)return function(){throw new Error(hn)}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(pn);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(fn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(wn)}function wn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(gn);return n}const $n=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},En=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},kn=async e=>{const t=await En(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Cn="undefined"!=typeof localStorage,xn=(e,t)=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),In=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),On=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Sn=(...e)=>{console.debug(...e)},jn="undefined"!=typeof window,An=Math.pow(2,31)-1,Rn="DS",Nn="DSR";function Mn(e=""){return In(`${e}${Nn}`)||""}function Un(e=""){On(`${e}${Nn}`),On(`${e}${Rn}`),cn.remove(Rn)}const Tn=jn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Dn="fp",Pn=(e=!1)=>{const t=localStorage.getItem(Dn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Ln=async(e,t=Tn)=>{try{if(Pn())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=bn({apiKey:e,endpoint:[o.toString(),un],scriptUrlPattern:[i,vn]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Dn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},_n=e=>{const t=Pn(!0);return t&&e.body&&(e.body.fpData=t),e},Wn="dls_last_user_login_id",Fn="dls_last_user_display_name",Vn=()=>In(Wn),qn=()=>In(Fn),Bn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Vn(),i=qn();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},zn=e=>async(...t)=>{const n=await e(...t);return On(Wn),On(Fn),n};function Kn(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}async function Hn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),n.publicKey.user.id=Qn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:eo(n.rawId),type:n.type,response:{attestationObject:eo(n.response.attestationObject),clientDataJSON:eo(n.response.clientDataJSON)}});var n}async function Gn(e){const t=Xn(e);return Yn(await navigator.credentials.get(t))}async function Jn(e,t){const n=Xn(e);return n.signal=t.signal,n.mediation="conditional",Yn(await navigator.credentials.get(n))}async function Zn(e=!1){if(!jn)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Xn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}function Yn(e){return JSON.stringify({id:e.id,rawId:eo(e.rawId),type:e.type,response:{authenticatorData:eo(e.response.authenticatorData),clientDataJSON:eo(e.response.clientDataJSON),signature:eo(e.response.signature),userHandle:e.response.userHandle?eo(e.response.userHandle):void 0}})}function Qn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function eo(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var to,no=(to=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await Gn(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Gn(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Hn,get:Gn,isSupported:Zn,conditional:Jn}}),(...e)=>{const t=to(...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 oo="/fedcm/config",ro=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:l}=s.data,c=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var o,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+oo),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>jn&&"IdentityCredential"in window});var io=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Zn(),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 so=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=c(t,["fpKey","fpLoad"]);return jn?(n&&o&&Ln(n).catch((()=>null)),e($n(r,{beforeRequest:_n}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=c(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;jn&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Sn("Expiration time passed, refreshing session"),d.refresh(Mn()||a))}));const d=e($n(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await En(t);if(401===(null==t?void 0:t.status))Sn("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=b(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void Sn("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>An&&(Sn(`Timeout is too large (${e}ms), setting it to ${An}ms`),e=An),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Sn(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{Sn("Refreshing session due to timer"),d.refresh(Mn()||n)}),e)}var l}}));return Xe(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Sn("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.12.2"},t.baseHeaders)}))),(e=>t=>{const n=Kn(),o=Kn(),r=e($n(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await kn(t);e&&o.pub(e);const{sessionJwt:r}=await En(t);r&&n.pub(r)}}})),i=Xe(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0}=t,o=c(t,["storeLastAuthenticatedUser"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:Vn,getLastUserDisplayName:qn});const r=e($n(o,{afterRequest:async(e,t)=>{var n;const o=await kn(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{xn(Wn,e)})(r),(e=>{xn(Fn,e)})(i))}}));let i=Xe(r,["flow.start"],Bn);return i=Xe(i,["logout","logoutAll"],zn),Object.assign(i,{getLastUserLoginId:Vn,getLastUserDisplayName:qn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!jn)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e($n(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Mn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Un(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&xn(`${n}${Nn}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);cn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(Rn,r,i):xn(`${n}${Rn}`,r))})(await En(t),o,r)}}));var a;const d=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Un(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Mn(r),getSessionToken:()=>function(e=""){return cn.get(Rn)||In(`${e}${Rn}`)||""}(r)})}))(((...e)=>{const t=an(...e);return Object.assign(Object.assign({},t),{flow:io(t),webauthn:no(t),fedcm:ro(t,e[0].projectId)})}));let ao;const lo=e=>{const t=so(Object.assign({persistTokens:d,autoRefresh:d},e));return ao=t,t},co=()=>lo({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});ao=co();const uo=()=>d?null==ao?void 0:ao.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),ho=()=>d?null==ao?void 0:ao.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),po=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtPermissions(e,t))),fo=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtRoles(e,t)));const go=t.lazy((async()=>((await Promise.resolve().then((function(){return ml}))).default.sdkConfigOverrides={baseHeaders:a,persistTokens:!1,hooks:{get beforeRequest(){return ao.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,baseStaticUrl:r,innerRef:i,tenant:s,theme:a,locale:d,debug:l,redirectUrl:c,client:u,form:h,autoFocus:p,validateOnBlur:f})=>o.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,"base-static-url":r,ref:i,tenant:s,theme:a,locale:d,debug:l,client:u,form:h,"redirect-url":c,"auto-focus":p,"validate-on-blur":f})}))),mo=o.default.forwardRef((({flowId:e,onSuccess:n,onError:i,onReady:s,logger:a,tenant:d,theme:l,locale:c,debug:u,client:h,form:p,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,errorTransformer:b},y)=>{const[w,$]=t.useState(null);t.useImperativeHandle(y,(()=>w));const{projectId:E,baseUrl:k,baseStaticUrl:C,storeLastAuthenticatedUser:x,keepLastAuthenticatedUserAfterLogout:I,sdk:O}=o.default.useContext(r),S=t.useCallback((async e=>{await O.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=w;return null==e||e.addEventListener("success",S),i&&(null==e||e.addEventListener("error",i)),s&&(null==e||e.addEventListener("ready",s)),()=>{i&&(null==e||e.removeEventListener("error",i)),s&&(null==e||e.removeEventListener("ready",s)),null==e||e.removeEventListener("success",S)}}),[w,i,S]),t.useEffect((()=>{const e=w;return null==e||e.addEventListener("success",S),()=>{null==e||e.removeEventListener("success",S)}}),[w,S]),t.useEffect((()=>{const e=w;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[w,i]),t.useEffect((()=>{const e=w;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[w,s]),t.useEffect((()=>{w&&(w.errorTransformer=b)}),[w,b]),t.useEffect((()=>{w&&a&&(w.logger=a)}),[w,a]);const{form:j,client:A}=t.useMemo((()=>({form:JSON.stringify(p||{}),client:JSON.stringify(h||{})})),[p,h]);return o.default.createElement("form",null,o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(go,{projectId:E,flowId:e,baseUrl:k,baseStaticUrl:C,innerRef:$,tenant:d,theme:l,locale:c,debug:u,form:j,client:A,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,storeLastAuthenticatedUser:x,keepLastAuthenticatedUserAfterLogout:I})))})),vo=t.lazy((async()=>(await Promise.resolve().then((function(){return jm})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),bo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(vo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),yo=t.lazy((async()=>(await Promise.resolve().then((function(){return iy})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),wo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(yo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),$o=t.lazy((async()=>(await Promise.resolve().then((function(){return V$})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Eo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement($o,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),ko=t.lazy((async()=>(await Promise.resolve().then((function(){return Dk})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Co=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(ko,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),xo=t.lazy((async()=>(await Promise.resolve().then((function(){return QO})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":i,"base-url":t,"base-static-url":n,theme:s,debug:a,ref:r})}))),Io=o.default.forwardRef((({logger:e,theme:n,debug:i,widgetId:s,onLogout:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),t.useEffect((()=>{if(l&&a)return l.addEventListener("logout",a),()=>l.removeEventListener("logout",a)}),[l,a]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(xo,{projectId:u,widgetId:s,baseUrl:h,baseStaticUrl:p,innerRef:c,theme:n,debug:i}))}));var Oo=()=>{const e=t.useContext(r);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const So=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,jo={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],jo);if("function"==typeof e[t])return()=>{throw Error(So("function"))};throw Error(So("attribute"))}};var Ao="/v1/auth/accesskey/exchange",Ro="/v1/auth/otp/verify",No="/v1/auth/otp/signin",Mo="/v1/auth/otp/signup",Uo={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},To="/v1/auth/otp/signup-in",Do="/v1/auth/magiclink/verify",Po="/v1/auth/magiclink/signin",Lo="/v1/auth/magiclink/signup",_o={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},Wo="/v1/auth/magiclink/signup-in",Fo="/v1/auth/enchantedlink/verify",Vo="/v1/auth/enchantedlink/signin",qo="/v1/auth/enchantedlink/signup",Bo="/v1/auth/enchantedlink/pending-session",zo={email:"/v1/auth/enchantedlink/update/email"},Ko="/v1/auth/enchantedlink/signup-in",Ho="/v1/auth/oauth/authorize",Go="/v1/auth/oauth/exchange",Jo="v1/auth/oauth/native/start",Zo="v1/auth/oauth/native/finish",Xo="/v1/auth/saml/authorize",Yo="/v1/auth/saml/exchange",Qo="/v1/auth/totp/verify",er="/v1/auth/totp/signup",tr="/v1/auth/totp/update",nr="/v1/auth/notp/whatsapp/signin",or="/v1/auth/notp/whatsapp/signup",rr="/v1/auth/notp/whatsapp/signup-in",ir="/v1/auth/notp/pending-session",sr={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},ar={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},dr={start:"/v1/auth/webauthn/signup-in/start"},lr={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},cr="/v1/auth/password/signup",ur="/v1/auth/password/signin",hr="/v1/auth/password/reset",pr="/v1/auth/password/update",fr="/v1/auth/password/replace",gr="/v1/auth/password/policy",mr="/v1/auth/refresh",vr="/v1/auth/tenant/select",br="/v1/auth/logout",yr="/v1/auth/logoutall",wr="/v1/auth/me",$r="/v1/auth/me/history",Er="/v1/flow/start",kr="/v1/flow/next";const Cr="<region>",xr=`https://api.${Cr}descope.com`,Ir=6e5,Or=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var Sr;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(Sr||(Sr={}));const jr=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(Cr,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},Ar=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),Rr={"Content-Type":"application/json"},Nr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Mr=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},Ur=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||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(...t)=>{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((e=>Or().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return Or().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:c,headers:u,queryParams:h,method:p,token:f}=d,g=(e=>void 0===e?void 0:JSON.stringify(e))(c),m={headers:Ar(Nr(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.21.0"},(null==n?void 0:n.baseHeaders)||{},Mr(g)?Rr:{},u),method:p,body:g};null!==i&&(m.credentials=i||"include");const v=await a(jr({path:l,baseUrl:e,queryParams:h,projectId:t}),m);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==v?void 0:v.clone()),null==r?void 0:r.transformResponse){const e=await v.json(),t=((null===(s=v.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},v),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return v};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:Sr.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:Sr.delete,token:o}),hooks:r,buildUrl:(n,o)=>jr({projectId:t,baseUrl:e,path:n,queryParams:o})}};var Tr=429;function Dr(e,t,n){var o;let r=Pr(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function Pr(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return b(e)}function Lr(e){const{exp:t}=Pr(e);return(new Date).getTime()/1e3>t}function _r(e){let t=Pr(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Wr(e,t){return Dr(e,t,"permissions")}function Fr(e,t){return Dr(e,t,"roles")}const Vr=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function qr(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===Tr&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Br=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),zr=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Kr=e=>t=>e.test(t),Hr=Kr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Gr=Kr(/^\+[1-9]{1}[0-9]{3,14}$/),Jr=Br(Hr,'"{val}" is not a valid email'),Zr=Br(Gr,'"{val}" is not a valid phone number'),Xr=Br((1,e=>e.length>=1),"Minimum length is 1");const Yr=Br((e=>"string"==typeof e),"Input is not a string"),Qr=Br((e=>void 0===e),"Input is defined"),ei=(ti=[Yr(),Qr()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=ti.filter((e=>e(t)));return!(n.length<ti.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var ti;const ni=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>zr(...e).validate(n[t]))),t(...n)),oi=e=>[Yr(`"${e}" must be a string`)],ri=e=>[Yr(`"${e}" must be a string`),Xr(`"${e}" must not be empty`)],ii=e=>[Yr(`"${e}" must be a string`),Jr()],si=e=>[Yr(`"${e}" must be a string`),Zr()],ai=ni(ri("accessKey")),di=e=>({exchange:ai(((t,n)=>qr(e.post(Ao,{loginOptions:n},{token:t}))))}),li=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),ci=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||Ir,Ir)});var ui,hi;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(ui||(ui={})),function(e){e.email="email"}(hi||(hi={}));const pi=Object.assign(Object.assign({},ui),hi);var fi;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(fi||(fi={}));const gi=ri("loginId"),mi=ni(ri("token")),vi=ni(gi),bi=ni(ri("pendingRef")),yi=ni(gi,ii("email")),wi=e=>({verify:mi((t=>qr(e.post(Fo,{token:t})))),signIn:vi(((t,n,o,r)=>qr(e.post(Vr(Vo,pi.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:vi(((t,n,o)=>qr(e.post(Vr(Ko,pi.email),{loginId:t,URI:n,loginOptions:o})))),signUp:vi(((t,n,o,r)=>qr(e.post(Vr(qo,pi.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:bi(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=ci(n);let s;const a=setInterval((async()=>{const n=await e.post(Bo,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:yi(((t,n,o,r,i)=>qr(e.post(zo.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),$i=ni(ri("flowId")),Ei=ni(ri("executionId"),ri("stepId"),ri("interactionId")),ki=e=>({start:$i(((t,n,o,r,i,s,a)=>qr(e.post(Er,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:Ei(((t,n,o,r,i,s)=>qr(e.post(kr,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),Ci=ri("loginId"),xi=ni(ri("token")),Ii=ni(Ci),Oi=ni(Ci,si("phone")),Si=ni(Ci,ii("email")),ji=Object.keys(pi).filter((e=>e!==ui.voice)),Ai=e=>({verify:xi((t=>qr(e.post(Do,{token:t})))),signIn:ji.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r,i)=>qr(e.post(Vr(Po,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:ji.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r,i)=>qr(e.post(Vr(Lo,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:ji.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r)=>qr(e.post(Vr(Wo,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:Si(((t,n,o,r,i)=>qr(e.post(_o.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(ui).filter((e=>e!==ui.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Oi(((t,o,r,i,s)=>qr(e.post(Vr(_o.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var Ri;!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"}(Ri||(Ri={}));const Ni=ni(ri("code")),Mi=e=>({start:Object.assign(((t,n,o,r)=>qr(e.post(Ho,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(Ri).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>qr(e.post(Ho,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:Ni((t=>qr(e.post(Go,{code:t})))),startNative:(t,n,o)=>qr(e.post(Jo,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>qr(e.post(Zo,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),Ui=ri("loginId"),Ti=ni(Ui,ri("code")),Di=ni(Ui),Pi=ni(Ui,si("phone")),Li=ni(Ui,ii("email")),_i=e=>({verify:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ti(((t,o)=>qr(e.post(Vr(Ro,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o,r)=>qr(e.post(Vr(No,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o,r)=>qr(e.post(Vr(Mo,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o)=>qr(e.post(Vr(To,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:Li(((t,n,o,r)=>qr(e.post(Uo.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(ui).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Pi(((t,o,r,i)=>qr(e.post(Vr(Uo.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Wi=ni(ri("tenant")),Fi=ni(ri("code")),Vi=e=>({start:Wi(((t,n,o,r)=>qr(e.post(Xo,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:Fi((t=>qr(e.post(Yo,{code:t}))))}),qi=ri("loginId"),Bi=ni(qi,ri("code")),zi=ni(qi),Ki=ni(qi),Hi=e=>({signUp:zi(((t,n)=>qr(e.post(er,{loginId:t,user:n})))),verify:Bi(((t,n,o,r)=>qr(e.post(Qo,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Ki(((t,n)=>qr(e.post(tr,{loginId:t},{token:n}))))}),Gi=ri("loginId"),Ji=ri("newPassword"),Zi=ni(Gi,ri("password")),Xi=ni(Gi),Yi=ni(Gi,Ji),Qi=ni(Gi,ri("oldPassword"),Ji),es=e=>({signUp:Zi(((t,n,o,r)=>qr(e.post(cr,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Zi(((t,n,o)=>qr(e.post(ur,{loginId:t,password:n,loginOptions:o})))),sendReset:Xi(((t,n,o)=>qr(e.post(hr,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Yi(((t,n,o)=>qr(e.post(pr,{loginId:t,newPassword:n},{token:o})))),replace:Qi(((t,n,o)=>qr(e.post(fr,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>qr(e.get(gr))}),ts=oi("loginId"),ns=ri("loginId"),os=ri("origin"),rs=ni(ns,os,ri("name")),is=ni(ns,os),ss=ni(ts,os),as=ni(ns,os,ri("token")),ds=ni(ri("transactionId"),ri("response")),ls=e=>({signUp:{start:rs(((t,n,o)=>qr(e.post(sr.start,{user:{loginId:t,name:o},origin:n})))),finish:ds(((t,n)=>qr(e.post(sr.finish,{transactionId:t,response:n}))))},signIn:{start:ss(((t,n,o,r)=>qr(e.post(ar.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:ds(((t,n)=>qr(e.post(ar.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:is(((t,n)=>qr(e.post(dr.start,{loginId:t,origin:n}))))},update:{start:as(((t,n,o)=>qr(e.post(lr.start,{loginId:t,origin:n},{token:o})))),finish:ds(((t,n)=>qr(e.post(lr.finish,{transactionId:t,response:n}))))}}),cs=oi("loginId"),us=ni(cs),hs=ni(ri("pendingRef")),ps=e=>({signUpOrIn:us(((t,n)=>qr(e.post(rr,{loginId:t,loginOptions:n})))),signUp:us(((t,n,o)=>qr(e.post(or,{loginId:t,user:n,loginOptions:o})))),signIn:us(((t,n,o)=>qr(e.post(nr,{loginId:t,loginOptions:n},{token:o})))),waitForSession:hs(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=ci(n);let s;const a=setInterval((async()=>{const n=await e.post(ir,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),fs=ni(ri("token")),gs=ni([ei('"token" must be string or undefined')]);var ms,vs=ni([("projectId",ms=ri("projectId"),Br(((e,t)=>n=>zr(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",ms))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=Ur({baseUrl:n||xr,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:di(a),otp:_i(a),magicLink:Ai(a),enchantedLink:wi(a),oauth:Mi(a),saml:Vi(a),totp:Hi(a),notp:ps(a),webauthn:ls(a),password:es(a),flow:ki(a),refresh:gs((e=>qr(a.post(mr,{},{token:e})))),selectTenant:ni([Yr("tenantId")],[ei('"token" must be string or undefined')])(((e,t)=>qr(a.post(vr,{tenant:e},{token:t})))),logout:gs((e=>qr(a.post(br,{},{token:e})))),logoutAll:gs((e=>qr(a.post(yr,{},{token:e})))),me:gs((e=>qr(a.get(wr,{token:e})))),history:gs((e=>qr(a.get($r,{token:e})))),isJwtExpired:fs(Lr),getTenants:fs(_r),getJwtPermissions:fs(Wr),getJwtRoles:fs(Fr),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);0!=r.length&&(await Promise.allSettled(null==r?void 0:r.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),bs=Object.assign(vs,{DeliveryMethods:pi});var ys={default:"endpoint"},ws="Blocked by CSP",$s="The endpoint parameter is not a valid URL",Es="Failed to load the JS script of the agent",ks="9319";var Cs="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",xs=Cs;function Is(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:Cs,a=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),d=a[0],u=a[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.9.8"):e}))}(String(e),t)}))}(s,r);return function(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=h([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===ws||s===$s)n.exclude(),i=0;else if(s===ks)n.exclude();else if(s===Es){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),d=a[0],l=a[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var c=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return c(r)}))}))};return c(d).then((function(e){return[e,s]}))}(e,Os)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===ks?new Error(Es):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(l(l({},i),{ldi:{attempts:n,visibilityStates:d}}))}))}function Os(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,d())};i.addEventListener(s,a);var d=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return d(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(d(),r)return function(){throw new Error(ws)}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error($s);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(Es))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(Ss)}function Ss(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(ks);return n}const js=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},As=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},Rs=async e=>{const t=await As(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Ns="undefined"!=typeof localStorage,Ms=(e,t)=>Ns&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Us=e=>Ns&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Ts=e=>Ns&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Ds=(...e)=>{console.debug(...e)},Ps="undefined"!=typeof window,Ls=Math.pow(2,31)-1,_s="DS",Ws="DSR";function Fs(e=""){return Us(`${e}${Ws}`)||""}function Vs(e=""){Ts(`${e}${Ws}`),Ts(`${e}${_s}`),cn.remove(_s)}const qs=Ps&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Bs="fp",zs=(e=!1)=>{const t=localStorage.getItem(Bs);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Ks=async(e,t=qs)=>{try{if(zs())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=Is({apiKey:e,endpoint:[o.toString(),ys],scriptUrlPattern:[i,xs]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Bs,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Hs=e=>{const t=zs(!0);return t&&e.body&&(e.body.fpData=t),e},Gs="dls_last_user_login_id",Js="dls_last_user_display_name",Zs=()=>Us(Gs),Xs=()=>Us(Js),Ys=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Zs(),i=Xs();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)};function Qs(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}async function ea(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=sa(n.publicKey.challenge),n.publicKey.user.id=sa(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=sa(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:aa(n.rawId),type:n.type,response:{attestationObject:aa(n.response.attestationObject),clientDataJSON:aa(n.response.clientDataJSON)}});var n}async function ta(e){const t=ra(e);return ia(await navigator.credentials.get(t))}async function na(e,t){const n=ra(e);return n.signal=t.signal,n.mediation="conditional",ia(await navigator.credentials.get(n))}async function oa(e=!1){if(!Ps)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function ra(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=sa(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=sa(e.id)})),n}function ia(e){return JSON.stringify({id:e.id,rawId:aa(e.rawId),type:e.type,response:{authenticatorData:aa(e.response.authenticatorData),clientDataJSON:aa(e.response.clientDataJSON),signature:aa(e.response.signature),userHandle:e.response.userHandle?aa(e.response.userHandle):void 0}})}function sa(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function aa(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var da,la=(da=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await ea(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await ta(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await ea(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await ta(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await ea(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:ea,get:ta,isSupported:oa,conditional:na}}),(...e)=>{const t=da(...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 ca="/fedcm/config",ua=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o,!0);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:l}=s.data,c=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var o,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+ca),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>Ps&&"IdentityCredential"in window});var ha=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await oa(),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 pa=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=c(t,["fpKey","fpLoad"]);return Ps?(n&&o&&Ks(n).catch((()=>null)),e(js(r,{beforeRequest:Hs}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=c(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;Ps&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Ds("Expiration time passed, refreshing session"),d.refresh(Fs()||a))}));const d=e(js(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await As(t);if(401===(null==t?void 0:t.status))Ds("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=b(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void Ds("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Ls&&(Ds(`Timeout is too large (${e}ms), setting it to ${Ls}ms`),e=Ls),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Ds(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{Ds("Refreshing session due to timer"),d.refresh(Fs()||n)}),e)}var l}}));return li(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Ds("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.14.0"},t.baseHeaders)}))),(e=>t=>{const n=Qs(),o=Qs(),r=e(js(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await Rs(t);e&&o.pub(e);const{sessionJwt:r}=await As(t);r&&n.pub(r)}}})),i=li(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=c(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:Zs,getLastUserDisplayName:Xs});const i=e(js(r,{afterRequest:async(e,t)=>{var n;const o=await Rs(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{Ms(Gs,e)})(r),(e=>{Ms(Js,e)})(i))}}));let s=li(i,["flow.start"],Ys);return s=li(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return e||(Ts(Gs),Ts(Js)),o})(o)),Object.assign(s,{getLastUserLoginId:Zs,getLastUserDisplayName:Xs})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!Ps)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e(js(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Fs(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Vs(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&Ms(`${n}${Ws}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);cn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(_s,r,i):Ms(`${n}${_s}`,r))})(await As(t),o,r)}}));var a;const d=li(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Vs(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Fs(r),getSessionToken:()=>function(e=""){return cn.get(_s)||Us(`${e}${_s}`)||""}(r)})}))(((...e)=>{const t=bs(...e);return Object.assign(Object.assign({},t),{flow:ha(t),webauthn:la(t),fedcm:ua(t,e[0].projectId)})})),fa="undefined"!=typeof localStorage,ga=fa&&localStorage.getItem("base.content.url")||"",ma="config.json",va="base.ui.components.url",ba=fa&&localStorage.getItem(va)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ya=fa&&localStorage.getItem(va)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",wa="descope-login-flow",$a="code",Ea="ra-challenge",ka="ra-callback",Ca="ra-backup-callback",xa="ra-initiator",Ia="data-exclude-field",Oa="dls_last_auth",Sa="state_id",ja="saml_idp_state_id",Aa="saml_idp_username",Ra="descope_idp_initiated",Na="sso_app_id",Ma="oidc_login_hint",Ua="data-type",Ta="poll",Da="webauthnCreate",Pa="submit",La="polling",_a=["descope-multi-select-combo-box","descope-text-area"];var Wa;function Fa(e){return new URLSearchParams(window.location.search).get(e)}function Va(e){if(window.history.replaceState&&Fa(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}function qa(e,t){return u(this,void 0,void 0,(function*(){const n=yield fetch(e,{cache:"default"});if(!n.ok)throw Error(`Error fetching URL ${e} [${n.status}]`);return{body:yield n[t||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function Ba({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(ga||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function za(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?Wa.forward:n<o?Wa.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(Wa||(Wa={}));const Ka=()=>{const[e="",t=""]=(Fa(wa)||"").split("_");return{executionId:e,stepId:t}};function Ha(){Va(wa)}const Ga=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),Ja=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},Za=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,Xa=e=>null==e?void 0:e.submit(),Ya=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},Qa=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function ed(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var td,nd,od,rd;function id(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!id(i,s))return!1}else if(i!==s)return!1}return!0}class sd{constructor(e={},{updateOnlyOnChange:t=!0}={}){td.set(this,void 0),nd.set(this,{}),od.set(this,0),rd.set(this,!1),this.update=e=>{const t="function"==typeof e?e(p(this,td,"f")):e,n=Object.assign(Object.assign({},p(this,td,"f")),t);if(!p(this,rd,"f")||!id(p(this,td,"f"),n)){const e=p(this,td,"f");f(this,td,n,"f"),Object.freeze(p(this,td,"f")),setTimeout((()=>{Object.values(p(this,nd,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,td,e,"f"),f(this,rd,t,"f")}get current(){return Object.assign({},p(this,td,"f"))}subscribe(e){return f(this,od,p(this,od,"f")+1,"f"),p(this,nd,"f")[p(this,od,"f")]=e,p(this,od,"f").toString()}unsubscribe(e){const t=!!p(this,nd,"f")[e];return t&&delete p(this,nd,"f")[e],t}unsubscribeAll(){return f(this,nd,{},"f"),!0}}td=new WeakMap,nd=new WeakMap,od=new WeakMap,rd=new WeakMap;const ad=["disabled"],dd=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Ia}])`)).forEach((e=>{e.value=n}))}))},ld=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),cd=(e,t,n)=>{e.querySelectorAll(`[${Ua}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},ud=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},hd=Ja((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=Promise.all([null===(e=window.PublicKeyCredential)||void 0===e?void 0:e.isConditionalMediationAvailable(),null===(t=window.PublicKeyCredential)||void 0===t?void 0:t.isUserVerifyingPlatformAuthenticatorAvailable()]).then((e=>e.every((e=>!!e)))),i=(()=>{var e;const t=null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===e?void 0:e.brands,n=null==t?void 0:t.find((({brand:e,version:t})=>"Chromium"===e&&parseFloat(t)));return n?n.version:0})()>=108;return yield(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),pd={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function fd(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Oa)))}catch(e){}return t}const gd="dls_ab_testing_id",md=document.createElement("template");var vd,bd,yd,wd,$d,Ed,kd,Cd,xd,Id,Od,Sd,jd,Ad,Rd,Nd,Md,Ud,Td,Dd,Pd,Ld,_d,Wd,Fd,Vd,qd,Bd,zd,Kd,Hd,Gd,Jd,Zd,Xd,Yd,Qd,el,tl,nl,ol,rl,il,sl,al,dl,ll,cl,ul,hl,pl;md.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class fl extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","keep-last-authenticated-user-after-logout","validate-on-blur"]}constructor(e){super(),vd.add(this),this.logger=console,bd.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),p(this,vd,"m",zd).call(this,e,t)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",n={})=>{this.logger.info(e,t,n)},debug:(e,t="")=>{this.logger.debug(e,t)}},yd.set(this,new sd({deferredRedirect:!1})),wd.set(this,new sd),$d.set(this,{}),this.getComponentsContext=()=>p(this,$d,"f"),this.nextRequestStatus=new sd({isLoading:!1}),Ed.set(this,void 0),kd.set(this,{popstate:p(this,vd,"m",jd).bind(this),visibilitychange:p(this,vd,"m",Ad).bind(this),componentsContext:p(this,vd,"m",Fd).bind(this)}),Cd.set(this,void 0),Td.set(this,Ja((()=>u(this,void 0,void 0,(function*(){const e=Ba({projectId:this.projectId,filename:ma,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield qa(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Pd.set(this,void 0),f(this,Cd,e,"f"),p(this,vd,"m",xd).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){return this.getAttribute("tenant")||void 0}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light":n||"light"}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield p(this,Td,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield p(this,Td,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(p(this,wd,"f").subscribe(p(this,vd,"m",Bd).bind(this)),p(this,wd,"f").update({isDebug:this.debug}),p(this,vd,"m",Id).call(this))return void p(this,vd,"m",Od).call(this);if(p(this,vd,"m",Sd).call(this),f(this,Pd,p(this,vd,"m",Dd).call(this),"f"),yield p(this,vd,"m",Md).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");if((yield p(this,Td,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");p(this,vd,"m",Ld).call(this),yield p(this,vd,"m",Gd).call(this),yield p(this,vd,"m",_d).call(this),p(this,vd,"m",Kd).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}=(()=>{const{executionId:e,stepId:t}=Ka();(e||t)&&Ha();const n=Fa("t")||void 0;n&&Va("t");const o=Fa($a)||void 0;o&&Va($a);const r=Fa("err")||void 0;r&&Va("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:Fa(Ea),redirectAuthCallbackUrl:Fa(ka),redirectAuthBackupCallbackUri:Fa(Ca),redirectAuthInitiator:Fa(xa)};(i||s||a||d)&&(Va(Ea),Va(ka),Va(Ca),Va(xa));const l=Fa(Sa);l&&Va(Sa);const c=Fa(ja);c&&Va(ja);const u=Fa(Aa);c&&Va(Aa);const h=Fa(Ra);h&&Va(Ra);const p=Fa(Na);p&&Va(Na);const f=Fa(Ma);return f&&Va(Ma),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}})();window.addEventListener("popstate",p(this,kd,"f").popstate),window.addEventListener("components-context",p(this,kd,"f").componentsContext),window.addEventListener("visibilitychange",p(this,kd,"f").visibilitychange),p(this,yd,"f").subscribe(p(this,vd,"m",Nd).bind(this)),p(this,yd,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}),f(this,bd,!0,"f")}}))}disconnectedCallback(){p(this,yd,"f").unsubscribeAll(),p(this,wd,"f").unsubscribeAll(),p(this,vd,"m",qd).call(this),window.removeEventListener("popstate",p(this,kd,"f").popstate),window.removeEventListener("visibilitychange",p(this,kd,"f").visibilitychange),window.removeEventListener("components-context",p(this,kd,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&p(this,bd,"f")&&t!==n&&fl.observedAttributes.includes(e)){p(this,vd,"m",Sd).call(this);const o=null===t;p(this,yd,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,Ha()),{[Ga(e)]:n,stepId:i,executionId:s}})),p(this,wd,"f").update({isDebug:this.debug})}}}bd=new WeakMap,yd=new WeakMap,wd=new WeakMap,$d=new WeakMap,Ed=new WeakMap,kd=new WeakMap,Cd=new WeakMap,Td=new WeakMap,Pd=new WeakMap,vd=new WeakSet,xd=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(md.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},Id=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},Od=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",t.style.height="100%",e.parentElement.appendChild(t),t.appendChild(e)},Sd=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur"];if(fl.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Ga(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},jd=function(){const{stepId:e,executionId:t}=Ka();p(this,yd,"f").update({stepId:e,executionId:t})},Ad=function(){document.hidden||setTimeout((()=>{p(this,yd,"f").update({deferredRedirect:!1})}),300)},Rd=function(e,t){this.sdk=pa(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout},fl.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},Nd=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;p(this,vd,"m",Rd).call(this,t,o)}p(this,Cd,"f").call(this,e)}))},Md=function(){return u(this,void 0,void 0,(function*(){return(yield p(this,Td,"f").call(this)).isMissingConfig&&(yield p(this,vd,"m",Ud).call(this))}))},Ud=function(){return u(this,void 0,void 0,(function*(){const e=Ba({projectId:this.projectId,filename:ma,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield qa(e,"json"),!0}catch(e){return!1}}))},Dd=function(){return u(this,void 0,void 0,(function*(){const e=Ba({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield qa(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},Ld=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield p(this,Td,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},_d=function(){return u(this,void 0,void 0,(function*(){yield p(this,vd,"m",Wd).call(this),yield p(this,vd,"m",Vd).call(this)}))},Wd=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield p(this,Pd,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield fl.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},Fd=function(e){f(this,$d,Object.assign(Object.assign({},p(this,$d,"f")),e.detail),"f")},Vd=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield fl.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},qd=function(){var e;null===(e=p(this,Ed,"f"))||void 0===e||e.remove(),f(this,Ed,null,"f")},Bd=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(f(this,Ed,document.createElement("descope-debugger"),"f"),Object.assign(p(this,Ed,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return pS})),document.body.appendChild(p(this,Ed,"f"))):p(this,vd,"m",qd).call(this)}))},zd=function(e,t){var n;e&&this.debug&&(null===(n=p(this,Ed,"f"))||void 0===n||n.updateData({title:e,description:t}))},Kd=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=_a.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)return;e.preventDefault();const s=this.rootElement.querySelectorAll("descope-button");if(1===s.length&&"false"!==s[0].getAttribute("auto-submit"))return void s[0].click();const a=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const d=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===d.length)"false"!==d[0].getAttribute("auto-submit")&&d[0].click();else if(0===d.length){const e=Array.from(s).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}},Hd=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield p(this,Td,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},Gd=function(){return u(this,void 0,void 0,(function*(){fl.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):fl.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield p(this,vd,"m",Hd).call(this),i=t(n(ba,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(ya,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},fl.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.18.0"}};class gl extends fl{static set sdkConfigOverrides(e){fl.sdkConfigOverrides=e}constructor(){const e=new sd;super(e.update.bind(e)),Jd.add(this),this.stepState=new sd({},{updateOnlyOnChange:!1}),Zd.set(this,void 0),Xd.set(this,null),Yd.set(this,((e,t,n,o,r)=>{n===Ta&&f(this,Zd,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,La,o,r,{});p(this,el,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};p(this,Yd,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),Qd.set(this,(()=>{clearTimeout(p(this,Zd,"f")),f(this,Zd,null,"f")})),el.set(this,(e=>{var t,n,o,r,i,s,a,d,l,c,u;if(!(null==e?void 0:e.ok)){p(this,Jd,"m",pl).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}null===(a=null===(s=e.data)||void 0===s?void 0:s.runnerLogs)||void 0===a||a.forEach((e=>this.loggerWrapper.info(e.title,e.log)));const h=null===(c=null===(l=null===(d=e.data)||void 0===d?void 0:d.screen)||void 0===l?void 0:l.state)||void 0===c?void 0:c.errorText;(null===(u=e.data)||void 0===u?void 0:u.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${h?`${h} - `:""}${e.data.error.message}`):h&&this.loggerWrapper.error(h);const{status:f,authInfo:g,lastAuth:m}=e.data;if("completed"===f)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&fa&&localStorage.setItem(Oa,JSON.stringify(e))}(m),void p(this,Jd,"m",pl).call(this,"success",g);const{executionId:v,stepId:b,stepName:y,action:w,screen:$,redirect:E,openInNewTabUrl:k,webauthn:C,error:x,samlIdpResponse:I}=e.data;w!==Ta?(this.loggerWrapper.info(`Step "${y||`#${b}`}" is ${f}`,"",{screen:$,status:f,stepId:b,stepName:y,action:w,error:x}),this.flowState.update({stepId:b,executionId:v,action:w,redirectTo:null==E?void 0:E.url,openInNewTabUrl:k,screenId:null==$?void 0:$.id,screenState:null==$?void 0:$.state,webauthnTransactionId:null==C?void 0:C.transactionId,webauthnOptions:null==C?void 0:C.options,samlIdpResponseUrl:null==I?void 0:I.url,samlIdpResponseSamlResponse:null==I?void 0:I.samlResponse,samlIdpResponseRelayState:null==I?void 0:I.relayState})):this.flowState.update({action:w})})),tl.set(this,Ja((()=>u(this,void 0,void 0,(function*(){var e;try{const t=yield this.sdk.webauthn.signIn.start("",window.location.origin);return t.ok||this.loggerWrapper.warn("Webauthn start failed",null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.errorMessage),t.data}catch(e){this.loggerWrapper.warn("Webauthn start failed",e.message)}}))))),ll.set(this,Qa(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||p(this,Jd,"m",il).call(this)){const o=null==e?void 0:e.getAttribute("id");p(this,Jd,"m",al).call(this,e);const r=yield p(this,Jd,"m",sl).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(o,d.version,l.componentsVersion,a);p(this,el,"f").call(this,c),p(this,Jd,"m",dl).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=p(this,Xd,"f"))||void 0===e||e.abort(),f(this,Xd,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=ed(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield qa(t,"text");return e}catch(n){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,n)}try{const{body:t}=yield qa(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:l,action:c,screenId:u,screenState:h,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:b,code:y,exchangeError:w,webauthnTransactionId:$,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:I,oidcIdpStateId:O,locale:S,samlIdpStateId:j,samlIdpUsername:A,descopeIdpInitiated:R,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,L;const _=(()=>{const e=localStorage.getItem(gd);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(gd,e.toString()),e}return Number(e)})(),W=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(F.fingerprintEnabled&&F.fingerprintKey?yield Ks(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Bs),F.conditions?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=pd[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:W,code:y,token:b,abTestingKey:_},F.conditions)):F.condition?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{var n;const o=null===(n=pd[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:W,code:y,token:b,abTestingKey:_})):P=F.startScreenId,!Za(P,O,j,A,T,D))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,client:this.client},v&&{redirectUrl:v}),{lastAuth:fd(W),abTestingKey:_,locale:ed(S)}),L,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),R&&{idpInitiated:!0}),b?{token:b}:{}),D?{externalId:D}:{}));return p(this,el,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&b||n("code")&&y||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(l,d,Pa,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return p(this,el,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===c&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!N||!M)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.innerHTML=`\n <input type="hidden" role="saml-response" name="SAMLResponse" value="${t}" />\n <input type="hidden" role="saml-relay-state" name="RelayState" value="${n}" />\n <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />\n `,document.body.appendChild(r),o(r)})(N,M,U||"",Xa)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===I&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===Da||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=p(this,Xd,"f"))||void 0===r||r.abort(),f(this,Xd,null,"f");try{e=c===Da?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(l,d,Pa,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});p(this,el,"f").call(this,n)}if(p(this,Yd,"f").call(this,l,d,c,F.version,V.componentsVersion),!u&&!P)return void this.loggerWrapper.warn("No screen was found to show");const B=P||u,z=yield this.getHtmlFilenameWithLocale(S,B),K={direction:za(d,t.stepId),screenState:Object.assign(Object.assign({},h),{form:Object.assign(Object.assign({},this.formConfigValues),null==h?void 0:h.form),lastAuth:{loginId:W,name:this.sdk.getLastUserDisplayName()||W}}),htmlUrl:Ba({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&Ba({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:A,oidcLoginHint:D,openInNewTabUrl:m},H=fd(W);Za(P,O,j,A,T,D)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,lastAuth:H,preview:this.preview,abTestingKey:_,client:this.client},v&&{redirectUrl:v}),{locale:ed(S)}),L,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),y&&{exchangeCode:y,idpInitiated:!0}),R&&{idpInitiated:!0}),b&&{token:b})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield fl.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const h=c.content.cloneNode(!0),f=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield p(this,Jd,"m",rl).call(this,h,a):h.querySelectorAll(`descope-button[${Ua}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Ua}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),cd(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),cd(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=ld(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",ld(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=ld(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{ad.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(h,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,ud(r,"descope-totp-image",i),((e,t)=>{ud(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(h),setTimeout((()=>{((e,t)=>{dd(e,null==t?void 0:t.inputs),dd(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-email-field"),t=this.rootElement.querySelectorAll("descope-password"),n=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t,...n].forEach((e=>p(this,Jd,"m",ol).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),p(this,Jd,"m",ul).call(this,a),s&&p(this,Jd,"m",pl).call(this,"ready",{}),p(this,Jd,"m",pl).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Ua}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(La,e.version,t.componentsVersion,{});p(this,el,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?p(this,Jd,"m",hl).call(this,m,s):m()}))}}Zd=new WeakMap,Xd=new WeakMap,Yd=new WeakMap,Qd=new WeakMap,el=new WeakMap,tl=new WeakMap,ll=new WeakMap,Jd=new WeakSet,nl=function(e){const t=e.getAttribute("name");if(!["email"].includes(t)){const n=`user-${t}`;e.setAttribute("name",n),e.addEventListener("input",(()=>{e.setAttribute("name",e.value?t:n)}))}},ol=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},rl=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=p(this,Xd,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield hd())){const{options:e,transactionId:n}=(yield p(this,tl,"f").call(this))||{};if(e&&n){p(this,Jd,"m",nl).call(this,o),f(this,Xd,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,p(this,Xd,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});p(this,el,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},il=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,o;"slot"!==t.localName&&(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(o=t.checkValidity)||void 0===o?void 0:o.call(t)))})),e},sl=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Ia}])`));return(yield Promise.all(e.map((e=>u(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},al=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},dl=function(e={}){var t,n;const o=Ya(e,["externalId","email","phone"]),r=Ya(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,password:r});null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.store)||void 0===n||n.call(t,e)}catch(e){this.loggerWrapper.error("Could not store credentials",e.message)}},cl=function(e){this.rootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.addEventListener("input",(()=>{var n;(null===(n=t.checkValidity)||void 0===n?void 0:n.call(t))&&p(this,ll,"f").call(this,t,e)}))}))},ul=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{p(this,ll,"f").call(this,t,e)}})),p(this,Jd,"m",cl).call(this,e)},hl=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===Wa.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},pl=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",gl);var ml=Object.freeze({__proto__:null,default:gl});function vl(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const bl=e=>{const t=document.createElement("template");return t.innerHTML=e,t},yl=(...e)=>e.join("/").replace(/\/+/g,"/"),wl=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),$l=e=>{let t,n;return(...o)=>(t&&wl(t,o)||(t=o,n=e(...o)),n)},El=e=>(t,...n)=>t.reduce(((t,o,r)=>{var i;return`${t}${o}${(null===(i=null==n?void 0:n[r])||void 0===i?void 0:i[e>1?1:0])||""}`}),""),kl=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},Cl=e=>{const t=Symbol((e=>{const t=e.toString();let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return n.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}};var xl,Il,Ol,Sl,jl,Al;function Rl(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!Rl(i,s))return!1}else if(i!==s)return!1}return!0}class Nl{constructor(e={},{updateOnlyOnChange:t=!0}={}){xl.set(this,void 0),Il.set(this,{}),Ol.set(this,0),Sl.set(this,!1),this.update=e=>{const t="function"==typeof e?e(p(this,xl,"f")):e,n=Object.assign(Object.assign({},p(this,xl,"f")),t);if(!p(this,Sl,"f")||!Rl(p(this,xl,"f"),n)){const e=p(this,xl,"f");f(this,xl,n,"f"),Object.freeze(p(this,xl,"f")),setTimeout((()=>{Object.values(p(this,Il,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,xl,e,"f"),f(this,Sl,t,"f")}get current(){return Object.assign({},p(this,xl,"f"))}subscribe(e){return f(this,Ol,p(this,Ol,"f")+1,"f"),p(this,Il,"f")[p(this,Ol,"f")]=e,p(this,Ol,"f").toString()}unsubscribe(e){const t=!!p(this,Il,"f")[e];return t&&delete p(this,Il,"f")[e],t}unsubscribeAll(){return f(this,Il,{},"f"),!0}}xl=new WeakMap,Il=new WeakMap,Ol=new WeakMap,Sl=new WeakMap;class Ml{constructor(e,t){jl.set(this,void 0),this.nodeName="",f(this,jl,e,"f"),this.logger=t.logger}get asyncEle(){return(async(e,t)=>new Promise((t=>{const n=setInterval((()=>{const o="function"==typeof e?e():e;o&&(clearInterval(n),t(o))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(p(this,jl,"f"))}get ele(){var e,t;const n="function"==typeof p(this,jl,"f")?p(this,jl,"f").call(this):p(this,jl,"f");return n?(null==n?void 0:n.localName)!==this.nodeName?(null===(t=this.logger)||void 0===t||t.debug(`node name do not match, expected "${this.nodeName}", received "${n.localName}" `,Error()),null):n:(null===(e=this.logger)||void 0===e||e.debug("no element for driver ",this.constructor.name,new Error),null)}}jl=new WeakMap;const Ul=/^descope-grid-([^-]+)-column$/,Tl={text:class extends Ml{constructor(){super(...arguments),this.nodeName="descope-grid-text-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}},custom:class extends Ml{constructor(){super(...arguments),this.nodeName="descope-grid-custom-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}}};class Dl extends Ml{constructor(){super(...arguments),this.nodeName="descope-grid",Al.set(this,void 0)}onSelectedItemsChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("selected-items-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}get ele(){return super.ele}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}set data(e){this.ele&&(this.ele.data=e)}get columns(){return this.ele?Array.from(this.ele.children).reduce(((e,t)=>{var n;const o=null===(n=Ul.exec(t.localName))||void 0===n?void 0:n[1],r=Tl[o];return r?(e.push(new r(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const o=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);wl(o,this.ele.columns)||(this.ele.columns=o,null===(n=p(this,Al,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){f(this,Al,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}Al=new WeakMap;class Pl extends Ml{constructor(){super(...arguments),this.nodeName="descope-button"}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}}var Ll;class _l extends Ml{constructor(){super(...arguments),Ll.set(this,void 0),this.nodeName="descope-modal"}close(){var e,t;null===(e=this.ele)||void 0===e||e.removeAttribute("opened"),null===(t=this.afterClose)||void 0===t||t.call(this)}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),p(this,Ll,"f")&&(null===(e=this.ele)||void 0===e||e.append(p(this,Ll,"f").content.cloneNode(!0)))}setContent(e){f(this,Ll,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Ll=new WeakMap;class Wl extends Ml{constructor(){super(...arguments),this.nodeName="descope-multi-select-combo-box"}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}}class Fl extends Ml{constructor(){super(...arguments),this.nodeName="descope-combo-box"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}}class Vl extends Ml{constructor(){super(...arguments),this.nodeName="descope-notification"}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}show(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("opened","true")}setContent(e){this.ele.innerHTML="",this.ele.appendChild(e.content.cloneNode(!0))}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}class ql extends Ml{constructor(){super(...arguments),this.nodeName="descope-text"}get ele(){return super.ele}get text(){var e;return null===(e=this.ele)||void 0===e?void 0:e.innerText}set text(e){this.ele&&(this.ele.innerText=e)}}class Bl extends Ml{constructor(){super(...arguments),this.nodeName="descope-text-field"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}}class zl extends Ml{constructor(){super(...arguments),this.nodeName="descope-avatar"}set displayName(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("display-name",e)}set image(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("img",e)}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}}class Kl extends Ml{constructor(){super(...arguments),this.nodeName="descope-user-attribute"}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",e)}set badgeLabel(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("badge-label",e)}get label(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("label"))||""}get editFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("edit-flow-id"))||""}get deleteFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("delete-flow-id"))||""}onEditClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("edit-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("edit-clicked",e)}}onDeleteClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("delete-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("delete-clicked",e)}}}class Hl extends Ml{constructor(){super(...arguments),this.nodeName="descope-user-auth-method"}set fulfilled(e){var t,n;e?null===(t=this.ele)||void 0===t||t.setAttribute("fulfilled","true"):null===(n=this.ele)||void 0===n||n.removeAttribute("fulfilled")}onButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}}class Gl extends Ml{constructor(){super(...arguments),this.nodeName="descope-wc"}set projectId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("project-id",e)}set baseUrl(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("base-url",e)}set flowId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("flow-id",e)}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}}function Jl(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Zl=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Xl=()=>Math.random().toString(36).substring(7).split("").join("."),Yl={INIT:`@@redux/INIT${Xl()}`,REPLACE:`@@redux/REPLACE${Xl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Xl()}`};function Ql(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ec(e){if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";const n=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function tc(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=ec(e)),t}function nc(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Jl(2):`Expected the root reducer to be a function. Instead, received: '${tc(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Jl(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("production"===process.env.NODE_ENV?Jl(1):`Expected the enhancer to be a function. Instead, received: '${tc(n)}'`);return n(nc)(e,t)}let o=e,r=t,i=new Map,s=i,a=0,d=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("production"===process.env.NODE_ENV?Jl(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return r}function u(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Jl(4):`Expected the listener to be a function. Instead, received: '${tc(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Jl(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(d)throw new Error("production"===process.env.NODE_ENV?Jl(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,l(),s.delete(n),i=null}}}function h(e){if(!Ql(e))throw new Error("production"===process.env.NODE_ENV?Jl(7):`Actions must be plain objects. Instead, the actual type was: '${tc(e)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(void 0===e.type)throw new Error("production"===process.env.NODE_ENV?Jl(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if("string"!=typeof e.type)throw new Error("production"===process.env.NODE_ENV?Jl(17):`Action "type" property must be a string. Instead, the actual type was: '${tc(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Jl(9):"Reducers may not dispatch actions.");try{d=!0,r=o(r,e)}finally{d=!1}return(i=s).forEach((e=>{e()})),e}function p(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Jl(10):`Expected the nextReducer to be a function. Instead, received: '${tc(e)}`);o=e,h({type:Yl.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Jl(11):`Expected the observer to be an object. Instead, received: '${tc(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Zl](){return this}}}h({type:Yl.INIT});const g={dispatch:h,subscribe:u,getState:c,replaceReducer:p,[Zl]:f};return g}function oc(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function rc(e){const t=Object.keys(e),n={};for(let o=0;o<t.length;o++){const r=t[o];"production"!==process.env.NODE_ENV&&void 0===e[r]&&oc(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const o=Object.keys(n);let r,i;"production"!==process.env.NODE_ENV&&(r={});try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Yl.INIT}))throw new Error("production"===process.env.NODE_ENV?Jl(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(void 0===n(void 0,{type:Yl.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Jl(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Yl.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)}))}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;if("production"!==process.env.NODE_ENV){const o=function(e,t,n,o){const r=Object.keys(t),i=n&&n.type===Yl.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===r.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Ql(e))return`The ${i} has unexpected type of "${tc(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!o[e]));return s.forEach((e=>{o[e]=!0})),n&&n.type===Yl.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);o&&oc(o)}let s=!1;const a={};for(let r=0;r<o.length;r++){const i=o[r],d=n[i],l=e[i],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?Jl(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${i}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[i]=c,s=s||c!==l}return s=s||o.length!==Object.keys(e).length,s?a:e}}function ic(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function sc(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?Jl(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:r.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map((e=>e(s)));return i=ic(...a)(r.dispatch),{...r,dispatch:i}}}function ac(e){return Ql(e)&&"type"in e&&"string"==typeof e.type}var dc=Symbol.for("immer-nothing"),lc=Symbol.for("immer-draftable"),cc=Symbol.for("immer-state"),uc="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function hc(e,...t){if("production"!==process.env.NODE_ENV){const n=uc[e],o="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pc=Object.getPrototypeOf;function fc(e){return!!e&&!!e[cc]}function gc(e){return!!e&&(vc(e)||Array.isArray(e)||!!e[lc]||!!e.constructor?.[lc]||Ec(e)||kc(e))}var mc=Object.prototype.constructor.toString();function vc(e){if(!e||"object"!=typeof e)return!1;const t=pc(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===mc}function bc(e,t){0===yc(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function yc(e){const t=e[cc];return t?t.type_:Array.isArray(e)?1:Ec(e)?2:kc(e)?3:0}function wc(e,t){return 2===yc(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $c(e,t,n){const o=yc(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Ec(e){return e instanceof Map}function kc(e){return e instanceof Set}function Cc(e){return e.copy_||e.base_}function xc(e,t){if(Ec(e))return new Map(e);if(kc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&vc(e)){if(!pc(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[cc];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(pc(e),n)}function Ic(e,t=!1){return Sc(e)||fc(e)||!gc(e)||(yc(e)>1&&(e.set=e.add=e.clear=e.delete=Oc),Object.freeze(e),t&&bc(e,((e,t)=>Ic(t,!0)))),e}function Oc(){hc(2)}function Sc(e){return Object.isFrozen(e)}var jc,Ac={};function Rc(e){const t=Ac[e];return t||hc(0,e),t}function Nc(){return jc}function Mc(e,t){t&&(Rc("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Uc(e){Tc(e),e.drafts_.forEach(Pc),e.drafts_=null}function Tc(e){e===jc&&(jc=e.parent_)}function Dc(e){return jc={drafts_:[],parent_:jc,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Pc(e){const t=e[cc];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Lc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[cc].modified_&&(Uc(t),hc(4)),gc(e)&&(e=_c(t,e),t.parent_||Fc(t,e)),t.patches_&&Rc("Patches").generateReplacementPatches_(n[cc].base_,e,t.patches_,t.inversePatches_)):e=_c(t,n,[]),Uc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==dc?e:void 0}function _c(e,t,n){if(Sc(t))return t;const o=t[cc];if(!o)return bc(t,((r,i)=>Wc(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Fc(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),bc(r,((r,s)=>Wc(e,o,t,r,s,n,i))),Fc(e,t,!1),n&&e.patches_&&Rc("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Wc(e,t,n,o,r,i,s){if("production"!==process.env.NODE_ENV&&r===n&&hc(5),fc(r)){const s=_c(e,r,i&&t&&3!==t.type_&&!wc(t.assigned_,o)?i.concat(o):void 0);if($c(n,o,s),!fc(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(gc(r)&&!Sc(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;_c(e,r),t&&t.scope_.parent_||Fc(e,r)}}function Fc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ic(t,n)}var Vc={get(e,t){if(t===cc)return e;const n=Cc(e);if(!wc(n,t))return function(e,t,n){const o=zc(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!gc(o)?o:o===Bc(e.base_,t)?(Hc(e),e.copy_[t]=Gc(o,e)):o},has:(e,t)=>t in Cc(e),ownKeys:e=>Reflect.ownKeys(Cc(e)),set(e,t,n){const o=zc(Cc(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Bc(Cc(e),t),r=o?.[cc];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,o)&&(void 0!==n||wc(e.base_,t)))return!0;Hc(e),Kc(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Bc(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Hc(e),Kc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Cc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){hc(11)},getPrototypeOf:e=>pc(e.base_),setPrototypeOf(){hc(12)}},qc={};function Bc(e,t){const n=e[cc];return(n?Cc(n):e)[t]}function zc(e,t){if(!(t in e))return;let n=pc(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pc(n)}}function Kc(e){e.modified_||(e.modified_=!0,e.parent_&&Kc(e.parent_))}function Hc(e){e.copy_||(e.copy_=xc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}bc(Vc,((e,t)=>{qc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),qc.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&hc(13),qc.set.call(this,e,t,void 0)},qc.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&hc(14),Vc.set.call(this,e[0],t,n,e[0])};function Gc(e,t){const n=Ec(e)?Rc("MapSet").proxyMap_(e,t):kc(e)?Rc("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Nc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Vc;n&&(r=[o],i=qc);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:Nc()).drafts_.push(n),n}function Jc(e){return fc(e)||hc(10,e),Zc(e)}function Zc(e){if(!gc(e)||Sc(e))return e;const t=e[cc];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xc(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xc(e,!0);return bc(n,((e,t)=>{$c(n,e,Zc(t))})),t&&(t.finalized_=!1),n}var Xc=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&hc(6),void 0!==n&&"function"!=typeof n&&hc(7),gc(e)){const r=Dc(this),i=Gc(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Uc(r):Tc(r)}return Mc(r,n),Lc(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===dc&&(o=void 0),this.autoFreeze_&&Ic(o,!0),n){const t=[],r=[];Rc("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}hc(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;const r=this.produce(e,t,((e,t)=>{n=e,o=t}));return[r,n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){gc(e)||hc(8),fc(e)&&(e=Jc(e));const t=Dc(this),n=Gc(e,void 0);return n[cc].isManual_=!0,Tc(t),n}finishDraft(e,t){const n=e&&e[cc];n&&n.isManual_||hc(9);const{scope_:o}=n;return Mc(o,t),Lc(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=Rc("Patches").applyPatches_;return fc(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},Yc=Xc.produce;Xc.produceWithPatches.bind(Xc),Xc.setAutoFreeze.bind(Xc),Xc.setUseStrictShallowCopy.bind(Xc),Xc.applyPatches.bind(Xc),Xc.createDraft.bind(Xc),Xc.finishDraft.bind(Xc);var Qc=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},eu=(e,t,n)=>{const{memoize:o,memoizeOptions:r}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=o((()=>({})),...r);if(!(a.apply(null,i)===a.apply(null,s))){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:i,secondInputs:s,stack:e})}},tu={inputStabilityCheck:"once",identityFunctionCheck:"once"};var nu=e=>Array.isArray(e)?e:[e];function ou(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ru(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var iu=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...tu,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Qc},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:eu}}},su="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function au(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:o}=t;let r,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}else{let e=t.p;null===e&&(t.p=e=new Map);const o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}}const a=t;let d;if(1===t.s?d=t.v:(d=e.apply(null,arguments),i++),a.s=1,o){const e=r?.deref?.()??r;null!=e&&o(e,d)&&(d=e,0!==i&&i--);r="object"==typeof d&&null!==d||"function"==typeof d?new su(d):d}return a.v=d,d}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function du(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,o=(...e)=>{let t,o=0,r=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:d,memoizeOptions:l=[],argsMemoize:c=au,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=nu(l),f=nu(u),g=ou(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const b=c((function(){r++;const e=ru(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=iu(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=ru(g,arguments);o.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:p},arguments)}v&&(v=!1)}return t}),...f);return Object.assign(b,{resultFunc:s,memoizedResultFunc:m,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:c})};return Object.assign(o,{withTypes:()=>o}),o}var lu=du(au),cu=Object.assign(((e,t=lu)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e),o=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,o)=>(e[n[o]]=t,e)),{})));return o}),{withTypes:()=>cu});function uu(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var hu=uu(),pu=uu;((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var fu="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},gu=e=>e&&"function"==typeof e.match;function mu(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?th(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function vu(e){return"function"==typeof e&&"type"in e&&gu(e)}function bu(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var yu=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function wu(e){return gc(e)?Yc(e,(()=>{})):e}function $u(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?th(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Eu(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function ku(e,t,n){const o=Cu(e,t,n);return{detectMutations:()=>xu(e,t,o,n)}}function Cu(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Cu(e,t,n[r],s))}}return i}function xu(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=xu(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Iu(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function Ou(e,t="",n=Iu,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Ou(l,a,n,o,r,i),s))return s}return i&&Su(e)&&i.add(e),!1}function Su(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Su(t))return!1;return!0}function ju(e){return"boolean"==typeof e}var Au=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new yu;if(t&&(ju(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};ju(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Eu,ignoredPaths:r,warnAfter:i=32}=e;const s=ku.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=bu(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?th(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?th(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};ju(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Iu,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!ac(u))return l(u);const h=l(u),p=bu(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Ou(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=Ou(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};ju(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=vu}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},Ru=e=>t=>{setTimeout(t,e)},Nu="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ru(10),Mu=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new yu(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Nu:"callback"===e.type?e.queueNotification:Ru(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Uu="production"===process.env.NODE_ENV;function Tu(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?th(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?th(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?th(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?th(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?th(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?th(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Du=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Pu(...e){return t=>e.some((e=>((e,t)=>gu(e)?e.match(t):e(t))(e,t)))}var Lu=["name","message","stack","code"],_u=class{constructor(e,t){this.payload=e,this.meta=t}_type},Wu=class{constructor(e,t){this.payload=e,this.meta=t}_type},Fu=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Lu)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Vu=(()=>{function e(e,t,n){const o=mu(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=mu(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=mu(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Fu)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):Du(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new _u(e,t),fulfillWithValue:(e,t)=>new Wu(e,t)})).then((t=>{if(t instanceof _u)throw t;return t instanceof Wu?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof _u?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(qu)})}}),{pending:r,rejected:i,fulfilled:o,settled:Pu(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function qu(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Bu=Symbol.for("rtk-slice-createasyncthunk");function zu(e,t){return`${e}/${t}`}function Ku({creators:e}={}){const t=e?.asyncThunk?.[Bu];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?th(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?th(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?th(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?th(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?Tu(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?th(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=Tu(t);if(function(e){return"function"==typeof e}(e))n=()=>wu(e());else{const t=wu(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?th(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:zu(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?th(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?mu(e,s):mu(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?th(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||Ju,pending:a||Ju,rejected:d||Ju,settled:l||Ju})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?th(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=$u(c,n,{insert:()=>new WeakMap});return $u(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Hu(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function Hu(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?th(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Gu=Ku();function Ju(){}var Zu="listenerMiddleware",Xu=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=mu(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?th(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?th(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Yu=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Xu(e);return{id:Du(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?th(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Yu}),Qu=Object.assign(mu(`${Zu}/add`),{withTypes:()=>Qu});mu(`${Zu}/removeAll`);var eh=Object.assign(mu(`${Zu}/remove`),{withTypes:()=>eh});function th(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const nh=["error","warn","info","debug"],oh=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return nh.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),rh="undefined"!=typeof localStorage,ih=rh&&localStorage.getItem("base.content.url")||"",sh=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,ah=Cl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),dh=Cl((e=>{var t,n;const o=vl(oh,ah)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),lh=e=>t=>{var n,o,r;const i=vl(oh,ah,dh)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};lh.missingAttrValidator=sh;const ch=Cl((e=>{const t=vl(lh({"project-id":sh}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),uh=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const hh=Cl((e=>{const t=vl(oh,ch,uh)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(ih||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),ph=Cl((e=>{var t,n,o;const r=vl(hh)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),fh=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(ah,oh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Kh})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),gh="load-descope-ui",mh="base.ui.components.url",vh=rh&&localStorage.getItem(mh)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",bh=rh&&localStorage.getItem(mh)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",yh=e=>{const t=document.createElement("script");return t.id=e,t},wh=(e,t)=>e.replace("<version>",t),$h=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(oh,ph)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=yh("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=wh(bh,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${gh}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=yh(gh);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=wh(vh,await p(this,t,"m",r).call(this))}return document.getElementById(gh)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),Eh="content-root",kh="root",Ch=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${kh}, #${Eh} {\n height: 100%;\n }\n #${kh} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${kh}">\n <div id="${Eh}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Eh),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(kh)}})),xh="descope-modal",Ih=Cl((e=>{var t,n;const o=vl(ah,Ch,$h)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(xh);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([xh]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Oh="descope-notification",Sh=Cl((e=>{var t,n;const o=vl(ah,Ch,$h)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Oh);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([Oh])}},t=new WeakMap,n})),jh=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Ah=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(lh({theme:jh}),hh,ah,$h,ph,Ch,dh)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(mh)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(mh),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),Rh=e=>Cl((t=>{const n=Gu(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(oh)(t)){constructor(...e){super(...e);const t=function(e){const t=Au(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?th(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!Uu&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?th(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Uu&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?th(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Uu&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?th(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=fu({trace:!Uu,..."object"==typeof r&&r}));const c=sc(...d),u=Mu(c);if(!Uu&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?th(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Uu&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?th(6):"`enhancers` callback must return an array");if(!Uu&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?th(7):"each enhancer provided to configureStore must be a function");return Uu||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{qu(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Nh=Cl((e=>class extends(oh(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Mh=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Uh,Th,Dh,Ph,Lh,_h,Wh,Fh,Vh,qh;const Bh=document.createElement("template");Bh.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class zh extends HTMLElement{constructor(){var e;super(),Uh.add(this),Th.set(this,new Nl({messages:[]})),Dh.set(this,void 0),Ph.set(this,void 0),Lh.set(this,void 0),_h.set(this,{resize:p(this,Uh,"m",qh).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Bh.content.cloneNode(!0)),f(this,Dh,this.shadowRoot.querySelector(".debugger"),"f"),f(this,Ph,p(this,Dh,"f").querySelector(".content"),"f"),f(this,Lh,p(this,Dh,"f").querySelector(".header"),"f")}updateData(e){p(this,Th,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Mh(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,Dh,"f"),p(this,Lh,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,_h,"f").resize),(e=p(this,Dh,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,Dh,"f").onresize=p(this,Uh,"m",Vh).bind(this),p(this,Th,"f").subscribe(p(this,Uh,"m",Wh).bind(this))}disconnectedCallback(){p(this,Th,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,_h,"f").resize)}}Th=new WeakMap,Dh=new WeakMap,Ph=new WeakMap,Lh=new WeakMap,_h=new WeakMap,Uh=new WeakSet,Wh=function(e){p(this,Uh,"m",Fh).call(this,e),p(this,Uh,"m",Vh).call(this)},Fh=function(e){p(this,Ph,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Vh=function(){p(this,Ph,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},qh=function(){const[e,t]=Mh(p(this,Dh,"f"),Number.parseInt(p(this,Dh,"f").style.left,10),Number.parseInt(p(this,Dh,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,Dh,"f").style.top=`${t}px`,p(this,Dh,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",zh);var Kh=Object.freeze({__proto__:null}),Hh={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:1[3-79]|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:22|44|7[27]|87|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-689]|8[1-69]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","2[0-24-9]\\d{8}|[78]\\d{10,13}|[7-9]\\d{9}|[1-9]\\d{7}|[124-7]\\d{6}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-6]|7(?:0[0-689]|[1-79])|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","810","(?:20|33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function Gh(e,t){var n=Array.prototype.slice.call(t);return n.push(Hh),e.apply(this,n)}function Jh(e){return Jh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jh(e)}function Zh(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Xh(e,t){if(t&&("object"===Jh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Yh(e)}function Yh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qh(e){var t="function"==typeof Map?new Map:void 0;return Qh=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return ep(e,arguments,op(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),np(o,e)},Qh(e)}function ep(e,t,n){return ep=tp()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&np(r,n.prototype),r},ep.apply(null,arguments)}function tp(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function np(e,t){return np=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},np(e,t)}function op(e){return op=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},op(e)}var rp=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&np(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=tp(),function(){var e,o=op(t);if(n){var r=op(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return Xh(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=s.call(this,e),Object.setPrototypeOf(Yh(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&Zh(o.prototype,r),i&&Zh(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(Qh(Error)),ip="0-90-9٠-٩۰-۹",sp="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function ap(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),o=t[0].split("."),r=0;r<3;r++){var i=Number(n[r]),s=Number(o[r]);if(i>s)return 1;if(s>i)return-1;if(!isNaN(i)&&isNaN(s))return 1;if(isNaN(i)&&!isNaN(s))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}var dp={}.constructor;function lp(e){return null!=e&&e.constructor===dp}function cp(e){return cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cp(e)}function up(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hp(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function pp(e,t,n){return t&&hp(e.prototype,t),n&&hp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var fp=" ext. ",gp=/^\d+$/,mp=function(){function e(t){up(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!lp(e)||!lp(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(lp(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Ep(e)+": "+e,"."))}(t),this.metadata=t,Cp.call(this,t)}return pp(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&gp.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new vp(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new vp(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var n=this.nonGeographic()[e];if(n)return n}else{var o=this.countryCallingCodes()[e];if(o&&1===o.length&&"001"===o[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),vp=function(){function e(t,n){up(this,e),this.globalMetadataObject=n,this.metadata=t,Cp.call(this,n.metadata)}return pp(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this,t=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return t.map((function(t){return new bp(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(e){if(this.hasTypes()&&$p(this.types(),e))return new wp($p(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?fp:this.metadata[13]||fp}}]),e}(),bp=function(){function e(t,n){up(this,e),this._format=t,this.metadata=n}return pp(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||yp.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),yp=/^\(?\$1\)?$/,wp=function(){function e(t,n){up(this,e),this.type=t,this.metadata=n}return pp(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function $p(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var Ep=function(e){return cp(e)};function kp(e,t){if((t=new mp(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Cp(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===ap(t,"1.2.0")?this.v2=!0:-1===ap(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var xp=function(e){return"([".concat(ip,"]{1,").concat(e,"})")};function Ip(e){var t="[  \\t,]*",n="[:\\..]?[  \\t,-]*",o="#?",r="[  \\t]*";return";ext="+xp("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+xp("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+xp("9")+o)+"|"+("[- ]+"+xp("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+xp("15")+o)+"|"+(r+"(?:,)+"+n+xp("9")+o)}var Op="["+ip+"]{2}",Sp="[++]{0,1}(?:["+sp+"]*["+ip+"]){3,}["+sp+ip+"]*",jp=new RegExp("^[++]{0,1}(?:["+sp+"]*["+ip+"]){1,2}$","i"),Ap=Sp+"(?:"+Ip()+")?",Rp=new RegExp("^"+Op+"$|^"+Ap+"$","i");var Np=new RegExp("(?:"+Ip()+")$","i");var Mp={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Up(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Tp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Dp(e){for(var t,n="",o=Up(e.split(""));!(t=o()).done;){n+=Pp(t.value,n)||""}return n}function Pp(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return Mp[e]}(e)}function Lp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _p(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Wp(e,t){return Fp(e,void 0,t)}function Fp(e,t,n){var o=n.type(t),r=o&&o.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!n.type("FIXED_LINE"))return Fp(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=Lp(t);!(n=r()).done;){var i=n.value;e.indexOf(i)<0&&o.push(i)}return o.sort((function(e,t){return e-t}))}(r,i.possibleLengths()))}else if(t&&!o)return"INVALID_LENGTH";var s=e.length,a=r[0];return a===s?"IS_POSSIBLE":a>s?"TOO_SHORT":r[r.length-1]<s?"TOO_LONG":r.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function Vp(e,t){return"IS_POSSIBLE"===Wp(e,t)}function qp(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Bp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return zp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var Kp=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Hp(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new mp(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(qp(o,n.nationalNumberPattern())){if(Gp(o,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Gp(o,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,i=Bp(Kp);!(r=i()).done;){var s=r.value;if(Gp(o,s,n))return s}}}}function Gp(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&qp(e,t.pattern()))}function Jp(e,t,n){var o=new mp(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new mp(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var Zp=/(\$\d)/;function Xp(e,t,n){var o=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var i=e.replace(new RegExp(t.pattern()),o?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(Zp,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(sp,"]+"),"g")," ").trim()}(i):i}var Yp=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Qp(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ef(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ef(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ef(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function tf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function nf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tf(Object(n),!0).forEach((function(t){of(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function of(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rf={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function sf(e,t,n,o){if(n=n?nf(nf({},rf),n):rf,o=new mp(o),e.country&&"001"!==e.country){if(!o.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));o.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";o.selectNumberingPlan(e.countryCallingCode)}var r,i=o.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?df(r=af(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=af(s,null,"INTERNATIONAL",o,n),df(r="+".concat(i," ").concat(r),e.ext,o,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(s);case"RFC3966":return function(e){var t=e.number,n=e.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(n?";ext="+n:"")}({number:"+".concat(i).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,o,r){var i=kp(o,r.metadata);if(i===n){var s=af(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new mp(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():Yp.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(af(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return df(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function af(e,t,n,o,r){var i=function(e,t){for(var n,o=Qp(e);!(n=o()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var i=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(i))continue}if(qp(t,r.pattern()))return r}}(o.formats(),e);return i?Xp(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function df(e,t,n,o){return t?o(e,t,n):e}function lf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lf(Object(n),!0).forEach((function(t){uf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hf(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var pf=function(){function e(t,n,o){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!n)throw new TypeError("`nationalNumber` not passed");if(!o)throw new TypeError("`metadata` not passed");var r=function(e,t){var n,o,r=new mp(t);i=e,/^[A-Z]{2}$/.test(i)?(n=e,r.selectNumberingPlan(n),o=r.countryCallingCode()):o=e;var i;return{country:n,countryCallingCode:o}}(t,o),i=r.country,s=r.countryCallingCode;this.country=i,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}var t,n,o;return t=e,n=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Jp(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new mp(n),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!n.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}}if(n.possibleLengths())return Vp(e.phone||e.nationalNumber,n);if(e.countryCallingCode&&n.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return function(e,t,n){return t=t||{},(n=new mp(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Hp(e,t,n.metadata):qp(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new mp(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Hp(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return sf(this,e,t?cf(cf({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],n&&hf(t.prototype,n),o&&hf(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var ff=new RegExp("(["+ip+"])");function gf(e,t){var n=function(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),o=n.exec(e);if(o){var r,i,s,a=o.length-1,d=a>0&&o[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(i=o[1]);else{var l=o[0];r=e.slice(l.length),d&&(i=o[1])}if(d){var c=e.indexOf(o[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=o[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:i}}}return{nationalNumber:e}}(e,t),o=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(qp(e,n.nationalNumberPattern())&&!qp(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Wp(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:o}}function mf(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new mp(o);r.selectNumberingPlan(t,n);var i=new RegExp(r.IDDPrefix());if(0===e.search(i)){var s=(e=e.slice(e.match(i)[0].length)).match(ff);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}(e,t,n,o);if(!i||i===e){if(t||n){var s=function(e,t,n,o){var r=t?kp(t,o):n;if(0===e.indexOf(r)){(o=new mp(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=gf(i,o).nationalNumber,a=gf(e,o).nationalNumber;if(!qp(a,o.nationalNumberPattern())&&qp(s,o.nationalNumberPattern())||"TOO_LONG"===Wp(a,o))return{countryCallingCode:r,number:i}}return{number:e}}(e,t,n,o),a=s.countryCallingCode,d=s.number;if(a)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:d}}return{number:e}}r=!0,e="+"+i}if("0"===e[1])return{};o=new mp(o);for(var l=2;l-1<=3&&l<=e.length;){var c=e.slice(1,l);if(o.hasCallingCode(c))return o.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function vf(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bf(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function yf(e,t){var n=t.nationalNumber,o=t.defaultCountry,r=t.metadata,i=r.getCountryCodesForCallingCode(e);if(i)return 1===i.length?i[0]:function(e,t){var n=t.countries,o=t.defaultCountry,r=t.metadata;r=new mp(r);for(var i,s=[],a=vf(n);!(i=a()).done;){var d=i.value;if(r.country(d),r.leadingDigits()){if(e&&0===e.search(r.leadingDigits()))return d}else if(Hp({phone:e,country:d},void 0,r.metadata)){if(!o)return d;if(d===o)return d;s.push(d)}}if(s.length>0)return s[0]}(n,{countries:i,defaultCountry:o,metadata:r.metadata})}var wf="(["+ip+"]|[\\-\\.\\(\\)]?)",$f=new RegExp("^\\+"+wf+"*["+ip+"]"+wf+"*$","g"),Ef=new RegExp("^("+("["+ip+"]+((\\-)*["+ip+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+ip+"])*")+"\\.?$","g"),kf="tel:",Cf=";phone-context=";function xf(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Cf);if(t<0)return null;var n=t+Cf.length;if(n>=e.length)return"";var o=e.indexOf(";",n);return o>=0?e.substring(n,o):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&($f.test(e)||Ef.test(e))}(r))throw new rp("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(kf);i=s>=0?s+kf.length:0;var a=e.indexOf(Cf);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var If=new RegExp("[++"+ip+"]"),Of=new RegExp("[^"+ip+"#]+$");function Sf(e,t,n){if(t=t||{},n=new mp(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new rp("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=xf(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new rp("TOO_LONG");return}if(!1===t)return e;var o=e.search(If);if(o<0)return;return e.slice(o).replace(Of,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&Rp.test(e)}(o))return function(e){return jp.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Np);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(Np),r=1;r<o.length;){if(o[r])return{number:n,ext:o[r]};r++}}(o);if(r.ext)return r;return{number:o}}(e,t.v2,t.extract),r=o.number,i=o.ext,s=o.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new rp("TOO_SHORT");throw new rp("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=mf(Dp(e),t,n,o.metadata),s=i.countryCallingCodeSource,a=i.countryCallingCode,d=i.number;if(a)o.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};o.selectNumberingPlan(t,n),t&&(r=t),a=n||kp(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=gf(Dp(d),o),c=l.nationalNumber,u=l.carrierCode,h=yf(a,{nationalNumber:c,defaultCountry:t,metadata:o});h&&(r=h,"001"===h||o.country(r));return{country:r,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(r,t.defaultCountry,t.defaultCallingCode,n),d=a.country,l=a.nationalNumber,c=a.countryCallingCode,u=a.countryCallingCodeSource,h=a.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2)throw new rp("INVALID_COUNTRY");return{}}if(!l||l.length<2){if(t.v2)throw new rp("TOO_SHORT");return{}}if(l.length>17){if(t.v2)throw new rp("TOO_LONG");return{}}if(t.v2){var p=new pf(c,l,n.metadata);return d&&(p.country=d),h&&(p.carrierCode=h),i&&(p.ext=i),p.__countryCallingCodeSource=u,p}var f=!!(t.extended?n.hasSelectedNumberingPlan():d)&&qp(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!Vp(l,n)),phone:l,ext:i}:f?function(e,t,n){var o={country:e,phone:t};n&&(o.ext=n);return o}(d,l,i):{}}function jf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Af(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jf(Object(n),!0).forEach((function(t){Rf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Mf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,r,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Tf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Df(e){var t,n,o,r=Uf(Array.prototype.slice.call(e),4),i=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof i)throw new TypeError("A text for parsing must be a string.");if(t=i,s&&"string"!=typeof s){if(!lp(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,o=a):o=s}else d?(n=a,o=d):(n=void 0,o=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nf(Object(n),!0).forEach((function(t){Mf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:o}}function Pf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Lf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pf(Object(n),!0).forEach((function(t){_f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wf(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=Lf(Lf({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Sf(e,Af(Af({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof rp))throw e}}function Ff(){var e=Df(arguments),t=e.text,n=e.options,o=e.metadata;return Wf(t,n,o)}const Vf=(e,t)=>Object.entries(e).reduce(((e,[n,o])=>{const[r,...i]=n.split(".");return t!==r?Object.assign(e,{[n]:o}):(e[r]||(e[r]={}),e[r][i.join(".")]=o,e)}),{}),qf=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Bf={enabled:"active",disabled:"disabled",invited:"invited"},zf=e=>e.tenantRoles.data,Kf=e=>e.selectedUsersLoginIds,Hf=e=>e.notifications,Gf=e=>e.customAttributes.data,Jf=lu((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),qf(null==e?void 0:e.customAttributes,"customAttributes")),{status:Bf[e.status]||e.status,roles:e.roleNames}))))),Zf=lu(Kf,Jf,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Xf=lu(Zf,(e=>e.map((e=>e.userId)))),Yf=lu(Zf,(e=>e.map((e=>e.status)))),Qf=lu(Zf,(e=>e.every((e=>e.editable)))),eg=lu(Kf,(e=>!!e.length)),tg=lu(Kf,(e=>1===e.length)),ng=lu(Kf,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),og=lu(tg,Yf,((e,t)=>e&&t.every((e=>e===Bf.enabled)))),rg=lu(Yf,(e=>e.every((e=>e===Bf.disabled)))),ig=lu(Zf,(e=>{var t;return 1===e.length?e[0].name||e[0].email||(null===(t=e[0].loginIds)||void 0===t?void 0:t[0]):`${e.length} users`})),sg=lu(tg,rg,Qf,((e,t,n)=>e&&t&&n)),ag=lu(tg,og,Qf,((e,t,n)=>e&&t&&n)),dg=lu(tg,Qf,((e,t)=>e&&t)),lg=lu(tg,Qf,((e,t)=>e&&t)),cg=lu(tg,Qf,((e,t)=>e&&t)),ug=lu(eg,(e=>e)),hg=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},pg=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),fg=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),gg=Vu("users/create",((e,{extra:{api:t}})=>t.user.create(e))),mg=hg(gg)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},pg((e=>e.createUser)),fg({getSuccessMsg:()=>"User created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),vg={action:gg,reducer:mg},bg=Vu("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),yg=hg(bg)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},pg((e=>e.deleteUser)),fg({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to delete user${["","s"]}`})),wg={action:bg,reducer:yg},$g=Vu("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Eg=hg($g)(pg((e=>e.setTempUserPassword)),fg({getSuccessMsg:()=>"Successfully reset user password",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to reset user's password</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),kg={action:$g,reducer:Eg},Cg=Vu("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),xg=hg(Cg)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},pg((e=>e.customAttributes))),Ig={action:Cg,reducer:xg},Og=Vu("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),Sg=hg(Og)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},pg((e=>e.usersList))),jg={action:Og,reducer:Sg},Ag=Vu("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Rg=hg(Ag)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},pg((e=>e.tenantRoles))),Ng={action:Ag,reducer:Rg},Mg=Vu("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Ug=hg(Mg)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>wl(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},pg((e=>e.updateUser)),fg({getSuccessMsg:()=>"User updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Tg={action:Mg,reducer:Ug},Dg=Vu("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Pg=hg(Dg)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return wl(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},pg((e=>e.enableUser)),fg({getSuccessMsg:()=>"User enabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to enable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Lg={action:Dg,reducer:Pg},_g=Vu("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Wg=hg(_g)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return wl(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},pg((e=>e.disableUser)),fg({getSuccessMsg:()=>"User disabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to disable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Fg={action:_g,reducer:Wg},Vg=Vu("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),qg={action:Vg,reducer:hg(Vg)(pg((e=>e.removePasskey)),fg({getSuccessMsg:()=>"Successfully removed user's passkey",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to remove user's passkey</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}}))},Bg={usersList:{data:[],loading:!1,error:null},createUser:{loading:!1,error:null},updateUser:{loading:!1,error:null},deleteUser:{loading:!1,error:null},enableUser:{loading:!1,error:null},disableUser:{loading:!1,error:null},removePasskey:{loading:!1,error:null},setTempUserPassword:{loading:!1,error:null},customAttributes:{loading:!1,error:null,data:[]},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]},zg="/v1/mgmt/user/search",Kg="/v1/mgmt/user/delete/batch",Hg="/v1/mgmt/user/create",Gg="/v1/mgmt/user/update",Jg="/v1/mgmt/user/update/status",Zg="/v1/mgmt/user/password/set/temporary",Xg="/v1/mgmt/user/passkeys/delete",Yg="/v1/mgmt/user/customattributes",Qg="/v1/mgmt/role/all",em=e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),tm=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.push({loginIds:[`user${e}@company.com`],externalIds:[`user${e}@company.com`],userId:`user-${e}`,name:`User ${e}`,email:`user${e}@company.com`,roleNames:[`Role ${e}`],phone:`+1-202-555-010${e}`,verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.phone.toLowerCase().includes(e.toLowerCase())||t.status.toLowerCase().includes(e.toLowerCase())||"active"===e.toLowerCase()||t.familyName.toLowerCase().includes(e.toLowerCase())||t.givenName.toLowerCase().includes(e.toLowerCase())||t.middleName.toLowerCase().includes(e.toLowerCase())||t.email.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c});const h=yield e.post(zg,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c},{queryParams:{tenant:t}});return yield em(h),(yield h.json()).users})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Kg,{userIds:o},{queryParams:{tenant:t}});return yield em(r),r.json()})),create:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{const p=Math.random().toString(10).substring(15);u({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w});const $=yield e.post(Hg,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w},{queryParams:{tenant:t}});return yield em($),(yield $.json()).user})),update:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{u({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m});const v=yield e.post(Gg,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:m},{queryParams:{tenant:t}});return yield em(v),(yield v.json()).user})),enable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(o);const r=yield e.post(Jg,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield em(r),r.json()})),disable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(o);const r=yield e.post(Jg,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield em(r),r.json()})),removePasskey:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Xg,{loginId:o},{queryParams:{tenant:t}});return yield em(r),r.json()})),setTempPassword:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(Zg,{loginId:o},{queryParams:{tenant:t}});return yield em(r),r.json()})),getCustomAttributes:()=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const o=yield e.get(Yg,{queryParams:{tenant:t}});return yield em(o),(yield o.json()).data}))}),nm=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>new Promise((t=>{const n=[];for(let t=1;t<5;t+=1)n.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:n})})))(t);const o=yield e.get(Qg,{queryParams:{tenant:t}});return yield em(o),o.json()}))}),om=Cl((e=>{var t,n,o,r;const i=vl(ch,dh,oh,uh,lh({tenant:lh.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.4.88"}}));return{user:tm({httpClient:r.httpClient,tenant:t,mock:n}),tenant:nm({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),rm=Cl((e=>{const t=vl(Rh({name:"widget",initialState:Bg,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{vg.reducer(e),Tg.reducer(e),Lg.reducer(e),Fg.reducer(e),wg.reducer(e),jg.reducer(e),kg.reducer(e),qg.reducer(e),Ig.reducer(e),Ng.reducer(e)},asyncActions:{searchUsers:jg.action,createUser:vg.action,updateUser:Tg.action,enableUser:Lg.action,disableUser:Fg.action,deleteUsers:wg.action,removePasskey:qg.action,getCustomAttributes:Ig.action,getTenantRoles:Ng.action,setTempUserPassword:kg.action}}),ah,oh,om)(e);return class extends t{constructor(...e){super(...e),this.state=Bg,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),im=Cl((e=>{const t=vl(hh,lh({"widget-id":lh.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),sm=Cl((e=>{var t,n,o;return o=class extends(vl(oh,ah,$h,Ch,im,rm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),am=Cl((e=>{var t,n,o,r,i,s;return s=class extends(vl(rm,Ih,Nh,oh,sm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){yield p(this,n,"f").setData(zf(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(bl(yield this.fetchWidgetPage("create-user-modal.html")));new Pl((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}));const e=new Pl((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele);this.actions.createUser(Object.assign(Object.assign({},Vf(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),f(this,n,new Wl((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),p(this,i,"f").call(this),this.createUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield p(this,i,"f").call(this),p(this,t,"m",r).call(this)}))}))},r=function(){const e=Gf(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),dm=Cl((e=>{var t,n,o;return o=class extends(vl(oh,am,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},o})),lm=Cl((e=>{var t,n,o;return o=class extends(vl(rm,Ih,oh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(bl(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Pl((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteUsersModal.close()));const n=new Pl((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Xf(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new ql(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=ig(this.state);o.text=`Delete ${e}?`}}))},o})),cm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,lm)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),ug)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-users"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteUsersModal.open()}))},r})),um=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.disableUserModal.close()))},o=function(){new Pl((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=ng(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.disableUserModal=this.createModal(),this.disableUserModal.setContent(bl(yield this.fetchWidgetPage("disable-user-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`Disable ${e}?`}))}))},i})),hm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,um,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),ag)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="disable-user"]'),{logger:this.logger}),this.disableButton.disable(),this.disableButton.onClick((()=>{this.disableUserModal.open()}))},r})),pm=e=>{if(!e)return e;const t=function(){return Gh(Ff,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},fm=Cl((e=>{var t,n,o,r,i,s,a,d,l,h;return h=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),s.set(this,(()=>u(this,void 0,void 0,(function*(){yield p(this,o,"f").setData(zf(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=Zf(this.state))||void 0===e?void 0:e[0],o=Object.assign({loginId:null===(t=null==n?void 0:n.loginIds)||void 0===t?void 0:t.join(", "),displayName:null==n?void 0:n.name,email:null==n?void 0:n.email,phone:pm(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},qf(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,o)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",l).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){new Pl((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editUserModal.close()))},i=function(){new Pl((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{if(this.validateForm(this.editUserModal.ele)){const e=this.getFormData(this.editUserModal.ele),{loginId:t}=e,n=c(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Vf(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=Gf(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},l=function(){var e;return u(this,void 0,void 0,(function*(){this.editUserModal=this.createModal(),this.editUserModal.setContent(bl(yield this.fetchWidgetPage("edit-user-modal.html"))),p(this,t,"m",r).call(this),p(this,t,"m",i).call(this),f(this,n,new Bl(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),f(this,o,new Wl((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield p(this,s,"f").call(this),p(this,n,"f").disable(),p(this,d,"f").call(this),p(this,t,"m",a).call(this)}))}))},h})),gm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,fm,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),dg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-user"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editUserModal.open()}))},r})),mm=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.enableUserModal.close()))},o=function(){new Pl((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=ng(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.enableUserModal=this.createModal(),this.enableUserModal.setContent(bl(yield this.fetchWidgetPage("enable-user-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`Activate ${e}?`}))}))},i})),vm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,mm,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),sg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="enable-user"]'),{logger:this.logger}),this.enableButton.disable(),this.enableButton.onClick((()=>{this.enableUserModal.open()}))},r})),bm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r})),ym={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},wm=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(oh,rm,Sh,ah)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=p(this,t,"m",o).call(this,e);i.setContent(p(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(p(this,r,"f").bind(this),Hf)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=ym[e],o=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),$m=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.removePasskeyModal.close()))},o=function(){new Pl((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=ng(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(bl(yield this.fetchWidgetPage("remove-passkey-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),Em=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,$m,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),lg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="remove-passkey"]'),{logger:this.logger}),this.removePasskeyButton.disable(),this.removePasskeyButton.onClick((()=>{this.removePasskeyModal.open()}))},r})),km=Cl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(vl(rm,oh,sm)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{this.usersTable.data=e}))),i.set(this,kl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchUsers({sort:n})}))),s.set(this,$l((e=>{this.usersTable.filterColumns((t=>{var n;const[o,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==o||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this),p(this,r,"f").call(this,Jf(this.state)),p(this,s,"f").call(this,Gf(this.state)),this.subscribe(p(this,s,"f").bind(this),Gf),this.subscribe(p(this,r,"f").bind(this),Jf)}))}},r=new WeakMap,i=new WeakMap,s=new WeakMap,t=new WeakSet,n=function(){const e=e=>{var t;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(`[path="${e}"]`)},t=e=>{var t;const n=`descope-grid-${e}-column`;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(n)},n=this.usersTable.renderColumn;this.usersTable.renderColumn=({path:o,header:r,type:i,attrs:s})=>{const a=e(o)||t(i);if(!a)return n({path:o,header:r,type:i,attrs:s});const d=a.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:r});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},o=function(){var e;this.usersTable=new Dl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="users-table"]'),{logger:this.logger}),this.usersTable.onSelectedItemsChange((e=>{this.actions.setSelectedUsersIds(e.detail.value.map((({loginIds:e})=>e)))})),this.usersTable.onColumnsChange(p(this,t,"m",a).bind(this)),p(this,t,"m",n).call(this),p(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{p(this,i,"f").call(this,e.target,e.detail)}))}))},d})),Cm=Cl((e=>{var t,n,o;return o=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(bl(yield this.fetchWidgetPage("generated-password-modal.html")));new Pl((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.generatedPasswordModal.ele)["generated-password"]),this.resetFormData(this.generatedPasswordModal.ele),this.generatedPasswordModal.close()}))}))},o})),xm=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm,Cm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.resetPasswordModal.close()))},o=function(){new Pl((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>u(this,void 0,void 0,(function*(){var e;const t=ng(this.state),n=yield this.actions.setTempUserPassword(t);this.resetPasswordModal.close(),this.setFormData(this.generatedPasswordModal.ele,{"generated-password":null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext}),this.generatedPasswordModal.open()}))))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(bl(yield this.fetchWidgetPage("reset-password-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),Im=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,xm,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),cg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="reset-password"]'),{logger:this.logger}),this.resetPasswordButton.disable(),this.resetPasswordButton.onClick((()=>{this.resetPasswordModal.open()}))},r})),Om=Cl((e=>class extends(vl(fh,Ah,km,dm,cm,gm,vm,hm,Im,Em,bm,wm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Sm=vl((e=>class extends(Om(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Sm);var jm=Object.freeze({__proto__:null,default:Sm});((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var Am="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},Rm=e=>e&&"function"==typeof e.match;function Nm(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?vv(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function Mm(e){return"function"==typeof e&&"type"in e&&Rm(e)}function Um(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var Tm=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Dm(e){return gc(e)?Yc(e,(()=>{})):e}function Pm(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?vv(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Lm(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function _m(e,t,n){const o=Wm(e,t,n);return{detectMutations:()=>Fm(e,t,o,n)}}function Wm(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Wm(e,t,n[r],s))}}return i}function Fm(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Fm(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Vm(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function qm(e,t="",n=Vm,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=qm(l,a,n,o,r,i),s))return s}return i&&Bm(e)&&i.add(e),!1}function Bm(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Bm(t))return!1;return!0}function zm(e){return"boolean"==typeof e}var Km=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Tm;if(t&&(zm(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};zm(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Lm,ignoredPaths:r,warnAfter:i=32}=e;const s=_m.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Um(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vv(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vv(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};zm(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Vm,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!ac(u))return l(u);const h=l(u),p=Um(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=qm(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=qm(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};zm(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Mm}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},Hm=e=>t=>{setTimeout(t,e)},Gm="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Hm(10),Jm=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Tm(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Gm:"callback"===e.type?e.queueNotification:Hm(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Zm="production"===process.env.NODE_ENV;function Xm(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?vv(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?vv(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?vv(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?vv(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?vv(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?vv(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Ym=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Qm(...e){return t=>e.some((e=>((e,t)=>Rm(e)?e.match(t):e(t))(e,t)))}var ev=["name","message","stack","code"],tv=class{constructor(e,t){this.payload=e,this.meta=t}_type},nv=class{constructor(e,t){this.payload=e,this.meta=t}_type},ov=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of ev)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},rv=(()=>{function e(e,t,n){const o=Nm(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Nm(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Nm(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||ov)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):Ym(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new tv(e,t),fulfillWithValue:(e,t)=>new nv(e,t)})).then((t=>{if(t instanceof tv)throw t;return t instanceof nv?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof tv?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(iv)})}}),{pending:r,rejected:i,fulfilled:o,settled:Qm(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function iv(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var sv=Symbol.for("rtk-slice-createasyncthunk");function av(e,t){return`${e}/${t}`}function dv({creators:e}={}){const t=e?.asyncThunk?.[sv];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?vv(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?vv(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?vv(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?vv(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?Xm(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?vv(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=Xm(t);if(function(e){return"function"==typeof e}(e))n=()=>Dm(e());else{const t=Dm(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?vv(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:av(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?vv(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Nm(e,s):Nm(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?vv(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||uv,pending:a||uv,rejected:d||uv,settled:l||uv})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vv(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Pm(c,n,{insert:()=>new WeakMap});return Pm(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=lv(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function lv(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vv(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var cv=dv();function uv(){}var hv="listenerMiddleware",pv=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Nm(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?vv(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?vv(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},fv=Object.assign((e=>{const{type:t,predicate:n,effect:o}=pv(e);return{id:Ym(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?vv(22):"Unsubscribe not initialized")}}}),{withTypes:()=>fv}),gv=Object.assign(Nm(`${hv}/add`),{withTypes:()=>gv});Nm(`${hv}/removeAll`);var mv=Object.assign(Nm(`${hv}/remove`),{withTypes:()=>mv});function vv(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const bv=["error","warn","info","debug"],yv=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return bv.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),wv="undefined"!=typeof localStorage,$v=wv&&localStorage.getItem("base.content.url")||"",Ev=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,kv=Cl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Cv=Cl((e=>{var t,n;const o=vl(yv,kv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),xv=e=>t=>{var n,o,r;const i=vl(yv,kv,Cv)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};xv.missingAttrValidator=Ev;const Iv=Cl((e=>{const t=vl(xv({"project-id":Ev}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Ov=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Sv=Cl((e=>{const t=vl(yv,Iv,Ov)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL($v||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),jv=Cl((e=>{var t,n,o;const r=vl(Sv)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),Av=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(kv,yv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return db})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),Rv="load-descope-ui",Nv="base.ui.components.url",Mv=wv&&localStorage.getItem(Nv)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Uv=wv&&localStorage.getItem(Nv)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Tv=e=>{const t=document.createElement("script");return t.id=e,t},Dv=(e,t)=>e.replace("<version>",t),Pv=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(yv,jv)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=Tv("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=Dv(Uv,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Rv}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Tv(Rv);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=Dv(Mv,await p(this,t,"m",r).call(this))}return document.getElementById(Rv)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),Lv="content-root",_v="root",Wv=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${_v}, #${Lv} {\n height: 100%;\n }\n #${_v} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${_v}">\n <div id="${Lv}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Lv),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(_v)}})),Fv="descope-modal",Vv=Cl((e=>{var t,n;const o=vl(kv,Wv,Pv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Fv);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Fv]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),qv="descope-notification",Bv=Cl((e=>{var t,n;const o=vl(kv,Wv,Pv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(qv);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([qv])}},t=new WeakMap,n})),zv=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Kv=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(xv({theme:zv}),Sv,kv,Pv,jv,Wv,Cv)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Nv)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(Nv),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),Hv=e=>Cl((t=>{const n=cv(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(yv)(t)){constructor(...e){super(...e);const t=function(e){const t=Km(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?vv(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!Zm&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?vv(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Zm&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?vv(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Zm&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vv(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=Am({trace:!Zm,..."object"==typeof r&&r}));const c=sc(...d),u=Jm(c);if(!Zm&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?vv(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Zm&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?vv(6):"`enhancers` callback must return an array");if(!Zm&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vv(7):"each enhancer provided to configureStore must be a function");return Zm||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{iv(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Gv=Cl((e=>class extends(yv(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Jv=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Zv,Xv,Yv,Qv,eb,tb,nb,ob,rb,ib;const sb=document.createElement("template");sb.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class ab extends HTMLElement{constructor(){var e;super(),Zv.add(this),Xv.set(this,new Nl({messages:[]})),Yv.set(this,void 0),Qv.set(this,void 0),eb.set(this,void 0),tb.set(this,{resize:p(this,Zv,"m",ib).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sb.content.cloneNode(!0)),f(this,Yv,this.shadowRoot.querySelector(".debugger"),"f"),f(this,Qv,p(this,Yv,"f").querySelector(".content"),"f"),f(this,eb,p(this,Yv,"f").querySelector(".header"),"f")}updateData(e){p(this,Xv,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Jv(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,Yv,"f"),p(this,eb,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,tb,"f").resize),(e=p(this,Yv,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,Yv,"f").onresize=p(this,Zv,"m",rb).bind(this),p(this,Xv,"f").subscribe(p(this,Zv,"m",nb).bind(this))}disconnectedCallback(){p(this,Xv,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,tb,"f").resize)}}Xv=new WeakMap,Yv=new WeakMap,Qv=new WeakMap,eb=new WeakMap,tb=new WeakMap,Zv=new WeakSet,nb=function(e){p(this,Zv,"m",ob).call(this,e),p(this,Zv,"m",rb).call(this)},ob=function(e){p(this,Qv,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},rb=function(){p(this,Qv,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},ib=function(){const[e,t]=Jv(p(this,Yv,"f"),Number.parseInt(p(this,Yv,"f").style.left,10),Number.parseInt(p(this,Yv,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,Yv,"f").style.top=`${t}px`,p(this,Yv,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",ab);var db=Object.freeze({__proto__:null});const lb=e=>e.selectedRolesIds,cb=e=>e.notifications,ub=e=>e.tenantPermissions.data||[],hb=lu((e=>e.rolesList.data),(e=>e.map((e=>{var t;return Object.assign(Object.assign({},e),{editable:0===(null===(t=null==e?void 0:e.tenantId)||void 0===t?void 0:t.length)?"no":"yes"})})))),pb=lu(lb,hb,((e,t)=>t.filter((t=>e.includes(t.name))))),fb=lu(lb,(e=>!!e.length)),gb=lu(lb,(e=>1===e.length)),mb=lu(pb,(e=>1===e.length?e[0].name:`${e.length} roles`)),vb=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},bb=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),yb=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),wb=rv("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),$b=vb(wb)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},bb((e=>e.createRole)),yb({getSuccessMsg:()=>"Role created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Eb={action:wb,reducer:$b},kb=rv("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Cb=vb(kb)({onFulfilled:(e,t)=>{e.rolesList.data=e.rolesList.data.filter((e=>{var n;return 0===(null===(n=null==e?void 0:e.tenantId)||void 0===n?void 0:n.length)||!t.meta.arg.includes(e.name)})),e.selectedRolesIds=[]}},bb((e=>e.deleteRole)),yb({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to delete role${["","s"]}`})),xb={action:kb,reducer:Cb},Ib=rv("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),Ob=vb(Ib)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},bb((e=>e.rolesList))),Sb={action:Ib,reducer:Ob},jb=rv("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),Ab=vb(jb)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},bb((e=>e.updateRole)),yb({getSuccessMsg:()=>"Role updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Rb={action:jb,reducer:Ab},Nb=rv("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),Mb={action:Nb,reducer:vb(Nb)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},bb((e=>e.tenantPermissions)))},Ub={rolesList:{data:[],loading:!1,error:null},createRole:{loading:!1,error:null},updateRole:{loading:!1,error:null},deleteRole:{loading:!1,error:null},tenantPermissions:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedRolesIds:[],notifications:[]},Tb="/v1/mgmt/role/search",Db="/v1/mgmt/role/delete/batch",Pb="/v1/mgmt/role/create",Lb="/v1/mgmt/role/update",_b="/v1/mgmt/permission/all",Wb=e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),Fb=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t},n)=>u(void 0,void 0,void 0,(function*(){return new Promise((o=>{const r=[];for(let e=1;e<10;e+=1)r.push({name:`Role ${e}`,description:`Role description ${e}`,permissionNames:[`Permission ${e}`],createdTime:new Date,tenantId:n});t.forEach((e=>{r.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),o(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s},t);const a=yield e.post(Tb,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Wb(a),(yield a.json()).roles})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Db,{roleNames:o},{queryParams:{tenant:t}});return yield Wb(r),r.json()})),create:({name:o,description:r,permissionNames:i})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,description:t,permissionNames:n},o)=>u(void 0,void 0,void 0,(function*(){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:o})}))})))({name:o,description:r,permissionNames:i},t);const s=yield e.post(Pb,{name:o,description:r,permissionNames:i,tenantId:t},{queryParams:{tenant:t}});return yield Wb(s),yield s.json()})),update:({name:o,newName:r,description:i,permissionNames:s})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,newName:t,description:n,permissionNames:o},r)=>u(void 0,void 0,void 0,(function*(){return new Promise((i=>{i({name:t,description:n,permissionNames:o,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:o,newName:r,description:i,permissionNames:s},t);const a=yield e.post(Lb,{name:o,newName:r,description:i,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Wb(a);const d=yield a.json();return d.oldName=o,d}))}),Vb=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>u(void 0,void 0,void 0,(function*(){if(n)return new Promise((e=>{const t=[];for(let e=1;e<5;e+=1)t.push({name:`Permission ${e}`});e({permissions:t})}));const o=yield e.get(_b,{queryParams:{tenant:t}});return yield Wb(o),o.json()}))}),qb=Cl((e=>{var t,n,o,r;const i=vl(Iv,Cv,yv,Ov,xv({tenant:xv.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.85"}}));return{role:Fb({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Vb({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Bb=Cl((e=>{const t=vl(Hv({name:"widget",initialState:Ub,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Eb.reducer(e),Rb.reducer(e),xb.reducer(e),Sb.reducer(e),Mb.reducer(e)},asyncActions:{searchRoles:Sb.action,createRole:Eb.action,updateRole:Rb.action,deleteRoles:xb.action,getTenantPermissions:Mb.action}}),kv,yv,qb)(e);return class extends t{constructor(...e){super(...e),this.state=Ub,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),zb=Cl((e=>{const t=vl(Sv,xv({"widget-id":xv.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Kb=Cl((e=>{var t,n,o;return o=class extends(vl(yv,kv,Pv,Wv,zb,Bb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Hb=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(Bb,Vv,Gv,yv,Kb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield p(this,n,"f").setData(null===(e=ub(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(bl(yield this.fetchWidgetPage("create-role-modal.html")));new Pl((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele)}));const e=new Pl((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(this,void 0,void 0,(function*(){this.validateForm(this.createRoleModal.ele)&&(this.actions.createRole(Object.assign({},this.getFormData(this.createRoleModal.ele))),this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele))})))),f(this,n,new Wl((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),p(this,r,"f").call(this)}))},i})),Gb=Cl((e=>{var t,n,o;return o=class extends(vl(yv,Hb,Kb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},o})),Jb=Cl((e=>{var t,n,o;return o=class extends(vl(Bb,Vv,yv,Kb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(bl(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Pl((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteRolesModal.close()));const n=new Pl((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=pb(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new ql(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=mb(this.state);o.text=`Delete ${e}?`}}))},o})),Zb=Cl((e=>{var t,n,o,r;return r=class extends(vl(yv,Kb,Bb,Jb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),fb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-roles"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteRolesModal.open()}))},r})),Xb=Cl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(vl(Bb,Vv,yv,Gv,Kb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield p(this,n,"f").setData(null===(e=ub(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=pb(this.state))||void 0===e?void 0:e[0],n={name:null==t?void 0:t.name,description:null==t?void 0:t.description,permissionNames:null==t?void 0:t.permissionNames};this.setFormData(this.editRoleModal.ele,n)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,t=new WeakSet,o=function(){new Pl((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editRoleModal.close()))},r=function(){new Pl((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{var e;if(this.validateForm(this.editRoleModal.ele)){const t=this.getFormData(this.editRoleModal.ele),{name:n}=t,o=c(t,["name"]),r=null===(e=pb(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},o)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return u(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(bl(yield this.fetchWidgetPage("edit-role-modal.html"))),p(this,t,"m",o).call(this),p(this,t,"m",r).call(this),f(this,n,new Wl((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),this.editRoleModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield p(this,i,"f").call(this),p(this,s,"f").call(this)}))}))},d})),Yb=Cl((e=>{var t,n,o,r;return r=class extends(vl(yv,Kb,Bb,Xb,Gv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),gb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-role"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editRoleModal.open()}))},r})),Qb=Cl((e=>{var t,n,o,r;return r=class extends(vl(yv,Kb,Bb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r})),ey={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},ty=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(yv,Bb,Bv,kv)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=p(this,t,"m",o).call(this,e);i.setContent(p(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(p(this,r,"f").bind(this),cb)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=ey[e],o=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),ny=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(Bb,yv,Kb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{this.rolesTable.data=e}))),r.set(this,kl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchRoles({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),p(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{p(this,r,"f").call(this,e.target,e.detail)}))})),p(this,o,"f").call(this,hb(this.state)),this.subscribe(p(this,o,"f").bind(this),hb)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Dl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="roles-table"]'),{logger:this.logger}),this.rolesTable.onSelectedItemsChange((e=>{this.actions.setSelectedRolesIds(e.detail.value.map((({name:e})=>e)))}))},i})),oy=Cl((e=>class extends(vl(Av,Kv,ny,Gb,Zb,Yb,Qb,ty)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),ry=vl((e=>class extends(oy(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",ry);var iy=Object.freeze({__proto__:null,default:ry});((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var sy="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},ay=e=>e&&"function"==typeof e.match;function dy(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Hy(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function ly(e){return"function"==typeof e&&"type"in e&&ay(e)}function cy(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var uy=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function hy(e){return gc(e)?Yc(e,(()=>{})):e}function py(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?Hy(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function fy(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function gy(e,t,n){const o=my(e,t,n);return{detectMutations:()=>vy(e,t,o,n)}}function my(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=my(e,t,n[r],s))}}return i}function vy(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=vy(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function by(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function yy(e,t="",n=by,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=yy(l,a,n,o,r,i),s))return s}return i&&wy(e)&&i.add(e),!1}function wy(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!wy(t))return!1;return!0}function $y(e){return"boolean"==typeof e}var Ey=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new uy;if(t&&($y(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};$y(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=fy,ignoredPaths:r,warnAfter:i=32}=e;const s=gy.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=cy(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Hy(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Hy(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};$y(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=by,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!ac(u))return l(u);const h=l(u),p=cy(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=yy(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=yy(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};$y(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ly}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},ky=e=>t=>{setTimeout(t,e)},Cy="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ky(10),xy=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new uy(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Cy:"callback"===e.type?e.queueNotification:ky(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Iy="production"===process.env.NODE_ENV;function Oy(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Hy(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Hy(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?Hy(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Hy(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Hy(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Hy(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Sy=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function jy(...e){return t=>e.some((e=>((e,t)=>ay(e)?e.match(t):e(t))(e,t)))}var Ay=["name","message","stack","code"],Ry=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ny=class{constructor(e,t){this.payload=e,this.meta=t}_type},My=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Ay)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Uy=(()=>{function e(e,t,n){const o=dy(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=dy(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=dy(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||My)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):Sy(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new Ry(e,t),fulfillWithValue:(e,t)=>new Ny(e,t)})).then((t=>{if(t instanceof Ry)throw t;return t instanceof Ny?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof Ry?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(Ty)})}}),{pending:r,rejected:i,fulfilled:o,settled:jy(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Ty(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Dy=Symbol.for("rtk-slice-createasyncthunk");function Py(e,t){return`${e}/${t}`}function Ly({creators:e}={}){const t=e?.asyncThunk?.[Dy];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Hy(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?Hy(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Hy(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?Hy(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?Oy(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?Hy(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=Oy(t);if(function(e){return"function"==typeof e}(e))n=()=>hy(e());else{const t=hy(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?Hy(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Py(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?Hy(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?dy(e,s):dy(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Hy(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||Fy,pending:a||Fy,rejected:d||Fy,settled:l||Fy})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Hy(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=py(c,n,{insert:()=>new WeakMap});return py(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=_y(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function _y(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Hy(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Wy=Ly();function Fy(){}var Vy="listenerMiddleware",qy=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=dy(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?Hy(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Hy(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},By=Object.assign((e=>{const{type:t,predicate:n,effect:o}=qy(e);return{id:Sy(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Hy(22):"Unsubscribe not initialized")}}}),{withTypes:()=>By}),zy=Object.assign(dy(`${Vy}/add`),{withTypes:()=>zy});dy(`${Vy}/removeAll`);var Ky=Object.assign(dy(`${Vy}/remove`),{withTypes:()=>Ky});function Hy(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Gy=["error","warn","info","debug"],Jy=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return Gy.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),Zy="undefined"!=typeof localStorage,Xy=Zy&&localStorage.getItem("base.content.url")||"",Yy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Qy=Cl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),ew=Cl((e=>{var t,n;const o=vl(Jy,Qy)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),tw=e=>t=>{var n,o,r;const i=vl(Jy,Qy,ew)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};tw.missingAttrValidator=Yy;const nw=Cl((e=>{const t=vl(tw({"project-id":Yy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),ow=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const rw=Cl((e=>{const t=vl(Jy,nw,ow)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Xy||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),iw=Cl((e=>{var t,n,o;const r=vl(rw)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),sw=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(Qy,Jy)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Lw})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),aw="load-descope-ui",dw="base.ui.components.url",lw=Zy&&localStorage.getItem(dw)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",cw=Zy&&localStorage.getItem(dw)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",uw=e=>{const t=document.createElement("script");return t.id=e,t},hw=(e,t)=>e.replace("<version>",t),pw=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(Jy,iw)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=uw("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=hw(cw,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${aw}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=uw(aw);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=hw(lw,await p(this,t,"m",r).call(this))}return document.getElementById(aw)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),fw="content-root",gw="root",mw=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${gw}, #${fw} {\n height: 100%;\n }\n #${gw} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${gw}">\n <div id="${fw}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(fw),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(gw)}})),vw="descope-modal",bw=Cl((e=>{var t,n;const o=vl(Qy,mw,pw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(vw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([vw]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),yw="descope-notification",ww=Cl((e=>{var t,n;const o=vl(Qy,mw,pw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(yw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([yw])}},t=new WeakMap,n})),$w=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Ew=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(tw({theme:$w}),rw,Qy,pw,iw,mw,ew)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(dw)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(dw),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),kw=e=>Cl((t=>{const n=Wy(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(Jy)(t)){constructor(...e){super(...e);const t=function(e){const t=Ey(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?Hy(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!Iy&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Hy(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Iy&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Hy(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Iy&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Hy(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=sy({trace:!Iy,..."object"==typeof r&&r}));const c=sc(...d),u=xy(c);if(!Iy&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Hy(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Iy&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Hy(6):"`enhancers` callback must return an array");if(!Iy&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Hy(7):"each enhancer provided to configureStore must be a function");return Iy||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{Ty(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Cw=Cl((e=>class extends(Jy(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const xw=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Iw,Ow,Sw,jw,Aw,Rw,Nw,Mw,Uw,Tw;const Dw=document.createElement("template");Dw.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Pw extends HTMLElement{constructor(){var e;super(),Iw.add(this),Ow.set(this,new Nl({messages:[]})),Sw.set(this,void 0),jw.set(this,void 0),Aw.set(this,void 0),Rw.set(this,{resize:p(this,Iw,"m",Tw).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Dw.content.cloneNode(!0)),f(this,Sw,this.shadowRoot.querySelector(".debugger"),"f"),f(this,jw,p(this,Sw,"f").querySelector(".content"),"f"),f(this,Aw,p(this,Sw,"f").querySelector(".header"),"f")}updateData(e){p(this,Ow,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=xw(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,Sw,"f"),p(this,Aw,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,Rw,"f").resize),(e=p(this,Sw,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,Sw,"f").onresize=p(this,Iw,"m",Uw).bind(this),p(this,Ow,"f").subscribe(p(this,Iw,"m",Nw).bind(this))}disconnectedCallback(){p(this,Ow,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,Rw,"f").resize)}}Ow=new WeakMap,Sw=new WeakMap,jw=new WeakMap,Aw=new WeakMap,Rw=new WeakMap,Iw=new WeakSet,Nw=function(e){p(this,Iw,"m",Mw).call(this,e),p(this,Iw,"m",Uw).call(this)},Mw=function(e){p(this,jw,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Uw=function(){p(this,jw,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Tw=function(){const[e,t]=xw(p(this,Sw,"f"),Number.parseInt(p(this,Sw,"f").style.left,10),Number.parseInt(p(this,Sw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,Sw,"f").style.top=`${t}px`,p(this,Sw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Pw);var Lw=Object.freeze({__proto__:null});const _w=e=>e.selectedAccessKeysIds,Ww=e=>e.notifications,Fw=lu((e=>e.accessKeysList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{expireTimeFormatted:(null==e?void 0:e.expireTime)?new Date(1e3*((null==e?void 0:e.expireTime)||0)).toLocaleString():"Never",createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:(null==e?void 0:e.expireTime)&&new Date(1e3*((null==e?void 0:e.expireTime)||0))<new Date?"expired":null==e?void 0:e.status}))))),Vw=lu(_w,Fw,((e,t)=>t.filter((t=>e.includes(t.id))))),qw=lu(_w,(e=>!!e.length)),Bw=lu(Vw,(e=>e.every((e=>e.editable)))),zw=lu(Bw,qw,((e,t)=>e&&t));lu(_w,(e=>1===e.length));const Kw=lu(Vw,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Hw=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},Gw=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),Jw=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),Zw=Uy("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),Xw=Hw(Zw)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},Gw((e=>e.createAccessKey)),Jw({getSuccessMsg:()=>"Access Key created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create access key</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Yw={action:Zw,reducer:Xw},Qw=Uy("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),e$=Hw(Qw)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},Gw((e=>e.deleteAccessKey)),Jw({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),t$={action:Qw,reducer:e$},n$=Uy("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),o$=Hw(n$)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},Gw((e=>e.accessKeysList))),r$={action:n$,reducer:o$},i$=Uy("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),s$=Hw(i$)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},Gw((e=>e.activateAccessKey)),Jw({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),a$={action:i$,reducer:s$},d$=Uy("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),l$=Hw(d$)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},Gw((e=>e.deactivateAccessKey)),Jw({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),c$={action:d$,reducer:l$},u$=Uy("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),h$={action:u$,reducer:Hw(u$)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Gw((e=>e.tenantRoles)))},p$={accessKeysList:{data:[],loading:!1,error:null},createAccessKey:{loading:!1,error:null},activateAccessKey:{loading:!1,error:null},deactivateAccessKey:{loading:!1,error:null},deleteAccessKey:{loading:!1,error:null},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedAccessKeysIds:[],notifications:[]},f$="/v1/mgmt/accesskey/search",g$="/v1/mgmt/accesskey/delete/batch",m$="/v1/mgmt/accesskey/create",v$="/v1/mgmt/accesskey/deactivate/batch",b$="/v1/mgmt/accesskey/activate/batch",y$="/v1/mgmt/role/all",w$=e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),$$=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t}={})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.push({id:`access-key-id-${e}`,name:`Access Key ${e}`,createdBy:`User ${e}`,editable:!0,expireTime:(new Date).getTime()/1e3+2592e3,createdTime:(new Date).getTime()/1e3,roleNames:[`Role ${e}`],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s});const a=yield e.post(f$,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield w$(a),(yield a.json()).keys})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(g$,{ids:o},{queryParams:{tenant:t}});return yield w$(r),r.json()})),create:({name:o,expiration:r,roleNames:i,userId:s})=>u(void 0,void 0,void 0,(function*(){const a=new Date;a.setDate(a.getDate()+ +r);const d="0"===r[0]?0:Math.floor(a.getTime()/1e3);if(n)return(({name:e,roleNames:t,userId:n},o)=>u(void 0,void 0,void 0,(function*(){const r=Math.random().toString(10).substring(15);return new Promise((i=>{i({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${r}`,name:e||`Access Key ${r}`,createdBy:n||`User ${r}`,editable:!0,expireTime:o,createdTime:(new Date).getTime()/1e3,roleNames:t,status:"active",clientId:`Client ID ${r}`,boundUserId:n||`User ${r}`}})}))})))({name:o,expiration:r,roleNames:i,userId:s},d);const l=yield e.post(m$,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield w$(l),yield l.json()})),activate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(b$,{ids:o},{queryParams:{tenant:t}});return yield w$(r),yield r.json()})),deactivate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(v$,{ids:o},{queryParams:{tenant:t}});return yield w$(r),yield r.json()}))}),E$=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>new Promise((t=>{const n=[];for(let t=1;t<5;t+=1)n.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:n})})))(t);const o=yield e.get(y$,{queryParams:{tenant:t}});return yield w$(o),o.json()}))}),k$=Cl((e=>{var t,n,o,r;const i=vl(nw,ew,Jy,ow,tw({tenant:tw.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.87"}}));return{accesskey:$$({httpClient:r.httpClient,tenant:t,mock:n}),tenant:E$({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),C$=Cl((e=>{const t=vl(kw({name:"widget",initialState:p$,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Yw.reducer(e),t$.reducer(e),r$.reducer(e),a$.reducer(e),c$.reducer(e),h$.reducer(e)},asyncActions:{searchAccessKeys:r$.action,createAccessKey:Yw.action,activateAccessKeys:a$.action,deactivateAccessKeys:c$.action,deleteAccessKeys:t$.action,getTenantRoles:h$.action}}),Qy,Jy,k$)(e);return class extends t{constructor(...e){super(...e),this.state=p$,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),x$=Cl((e=>{const t=vl(rw,tw({"widget-id":tw.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),I$=Cl((e=>{var t,n,o;return o=class extends(vl(Jy,Qy,pw,mw,x$,C$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),O$=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(C$,Jy,I$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{this.accessKeysTable.data=e}))),r.set(this,kl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchAccessKeys({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),p(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{p(this,r,"f").call(this,e.target,e.detail)}))})),p(this,o,"f").call(this,Fw(this.state)),this.subscribe(p(this,o,"f").bind(this),Fw)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Dl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="access-keys-table"]'),{logger:this.logger}),this.accessKeysTable.onSelectedItemsChange((e=>{this.actions.setSelectedAccessKeysIds(e.detail.value.map((({id:e})=>e)))}))},i})),S$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(bl(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Pl((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.activateAccessKeysModal.close()));const n=new Pl((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Vw(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new ql(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Kw(this.state);o.text=`Activate ${e}?`}}))},o})),j$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$,S$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),zw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="activate-access-keys"]'),{logger:this.logger}),this.activateButton.disable(),this.activateButton.onClick((()=>{this.activateAccessKeysModal.open()}))},r})),A$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Cw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(bl(yield this.fetchWidgetPage("created-access-key-modal.html")));new Pl((()=>{var e;return null===(e=this.createdAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.createdAccessKeyModal.ele)["generated-key"]),this.resetFormData(this.createdAccessKeyModal.ele),this.createdAccessKeyModal.close()}))}))},o})),R$=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(C$,bw,Cw,Jy,I$,A$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e,t;yield p(this,n,"f").setData(null===(t=this.state,e=t.tenantRoles.data||[])||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function e(){return u(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(bl(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Pl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});o.onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)}));const i=new Pl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});i.onClick((()=>u(this,void 0,void 0,(function*(){var e;if(this.validateForm(this.createAccessKeyModal.ele)){const t=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(e=null==t?void 0:t.payload)||void 0===e?void 0:e.cleartext}),this.createdAccessKeyModal.open()}})))),f(this,n,new Wl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),p(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{p(this,t,"m",e).call(this)}}))},i})),N$=Cl((e=>{var t,n,o;return o=class extends(vl(Jy,R$,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-access-key"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createAccessKeyModal.open()))},o})),M$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(bl(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Pl((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deactivateAccessKeysModal.close()));const n=new Pl((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Vw(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new ql(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Kw(this.state);o.text=`Deactivate ${e}?`}}))},o})),U$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$,M$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),zw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="deactivate-access-keys"]'),{logger:this.logger}),this.deactivateButton.disable(),this.deactivateButton.onClick((()=>{this.deactivateAccessKeysModal.open()}))},r})),T$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(bl(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Pl((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteAccessKeysModal.close()));const n=new Pl((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Vw(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new ql(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Kw(this.state);o.text=`Delete ${e}?`}}))},o})),D$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$,T$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),zw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-access-keys"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteAccessKeysModal.open()}))},r})),P$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r})),L$={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},_$=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(Jy,C$,ww,Qy)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=p(this,t,"m",o).call(this,e);i.setContent(p(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(p(this,r,"f").bind(this),Ww)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=L$[e],o=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),W$=Cl((e=>class extends(vl(sw,Ew,O$,N$,D$,P$,j$,U$,_$)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),F$=vl((e=>class extends(W$(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",F$);var V$=Object.freeze({__proto__:null,default:F$});((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var q$="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},B$=e=>e&&"function"==typeof e.match;function z$(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?AE(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function K$(e){return"function"==typeof e&&"type"in e&&B$(e)}function H$(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var G$=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function J$(e){return gc(e)?Yc(e,(()=>{})):e}function Z$(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?AE(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function X$(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Y$(e,t,n){const o=Q$(e,t,n);return{detectMutations:()=>eE(e,t,o,n)}}function Q$(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Q$(e,t,n[r],s))}}return i}function eE(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=eE(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function tE(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function nE(e,t="",n=tE,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=nE(l,a,n,o,r,i),s))return s}return i&&oE(e)&&i.add(e),!1}function oE(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!oE(t))return!1;return!0}function rE(e){return"boolean"==typeof e}var iE=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new G$;if(t&&(rE(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};rE(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=X$,ignoredPaths:r,warnAfter:i=32}=e;const s=Y$.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=H$(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?AE(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?AE(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};rE(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=tE,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!ac(u))return l(u);const h=l(u),p=H$(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=nE(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=nE(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};rE(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=K$}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},sE=e=>t=>{setTimeout(t,e)},aE="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:sE(10),dE=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new G$(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?aE:"callback"===e.type?e.queueNotification:sE(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},lE="production"===process.env.NODE_ENV;function cE(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?AE(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?AE(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?AE(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?AE(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?AE(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?AE(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var uE=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function hE(...e){return t=>e.some((e=>((e,t)=>B$(e)?e.match(t):e(t))(e,t)))}var pE=["name","message","stack","code"],fE=class{constructor(e,t){this.payload=e,this.meta=t}_type},gE=class{constructor(e,t){this.payload=e,this.meta=t}_type},mE=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of pE)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},vE=(()=>{function e(e,t,n){const o=z$(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=z$(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=z$(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||mE)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):uE(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new fE(e,t),fulfillWithValue:(e,t)=>new gE(e,t)})).then((t=>{if(t instanceof fE)throw t;return t instanceof gE?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof fE?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(bE)})}}),{pending:r,rejected:i,fulfilled:o,settled:hE(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function bE(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var yE=Symbol.for("rtk-slice-createasyncthunk");function wE(e,t){return`${e}/${t}`}function $E({creators:e}={}){const t=e?.asyncThunk?.[yE];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?AE(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?AE(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?AE(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?AE(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?cE(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?AE(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=cE(t);if(function(e){return"function"==typeof e}(e))n=()=>J$(e());else{const t=J$(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?AE(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:wE(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?AE(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?z$(e,s):z$(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?AE(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||CE,pending:a||CE,rejected:d||CE,settled:l||CE})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?AE(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Z$(c,n,{insert:()=>new WeakMap});return Z$(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=EE(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function EE(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?AE(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var kE=$E();function CE(){}var xE="listenerMiddleware",IE=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=z$(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?AE(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?AE(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},OE=Object.assign((e=>{const{type:t,predicate:n,effect:o}=IE(e);return{id:uE(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?AE(22):"Unsubscribe not initialized")}}}),{withTypes:()=>OE}),SE=Object.assign(z$(`${xE}/add`),{withTypes:()=>SE});z$(`${xE}/removeAll`);var jE=Object.assign(z$(`${xE}/remove`),{withTypes:()=>jE});function AE(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const RE=["error","warn","info","debug"],NE=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return RE.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),ME="undefined"!=typeof localStorage,UE=ME&&localStorage.getItem("base.content.url")||"",TE=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,DE=Cl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),PE=Cl((e=>{var t,n;const o=vl(NE,DE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),LE=e=>t=>{var n,o,r;const i=vl(NE,DE,PE)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};LE.missingAttrValidator=TE;const _E=Cl((e=>{const t=vl(LE({"project-id":TE}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),WE=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const FE=Cl((e=>{const t=vl(NE,_E,WE)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(UE||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),VE=Cl((e=>{var t,n,o;const r=vl(FE)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),qE=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(DE,NE)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return bk})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),BE="load-descope-ui",zE="base.ui.components.url",KE=ME&&localStorage.getItem(zE)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",HE=ME&&localStorage.getItem(zE)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",GE=e=>{const t=document.createElement("script");return t.id=e,t},JE=(e,t)=>e.replace("<version>",t),ZE=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(NE,VE)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=GE("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=JE(HE,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${BE}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=GE(BE);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=JE(KE,await p(this,t,"m",r).call(this))}return document.getElementById(BE)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),XE="content-root",YE="root",QE=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${YE}, #${XE} {\n height: 100%;\n }\n #${YE} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${YE}">\n <div id="${XE}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(XE),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(YE)}})),ek="descope-modal";Cl((e=>{var t,n;const o=vl(DE,QE,ZE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(ek);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([ek]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const tk="descope-notification";Cl((e=>{var t,n;const o=vl(DE,QE,ZE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(tk);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([tk])}},t=new WeakMap,n}));const nk=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',ok=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(LE({theme:nk}),FE,DE,ZE,VE,QE,PE)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(zE)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(zE),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),rk=e=>Cl((t=>{const n=kE(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(NE)(t)){constructor(...e){super(...e);const t=function(e){const t=iE(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?AE(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!lE&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?AE(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!lE&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?AE(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!lE&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?AE(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=q$({trace:!lE,..."object"==typeof r&&r}));const c=sc(...d),u=dE(c);if(!lE&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?AE(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!lE&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?AE(6):"`enhancers` callback must return an array");if(!lE&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?AE(7):"each enhancer provided to configureStore must be a function");return lE||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{bE(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));Cl((e=>class extends(NE(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}})),Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const ik=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var sk,ak,dk,lk,ck,uk,hk,pk,fk,gk;const mk=document.createElement("template");mk.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class vk extends HTMLElement{constructor(){var e;super(),sk.add(this),ak.set(this,new Nl({messages:[]})),dk.set(this,void 0),lk.set(this,void 0),ck.set(this,void 0),uk.set(this,{resize:p(this,sk,"m",gk).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(mk.content.cloneNode(!0)),f(this,dk,this.shadowRoot.querySelector(".debugger"),"f"),f(this,lk,p(this,dk,"f").querySelector(".content"),"f"),f(this,ck,p(this,dk,"f").querySelector(".header"),"f")}updateData(e){p(this,ak,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=ik(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,dk,"f"),p(this,ck,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,uk,"f").resize),(e=p(this,dk,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,dk,"f").onresize=p(this,sk,"m",fk).bind(this),p(this,ak,"f").subscribe(p(this,sk,"m",hk).bind(this))}disconnectedCallback(){p(this,ak,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,uk,"f").resize)}}ak=new WeakMap,dk=new WeakMap,lk=new WeakMap,ck=new WeakMap,uk=new WeakMap,sk=new WeakSet,hk=function(e){p(this,sk,"m",pk).call(this,e),p(this,sk,"m",fk).call(this)},pk=function(e){p(this,lk,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},fk=function(){p(this,lk,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},gk=function(){const[e,t]=ik(p(this,dk,"f"),Number.parseInt(p(this,dk,"f").style.left,10),Number.parseInt(p(this,dk,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,dk,"f").style.top=`${t}px`,p(this,dk,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",vk);var bk=Object.freeze({__proto__:null});const yk=e=>e.selectedAuditId,wk=lu((e=>e.auditList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{occurredFormatted:(null==e?void 0:e.occurred)?new Date(Number(null==e?void 0:e.occurred)||0).toLocaleString():"N/A"})))));lu(yk,wk,((e,t)=>t.find((t=>e===t.id)))),lu(yk,(e=>!!e));const $k=vE("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),Ek=(e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))})($k)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(kk=e=>e.auditList,{onFulfilled:e=>{kk(e).loading=!1},onPending:e=>{kk(e).loading=!0,kk(e).error=null},onRejected:(e,t)=>{kk(e).loading=!1,kk(e).error=t.error}}));var kk;const Ck={action:$k,reducer:Ek},xk={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Ik="/v1/mgmt/audit/search",Ok=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s,from:a}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<9;e+=1)o.push({id:`Audit ${e}`,action:`Action ${e}`,actorId:`Actor ${e}`,type:"info",method:`Method ${e}`,userId:`User ${e}`,device:`Device ${e}`,geo:`Geo ${e}`,remoteAddress:`127.0.0.${e}`,externalIds:[`Login ID ${e}`],occurred:(new Date).getTime()});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.id.toLowerCase().includes(e.toLowerCase())||t.action.toLowerCase().includes(e.toLowerCase())||t.type.toLowerCase().includes(e.toLowerCase())||t.device.toLowerCase().includes(e.toLowerCase())||t.method.toLowerCase().includes(e.toLowerCase())||t.geo.toLowerCase().includes(e.toLowerCase())||t.remoteAddress.toLowerCase().includes(e.toLowerCase())||t.externalIds.includes(e.toLowerCase())||t.userId.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s});const d=yield e.post(Ik,{limit:r,page:o,text:i,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})))(d),(yield d.json()).audits}))}),Sk=Cl((e=>{var t,n,o,r;const i=vl(_E,PE,NE,WE,LE({tenant:LE.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.50"}}));return{audit:Ok({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),jk=Cl((e=>{const t=vl(rk({name:"widget",initialState:xk,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Ck.reducer(e)},asyncActions:{searchAudit:Ck.action}}),DE,NE,Sk)(e);return class extends t{constructor(...e){super(...e),this.state=xk,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Ak=Cl((e=>{const t=vl(FE,LE({"widget-id":LE.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Rk=Cl((e=>{var t,n,o;return o=class extends(vl(NE,DE,ZE,QE,Ak,jk)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Nk=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(NE,Rk,jk)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{const e=this.rangeInput.value,t=new Date;let n;switch(e){case"minuets15":n=t.setMinutes(t.getMinutes()-15);break;case"hour":n=t.setHours(t.getHours()-1);break;case"hour6":n=t.setHours(t.getHours()-6);break;case"day":default:n=t.setDate(t.getDate()-1);break;case"day3":n=t.setDate(t.getDate()-3);break;case"week":n=t.setDate(t.getDate()-7);break;case"week2":n=t.setDate(t.getDate()-14);break;case"month":n=t.setMonth(t.getMonth()-1)}this.actions.searchAudit({text:this.searchInput.value,from:Math.floor(new Date(n).getTime())})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this),p(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r=function(){var e;this.rangeInput=new Fl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(p(this,n,"f"))},i})),Mk=Cl((e=>{var t,n,o,r;return r=class extends(vl(jk,NE,Rk)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),p(this,o,"f").call(this,wk(this.state)),this.subscribe(p(this,o,"f").bind(this),wk)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Dl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="audit-table"]'),{logger:this.logger}),this.auditTable.onSelectedItemsChange((e=>{this.actions.setSelectedAuditId(e.detail.value.map((({id:e})=>e)))}))},r})),Uk=Cl((e=>class extends(vl(qE,ok,Mk,Nk)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Tk=vl((e=>class extends(Uk(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Tk);var Dk=Object.freeze({__proto__:null,default:Tk});const Pk="undefined"!=typeof localStorage,Lk=Pk&&localStorage.getItem("base.content.url")||"",_k="config.json",Wk="base.ui.components.url",Fk=Pk&&localStorage.getItem(Wk)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Vk=Pk&&localStorage.getItem(Wk)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",qk="descope-login-flow",Bk="code",zk="ra-challenge",Kk="ra-callback",Hk="ra-backup-callback",Gk="ra-initiator",Jk="data-exclude-field",Zk="dls_last_auth",Xk="state_id",Yk="saml_idp_state_id",Qk="saml_idp_username",eC="descope_idp_initiated",tC="sso_app_id",nC="oidc_login_hint",oC="data-type",rC="poll",iC="webauthnCreate",sC="submit",aC="polling",dC=["descope-multi-select-combo-box","descope-text-area"];var lC;function cC(e){return new URLSearchParams(window.location.search).get(e)}function uC(e){if(window.history.replaceState&&cC(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}function hC(e,t){return u(this,void 0,void 0,(function*(){const n=yield fetch(e,{cache:"default"});if(!n.ok)throw Error(`Error fetching URL ${e} [${n.status}]`);return{body:yield n[t||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function pC({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Lk||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function fC(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?lC.forward:n<o?lC.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(lC||(lC={}));const gC=()=>{const[e="",t=""]=(cC(qk)||"").split("_");return{executionId:e,stepId:t}};function mC(){uC(qk)}const vC=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),bC=()=>{const{executionId:e,stepId:t}=gC();(e||t)&&mC();const n=cC("t")||void 0;n&&uC("t");const o=cC(Bk)||void 0;o&&uC(Bk);const r=cC("err")||void 0;r&&uC("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:cC(zk),redirectAuthCallbackUrl:cC(Kk),redirectAuthBackupCallbackUri:cC(Hk),redirectAuthInitiator:cC(Gk)};(i||s||a||d)&&(uC(zk),uC(Kk),uC(Hk),uC(Gk));const l=cC(Xk);l&&uC(Xk);const c=cC(Yk);c&&uC(Yk);const u=cC(Qk);c&&uC(Qk);const h=cC(eC);h&&uC(eC);const p=cC(tC);p&&uC(tC);const f=cC(nC);return f&&uC(nC),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}},yC=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},wC=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,$C=e=>null==e?void 0:e.submit(),EC=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},kC=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function CC(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var xC,IC,OC,SC;function jC(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!jC(i,s))return!1}else if(i!==s)return!1}return!0}class AC{constructor(e={},{updateOnlyOnChange:t=!0}={}){xC.set(this,void 0),IC.set(this,{}),OC.set(this,0),SC.set(this,!1),this.update=e=>{const t="function"==typeof e?e(p(this,xC,"f")):e,n=Object.assign(Object.assign({},p(this,xC,"f")),t);if(!p(this,SC,"f")||!jC(p(this,xC,"f"),n)){const e=p(this,xC,"f");f(this,xC,n,"f"),Object.freeze(p(this,xC,"f")),setTimeout((()=>{Object.values(p(this,IC,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,xC,e,"f"),f(this,SC,t,"f")}get current(){return Object.assign({},p(this,xC,"f"))}subscribe(e){return f(this,OC,p(this,OC,"f")+1,"f"),p(this,IC,"f")[p(this,OC,"f")]=e,p(this,OC,"f").toString()}unsubscribe(e){const t=!!p(this,IC,"f")[e];return t&&delete p(this,IC,"f")[e],t}unsubscribeAll(){return f(this,IC,{},"f"),!0}}xC=new WeakMap,IC=new WeakMap,OC=new WeakMap,SC=new WeakMap;const RC=["disabled"],NC=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Jk}])`)).forEach((e=>{e.value=n}))}))},MC=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),UC=(e,t,n)=>{e.querySelectorAll(`[${oC}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},TC=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},DC=yC((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=Promise.all([null===(e=window.PublicKeyCredential)||void 0===e?void 0:e.isConditionalMediationAvailable(),null===(t=window.PublicKeyCredential)||void 0===t?void 0:t.isUserVerifyingPlatformAuthenticatorAvailable()]).then((e=>e.every((e=>!!e)))),i=(()=>{var e;const t=null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===e?void 0:e.brands,n=null==t?void 0:t.find((({brand:e,version:t})=>"Chromium"===e&&parseFloat(t)));return n?n.version:0})()>=108;return yield(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),PC={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function LC(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Zk)))}catch(e){}return t}const _C="dls_ab_testing_id",WC=document.createElement("template");var FC,VC,qC,BC,zC,KC,HC,GC,JC,ZC,XC,YC,QC,ex,tx,nx,ox,rx,ix,sx,ax,dx,lx,cx,ux,hx,px,fx,gx,mx,vx,bx,yx,wx,$x,Ex,kx,Cx,xx,Ix,Ox,Sx,jx,Ax,Rx,Nx,Mx,Ux,Tx,Dx,Px;WC.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class Lx extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","validate-on-blur"]}constructor(e){super(),FC.add(this),this.logger=console,VC.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),p(this,FC,"m",gx).call(this,e,t)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",n={})=>{this.logger.info(e,t,n)},debug:(e,t="")=>{this.logger.debug(e,t)}},qC.set(this,new AC({deferredRedirect:!1})),BC.set(this,new AC),zC.set(this,{}),this.getComponentsContext=()=>p(this,zC,"f"),this.nextRequestStatus=new AC({isLoading:!1}),KC.set(this,void 0),HC.set(this,{popstate:p(this,FC,"m",QC).bind(this),visibilitychange:p(this,FC,"m",ex).bind(this),componentsContext:p(this,FC,"m",ux).bind(this)}),GC.set(this,void 0),ix.set(this,yC((()=>u(this,void 0,void 0,(function*(){const e=pC({projectId:this.projectId,filename:_k,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield hC(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),ax.set(this,void 0),f(this,GC,e,"f"),p(this,FC,"m",JC).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){return this.getAttribute("tenant")||void 0}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light":n||"light"}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield p(this,ix,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield p(this,ix,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(p(this,BC,"f").subscribe(p(this,FC,"m",fx).bind(this)),p(this,BC,"f").update({isDebug:this.debug}),p(this,FC,"m",ZC).call(this))return void p(this,FC,"m",XC).call(this);if(p(this,FC,"m",YC).call(this),f(this,ax,p(this,FC,"m",sx).call(this),"f"),yield p(this,FC,"m",ox).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");if((yield p(this,ix,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");p(this,FC,"m",dx).call(this),yield p(this,FC,"m",bx).call(this),yield p(this,FC,"m",lx).call(this),p(this,FC,"m",mx).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}=bC();window.addEventListener("popstate",p(this,HC,"f").popstate),window.addEventListener("components-context",p(this,HC,"f").componentsContext),window.addEventListener("visibilitychange",p(this,HC,"f").visibilitychange),p(this,qC,"f").subscribe(p(this,FC,"m",nx).bind(this)),p(this,qC,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}),f(this,VC,!0,"f")}}))}disconnectedCallback(){p(this,qC,"f").unsubscribeAll(),p(this,BC,"f").unsubscribeAll(),p(this,FC,"m",px).call(this),window.removeEventListener("popstate",p(this,HC,"f").popstate),window.removeEventListener("visibilitychange",p(this,HC,"f").visibilitychange),window.removeEventListener("components-context",p(this,HC,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&p(this,VC,"f")&&t!==n&&Lx.observedAttributes.includes(e)){p(this,FC,"m",YC).call(this);const o=null===t;p(this,qC,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,mC()),{[vC(e)]:n,stepId:i,executionId:s}})),p(this,BC,"f").update({isDebug:this.debug})}}}VC=new WeakMap,qC=new WeakMap,BC=new WeakMap,zC=new WeakMap,KC=new WeakMap,HC=new WeakMap,GC=new WeakMap,ix=new WeakMap,ax=new WeakMap,FC=new WeakSet,JC=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(WC.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},ZC=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},XC=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",t.style.height="100%",e.parentElement.appendChild(t),t.appendChild(e)},YC=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client","validate-on-blur"];if(Lx.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[vC(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},QC=function(){const{stepId:e,executionId:t}=gC();p(this,qC,"f").update({stepId:e,executionId:t})},ex=function(){document.hidden||setTimeout((()=>{p(this,qC,"f").update({deferredRedirect:!1})}),300)},tx=function(e,t){this.sdk=so(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},Lx.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},nx=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;p(this,FC,"m",tx).call(this,t,o)}p(this,GC,"f").call(this,e)}))},ox=function(){return u(this,void 0,void 0,(function*(){return(yield p(this,ix,"f").call(this)).isMissingConfig&&(yield p(this,FC,"m",rx).call(this))}))},rx=function(){return u(this,void 0,void 0,(function*(){const e=pC({projectId:this.projectId,filename:_k,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield hC(e,"json"),!0}catch(e){return!1}}))},sx=function(){return u(this,void 0,void 0,(function*(){const e=pC({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield hC(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},dx=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield p(this,ix,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},lx=function(){return u(this,void 0,void 0,(function*(){yield p(this,FC,"m",cx).call(this),yield p(this,FC,"m",hx).call(this)}))},cx=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield p(this,ax,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield Lx.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},ux=function(e){f(this,zC,Object.assign(Object.assign({},p(this,zC,"f")),e.detail),"f")},hx=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Lx.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},px=function(){var e;null===(e=p(this,KC,"f"))||void 0===e||e.remove(),f(this,KC,null,"f")},fx=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(f(this,KC,document.createElement("descope-debugger"),"f"),Object.assign(p(this,KC,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return OS})),document.body.appendChild(p(this,KC,"f"))):p(this,FC,"m",px).call(this)}))},gx=function(e,t){var n;e&&this.debug&&(null===(n=p(this,KC,"f"))||void 0===n||n.updateData({title:e,description:t}))},mx=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=dC.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)return;e.preventDefault();const s=this.rootElement.querySelectorAll("descope-button");if(1===s.length&&"false"!==s[0].getAttribute("auto-submit"))return void s[0].click();const a=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const d=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===d.length)"false"!==d[0].getAttribute("auto-submit")&&d[0].click();else if(0===d.length){const e=Array.from(s).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}},vx=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield p(this,ix,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},bx=function(){return u(this,void 0,void 0,(function*(){Lx.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Lx.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield p(this,FC,"m",vx).call(this),i=t(n(Fk,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Vk,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},Lx.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.16.0"}};class _x extends Lx{static set sdkConfigOverrides(e){Lx.sdkConfigOverrides=e}constructor(){const e=new AC;super(e.update.bind(e)),yx.add(this),this.stepState=new AC({},{updateOnlyOnChange:!1}),wx.set(this,void 0),$x.set(this,null),Ex.set(this,((e,t,n,o,r)=>{n===rC&&f(this,wx,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,aC,o,r,{});p(this,Cx,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};p(this,Ex,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),kx.set(this,(()=>{clearTimeout(p(this,wx,"f")),f(this,wx,null,"f")})),Cx.set(this,(e=>{var t,n,o,r,i,s,a,d,l;if(!(null==e?void 0:e.ok)){p(this,yx,"m",Px).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}const c=null===(d=null===(a=null===(s=e.data)||void 0===s?void 0:s.screen)||void 0===a?void 0:a.state)||void 0===d?void 0:d.errorText;(null===(l=e.data)||void 0===l?void 0:l.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${c?`${c} - `:""}${e.data.error.message}`):c&&this.loggerWrapper.error(c);const{status:u,authInfo:h,lastAuth:f}=e.data;if("completed"===u)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&Pk&&localStorage.setItem(Zk,JSON.stringify(e))}(f),void p(this,yx,"m",Px).call(this,"success",h);const{executionId:g,stepId:m,stepName:v,action:b,screen:y,redirect:w,openInNewTabUrl:$,webauthn:E,error:k,samlIdpResponse:C}=e.data;b!==rC?(this.loggerWrapper.info(`Step "${v||`#${m}`}" is ${u}`,"",{screen:y,status:u,stepId:m,stepName:v,action:b,error:k}),this.flowState.update({stepId:m,executionId:g,action:b,redirectTo:null==w?void 0:w.url,openInNewTabUrl:$,screenId:null==y?void 0:y.id,screenState:null==y?void 0:y.state,webauthnTransactionId:null==E?void 0:E.transactionId,webauthnOptions:null==E?void 0:E.options,samlIdpResponseUrl:null==C?void 0:C.url,samlIdpResponseSamlResponse:null==C?void 0:C.samlResponse,samlIdpResponseRelayState:null==C?void 0:C.relayState})):this.flowState.update({action:b})})),xx.set(this,yC((()=>u(this,void 0,void 0,(function*(){var e;try{const t=yield this.sdk.webauthn.signIn.start("",window.location.origin);return t.ok||this.loggerWrapper.warn("Webauthn start failed",null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.errorMessage),t.data}catch(e){this.loggerWrapper.warn("Webauthn start failed",e.message)}}))))),Mx.set(this,kC(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||p(this,yx,"m",jx).call(this)){const o=null==e?void 0:e.getAttribute("id");p(this,yx,"m",Rx).call(this,e);const r=yield p(this,yx,"m",Ax).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(o,d.version,l.componentsVersion,a);p(this,Cx,"f").call(this,c),p(this,yx,"m",Nx).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=p(this,$x,"f"))||void 0===e||e.abort(),f(this,$x,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=CC(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield hC(t,"text");return e}catch(n){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,n)}try{const{body:t}=yield hC(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:l,action:c,screenId:u,screenState:h,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:b,code:y,exchangeError:w,webauthnTransactionId:$,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:I,oidcIdpStateId:O,locale:S,samlIdpStateId:j,samlIdpUsername:A,descopeIdpInitiated:R,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,L;const _=(()=>{const e=localStorage.getItem(_C);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(_C,e.toString()),e}return Number(e)})(),W=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(F.fingerprintEnabled&&F.fingerprintKey?yield Ln(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Dn),F.conditions?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=PC[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:W,code:y,token:b,abTestingKey:_},F.conditions)):F.condition?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{var n;const o=null===(n=PC[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:W,code:y,token:b,abTestingKey:_})):P=F.startScreenId,!wC(P,O,j,A,T,D))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,client:this.client},v&&{redirectUrl:v}),{lastAuth:LC(W),abTestingKey:_,locale:CC(S)}),L,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),R&&{idpInitiated:!0}),b?{token:b}:{}),D?{externalId:D}:{}));return p(this,Cx,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&b||n("code")&&y||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(l,d,sC,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return p(this,Cx,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===c&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!N||!M)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.innerHTML=`\n <input type="hidden" role="saml-response" name="SAMLResponse" value="${t}" />\n <input type="hidden" role="saml-relay-state" name="RelayState" value="${n}" />\n <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />\n `,document.body.appendChild(r),o(r)})(N,M,U||"",$C)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===I&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===iC||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=p(this,$x,"f"))||void 0===r||r.abort(),f(this,$x,null,"f");try{e=c===iC?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(l,d,sC,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});p(this,Cx,"f").call(this,n)}if(p(this,Ex,"f").call(this,l,d,c,F.version,V.componentsVersion),!u&&!P)return void this.loggerWrapper.warn("No screen was found to show");const B=P||u,z=yield this.getHtmlFilenameWithLocale(S,B),K={direction:fC(d,t.stepId),screenState:Object.assign(Object.assign({},h),{form:Object.assign(Object.assign({},this.formConfigValues),null==h?void 0:h.form),lastAuth:{loginId:W,name:this.sdk.getLastUserDisplayName()||W}}),htmlUrl:pC({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&pC({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:A,oidcLoginHint:D,openInNewTabUrl:m},H=LC(W);wC(P,O,j,A,T,D)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,lastAuth:H,preview:this.preview,abTestingKey:_,client:this.client},v&&{redirectUrl:v}),{locale:CC(S)}),L,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),y&&{exchangeCode:y,idpInitiated:!0}),R&&{idpInitiated:!0}),b&&{token:b})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield Lx.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const h=c.content.cloneNode(!0),f=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield p(this,yx,"m",Sx).call(this,h,a):h.querySelectorAll(`descope-button[${oC}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${oC}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),UC(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),UC(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=MC(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",MC(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=MC(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{RC.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(h,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,TC(r,"descope-totp-image",i),((e,t)=>{TC(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(h),setTimeout((()=>{((e,t)=>{NC(e,null==t?void 0:t.inputs),NC(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-password"),t=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t].forEach((e=>p(this,yx,"m",Ox).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),p(this,yx,"m",Tx).call(this,a),s&&p(this,yx,"m",Px).call(this,"ready",{}),p(this,yx,"m",Px).call(this,"page-updated",{}),this.rootElement.querySelector(`[${oC}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(aC,e.version,t.componentsVersion,{});p(this,Cx,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?p(this,yx,"m",Dx).call(this,m,s):m()}))}}wx=new WeakMap,$x=new WeakMap,Ex=new WeakMap,kx=new WeakMap,Cx=new WeakMap,xx=new WeakMap,Mx=new WeakMap,yx=new WeakSet,Ix=function(e){const t=e.getAttribute("name");if(!["email"].includes(t)){const n=`user-${t}`;e.setAttribute("name",n),e.addEventListener("input",(()=>{e.setAttribute("name",e.value?t:n)}))}},Ox=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},Sx=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=p(this,$x,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield DC())){const{options:e,transactionId:n}=(yield p(this,xx,"f").call(this))||{};if(e&&n){p(this,yx,"m",Ix).call(this,o),f(this,$x,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,p(this,$x,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});p(this,Cx,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},jx=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).every((e=>{var t,n;return"slot"===e.localName||(null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e))}))},Ax=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Jk}])`));return(yield Promise.all(e.map((e=>u(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},Rx=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Nx=function(e={}){var t,n;const o=EC(e,["externalId","email","phone"]),r=EC(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,password:r});null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.store)||void 0===n||n.call(t,e)}catch(e){this.loggerWrapper.error("Could not store credentials",e.message)}},Ux=function(e){this.rootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.addEventListener("input",(()=>{var n;(null===(n=t.checkValidity)||void 0===n?void 0:n.call(t))&&p(this,Mx,"f").call(this,t,e)}))}))},Tx=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{p(this,Mx,"f").call(this,t,e)}})),p(this,yx,"m",Ux).call(this,e)},Dx=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===lC.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},Px=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",_x);((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var Wx="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},Fx=e=>e&&"function"==typeof e.match;function Vx(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?OI(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function qx(e){return"function"==typeof e&&"type"in e&&Fx(e)}function Bx(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var zx=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Kx(e){return gc(e)?Yc(e,(()=>{})):e}function Hx(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?OI(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Gx(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Jx(e,t,n){const o=Zx(e,t,n);return{detectMutations:()=>Xx(e,t,o,n)}}function Zx(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Zx(e,t,n[r],s))}}return i}function Xx(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Xx(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Yx(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function Qx(e,t="",n=Yx,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Qx(l,a,n,o,r,i),s))return s}return i&&eI(e)&&i.add(e),!1}function eI(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!eI(t))return!1;return!0}function tI(e){return"boolean"==typeof e}var nI=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new zx;if(t&&(tI(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};tI(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Gx,ignoredPaths:r,warnAfter:i=32}=e;const s=Jx.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Bx(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?OI(19):`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?OI(20):`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(o){let e={};tI(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Yx,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!ac(u))return l(u);const h=l(u),p=Bx(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Qx(u,"",t,n,r,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const o=Qx(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};tI(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=qx}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}}return i},oI=e=>t=>{setTimeout(t,e)},rI="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:oI(10),iI=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new zx(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?rI:"callback"===e.type?e.queueNotification:oI(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},sI="production"===process.env.NODE_ENV;function aI(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?OI(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?OI(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?OI(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?OI(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?OI(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?OI(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var dI=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function lI(...e){return t=>e.some((e=>((e,t)=>Fx(e)?e.match(t):e(t))(e,t)))}var cI=["name","message","stack","code"],uI=class{constructor(e,t){this.payload=e,this.meta=t}_type},hI=class{constructor(e,t){this.payload=e,this.meta=t}_type},pI=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of cI)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},fI=(()=>{function e(e,t,n){const o=Vx(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Vx(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Vx(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||pI)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):dI(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new uI(e,t),fulfillWithValue:(e,t)=>new hI(e,t)})).then((t=>{if(t instanceof uI)throw t;return t instanceof hI?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof uI?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(gI)})}}),{pending:r,rejected:i,fulfilled:o,settled:lI(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function gI(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var mI=Symbol.for("rtk-slice-createasyncthunk");function vI(e,t){return`${e}/${t}`}function bI({creators:e}={}){const t=e?.asyncThunk?.[mI];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?OI(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?OI(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?OI(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?OI(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],o]="function"==typeof e.extraReducers?aI(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?OI(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[o,r,i]=aI(t);if(function(e){return"function"==typeof e}(e))n=()=>Kx(e());else{const t=Kx(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?OI(9):"A case reducer on a non-draftable value must not return undefined")}return o}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:vI(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?OI(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Vx(e,s):Vx(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?OI(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||$I,pending:a||$I,rejected:d||$I,settled:l||$I})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?OI(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Hx(c,n,{insert:()=>new WeakMap});return Hx(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=yI(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function yI(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?OI(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var wI=bI();function $I(){}var EI="listenerMiddleware",kI=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Vx(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?OI(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?OI(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},CI=Object.assign((e=>{const{type:t,predicate:n,effect:o}=kI(e);return{id:dI(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?OI(22):"Unsubscribe not initialized")}}}),{withTypes:()=>CI}),xI=Object.assign(Vx(`${EI}/add`),{withTypes:()=>xI});Vx(`${EI}/removeAll`);var II=Object.assign(Vx(`${EI}/remove`),{withTypes:()=>II});function OI(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const SI=["error","warn","info","debug"],jI=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return SI.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),AI="undefined"!=typeof localStorage,RI=AI&&localStorage.getItem("base.content.url")||"",NI=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,MI=Cl((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),UI=Cl((e=>{var t,n;const o=vl(jI,MI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),TI=e=>t=>{var n,o,r;const i=vl(jI,MI,UI)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};TI.missingAttrValidator=NI;const DI=Cl((e=>{const t=vl(TI({"project-id":NI}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),PI=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const LI=Cl((e=>{const t=vl(jI,DI,PI)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(RI||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),_I=Cl((e=>{var t,n,o;const r=vl(LI)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),WI=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(MI,jI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return vO})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),FI="load-descope-ui",VI="base.ui.components.url",qI=AI&&localStorage.getItem(VI)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",BI=AI&&localStorage.getItem(VI)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",zI=e=>{const t=document.createElement("script");return t.id=e,t},KI=(e,t)=>e.replace("<version>",t),HI=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(jI,_I)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=zI("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=KI(BI,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${FI}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=zI(FI);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=KI(qI,await p(this,t,"m",r).call(this))}return document.getElementById(FI)},c=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),GI="content-root",JI="root",ZI=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${JI}, #${GI} {\n height: 100%;\n }\n #${JI} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${JI}">\n <div id="${GI}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(GI),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(JI)}})),XI="descope-modal",YI=Cl((e=>{var t,n;const o=vl(MI,ZI,HI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(XI);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([XI]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),QI="descope-notification";Cl((e=>{var t,n;const o=vl(MI,ZI,HI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(QI);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([QI])}},t=new WeakMap,n}));const eO=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',tO=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(TI({theme:eO}),LI,MI,HI,_I,ZI,UI)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(VI)))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(VI),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))}))},d=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},l})),nO=e=>Cl((t=>{const n=wI(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(jI)(t)){constructor(...e){super(...e);const t=function(e){const t=nI(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?OI(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!sI&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?OI(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!sI&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?OI(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!sI&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?OI(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=Wx({trace:!sI,..."object"==typeof r&&r}));const c=sc(...d),u=iI(c);if(!sI&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?OI(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!sI&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?OI(6):"`enhancers` callback must return an array");if(!sI&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?OI(7):"each enhancer provided to configureStore must be a function");return sI||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{gI(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));Cl((e=>class extends(jI(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));const oO=Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}})),rO=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var iO,sO,aO,dO,lO,cO,uO,hO,pO,fO;const gO=document.createElement("template");gO.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class mO extends HTMLElement{constructor(){var e;super(),iO.add(this),sO.set(this,new Nl({messages:[]})),aO.set(this,void 0),dO.set(this,void 0),lO.set(this,void 0),cO.set(this,{resize:p(this,iO,"m",fO).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(gO.content.cloneNode(!0)),f(this,aO,this.shadowRoot.querySelector(".debugger"),"f"),f(this,dO,p(this,aO,"f").querySelector(".content"),"f"),f(this,lO,p(this,aO,"f").querySelector(".header"),"f")}updateData(e){p(this,sO,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=rO(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,aO,"f"),p(this,lO,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,cO,"f").resize),(e=p(this,aO,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,aO,"f").onresize=p(this,iO,"m",pO).bind(this),p(this,sO,"f").subscribe(p(this,iO,"m",uO).bind(this))}disconnectedCallback(){p(this,sO,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,cO,"f").resize)}}sO=new WeakMap,aO=new WeakMap,dO=new WeakMap,lO=new WeakMap,cO=new WeakMap,iO=new WeakSet,uO=function(e){p(this,iO,"m",hO).call(this,e),p(this,iO,"m",pO).call(this)},hO=function(e){p(this,dO,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},pO=function(){p(this,dO,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},fO=function(){const[e,t]=rO(p(this,aO,"f"),Number.parseInt(p(this,aO,"f").style.left,10),Number.parseInt(p(this,aO,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,aO,"f").style.top=`${t}px`,p(this,aO,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",mO);var vO=Object.freeze({__proto__:null});const bO=e=>e.me.data,yO=lu(bO,(e=>e.picture)),wO=lu(bO,(e=>e.email)),$O=lu(bO,(e=>e.verifiedEmail)),EO=lu(bO,(e=>e.name)),kO=lu(bO,(e=>e.phone)),CO=lu(bO,(e=>e.verifiedPhone)),xO=lu(bO,(e=>e.webauthn));lu(bO,(e=>e.password));const IO=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},OO=fI("users/me",((e,{extra:{api:t}})=>t.user.me())),SO=IO(OO)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(jO=e=>e.me,{onFulfilled:e=>{jO(e).loading=!1},onPending:e=>{jO(e).loading=!0,jO(e).error=null},onRejected:(e,t)=>{jO(e).loading=!1,jO(e).error=t.error}}));var jO;const AO={action:OO,reducer:SO},RO=fI("users/logout",((e,{extra:{api:t}})=>t.user.logout())),NO={action:RO,reducer:IO(RO)({})},MO={me:{loading:!1,error:null,data:{}}},UO="/v1/auth/me",TO=({httpClient:e,mock:t})=>({me:()=>u(void 0,void 0,void 0,(function*(){if(t)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))}));const n=yield e.get(UO);return yield(e=>u(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})))(n),n.json()}))}),DO=Cl((e=>{var t,n,o,r;const i=vl(DI,UI,jI,PI)(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n)=>{const o=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.0.59"}}));return{user:Object.assign(Object.assign({},TO({httpClient:o.httpClient,mock:t})),{logout:t?()=>u(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},r})),PO=Cl((e=>{const t=vl(nO({name:"widget",initialState:MO,reducers:{},extraReducers:e=>{AO.reducer(e),NO.reducer(e)},asyncActions:{getMe:AO.action,logout:NO.action}}),MI,jI,DO)(e);return class extends t{constructor(...e){super(...e),this.state=MO,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),LO=Cl((e=>{const t=vl(LI,TI({"widget-id":TI.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),_O=Cl((e=>{var t,n,o;return o=class extends(vl(jI,MI,HI,ZI,LO,PO)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([this.actions.getMe(),p(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),WO=(e={})=>{const t=bl("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),n)})),t};function FO(e){return new URLSearchParams(window.location.search).get(e)}const VO=Cl((e=>{var t,n,o,r,i,s,a,d,l;return l=class extends(vl(PO,jI,_O,YI,oO)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,$l((e=>{this.avatar.image=e}))),d.set(this,$l((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",s).call(this),p(this,t,"m",r).call(this),p(this,a,"f").call(this,yO(this.state)),p(this,d,"f").call(this,EO(this.state)),this.subscribe(p(this,a,"f").bind(this),yO),this.subscribe(p(this,d,"f").bind(this),EO)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){f(this,n,this.createModal({"data-id":"update-pic"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",i).bind(this),p(this,t,"m",i).call(this)},i=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new zl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{p(this,n,"f").open()}))},l})),qO=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,h,g,m;return m=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),h.set(this,$l((e=>{this.emailUserAttr.value=e}))),g.set(this,$l((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",c).call(this),p(this,t,"m",s).call(this),p(this,t,"m",d).call(this),p(this,h,"f").call(this,wO(this.state)),p(this,g,"f").call(this,$O(this.state)),this.subscribe(p(this,h,"f").bind(this),wO),this.subscribe(p(this,g,"f").bind(this),$O)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,h=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-email"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",a).bind(this),p(this,t,"m",a).call(this)},a=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},d=function(){f(this,r,this.createModal({"data-id":"delete-email"}),"f"),f(this,i,new Gl((()=>{var e;return null===(e=p(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,r,"f").afterClose=p(this,t,"m",l).bind(this),p(this,t,"m",l).call(this)},l=function(){p(this,r,"f").setContent(WO({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,i,"f").onSuccess((()=>{p(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.emailUserAttr=new Kl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{p(this,n,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{p(this,r,"f").open()}))},m})),BO=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,h,g;return g=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),h.set(this,$l((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",c).call(this),p(this,t,"m",s).call(this),p(this,t,"m",d).call(this),p(this,h,"f").call(this,EO(this.state)),this.subscribe(p(this,h,"f").bind(this),EO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,h=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-name"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",a).bind(this),p(this,t,"m",a).call(this)},a=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},d=function(){f(this,r,this.createModal({"data-id":"delete-name"}),"f"),f(this,i,new Gl((()=>{var e;return null===(e=p(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,r,"f").afterClose=p(this,t,"m",l).bind(this),p(this,t,"m",l).call(this)},l=function(){p(this,r,"f").setContent(WO({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,i,"f").onSuccess((()=>{p(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.nameUserAttr=new Kl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{p(this,n,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{p(this,r,"f").open()}))},g})),zO=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,h,g,m;return m=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),h.set(this,$l((e=>{this.phoneUserAttr.value=e}))),g.set(this,$l((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",c).call(this),p(this,t,"m",s).call(this),p(this,t,"m",d).call(this),p(this,h,"f").call(this,kO(this.state)),p(this,g,"f").call(this,CO(this.state)),this.subscribe(p(this,h,"f").bind(this),kO),this.subscribe(p(this,g,"f").bind(this),CO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,h=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-phone"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",a).bind(this),p(this,t,"m",a).call(this)},a=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},d=function(){f(this,r,this.createModal({"data-id":"delete-phone"}),"f"),f(this,i,new Gl((()=>{var e;return null===(e=p(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,r,"f").afterClose=p(this,t,"m",l).bind(this),p(this,t,"m",l).call(this)},l=function(){p(this,r,"f").setContent(WO({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,i,"f").onSuccess((()=>{p(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.phoneUserAttr=new Kl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{p(this,n,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{p(this,r,"f").open()}))},m})),KO=Cl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,$l((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",s).call(this),p(this,t,"m",r).call(this),p(this,a,"f").call(this,xO(this.state)),this.subscribe(p(this,a,"f").bind(this),xO)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){f(this,n,this.createModal({"data-id":"passkey"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",i).bind(this),p(this,t,"m",i).call(this)},i=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new Hl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{p(this,n,"f").open()}))},d})),HO=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",s).call(this),p(this,t,"m",r).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,r=function(){f(this,n,this.createModal({"data-id":"password"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",i).bind(this),p(this,t,"m",i).call(this)},i=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new Hl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{p(this,n,"f").open()}))},a})),GO=Cl((e=>{var t,n,o;return o=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Pl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>u(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),JO="widget-flow",ZO=Cl((e=>{var t,n,o;return o=class extends(vl(MI,YI,PO,jI)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this);const r=FO(JO);r&&(function(e){if(window.history.replaceState&&FO(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}(JO),p(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(WO({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));const n=new Gl((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger});n.onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},o})),XO=Cl((e=>class extends(vl(WI,tO,ZO,qO,VO,BO,zO,KO,HO,GO)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),YO=vl((e=>class extends(XO(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),_x.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.59"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",YO);var QO=Object.freeze({__proto__:null,default:YO});const eS=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var tS,nS,oS,rS,iS,sS,aS,dS,lS,cS;const uS=document.createElement("template");uS.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class hS extends HTMLElement{constructor(){super(),tS.add(this),nS.set(this,new sd({messages:[]})),oS.set(this,void 0),rS.set(this,void 0),iS.set(this,void 0),sS.set(this,{resize:p(this,tS,"m",cS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(uS.content.cloneNode(!0)),f(this,oS,this.shadowRoot.querySelector(".debugger"),"f"),f(this,rS,p(this,oS,"f").querySelector(".content"),"f"),f(this,iS,p(this,oS,"f").querySelector(".header"),"f")}updateData(e){p(this,nS,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=eS(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,oS,"f"),p(this,iS,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,sS,"f").resize),(e=p(this,oS,"f")).onmousemove=t=>{(t.target.w&&t.target.w!==t.target.offsetWidth||t.target.h&&t.target.h!==t.target.offsetHeight)&&e.onresize(t),t.target.w=t.target.offsetWidth,t.target.h=t.target.offsetHeight},p(this,oS,"f").onresize=p(this,tS,"m",lS).bind(this),p(this,nS,"f").subscribe(p(this,tS,"m",aS).bind(this))}disconnectedCallback(){p(this,nS,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,sS,"f").resize)}}nS=new WeakMap,oS=new WeakMap,rS=new WeakMap,iS=new WeakMap,sS=new WeakMap,tS=new WeakSet,aS=function(e){p(this,tS,"m",dS).call(this,e),p(this,tS,"m",lS).call(this)},dS=function(e){p(this,rS,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},lS=function(){p(this,rS,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},cS=function(){const[e,t]=eS(p(this,oS,"f"),Number.parseInt(p(this,oS,"f").style.left,10),Number.parseInt(p(this,oS,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,oS,"f").style.top=`${t}px`,p(this,oS,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",hS);var pS=Object.freeze({__proto__:null,default:hS});const fS=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var gS,mS,vS,bS,yS,wS,$S,ES,kS,CS;const xS=document.createElement("template");xS.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class IS extends HTMLElement{constructor(){super(),gS.add(this),mS.set(this,new AC({messages:[]})),vS.set(this,void 0),bS.set(this,void 0),yS.set(this,void 0),wS.set(this,{resize:p(this,gS,"m",CS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(xS.content.cloneNode(!0)),f(this,vS,this.shadowRoot.querySelector(".debugger"),"f"),f(this,bS,p(this,vS,"f").querySelector(".content"),"f"),f(this,yS,p(this,vS,"f").querySelector(".header"),"f")}updateData(e){p(this,mS,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=fS(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,vS,"f"),p(this,yS,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,wS,"f").resize),(e=p(this,vS,"f")).onmousemove=t=>{(t.target.w&&t.target.w!==t.target.offsetWidth||t.target.h&&t.target.h!==t.target.offsetHeight)&&e.onresize(t),t.target.w=t.target.offsetWidth,t.target.h=t.target.offsetHeight},p(this,vS,"f").onresize=p(this,gS,"m",kS).bind(this),p(this,mS,"f").subscribe(p(this,gS,"m",$S).bind(this))}disconnectedCallback(){p(this,mS,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,wS,"f").resize)}}mS=new WeakMap,vS=new WeakMap,bS=new WeakMap,yS=new WeakMap,wS=new WeakMap,gS=new WeakSet,$S=function(e){p(this,gS,"m",ES).call(this,e),p(this,gS,"m",kS).call(this)},ES=function(e){p(this,bS,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},kS=function(){p(this,bS,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},CS=function(){const[e,t]=fS(p(this,vS,"f"),Number.parseInt(p(this,vS,"f").style.left,10),Number.parseInt(p(this,vS,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,vS,"f").style.top=`${t}px`,p(this,vS,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",IS);var OS=Object.freeze({__proto__:null,default:IS});e.AccessKeyManagement=Eo,e.AuditManagement=Co,e.AuthProvider=({projectId:e,baseUrl:n="",baseStaticUrl:s="",sessionTokenViaCookie:d=!1,persistTokens:l=!0,storeLastAuthenticatedUser:c=!0,keepLastAuthenticatedUserAfterLogout:u=!1,children:h})=>{const[p,f]=t.useState(),[g,m]=t.useState(),[v,b]=t.useState(!1),[y,w]=t.useState(!1),$=(({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,storeLastAuthenticatedUser:i,keepLastAuthenticatedUserAfterLogout:s})=>t.useMemo((()=>{if(e)return lo({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:a,persistTokens:o,storeLastAuthenticatedUser:i,keepLastAuthenticatedUserAfterLogout:s,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:l,sessionTokenViaCookie:d,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u});t.useEffect((()=>{if($){const e=$.onSessionTokenChange(m),t=$.onUserChange(f);return()=>{e(),t()}}}),[$]);const E=t.useRef(!1),k=t.useCallback((()=>{E.current||(E.current=!0,w(!0),i(null==$?void 0:$.refresh)().then((()=>{w(!1)})))}),[$]),C=t.useCallback((()=>{b(!0),i($.me)().then((()=>{b(!1)}))}),[$]),x=t.useMemo((()=>({fetchUser:C,user:p,isUserLoading:v,fetchSession:k,session:g,isSessionLoading:y,isSessionFetched:E.current,projectId:e,baseUrl:n,baseStaticUrl:s,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,setUser:f,setSession:m,sdk:$})),[C,p,v,k,g,y,E.current,e,n,s,f,m,$]);return o.default.createElement(r.Provider,{value:x},h)},e.Descope=mo,e.RoleManagement=wo,e.SignInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=bo,e.UserProfile=Io,e.baseHeaders=a,e.getJwtPermissions=po,e.getJwtRoles=fo,e.getRefreshToken=ho,e.getSessionToken=uo,e.isRefreshTokenExpired=(e=ho())=>null==ao?void 0:ao.isJwtExpired(e),e.isSessionTokenExpired=(e=uo())=>null==ao?void 0:ao.isJwtExpired(e),e.refresh=(e=ho())=>null==ao?void 0:ao.refresh(e),e.useDescope=()=>{const{sdk:e}=Oo();return t.useMemo((()=>e||new Proxy(co(),jo)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:o,isSessionFetched:r}=Oo(),i=t.useRef(n);t.useMemo((()=>{i.current=n}),[n]);const s=!e&&!n;return t.useMemo((()=>{s&&!r&&(i.current=!0)}),[r]),t.useEffect((()=>{s&&o()}),[o]),{isSessionLoading:i.current,sessionToken:e,isAuthenticated:!!e}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:o,session:r}=Oo(),[i,s]=t.useState(!1),a=t.useRef(o),d=t.useMemo((()=>!e&&!o&&r&&!i),[n,r,i]);return t.useMemo((()=>{a.current=o}),[o]),t.useMemo((()=>{d&&(a.current=!0)}),[d]),t.useEffect((()=>{d&&(s(!0),n())}),[d]),{isUserLoading:a.current,user:e}},Object.defineProperty(e,"__esModule",{value:!0})}));
3
3
  //# sourceMappingURL=index.umd.js.map