@descope/react-sdk 2.0.43 → 2.0.45
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/README.md +58 -58
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +3 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +126 -124
package/dist/index.umd.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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.43"},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",A="/v1/auth/enchantedlink/signin",R="/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",L="v1/auth/oauth/native/finish",_="/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={"Content-Type":"application/json"},we=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},$e=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},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=>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=(e=>void 0===e?void 0:JSON.stringify(e))(c),m={headers:be(we(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.21.0"},(null==n?void 0:n.baseHeaders)||{},$e(g)?ye:{},u),method:p,body:g};null!==i&&(m.credentials=i||"include");const v=await a(ve({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: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 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 v(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(b,{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||fe,fe)});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(j,{token:t})))),signIn:it(((t,n,o,r)=>Re(e.post(Ae(A,tt.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:it(((t,n,o)=>Re(e.post(Ae(U,tt.email),{loginId:t,URI:n,loginOptions:o})))),signUp:it(((t,n,o,r)=>Re(e.post(Ae(R,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(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:at(((t,n,o,r,i)=>Re(e.post(M.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(ce,{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(ue,{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(C,{token:t})))),signIn:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i)=>Re(e.post(Ae(x,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(I,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(S,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:mt(((t,n,o,r,i)=>Re(e.post(O.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(O.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(T,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(T,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:wt((t=>Re(e.post(D,{code:t})))),startNative:(t,n,o)=>Re(e.post(P,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>Re(e.post(L,{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(y,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(w,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($,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(k,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:It(((t,n,o,r)=>Re(e.post(E.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(E.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(_,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:jt((t=>Re(e.post(W,{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(V,{loginId:t,user:n})))),verify:Nt(((t,n,o,r)=>Re(e.post(F,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Ut(((t,n)=>Re(e.post(q,{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(Y,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Lt(((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:Wt(((t,n,o)=>Re(e.post(te,{loginId:t,newPassword:n},{token:o})))),replace:Ft(((t,n,o)=>Re(e.post(ne,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Re(e.get(oe))}),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(G.start,{user:{loginId:t,name:o},origin:n})))),finish:Zt(((t,n)=>Re(e.post(G.finish,{transactionId:t,response:n}))))},signIn:{start:Gt(((t,n,o,r)=>Re(e.post(J.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Zt(((t,n)=>Re(e.post(J.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Ht(((t,n)=>Re(e.post(Z.start,{loginId:t,origin:n}))))},update:{start:Jt(((t,n,o)=>Re(e.post(X.start,{loginId:t,origin:n},{token:o})))),finish:Zt(((t,n)=>Re(e.post(X.finish,{transactionId:t,response:n}))))}}),Yt=ze("loginId"),Qt=Be(Yt),en=Be(Ke("pendingRef")),tn=e=>({signUpOrIn:Qt(((t,n)=>Re(e.post(K,{loginId:t,loginOptions:n})))),signUp:Qt(((t,n,o)=>Re(e.post(z,{loginId:t,user:n,loginOptions:o})))),signIn:Qt(((t,n,o)=>Re(e.post(B,{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(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)}))))}),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||pe,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(re,{},{token:e})))),selectTenant:Be([We("tenantId")],[Ve('"token" must be string or undefined')])(((e,t)=>Re(a.post(ie,{tenant:e},{token:t})))),logout:on((e=>Re(a.post(se,{},{token:e})))),logoutAll:on((e=>Re(a.post(ae,{},{token:e})))),me:on((e=>Re(a.get(de,{token:e})))),history:on((e=>Re(a.get(le,{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)||[]);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}}))})),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";function mn(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===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]}))}var vn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",bn=vn;function yn(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:vn,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 mn(e,wn)})).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 wn(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($n)}function $n(){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 En=(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},kn=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||{}},Cn=async e=>{const t=await kn(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},xn="undefined"!=typeof localStorage,In=(e,t)=>xn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),On=e=>xn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Sn=e=>xn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),jn=(...e)=>{console.debug(...e)},An="undefined"!=typeof window,Rn=Math.pow(2,31)-1,Nn="DS",Mn="DSR";function Un(e=""){return On(`${e}${Mn}`)||""}function Tn(e=""){Sn(`${e}${Mn}`),Sn(`${e}${Nn}`),cn.remove(Nn)}const Dn=An&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Pn="fp",Ln=(e=!1)=>{const t=localStorage.getItem(Pn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},_n=async(e,t=Dn)=>{try{if(Ln())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=yn({apiKey:e,endpoint:[o.toString(),un],scriptUrlPattern:[i,bn]}),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(Pn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Wn=e=>{const t=Ln(!0);return t&&e.body&&(e.body.fpData=t),e},Fn="dls_last_user_login_id",Vn="dls_last_user_display_name",qn=()=>On(Fn),Bn=()=>On(Vn),zn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=qn(),i=Bn();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)};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(!An)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,!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+oo),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>An&&"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 An?(n&&o&&_n(n).catch((()=>null)),e(En(r,{beforeRequest:Wn}))):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;An&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(jn("Expiration time passed, refreshing session"),d.refresh(Un()||a))}));const d=e(En(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await kn(t);if(401===(null==t?void 0:t.status))jn("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 jn("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Rn&&(jn(`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});jn(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{jn("Refreshing session due to timer"),d.refresh(Un()||n)}),e)}var l}}));return Xe(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return jn("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.1"},t.baseHeaders)}))),(e=>t=>{const n=Kn(),o=Kn(),r=e(En(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await Cn(t);e&&o.pub(e);const{sessionJwt:r}=await kn(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,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=c(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:qn,getLastUserDisplayName:Bn});const i=e(En(r,{afterRequest:async(e,t)=>{var n;const o=await Cn(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=>{In(Fn,e)})(r),(e=>{In(Vn,e)})(i))}}));let s=Xe(i,["flow.start"],zn);return s=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return e||(Sn(Fn),Sn(Vn)),o})(o)),Object.assign(s,{getLastUserLoginId:qn,getLastUserDisplayName:Bn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!An)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(En(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Un(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Tn(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&&In(`${n}${Mn}`,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})}}(Nn,r,i):In(`${n}${Nn}`,r))})(await kn(t),o,r)}}));var a;const d=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Tn(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Un(r),getSessionToken:()=>function(e=""){return cn.get(Nn)||On(`${e}${Nn}`)||""}(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 al}))).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 wm})),{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 Zb})),{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 M$})),{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 Ok})),{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 BO})),{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",e.patch="PATCH"}(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.23.1"},(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}),patch:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.patch,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 v(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});const ys=(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},ws=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||{}},$s=async e=>{const t=await ws(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Es="undefined"!=typeof localStorage,ks=(e,t)=>Es&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Cs=e=>Es&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),xs=e=>Es&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Is=(...e)=>{console.debug(...e)},Os="undefined"!=typeof window,Ss=Math.pow(2,31)-1,js="DS",As="DSR";function Rs(e=""){return Cs(`${e}${As}`)||""}function Ns(e=""){xs(`${e}${As}`),xs(`${e}${js}`),cn.remove(js)}const Ms=Os&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Us="fp",Ts=(e=!1)=>{const t=localStorage.getItem(Us);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Ds=async(e,t=Ms)=>{try{if(Ts())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=yn({apiKey:e,endpoint:[o.toString(),un],scriptUrlPattern:[i,bn]}),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(Us,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Ps=e=>{const t=Ts(!0);return t&&e.body&&(e.body.fpData=t),e},Ls="dls_last_user_login_id",_s="dls_last_user_display_name",Ws=()=>Cs(Ls),Fs=()=>Cs(_s),Vs=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Ws(),i=Fs();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 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(!Os)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:()=>Os&&"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 Os?(n&&o&&Ds(n).catch((()=>null)),e(ys(r,{beforeRequest:Ps}))):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;Os&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Is("Expiration time passed, refreshing session"),d.refresh(Rs()||a))}));const d=e(ys(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await ws(t);if(401===(null==t?void 0:t.status))Is("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 Is("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Ss&&(Is(`Timeout is too large (${e}ms), setting it to ${Ss}ms`),e=Ss),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Is(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{Is("Refreshing session due to timer"),d.refresh(Rs()||n)}),e)}var l}}));return li(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Is("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.15.1"},t.baseHeaders)}))),(e=>t=>{const n=qs(),o=qs(),r=e(ys(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await $s(t);e&&o.pub(e);const{sessionJwt:r}=await ws(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:Ws,getLastUserDisplayName:Fs});const i=e(ys(r,{afterRequest:async(e,t)=>{var n;const o=await $s(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=>{ks(Ls,e)})(r),(e=>{ks(_s,e)})(i))}}));let s=li(i,["flow.start"],Vs);return s=li(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return e||(xs(Ls),xs(_s)),o})(o)),Object.assign(s,{getLastUserLoginId:Ws,getLastUserDisplayName:Fs})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!Os)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(ys(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||Ns(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&&ks(`${n}${As}`,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})}}(js,r,i):ks(`${n}${js}`,r))})(await ws(t),o,r)}}));var a;const d=li(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Ns(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Rs(r),getSessionToken:()=>function(e=""){return cn.get(js)||Cs(`${e}${js}`)||""}(r)})}))(((...e)=>{const t=bs(...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="oidc_prompt",xa="data-type",Ia="poll",Oa="webauthnCreate",Sa="submit",ja="polling",Aa=["descope-multi-select-combo-box","descope-text-area"];var Ra;function Na(e){return new URLSearchParams(window.location.search).get(e)}function Ma(e){if(window.history.replaceState&&Na(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 Ua(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 Ta({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 Da(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 Pa=()=>{const[e="",t=""]=(Na(ca)||"").split("_");return{executionId:e,stepId:t}};function La(){Ma(ca)}const _a=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),Wa=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}},Fa=(e,t,n,o,r,i,s)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i&&e&&!s,Va=e=>null==e?void 0:e.submit(),qa=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},Ba=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function za(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var Ka,Ha,Ga,Ja;function Za(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(!Za(i,s))return!1}else if(i!==s)return!1}return!0}class Xa{constructor(e={},{updateOnlyOnChange:t=!0}={}){Ka.set(this,void 0),Ha.set(this,{}),Ga.set(this,0),Ja.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,Ka,"f")):e,n=Object.assign(Object.assign({},h(this,Ka,"f")),t);if(!h(this,Ja,"f")||!Za(h(this,Ka,"f"),n)){const e=h(this,Ka,"f");p(this,Ka,n,"f"),Object.freeze(h(this,Ka,"f")),setTimeout((()=>{Object.values(h(this,Ha,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,Ka,e,"f"),p(this,Ja,t,"f")}get current(){return Object.assign({},h(this,Ka,"f"))}subscribe(e){return p(this,Ga,h(this,Ga,"f")+1,"f"),h(this,Ha,"f")[h(this,Ga,"f")]=e,h(this,Ga,"f").toString()}unsubscribe(e){const t=!!h(this,Ha,"f")[e];return t&&delete h(this,Ha,"f")[e],t}unsubscribeAll(){return p(this,Ha,{},"f"),!0}}Ka=new WeakMap,Ha=new WeakMap,Ga=new WeakMap,Ja=new WeakMap;const Ya=["disabled"],Qa=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${ma}])`)).forEach((e=>{e.value=n}))}))},ed=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),td=(e,t,n)=>{e.querySelectorAll(`[${xa}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},nd=(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})`))},od=Wa((()=>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}})))),rd={"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 id(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(va)))}catch(e){}return t}const sd="dls_ab_testing_id",ad=document.createElement("template");var dd,ld,cd,ud,hd,pd,fd,gd,md,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;ad.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 il 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(),dd.add(this),this.logger=console,ld.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,dd,"m",Dd).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)}},cd.set(this,new Xa({deferredRedirect:!1})),ud.set(this,new Xa),hd.set(this,{}),this.getComponentsContext=()=>h(this,hd,"f"),this.nextRequestStatus=new Xa({isLoading:!1}),pd.set(this,void 0),fd.set(this,{popstate:h(this,dd,"m",wd).bind(this),visibilitychange:h(this,dd,"m",$d).bind(this),componentsContext:h(this,dd,"m",Nd).bind(this)}),gd.set(this,void 0),Id.set(this,Wa((()=>u(this,void 0,void 0,(function*(){const e=Ta({projectId:this.projectId,filename:sa,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield Ua(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Sd.set(this,void 0),p(this,gd,e,"f"),h(this,dd,"m",md).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 h(this,Id,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,Id,"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,ud,"f").subscribe(h(this,dd,"m",Td).bind(this)),h(this,ud,"f").update({isDebug:this.debug}),h(this,dd,"m",vd).call(this))return void h(this,dd,"m",bd).call(this);if(h(this,dd,"m",yd).call(this),p(this,Sd,h(this,dd,"m",Od).call(this),"f"),yield h(this,dd,"m",Cd).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,Id,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,dd,"m",jd).call(this),yield h(this,dd,"m",_d).call(this),yield h(this,dd,"m",Ad).call(this),h(this,dd,"m",Pd).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,oidcPrompt:v}=(()=>{const{executionId:e,stepId:t}=Pa();(e||t)&&La();const n=Na("t")||void 0;n&&Ma("t");const o=Na(ua)||void 0;o&&Ma(ua);const r=Na("err")||void 0;r&&Ma("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:Na(ha),redirectAuthCallbackUrl:Na(pa),redirectAuthBackupCallbackUri:Na(fa),redirectAuthInitiator:Na(ga)};(i||s||a||d)&&(Ma(ha),Ma(pa),Ma(fa),Ma(ga));const l=Na(ba);l&&Ma(ba);const c=Na(ya);c&&Ma(ya);const u=Na(wa);c&&Ma(wa);const h=Na($a);h&&Ma($a);const p=Na(Ea);p&&Ma(Ea);const f=Na(ka);f&&Ma(ka);const g=Na(Ca);return g&&Ma(Ca),{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,oidcPrompt:g}})();window.addEventListener("popstate",h(this,fd,"f").popstate),window.addEventListener("components-context",h(this,fd,"f").componentsContext),window.addEventListener("visibilitychange",h(this,fd,"f").visibilitychange),h(this,cd,"f").subscribe(h(this,dd,"m",kd).bind(this)),h(this,cd,"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,oidcPrompt:v}),p(this,ld,!0,"f")}}))}disconnectedCallback(){h(this,cd,"f").unsubscribeAll(),h(this,ud,"f").unsubscribeAll(),h(this,dd,"m",Ud).call(this),window.removeEventListener("popstate",h(this,fd,"f").popstate),window.removeEventListener("visibilitychange",h(this,fd,"f").visibilitychange),window.removeEventListener("components-context",h(this,fd,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,ld,"f")&&t!==n&&il.observedAttributes.includes(e)){h(this,dd,"m",yd).call(this);const o=null===t;h(this,cd,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,La()),{[_a(e)]:n,stepId:i,executionId:s}})),h(this,ud,"f").update({isDebug:this.debug})}}}ld=new WeakMap,cd=new WeakMap,ud=new WeakMap,hd=new WeakMap,pd=new WeakMap,fd=new WeakMap,gd=new WeakMap,Id=new WeakMap,Sd=new WeakMap,dd=new WeakSet,md=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(ad.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},vd=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},bd=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)},yd=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(il.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')},wd=function(){const{stepId:e,executionId:t}=Pa();h(this,cd,"f").update({stepId:e,executionId:t})},$d=function(){document.hidden||setTimeout((()=>{h(this,cd,"f").update({deferredRedirect:!1})}),300)},Ed=function(e,t){this.sdk=oa(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout},il.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})}}))}))},kd=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,dd,"m",Ed).call(this,t,o)}h(this,gd,"f").call(this,e)}))},Cd=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,Id,"f").call(this)).isMissingConfig&&(yield h(this,dd,"m",xd).call(this))}))},xd=function(){return u(this,void 0,void 0,(function*(){const e=Ta({projectId:this.projectId,filename:sa,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield Ua(e,"json"),!0}catch(e){return!1}}))},Od=function(){return u(this,void 0,void 0,(function*(){const e=Ta({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield Ua(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},jd=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,Id,"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)))}))},Ad=function(){return u(this,void 0,void 0,(function*(){yield h(this,dd,"m",Rd).call(this),yield h(this,dd,"m",Md).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,Sd,"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 il.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)}))},Nd=function(e){p(this,hd,Object.assign(Object.assign({},h(this,hd,"f")),e.detail),"f")},Md=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield il.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},Ud=function(){var e;null===(e=h(this,pd,"f"))||void 0===e||e.remove(),p(this,pd,null,"f")},Td=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,pd,document.createElement("descope-debugger"),"f"),Object.assign(h(this,pd,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return rS})),document.body.appendChild(h(this,pd,"f"))):h(this,dd,"m",Ud).call(this)}))},Dd=function(e,t){var n;e&&this.debug&&(null===(n=h(this,pd,"f"))||void 0===n||n.updateData({title:e,description:t}))},Pd=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=Aa.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()}}},Ld=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,Id,"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*(){il.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):il.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,dd,"m",Ld).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)}))})()}))}))},il.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.19.1"}};class sl extends il{static set sdkConfigOverrides(e){il.sdkConfigOverrides=e}constructor(){const e=new Xa;super(e.update.bind(e)),Wd.add(this),this.stepState=new Xa({},{updateOnlyOnChange:!1}),Fd.set(this,void 0),Vd.set(this,null),qd.set(this,((e,t,n,o,r)=>{n===Ia&&p(this,Fd,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,ja,o,r,{});h(this,zd,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,qd,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),Bd.set(this,(()=>{clearTimeout(h(this,Fd,"f")),p(this,Fd,null,"f")})),zd.set(this,(e=>{var t,n,o,r,i,s,a,d,l,c,u;if(!(null==e?void 0:e.ok)){h(this,Wd,"m",rl).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=>{const{level:t,title:n,log:o}=e;t&&this.loggerWrapper[t]?this.loggerWrapper[t](n,o):this.loggerWrapper.info(n,o)}));const p=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}`,`${p?`${p} - `:""}${e.data.error.message}`):p&&this.loggerWrapper.error(p);const{status:f,authInfo:g,lastAuth:m}=e.data;if("completed"===f)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&ra&&localStorage.setItem(va,JSON.stringify(e))}(m),void h(this,Wd,"m",rl).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!==Ia?(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})})),Kd.set(this,Wa((()=>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)}}))))),el.set(this,Ba(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,Wd,"m",Zd).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,Wd,"m",Yd).call(this,e);const r=yield h(this,Wd,"m",Xd).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,zd,"f").call(this,c),h(this,Wd,"m",Qd).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,Vd,"f"))||void 0===e||e.abort(),p(this,Vd,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=za(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 Ua(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 Ua(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:A,descopeIdpInitiated:R,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D,oidcPrompt:P}=e;let L,_;const W=(()=>{const e=localStorage.getItem(sd);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(sd,e.toString()),e}return Number(e)})(),F=this.sdk.getLastUserLoginId(),V=yield this.getFlowConfig(),q=yield this.getProjectConfig(),B=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(V.fingerprintEnabled&&V.fingerprintKey?yield Ds(V.fingerprintKey,this.baseUrl):localStorage.removeItem(Us),V.conditions?({startScreenId:L,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=rd[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:F,code:y,token:b,abTestingKey:W},V.conditions)):V.condition?({startScreenId:L,conditionInteractionId:_}=((e,t)=>{var n;const o=null===(n=rd[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}})(V.condition,{loginId:F,code:y,token:b,abTestingKey:W})):L=V.startScreenId,!Fa(L,O,j,A,T,D,P))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:B,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,oidcPrompt:P,client:this.client},v&&{redirectUrl:v}),{lastAuth:id(F),abTestingKey:W,locale:za(S)}),_,"",V.version,q.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 h(this,zd,"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,Sa,V.version,q.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return h(this,zd,"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||"",Va)}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===Oa||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=h(this,Vd,"f"))||void 0===r||r.abort(),p(this,Vd,null,"f");try{e=c===Oa?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,Sa,V.version,q.componentsVersion,{transactionId:$,response:e,failure:t});h(this,zd,"f").call(this,n)}if(h(this,qd,"f").call(this,l,d,c,V.version,q.componentsVersion),!u&&!L)return void this.loggerWrapper.warn("No screen was found to show");const z=L||u,K=yield this.getHtmlFilenameWithLocale(S,z),H={direction:Da(d,t.stepId),screenState:Object.assign(Object.assign({},f),{form:Object.assign(Object.assign({},this.formConfigValues),null==f?void 0:f.form),lastAuth:{loginId:F,name:this.sdk.getLastUserDisplayName()||F}}),htmlUrl:Ta({projectId:i,filename:`${z}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:K&&Ta({projectId:i,filename:K,baseUrl:this.baseStaticUrl}),samlIdpUsername:A,oidcLoginHint:D,oidcPrompt:P,openInNewTabUrl:m},G=id(F);Fa(L,O,j,A,T,D,P)?H.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:B,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,lastAuth:G,preview:this.preview,abTestingKey:W,client:this.client},v&&{redirectUrl:v}),{locale:za(S),oidcPrompt:P}),_,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"))&&(H.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(H)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield il.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,Wd,"m",Jd).call(this,p,a):p.querySelectorAll(`descope-button[${xa}="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(`[${xa}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),td(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),td(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=ed(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",ed(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=ed(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])=>{Ya.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,nd(r,"descope-totp-image",i),((e,t)=>{nd(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)=>{Qa(e,null==t?void 0:t.inputs),Qa(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=>h(this,Wd,"m",Gd).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,Wd,"m",nl).call(this,a),s&&h(this,Wd,"m",rl).call(this,"ready",{}),h(this,Wd,"m",rl).call(this,"page-updated",{}),this.rootElement.querySelector(`[${xa}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(ja,e.version,t.componentsVersion,{});h(this,zd,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?h(this,Wd,"m",ol).call(this,m,s):m()}))}}Fd=new WeakMap,Vd=new WeakMap,qd=new WeakMap,Bd=new WeakMap,zd=new WeakMap,Kd=new WeakMap,el=new WeakMap,Wd=new WeakSet,Hd=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)}))}},Gd=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)}))},Jd=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,Vd,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield od())){const{options:e,transactionId:n}=(yield h(this,Kd,"f").call(this))||{};if(e&&n){h(this,Wd,"m",Hd).call(this,o),p(this,Vd,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,Vd,"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,zd,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},Zd=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},Xd=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})),{})}))},Yd=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Qd=function(e={}){var t,n;const o=qa(e,["externalId","email","phone"]),r=qa(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)}},tl=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,el,"f").call(this,t,e)}))}))},nl=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,el,"f").call(this,t,e)}})),h(this,Wd,"m",tl).call(this,e)},ol=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")},rl=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",sl);var al=Object.freeze({__proto__:null,default:sl});function dl(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const ll=e=>{const t=document.createElement("template");return t.innerHTML=e,t},cl=(...e)=>e.join("/").replace(/\/+/g,"/"),ul=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hl=e=>{let t,n;return(...o)=>(t&&ul(t,o)||(t=o,n=e(...o)),n)},pl=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])||""}`}),""),fl=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},gl=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 ml,vl,bl,yl,wl,$l;function El(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(!El(i,s))return!1}else if(i!==s)return!1}return!0}class kl{constructor(e={},{updateOnlyOnChange:t=!0}={}){ml.set(this,void 0),vl.set(this,{}),bl.set(this,0),yl.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,ml,"f")):e,n=Object.assign(Object.assign({},h(this,ml,"f")),t);if(!h(this,yl,"f")||!El(h(this,ml,"f"),n)){const e=h(this,ml,"f");p(this,ml,n,"f"),Object.freeze(h(this,ml,"f")),setTimeout((()=>{Object.values(h(this,vl,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,ml,e,"f"),p(this,yl,t,"f")}get current(){return Object.assign({},h(this,ml,"f"))}subscribe(e){return p(this,bl,h(this,bl,"f")+1,"f"),h(this,vl,"f")[h(this,bl,"f")]=e,h(this,bl,"f").toString()}unsubscribe(e){const t=!!h(this,vl,"f")[e];return t&&delete h(this,vl,"f")[e],t}unsubscribeAll(){return p(this,vl,{},"f"),!0}}ml=new WeakMap,vl=new WeakMap,bl=new WeakMap,yl=new WeakMap;class Cl{constructor(e,t){wl.set(this,void 0),this.nodeName="",p(this,wl,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,wl,"f"))}get ele(){var e,t;const n="function"==typeof h(this,wl,"f")?h(this,wl,"f").call(this):h(this,wl,"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)}}wl=new WeakMap;const xl=/^descope-grid-([^-]+)-column$/,Il={text:class extends Cl{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 Cl{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 Ol extends Cl{constructor(){super(...arguments),this.nodeName="descope-grid",$l.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=xl.exec(t.localName))||void 0===n?void 0:n[1],r=Il[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);ul(o,this.ele.columns)||(this.ele.columns=o,null===(n=h(this,$l,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){p(this,$l,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}$l=new WeakMap;class Sl extends Cl{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 jl;class Al extends Cl{constructor(){super(...arguments),jl.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,jl,"f")&&(null===(e=this.ele)||void 0===e||e.append(h(this,jl,"f").content.cloneNode(!0)))}setContent(e){p(this,jl,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}jl=new WeakMap;class Rl extends Cl{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 Nl extends Cl{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 Ml extends Cl{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 Ul extends Cl{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 Tl extends Cl{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 Dl extends Cl{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 Pl extends Cl{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 Ll extends Cl{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 Cl{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 Wl(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 Fl=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Vl=()=>Math.random().toString(36).substring(7).split("").join("."),ql={INIT:`@@redux/INIT${Vl()}`,REPLACE:`@@redux/REPLACE${Vl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Vl()}`};function Bl(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 zl(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 Kl(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=zl(e)),t}function Hl(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Wl(2):`Expected the root reducer to be a function. Instead, received: '${Kl(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Wl(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?Wl(1):`Expected the enhancer to be a function. Instead, received: '${Kl(n)}'`);return n(Hl)(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?Wl(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?Wl(4):`Expected the listener to be a function. Instead, received: '${Kl(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Wl(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?Wl(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(!Bl(e))throw new Error("production"===process.env.NODE_ENV?Wl(7):`Actions must be plain objects. Instead, the actual type was: '${Kl(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?Wl(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?Wl(17):`Action "type" property must be a string. Instead, the actual type was: '${Kl(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Wl(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?Wl(10):`Expected the nextReducer to be a function. Instead, received: '${Kl(e)}`);o=e,h({type:ql.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Wl(11):`Expected the observer to be an object. Instead, received: '${Kl(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Fl](){return this}}}h({type:ql.INIT});const g={dispatch:h,subscribe:u,getState:c,replaceReducer:p,[Fl]:f};return g}function Gl(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Jl(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]&&Gl(`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:ql.INIT}))throw new Error("production"===process.env.NODE_ENV?Wl(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:ql.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Wl(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${ql.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===ql.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(!Bl(e))return`The ${i} has unexpected type of "${Kl(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===ql.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&&Gl(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?Wl(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 Zl(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Xl(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?Wl(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=Zl(...a)(r.dispatch),{...r,dispatch:i}}}function Yl(e){return Bl(e)&&"type"in e&&"string"==typeof e.type}var Ql=Symbol.for("immer-nothing"),ec=Symbol.for("immer-draftable"),tc=Symbol.for("immer-state"),nc="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 oc(e,...t){if("production"!==process.env.NODE_ENV){const n=nc[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 rc=Object.getPrototypeOf;function ic(e){return!!e&&!!e[tc]}function sc(e){return!!e&&(dc(e)||Array.isArray(e)||!!e[ec]||!!e.constructor?.[ec]||pc(e)||fc(e))}var ac=Object.prototype.constructor.toString();function dc(e){if(!e||"object"!=typeof e)return!1;const t=rc(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)===ac}function lc(e,t){0===cc(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function cc(e){const t=e[tc];return t?t.type_:Array.isArray(e)?1:pc(e)?2:fc(e)?3:0}function uc(e,t){return 2===cc(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function hc(e,t,n){const o=cc(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function pc(e){return e instanceof Map}function fc(e){return e instanceof Set}function gc(e){return e.copy_||e.base_}function mc(e,t){if(pc(e))return new Map(e);if(fc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&dc(e)){if(!rc(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[tc];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(rc(e),n)}function vc(e,t=!1){return yc(e)||ic(e)||!sc(e)||(cc(e)>1&&(e.set=e.add=e.clear=e.delete=bc),Object.freeze(e),t&&lc(e,((e,t)=>vc(t,!0)))),e}function bc(){oc(2)}function yc(e){return Object.isFrozen(e)}var wc,$c={};function Ec(e){const t=$c[e];return t||oc(0,e),t}function kc(){return wc}function Cc(e,t){t&&(Ec("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function xc(e){Ic(e),e.drafts_.forEach(Sc),e.drafts_=null}function Ic(e){e===wc&&(wc=e.parent_)}function Oc(e){return wc={drafts_:[],parent_:wc,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Sc(e){const t=e[tc];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function jc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[tc].modified_&&(xc(t),oc(4)),sc(e)&&(e=Ac(t,e),t.parent_||Nc(t,e)),t.patches_&&Ec("Patches").generateReplacementPatches_(n[tc].base_,e,t.patches_,t.inversePatches_)):e=Ac(t,n,[]),xc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ql?e:void 0}function Ac(e,t,n){if(yc(t))return t;const o=t[tc];if(!o)return lc(t,((r,i)=>Rc(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Nc(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),lc(r,((r,s)=>Rc(e,o,t,r,s,n,i))),Nc(e,t,!1),n&&e.patches_&&Ec("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&&oc(5),ic(r)){const s=Ac(e,r,i&&t&&3!==t.type_&&!uc(t.assigned_,o)?i.concat(o):void 0);if(hc(n,o,s),!ic(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(sc(r)&&!yc(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ac(e,r),t&&t.scope_.parent_||Nc(e,r)}}function Nc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vc(t,n)}var Mc={get(e,t){if(t===tc)return e;const n=gc(e);if(!uc(n,t))return function(e,t,n){const o=Dc(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_||!sc(o)?o:o===Tc(e.base_,t)?(Lc(e),e.copy_[t]=_c(o,e)):o},has:(e,t)=>t in gc(e),ownKeys:e=>Reflect.ownKeys(gc(e)),set(e,t,n){const o=Dc(gc(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Tc(gc(e),t),r=o?.[tc];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||uc(e.base_,t)))return!0;Lc(e),Pc(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!==Tc(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Lc(e),Pc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=gc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){oc(11)},getPrototypeOf:e=>rc(e.base_),setPrototypeOf(){oc(12)}},Uc={};function Tc(e,t){const n=e[tc];return(n?gc(n):e)[t]}function Dc(e,t){if(!(t in e))return;let n=rc(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=rc(n)}}function Pc(e){e.modified_||(e.modified_=!0,e.parent_&&Pc(e.parent_))}function Lc(e){e.copy_||(e.copy_=mc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}lc(Mc,((e,t)=>{Uc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Uc.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&oc(13),Uc.set.call(this,e,t,void 0)},Uc.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&oc(14),Mc.set.call(this,e[0],t,n,e[0])};function _c(e,t){const n=pc(e)?Ec("MapSet").proxyMap_(e,t):fc(e)?Ec("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:kc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Mc;n&&(r=[o],i=Uc);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:kc()).drafts_.push(n),n}function Wc(e){return ic(e)||oc(10,e),Fc(e)}function Fc(e){if(!sc(e)||yc(e))return e;const t=e[tc];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=mc(e,t.scope_.immer_.useStrictShallowCopy_)}else n=mc(e,!0);return lc(n,((e,t)=>{hc(n,e,Fc(t))})),t&&(t.finalized_=!1),n}var Vc=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&&oc(6),void 0!==n&&"function"!=typeof n&&oc(7),sc(e)){const r=Oc(this),i=_c(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?xc(r):Ic(r)}return Cc(r,n),jc(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===Ql&&(o=void 0),this.autoFreeze_&&vc(o,!0),n){const t=[],r=[];Ec("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}oc(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){sc(e)||oc(8),ic(e)&&(e=Wc(e));const t=Oc(this),n=_c(e,void 0);return n[tc].isManual_=!0,Ic(t),n}finishDraft(e,t){const n=e&&e[tc];n&&n.isManual_||oc(9);const{scope_:o}=n;return Cc(o,t),jc(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=Ec("Patches").applyPatches_;return ic(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},qc=Vc.produce;Vc.produceWithPatches.bind(Vc),Vc.setAutoFreeze.bind(Vc),Vc.setUseStrictShallowCopy.bind(Vc),Vc.applyPatches.bind(Vc),Vc.createDraft.bind(Vc),Vc.finishDraft.bind(Vc);var Bc=(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})}}},zc=(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})}},Kc={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Hc=e=>Array.isArray(e)?e:[e];function Gc(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 Jc(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var Zc=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...Kc,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Bc},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:zc}}},Xc="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function Yc(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;else if(d=e.apply(null,arguments),i++,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 Xc(d):d}return a.s=1,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 Qc(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=Yc,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=Hc(l),f=Hc(u),g=Gc(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const b=c((function(){r++;const e=Jc(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=Zc(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=Jc(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 eu=Qc(Yc),tu=Object.assign(((e,t=eu)=>{!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:()=>tu});function nu(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var ou=nu(),ru=nu;((...e)=>{const t=Qc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(ic(e)?Wc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Yc);var iu="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Zl:Zl.apply(null,arguments)},su=e=>e&&"function"==typeof e.match;function au(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Ku(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=>Yl(t)&&t.type===e,n}function du(e){return"function"==typeof e&&"type"in e&&su(e)}function lu(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 cu=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 uu(e){return sc(e)?qc(e,(()=>{})):e}function hu(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?Ku(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function pu(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function fu(e,t,n){const o=gu(e,t,n);return{detectMutations:()=>mu(e,t,o,n)}}function gu(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]=gu(e,t,n[r],s))}}return i}function mu(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=mu(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function vu(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Bl(e)}function bu(e,t="",n=vu,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=bu(l,a,n,o,r,i),s))return s}return i&&yu(e)&&i.add(e),!1}function yu(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!yu(t))return!1;return!0}function wu(e){return"boolean"==typeof e}var $u=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new cu;if(t&&(wu(t)?i.push(ou):i.push(ru(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};wu(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=pu,ignoredPaths:r,warnAfter:i=32}=e;const s=fu.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=lu(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ku(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?Ku(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={};wu(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=vu,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(!Yl(u))return l(u);const h=l(u),p=lu(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=bu(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=bu(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={};wu(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=du}=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},Eu=e=>t=>{setTimeout(t,e)},ku="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Eu(10),Cu=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new cu(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?ku:"callback"===e.type?e.queueNotification:Eu(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},xu="production"===process.env.NODE_ENV;function Iu(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?Ku(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Ku(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?Ku(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Ku(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?Ku(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?Ku(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Ou=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Su(...e){return t=>e.some((e=>((e,t)=>su(e)?e.match(t):e(t))(e,t)))}var ju=["name","message","stack","code"],Au=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ru=class{constructor(e,t){this.payload=e,this.meta=t}_type},Nu=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of ju)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Mu=(()=>{function e(e,t,n){const o=au(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=au(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=au(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Nu)(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):Ou(),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 Au(e,t),fulfillWithValue:(e,t)=>new Ru(e,t)})).then((t=>{if(t instanceof Au)throw t;return t instanceof Ru?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof Au?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(Uu)})}}),{pending:r,rejected:i,fulfilled:o,settled:Su(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Uu(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Tu=Symbol.for("rtk-slice-createasyncthunk");function Du(e,t){return`${e}/${t}`}function Pu({creators:e}={}){const t=e?.asyncThunk?.[Tu];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Ku(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?Ku(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Ku(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?Ku(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?Iu(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?Ku(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]=Iu(t);if(function(e){return"function"==typeof e}(e))n=()=>uu(e());else{const t=uu(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(ic(e)){const o=n(e,t);return void 0===o?e:o}if(sc(e))return qc(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?Ku(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:Du(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?Ku(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?au(e,s):au(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Ku(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||Wu,pending:a||Wu,rejected:d||Wu,settled:l||Wu})}(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?Ku(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=hu(c,n,{insert:()=>new WeakMap});return hu(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Lu(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 Lu(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?Ku(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var _u=Pu();function Wu(){}var Fu="listenerMiddleware",Vu=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=au(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?Ku(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?Ku(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},qu=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Vu(e);return{id:Ou(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Ku(22):"Unsubscribe not initialized")}}}),{withTypes:()=>qu}),Bu=Object.assign(au(`${Fu}/add`),{withTypes:()=>Bu});au(`${Fu}/removeAll`);var zu=Object.assign(au(`${Fu}/remove`),{withTypes:()=>zu});function Ku(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 Hu=["error","warn","info","debug"],Gu=gl((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 Hu.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})),Ju="undefined"!=typeof localStorage,Zu=Ju&&localStorage.getItem("base.content.url")||"",Xu=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Yu=gl((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})),Qu=gl((e=>{var t,n;const o=dl(Gu,Yu)(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})),eh=e=>t=>{var n,o,r;const i=dl(Gu,Yu,Qu)(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};eh.missingAttrValidator=Xu;const th=gl((e=>{const t=dl(eh({"project-id":Xu}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),nh=gl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const oh=gl((e=>{const t=dl(Gu,th,nh)(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(Zu||o||"https://static.descope.com/pages");return r.pathname=cl(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")}}})),rh=gl((e=>{var t,n,o;const r=dl(oh)(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})),ih=gl((e=>{var t,n,o,r,i,s,a;return a=class extends(dl(Yu,Gu)(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 Ph})),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})),sh="load-descope-ui",ah="base.ui.components.url",dh=Ju&&localStorage.getItem(ah)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",lh=Ju&&localStorage.getItem(ah)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ch=e=>{const t=document.createElement("script");return t.id=e,t},uh=(e,t)=>e.replace("<version>",t),hh=gl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=dl(Gu,rh)(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=ch("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=uh(lh,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#${sh}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=ch(sh);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=uh(dh,await h(this,t,"m",r).call(this))}return document.getElementById(sh)},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})),ph="content-root",fh="root",gh=gl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${fh}, #${ph} {\n height: 100%;\n }\n #${fh} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${fh}">\n <div id="${ph}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(ph),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(fh)}})),mh="descope-modal",vh=gl((e=>{var t,n;const o=dl(Yu,gh,hh)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Al{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(mh);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([mh]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),bh="descope-notification",yh=gl((e=>{var t,n;const o=dl(Yu,gh,hh)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ml{setContent(t){const n="string"==typeof t?ll(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(bh);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([bh])}},t=new WeakMap,n})),wh=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',$h=gl((e=>{var t,n,o,r,i,s,a,d,l;const c=dl(eh({theme:wh}),oh,Yu,hh,rh,gh,Qu)(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(ah)))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(ah),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})),Eh=e=>gl((t=>{const n=_u(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(dl(Gu)(t)){constructor(...e){super(...e);const t=function(e){const t=$u(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Bl(n))throw new Error("production"===process.env.NODE_ENV?Ku(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Jl(n)}if(!xu&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Ku(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!xu&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Ku(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!xu&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ku(4):"each middleware provided to configureStore must be a function");let l=Zl;r&&(l=iu({trace:!xu,..."object"==typeof r&&r}));const c=Xl(...d),u=Cu(c);if(!xu&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Ku(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!xu&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Ku(6):"`enhancers` callback must return an array");if(!xu&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ku(7):"each enhancer provided to configureStore must be a function");return xu||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Hl(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{Uu(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()))))}}})),kh=gl((e=>class extends(Gu(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()}}));gl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Ch=(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 xh,Ih,Oh,Sh,jh,Ah,Rh,Nh,Mh,Uh;const Th=document.createElement("template");Th.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 Dh extends HTMLElement{constructor(){var e;super(),xh.add(this),Ih.set(this,new kl({messages:[]})),Oh.set(this,void 0),Sh.set(this,void 0),jh.set(this,void 0),Ah.set(this,{resize:h(this,xh,"m",Uh).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Th.content.cloneNode(!0)),p(this,Oh,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Sh,h(this,Oh,"f").querySelector(".content"),"f"),p(this,jh,h(this,Oh,"f").querySelector(".header"),"f")}updateData(e){h(this,Ih,"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]=Ch(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,Oh,"f"),h(this,jh,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Ah,"f").resize),(e=h(this,Oh,"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,Oh,"f").onresize=h(this,xh,"m",Mh).bind(this),h(this,Ih,"f").subscribe(h(this,xh,"m",Rh).bind(this))}disconnectedCallback(){h(this,Ih,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Ah,"f").resize)}}Ih=new WeakMap,Oh=new WeakMap,Sh=new WeakMap,jh=new WeakMap,Ah=new WeakMap,xh=new WeakSet,Rh=function(e){h(this,xh,"m",Nh).call(this,e),h(this,xh,"m",Mh).call(this)},Nh=function(e){h(this,Sh,"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("")},Mh=function(){h(this,Sh,"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)}))},Uh=function(){const[e,t]=Ch(h(this,Oh,"f"),Number.parseInt(h(this,Oh,"f").style.left,10),Number.parseInt(h(this,Oh,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Oh,"f").style.top=`${t}px`,h(this,Oh,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Dh);var Ph=Object.freeze({__proto__:null}),Lh={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(Lh),e.apply(this,n)}function Wh(e){return Wh="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},Wh(e)}function Fh(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 Vh(e,t){if(t&&("object"===Wh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qh(e)}function qh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bh(e){var t="function"==typeof Map?new Map:void 0;return Bh=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 zh(e,arguments,Gh(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Hh(o,e)},Bh(e)}function zh(e,t,n){return zh=Kh()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&Hh(r,n.prototype),r},zh.apply(null,arguments)}function Kh(){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 Hh(e,t){return Hh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hh(e,t)}function Gh(e){return Gh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gh(e)}var Jh=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&&Hh(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=Kh(),function(){var e,o=Gh(t);if(n){var r=Gh(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return Vh(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(qh(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&Fh(o.prototype,r),i&&Fh(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(Bh(Error)),Zh="0-90-9٠-٩۰-۹",Xh="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function Yh(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 Qh={}.constructor;function ep(e){return null!=e&&e.constructor===Qh}function tp(e){return tp="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},tp(e)}function np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function op(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 rp(e,t,n){return t&&op(e.prototype,t),n&&op(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var ip=" ext. ",sp=/^\d+$/,ap=function(){function e(t){np(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!ep(e)||!ep(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(ep(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+pp(e)+": "+e,"."))}(t),this.metadata=t,gp.call(this,t)}return rp(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&&sp.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new dp(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new dp(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}(),dp=function(){function e(t,n){np(this,e),this.globalMetadataObject=n,this.metadata=t,gp.call(this,n.metadata)}return rp(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 lp(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()&&hp(this.types(),e))return new up(hp(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?ip:this.metadata[13]||ip}}]),e}(),lp=function(){function e(t,n){np(this,e),this._format=t,this.metadata=n}return rp(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()||cp.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),cp=/^\(?\$1\)?$/,up=function(){function e(t,n){np(this,e),this.type=t,this.metadata=n}return rp(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 hp(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 pp=function(e){return tp(e)};function fp(e,t){if((t=new ap(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function gp(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===Yh(t,"1.2.0")?this.v2=!0:-1===Yh(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var mp=function(e){return"([".concat(Zh,"]{1,").concat(e,"})")};function vp(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",o="#?",r="[ \\t]*";return";ext="+mp("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+mp("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+mp("9")+o)+"|"+("[- ]+"+mp("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+mp("15")+o)+"|"+(r+"(?:,)+"+n+mp("9")+o)}var bp="["+Zh+"]{2}",yp="[++]{0,1}(?:["+Xh+"]*["+Zh+"]){3,}["+Xh+Zh+"]*",wp=new RegExp("^[++]{0,1}(?:["+Xh+"]*["+Zh+"]){1,2}$","i"),$p=yp+"(?:"+vp()+")?",Ep=new RegExp("^"+bp+"$|^"+$p+"$","i");var kp=new RegExp("(?:"+vp()+")$","i");var Cp={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 xp(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 Ip(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 Ip(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 Ip(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 Op(e){for(var t,n="",o=xp(e.split(""));!(t=o()).done;){n+=Sp(t.value,n)||""}return n}function Sp(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return Cp[e]}(e)}function jp(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 Ap(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 Ap(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 Ap(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 Np(e,void 0,t)}function Np(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 Np(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=jp(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 Mp(e,t){return"IS_POSSIBLE"===Rp(e,t)}function Up(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Tp(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 Dp(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 Dp(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 Dp(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 Pp=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Lp(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new ap(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(Up(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=Tp(Pp);!(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)&&Up(e,t.pattern()))}function Wp(e,t,n){var o=new ap(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new ap(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var Fp=/(\$\d)/;function Vp(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(Fp,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(Xh,"]+"),"g")," ").trim()}(i):i}var qp=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;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}function Kp(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 Hp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kp(Object(n),!0).forEach((function(t){Gp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jp={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function Zp(e,t,n,o){if(n=n?Hp(Hp({},Jp),n):Jp,o=new ap(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?Yp(r=Xp(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=Xp(s,null,"INTERNATIONAL",o,n),Yp(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=fp(o,r.metadata);if(i===n){var s=Xp(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new ap(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():qp.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(Xp(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return Yp(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function Xp(e,t,n,o,r){var i=function(e,t){for(var n,o=Bp(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(Up(t,r.pattern()))return r}}(o.formats(),e);return i?Vp(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function Yp(e,t,n,o){return t?o(e,t,n):e}function Qp(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 ef(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qp(Object(n),!0).forEach((function(t){tf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tf(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){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 of=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 ap(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]:Wp(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new ap(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 Mp(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 ap(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Lp(e,t,n.metadata):Up(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new ap(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Lp(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Zp(this,e,t?ef(ef({},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&&nf(t.prototype,n),o&&nf(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var rf=new RegExp("(["+Zh+"])");function sf(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(Up(e,n.nationalNumberPattern())&&!Up(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 af(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new ap(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(rf);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?fp(t,o):n;if(0===e.indexOf(r)){(o=new ap(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=sf(i,o).nationalNumber,a=sf(e,o).nationalNumber;if(!Up(a,o.nationalNumberPattern())&&Up(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 ap(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 df(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 lf(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 lf(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 lf(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 cf(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 ap(r);for(var i,s=[],a=df(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(Lp({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 uf="(["+Zh+"]|[\\-\\.\\(\\)]?)",hf=new RegExp("^\\+"+uf+"*["+Zh+"]"+uf+"*$","g"),pf=new RegExp("^("+("["+Zh+"]+((\\-)*["+Zh+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Zh+"])*")+"\\.?$","g"),ff="tel:",gf=";phone-context=";function mf(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(gf);if(t<0)return null;var n=t+gf.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&&(hf.test(e)||pf.test(e))}(r))throw new Jh("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(ff);i=s>=0?s+ff.length:0;var a=e.indexOf(gf);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var vf=new RegExp("[++"+Zh+"]"),bf=new RegExp("[^"+Zh+"#]+$");function yf(e,t,n){if(t=t||{},n=new ap(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Jh("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=mf(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new Jh("TOO_LONG");return}if(!1===t)return e;var o=e.search(vf);if(o<0)return;return e.slice(o).replace(bf,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&Ep.test(e)}(o))return function(e){return wp.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(kp);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(kp),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 Jh("TOO_SHORT");throw new Jh("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=af(Op(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||fp(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=sf(Op(d),o),c=l.nationalNumber,u=l.carrierCode,h=cf(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 Jh("INVALID_COUNTRY");return{}}if(!l||l.length<2){if(t.v2)throw new Jh("TOO_SHORT");return{}}if(l.length>17){if(t.v2)throw new Jh("TOO_LONG");return{}}if(t.v2){var p=new of(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)&&Up(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!Mp(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 wf(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 $f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wf(Object(n),!0).forEach((function(t){Ef(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wf(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 kf(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,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xf(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 If(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 If(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 If(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 Of(e){var t,n,o,r=xf(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(!ep(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?kf(Object(n),!0).forEach((function(t){Cf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kf(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 Sf(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 jf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sf(Object(n),!0).forEach((function(t){Af(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Af(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=jf(jf({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return yf(e,$f($f({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Jh))throw e}}function Nf(){var e=Of(arguments),t=e.text,n=e.options,o=e.metadata;return Rf(t,n,o)}const Mf=(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)}),{}),Uf=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Tf={enabled:"active",disabled:"disabled",invited:"invited"},Df=e=>e.tenantRoles.data,Pf=e=>e.selectedUsersLoginIds,Lf=e=>e.notifications,_f=e=>e.customAttributes.data,Wf=eu((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Uf(null==e?void 0:e.customAttributes,"customAttributes")),{status:Tf[e.status]||e.status,roles:e.roleNames}))))),Ff=eu(Pf,Wf,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Vf=eu(Ff,(e=>e.map((e=>e.userId)))),qf=eu(Ff,(e=>e.map((e=>e.status)))),Bf=eu(Ff,(e=>e.every((e=>e.editable)))),zf=eu(Pf,(e=>!!e.length)),Kf=eu(Pf,(e=>1===e.length)),Hf=eu(Pf,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),Gf=eu(Kf,qf,((e,t)=>e&&t.every((e=>e===Tf.enabled)))),Jf=eu(qf,(e=>e.every((e=>e===Tf.disabled)))),Zf=eu(Ff,(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`})),Xf=eu(Kf,Jf,Bf,((e,t,n)=>e&&t&&n)),Yf=eu(Kf,Gf,Bf,((e,t,n)=>e&&t&&n)),Qf=eu(Kf,Bf,((e,t)=>e&&t)),eg=eu(Kf,Bf,((e,t)=>e&&t)),tg=eu(Kf,Bf,((e,t)=>e&&t)),ng=eu(zf,(e=>e)),og=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)}))}))},rg=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}}),ig=({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)})}}),sg=Mu("users/create",((e,{extra:{api:t}})=>t.user.create(e))),ag=og(sg)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},rg((e=>e.createUser)),ig({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>`}})),dg={action:sg,reducer:ag},lg=Mu("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),cg=og(lg)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},rg((e=>e.deleteUser)),ig({getSuccessMsg:e=>pl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>pl(e.meta.arg.length)`Failed to delete user${["","s"]}`})),ug={action:lg,reducer:cg},hg=Mu("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),pg=og(hg)(rg((e=>e.setTempUserPassword)),ig({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>`}})),fg={action:hg,reducer:pg},gg=Mu("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),mg=og(gg)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},rg((e=>e.customAttributes))),vg={action:gg,reducer:mg},bg=Mu("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),yg=og(bg)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},rg((e=>e.usersList))),wg={action:bg,reducer:yg},$g=Mu("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Eg=og($g)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},rg((e=>e.tenantRoles))),kg={action:$g,reducer:Eg},Cg=Mu("users/update",((e,{extra:{api:t}})=>t.user.update(e))),xg=og(Cg)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>ul(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},rg((e=>e.updateUser)),ig({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>`}})),Ig={action:Cg,reducer:xg},Og=Mu("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Sg=og(Og)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return ul(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)}},rg((e=>e.enableUser)),ig({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>`}})),jg={action:Og,reducer:Sg},Ag=Mu("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Rg=og(Ag)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return ul(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)}},rg((e=>e.disableUser)),ig({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>`}})),Ng={action:Ag,reducer:Rg},Mg=Mu("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Ug={action:Mg,reducer:og(Mg)(rg((e=>e.removePasskey)),ig({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>`}}))},Tg={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:[]},Dg="/v1/mgmt/user/search",Pg="/v1/mgmt/user/delete/batch",Lg="/v1/mgmt/user/create",_g="/v1/mgmt/user/update",Wg="/v1/mgmt/user/update/status",Fg="/v1/mgmt/user/password/set/temporary",Vg="/v1/mgmt/user/passkeys/delete",qg="/v1/mgmt/user/customattributes",Bg="/v1/mgmt/role/all",zg=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)})),Kg=({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(Dg,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c},{queryParams:{tenant:t}});return yield zg(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(Pg,{userIds:o},{queryParams:{tenant:t}});return yield zg(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(Lg,{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 zg($),(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 zg(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(Wg,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield zg(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(Wg,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield zg(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(Vg,{loginId:o},{queryParams:{tenant:t}});return yield zg(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(Fg,{loginId:o},{queryParams:{tenant:t}});return yield zg(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(qg,{queryParams:{tenant:t}});return yield zg(o),(yield o.json()).data}))}),Hg=({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(Bg,{queryParams:{tenant:t}});return yield zg(o),o.json()}))}),Gg=gl((e=>{var t,n,o,r;const i=dl(th,Qu,Gu,nh,eh({tenant:eh.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.103"}}));return{user:Kg({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Hg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Jg=gl((e=>{const t=dl(Eh({name:"widget",initialState:Tg,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{dg.reducer(e),Ig.reducer(e),jg.reducer(e),Ng.reducer(e),ug.reducer(e),wg.reducer(e),fg.reducer(e),Ug.reducer(e),vg.reducer(e),kg.reducer(e)},asyncActions:{searchUsers:wg.action,createUser:dg.action,updateUser:Ig.action,enableUser:jg.action,disableUser:Ng.action,deleteUsers:ug.action,removePasskey:Ug.action,getCustomAttributes:vg.action,getTenantRoles:kg.action,setTempUserPassword:fg.action}}),Yu,Gu,Gg)(e);return class extends t{constructor(...e){super(...e),this.state=Tg,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Zg=gl((e=>{const t=dl(oh,eh({"widget-id":eh.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}))}}})),Xg=gl((e=>{var t,n,o;return o=class extends(dl(Gu,Yu,hh,gh,Zg,Jg)(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=ll(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Yg=gl((e=>{var t,n,o,r,i,s;return s=class extends(dl(Jg,vh,kh,Gu,Xg)(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(Df(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(ll(yield this.fetchWidgetPage("create-user-modal.html")));new Sl((()=>{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 Sl((()=>{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({},Mf(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})),Qg=gl((e=>{var t,n,o;return o=class extends(dl(Gu,Yg,Xg)(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 Sl(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})),em=gl((e=>{var t,n,o;return o=class extends(dl(Jg,vh,Gu,Xg)(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(ll(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Sl((()=>{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 Sl((()=>{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=Vf(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new Ul(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Zf(this.state);o.text=`Delete ${e}?`}}))},o})),tm=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg,em)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),ng)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Sl(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})),nm=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Jg,vh,Gu,kh,Xg)(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 Sl((()=>{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 Sl((()=>{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=Hf(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(ll(yield this.fetchWidgetPage("disable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ul(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=Zf(this.state);r.text=`Disable ${e}?`}))}))},i})),om=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg,nm,kh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),Yf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Sl(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})),rm=e=>{if(!e)return e;const t=function(){return _h(Nf,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},im=gl((e=>{var t,n,o,r,i,s,a,d,l,f;return f=class extends(dl(Jg,vh,Gu,kh,Xg)(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(Df(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=Ff(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:rm(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},Uf(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 Sl((()=>{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 Sl((()=>{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]},Mf(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(ll(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 Tl(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})),sm=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg,im,kh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),Qf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Sl(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})),am=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Jg,vh,Gu,kh,Xg)(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 Sl((()=>{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 Sl((()=>{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=Hf(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(ll(yield this.fetchWidgetPage("enable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ul(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=Zf(this.state);r.text=`Activate ${e}?`}))}))},i})),dm=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg,am,kh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),Xf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Sl(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})),lm=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,fl((()=>{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 Tl(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})),cm={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},um=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Gu,Jg,yh,Yu)(e)){constructor(){super(...arguments),t.add(this),r.set(this,hl((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),Lf)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=cm[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})),hm=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Jg,vh,Gu,kh,Xg)(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 Sl((()=>{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 Sl((()=>{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=Hf(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(ll(yield this.fetchWidgetPage("remove-passkey-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ul(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=Zf(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),pm=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg,hm,kh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),eg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Sl(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})),fm=gl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(dl(Jg,Gu,Xg)(e)){constructor(){super(...arguments),t.add(this),r.set(this,hl((e=>{this.usersTable.data=e}))),i.set(this,fl(((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,hl((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,Wf(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),Wf)}))}},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 Ol(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})),gm=gl((e=>{var t,n,o;return o=class extends(dl(Jg,vh,Gu,kh,Xg)(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(ll(yield this.fetchWidgetPage("generated-password-modal.html")));new Sl((()=>{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})),mm=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Jg,vh,Gu,kh,Xg,gm)(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 Sl((()=>{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 Sl((()=>{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=Hf(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(ll(yield this.fetchWidgetPage("reset-password-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new Ul(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=Zf(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),vm=gl((e=>{var t,n,o,r;return r=class extends(dl(Gu,Xg,Jg,mm,kh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),tg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Sl(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})),bm=gl((e=>class extends(dl(ih,$h,fm,Qg,tm,sm,dm,om,vm,pm,lm,um)(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)}))}})),ym=dl((e=>class extends(bm(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",ym);var wm=Object.freeze({__proto__:null,default:ym});((...e)=>{const t=Qc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(ic(e)?Wc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Yc);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]?Zl:Zl.apply(null,arguments)},Em=e=>e&&"function"==typeof e.match;function km(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?dv(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=>Yl(t)&&t.type===e,n}function Cm(e){return"function"==typeof e&&"type"in e&&Em(e)}function xm(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 Im=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 Om(e){return sc(e)?qc(e,(()=>{})):e}function Sm(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?dv(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function jm(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Am(e,t,n){const o=Rm(e,t,n);return{detectMutations:()=>Nm(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 Nm(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=Nm(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Mm(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Bl(e)}function Um(e,t="",n=Mm,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=Um(l,a,n,o,r,i),s))return s}return i&&Tm(e)&&i.add(e),!1}function Tm(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Tm(t))return!1;return!0}function Dm(e){return"boolean"==typeof e}var Pm=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Im;if(t&&(Dm(t)?i.push(ou):i.push(ru(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Dm(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=jm,ignoredPaths:r,warnAfter:i=32}=e;const s=Am.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=xm(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?dv(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?dv(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={};Dm(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Mm,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(!Yl(u))return l(u);const h=l(u),p=xm(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Um(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=Um(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={};Dm(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Cm}=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},Lm=e=>t=>{setTimeout(t,e)},_m="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Lm(10),Wm=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Im(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:Lm(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},Fm="production"===process.env.NODE_ENV;function Vm(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?dv(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?dv(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?dv(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?dv(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?dv(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?dv(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var qm=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Bm(...e){return t=>e.some((e=>((e,t)=>Em(e)?e.match(t):e(t))(e,t)))}var zm=["name","message","stack","code"],Km=class{constructor(e,t){this.payload=e,this.meta=t}_type},Hm=class{constructor(e,t){this.payload=e,this.meta=t}_type},Gm=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of zm)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Jm=(()=>{function e(e,t,n){const o=km(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=km(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=km(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Gm)(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):qm(),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 Km(e,t),fulfillWithValue:(e,t)=>new Hm(e,t)})).then((t=>{if(t instanceof Km)throw t;return t instanceof Hm?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof Km?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(Zm)})}}),{pending:r,rejected:i,fulfilled:o,settled:Bm(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Zm(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Xm=Symbol.for("rtk-slice-createasyncthunk");function Ym(e,t){return`${e}/${t}`}function Qm({creators:e}={}){const t=e?.asyncThunk?.[Xm];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?dv(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?dv(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?dv(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?dv(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?Vm(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?dv(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]=Vm(t);if(function(e){return"function"==typeof e}(e))n=()=>Om(e());else{const t=Om(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(ic(e)){const o=n(e,t);return void 0===o?e:o}if(sc(e))return qc(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?dv(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:Ym(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?dv(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?km(e,s):km(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?dv(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||nv,pending:a||nv,rejected:d||nv,settled:l||nv})}(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?dv(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Sm(c,n,{insert:()=>new WeakMap});return Sm(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=ev(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 ev(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?dv(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var tv=Qm();function nv(){}var ov="listenerMiddleware",rv=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=km(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?dv(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?dv(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},iv=Object.assign((e=>{const{type:t,predicate:n,effect:o}=rv(e);return{id:qm(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?dv(22):"Unsubscribe not initialized")}}}),{withTypes:()=>iv}),sv=Object.assign(km(`${ov}/add`),{withTypes:()=>sv});km(`${ov}/removeAll`);var av=Object.assign(km(`${ov}/remove`),{withTypes:()=>av});function dv(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 lv=["error","warn","info","debug"],cv=gl((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 lv.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})),uv="undefined"!=typeof localStorage,hv=uv&&localStorage.getItem("base.content.url")||"",pv=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,fv=gl((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})),gv=gl((e=>{var t,n;const o=dl(cv,fv)(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})),mv=e=>t=>{var n,o,r;const i=dl(cv,fv,gv)(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};mv.missingAttrValidator=pv;const vv=gl((e=>{const t=dl(mv({"project-id":pv}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),bv=gl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const yv=gl((e=>{const t=dl(cv,vv,bv)(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(hv||o||"https://static.descope.com/pages");return r.pathname=cl(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")}}})),wv=gl((e=>{var t,n,o;const r=dl(yv)(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})),$v=gl((e=>{var t,n,o,r,i,s,a;return a=class extends(dl(fv,cv)(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 Qv})),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})),Ev="load-descope-ui",kv="base.ui.components.url",Cv=uv&&localStorage.getItem(kv)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",xv=uv&&localStorage.getItem(kv)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Iv=e=>{const t=document.createElement("script");return t.id=e,t},Ov=(e,t)=>e.replace("<version>",t),Sv=gl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=dl(cv,wv)(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=Iv("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=Ov(xv,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#${Ev}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Iv(Ev);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Ov(Cv,await h(this,t,"m",r).call(this))}return document.getElementById(Ev)},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})),jv="content-root",Av="root",Rv=gl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Av}, #${jv} {\n height: 100%;\n }\n #${Av} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Av}">\n <div id="${jv}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(jv),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Av)}})),Nv="descope-modal",Mv=gl((e=>{var t,n;const o=dl(fv,Rv,Sv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Al{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Nv);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([Nv]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Uv="descope-notification",Tv=gl((e=>{var t,n;const o=dl(fv,Rv,Sv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ml{setContent(t){const n="string"==typeof t?ll(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Uv);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([Uv])}},t=new WeakMap,n})),Dv=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Pv=gl((e=>{var t,n,o,r,i,s,a,d,l;const c=dl(mv({theme:Dv}),yv,fv,Sv,wv,Rv,gv)(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(kv)))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(kv),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})),Lv=e=>gl((t=>{const n=tv(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(dl(cv)(t)){constructor(...e){super(...e);const t=function(e){const t=Pm(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Bl(n))throw new Error("production"===process.env.NODE_ENV?dv(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Jl(n)}if(!Fm&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?dv(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Fm&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?dv(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Fm&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?dv(4):"each middleware provided to configureStore must be a function");let l=Zl;r&&(l=$m({trace:!Fm,..."object"==typeof r&&r}));const c=Xl(...d),u=Wm(c);if(!Fm&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?dv(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Fm&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?dv(6):"`enhancers` callback must return an array");if(!Fm&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?dv(7):"each enhancer provided to configureStore must be a function");return Fm||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Hl(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{Zm(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=gl((e=>class extends(cv(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()}}));gl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Wv=(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 Fv,Vv,qv,Bv,zv,Kv,Hv,Gv,Jv,Zv;const Xv=document.createElement("template");Xv.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 Yv extends HTMLElement{constructor(){var e;super(),Fv.add(this),Vv.set(this,new kl({messages:[]})),qv.set(this,void 0),Bv.set(this,void 0),zv.set(this,void 0),Kv.set(this,{resize:h(this,Fv,"m",Zv).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Xv.content.cloneNode(!0)),p(this,qv,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Bv,h(this,qv,"f").querySelector(".content"),"f"),p(this,zv,h(this,qv,"f").querySelector(".header"),"f")}updateData(e){h(this,Vv,"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]=Wv(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,qv,"f"),h(this,zv,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Kv,"f").resize),(e=h(this,qv,"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,qv,"f").onresize=h(this,Fv,"m",Jv).bind(this),h(this,Vv,"f").subscribe(h(this,Fv,"m",Hv).bind(this))}disconnectedCallback(){h(this,Vv,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Kv,"f").resize)}}Vv=new WeakMap,qv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Kv=new WeakMap,Fv=new WeakSet,Hv=function(e){h(this,Fv,"m",Gv).call(this,e),h(this,Fv,"m",Jv).call(this)},Gv=function(e){h(this,Bv,"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("")},Jv=function(){h(this,Bv,"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)}))},Zv=function(){const[e,t]=Wv(h(this,qv,"f"),Number.parseInt(h(this,qv,"f").style.left,10),Number.parseInt(h(this,qv,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,qv,"f").style.top=`${t}px`,h(this,qv,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Yv);var Qv=Object.freeze({__proto__:null});const eb=e=>e.selectedRolesIds,tb=e=>e.notifications,nb=e=>e.tenantPermissions.data||[],ob=eu((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"})})))),rb=eu(eb,ob,((e,t)=>t.filter((t=>e.includes(t.name))))),ib=eu(eb,(e=>!!e.length)),sb=eu(eb,(e=>1===e.length)),ab=eu(rb,(e=>1===e.length?e[0].name:`${e.length} roles`)),db=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)}))}))},lb=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}}),cb=({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)})}}),ub=Jm("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),hb=db(ub)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},lb((e=>e.createRole)),cb({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>`}})),pb={action:ub,reducer:hb},fb=Jm("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),gb=db(fb)({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=[]}},lb((e=>e.deleteRole)),cb({getSuccessMsg:e=>pl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>pl(e.meta.arg.length)`Failed to delete role${["","s"]}`})),mb={action:fb,reducer:gb},vb=Jm("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),bb=db(vb)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},lb((e=>e.rolesList))),yb={action:vb,reducer:bb},wb=Jm("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),$b=db(wb)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},lb((e=>e.updateRole)),cb({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>`}})),Eb={action:wb,reducer:$b},kb=Jm("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),Cb={action:kb,reducer:db(kb)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},lb((e=>e.tenantPermissions)))},xb={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:[]},Ib="/v1/mgmt/role/search",Ob="/v1/mgmt/role/delete/batch",Sb="/v1/mgmt/role/create",jb="/v1/mgmt/role/update",Ab="/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)})),Nb=({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(Ib,{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(Ob,{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(Sb,{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(jb,{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}))}),Mb=({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(Ab,{queryParams:{tenant:t}});return yield Rb(o),o.json()}))}),Ub=gl((e=>{var t,n,o,r;const i=dl(vv,gv,cv,bv,mv({tenant:mv.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.100"}}));return{role:Nb({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Mb({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Tb=gl((e=>{const t=dl(Lv({name:"widget",initialState:xb,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{pb.reducer(e),Eb.reducer(e),mb.reducer(e),yb.reducer(e),Cb.reducer(e)},asyncActions:{searchRoles:yb.action,createRole:pb.action,updateRole:Eb.action,deleteRoles:mb.action,getTenantPermissions:Cb.action}}),fv,cv,Ub)(e);return class extends t{constructor(...e){super(...e),this.state=xb,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Db=gl((e=>{const t=dl(yv,mv({"widget-id":mv.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}))}}})),Pb=gl((e=>{var t,n,o;return o=class extends(dl(cv,fv,Sv,Rv,Db,Tb)(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=ll(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Lb=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Tb,Mv,_v,cv,Pb)(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=nb(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(ll(yield this.fetchWidgetPage("create-role-modal.html")));new Sl((()=>{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 Sl((()=>{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=gl((e=>{var t,n,o;return o=class extends(dl(cv,Lb,Pb)(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 Sl(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})),Wb=gl((e=>{var t,n,o;return o=class extends(dl(Tb,Mv,cv,Pb)(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(ll(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Sl((()=>{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 Sl((()=>{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=rb(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new Ul(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=ab(this.state);o.text=`Delete ${e}?`}}))},o})),Fb=gl((e=>{var t,n,o,r;return r=class extends(dl(cv,Pb,Tb,Wb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),ib)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Sl(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})),Vb=gl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(dl(Tb,Mv,cv,_v,Pb)(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=nb(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=rb(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 Sl((()=>{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 Sl((()=>{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=rb(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(ll(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})),qb=gl((e=>{var t,n,o,r;return r=class extends(dl(cv,Pb,Tb,Vb,_v)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),sb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Sl(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})),Bb=gl((e=>{var t,n,o,r;return r=class extends(dl(cv,Pb,Tb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,fl((()=>{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 Tl(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})),zb={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},Kb=gl((e=>{var t,n,o,r,i;return i=class extends(dl(cv,Tb,Tv,fv)(e)){constructor(){super(...arguments),t.add(this),r.set(this,hl((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),tb)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=zb[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})),Hb=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Tb,cv,Pb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((e=>{this.rolesTable.data=e}))),r.set(this,fl(((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,ob(this.state)),this.subscribe(h(this,o,"f").bind(this),ob)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Ol(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})),Gb=gl((e=>class extends(dl($v,Pv,Hb,_b,Fb,qb,Bb,Kb)(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)}))}})),Jb=dl((e=>class extends(Gb(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Jb);var Zb=Object.freeze({__proto__:null,default:Jb});((...e)=>{const t=Qc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(ic(e)?Wc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Yc);var Xb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Zl:Zl.apply(null,arguments)},Yb=e=>e&&"function"==typeof e.match;function Qb(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Ly(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=>Yl(t)&&t.type===e,n}function ey(e){return"function"==typeof e&&"type"in e&&Yb(e)}function ty(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 ny=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 oy(e){return sc(e)?qc(e,(()=>{})):e}function ry(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?Ly(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function iy(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function sy(e,t,n){const o=ay(e,t,n);return{detectMutations:()=>dy(e,t,o,n)}}function ay(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]=ay(e,t,n[r],s))}}return i}function dy(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=dy(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function ly(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Bl(e)}function cy(e,t="",n=ly,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=cy(l,a,n,o,r,i),s))return s}return i&&uy(e)&&i.add(e),!1}function uy(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!uy(t))return!1;return!0}function hy(e){return"boolean"==typeof e}var py=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new ny;if(t&&(hy(t)?i.push(ou):i.push(ru(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};hy(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=iy,ignoredPaths:r,warnAfter:i=32}=e;const s=sy.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=ty(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ly(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?Ly(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={};hy(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=ly,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(!Yl(u))return l(u);const h=l(u),p=ty(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=cy(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=cy(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={};hy(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ey}=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},fy=e=>t=>{setTimeout(t,e)},gy="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:fy(10),my=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new ny(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?gy:"callback"===e.type?e.queueNotification:fy(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},vy="production"===process.env.NODE_ENV;function by(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?Ly(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Ly(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?Ly(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Ly(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?Ly(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?Ly(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var yy=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function wy(...e){return t=>e.some((e=>((e,t)=>Yb(e)?e.match(t):e(t))(e,t)))}var $y=["name","message","stack","code"],Ey=class{constructor(e,t){this.payload=e,this.meta=t}_type},ky=class{constructor(e,t){this.payload=e,this.meta=t}_type},Cy=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of $y)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},xy=(()=>{function e(e,t,n){const o=Qb(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Qb(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Qb(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Cy)(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):yy(),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 Ey(e,t),fulfillWithValue:(e,t)=>new ky(e,t)})).then((t=>{if(t instanceof Ey)throw t;return t instanceof ky?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof Ey?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(Iy)})}}),{pending:r,rejected:i,fulfilled:o,settled:wy(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Iy(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Oy=Symbol.for("rtk-slice-createasyncthunk");function Sy(e,t){return`${e}/${t}`}function jy({creators:e}={}){const t=e?.asyncThunk?.[Oy];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Ly(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?Ly(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Ly(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?Ly(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?by(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?Ly(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]=by(t);if(function(e){return"function"==typeof e}(e))n=()=>oy(e());else{const t=oy(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(ic(e)){const o=n(e,t);return void 0===o?e:o}if(sc(e))return qc(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?Ly(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:Sy(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?Ly(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?Qb(e,s):Qb(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Ly(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||Ny,pending:a||Ny,rejected:d||Ny,settled:l||Ny})}(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?Ly(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=ry(c,n,{insert:()=>new WeakMap});return ry(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Ay(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 Ay(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?Ly(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Ry=jy();function Ny(){}var My="listenerMiddleware",Uy=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Qb(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?Ly(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?Ly(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Ty=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Uy(e);return{id:yy(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Ly(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Ty}),Dy=Object.assign(Qb(`${My}/add`),{withTypes:()=>Dy});Qb(`${My}/removeAll`);var Py=Object.assign(Qb(`${My}/remove`),{withTypes:()=>Py});function Ly(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"],Wy=gl((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})),Fy="undefined"!=typeof localStorage,Vy=Fy&&localStorage.getItem("base.content.url")||"",qy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,By=gl((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})),zy=gl((e=>{var t,n;const o=dl(Wy,By)(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})),Ky=e=>t=>{var n,o,r;const i=dl(Wy,By,zy)(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};Ky.missingAttrValidator=qy;const Hy=gl((e=>{const t=dl(Ky({"project-id":qy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Gy=gl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Jy=gl((e=>{const t=dl(Wy,Hy,Gy)(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(Vy||o||"https://static.descope.com/pages");return r.pathname=cl(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")}}})),Zy=gl((e=>{var t,n,o;const r=dl(Jy)(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})),Xy=gl((e=>{var t,n,o,r,i,s,a;return a=class extends(dl(By,Wy)(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 jw})),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})),Yy="load-descope-ui",Qy="base.ui.components.url",ew=Fy&&localStorage.getItem(Qy)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",tw=Fy&&localStorage.getItem(Qy)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",nw=e=>{const t=document.createElement("script");return t.id=e,t},ow=(e,t)=>e.replace("<version>",t),rw=gl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=dl(Wy,Zy)(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=nw("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=ow(tw,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#${Yy}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=nw(Yy);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=ow(ew,await h(this,t,"m",r).call(this))}return document.getElementById(Yy)},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})),iw="content-root",sw="root",aw=gl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${sw}, #${iw} {\n height: 100%;\n }\n #${sw} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${sw}">\n <div id="${iw}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(iw),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(sw)}})),dw="descope-modal",lw=gl((e=>{var t,n;const o=dl(By,aw,rw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Al{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(dw);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([dw]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),cw="descope-notification",uw=gl((e=>{var t,n;const o=dl(By,aw,rw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ml{setContent(t){const n="string"==typeof t?ll(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(cw);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([cw])}},t=new WeakMap,n})),hw=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',pw=gl((e=>{var t,n,o,r,i,s,a,d,l;const c=dl(Ky({theme:hw}),Jy,By,rw,Zy,aw,zy)(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(Qy)))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(Qy),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})),fw=e=>gl((t=>{const n=Ry(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(dl(Wy)(t)){constructor(...e){super(...e);const t=function(e){const t=py(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Bl(n))throw new Error("production"===process.env.NODE_ENV?Ly(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Jl(n)}if(!vy&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Ly(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!vy&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Ly(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!vy&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ly(4):"each middleware provided to configureStore must be a function");let l=Zl;r&&(l=Xb({trace:!vy,..."object"==typeof r&&r}));const c=Xl(...d),u=my(c);if(!vy&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Ly(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!vy&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Ly(6):"`enhancers` callback must return an array");if(!vy&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ly(7):"each enhancer provided to configureStore must be a function");return vy||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Hl(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{Iy(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()))))}}})),gw=gl((e=>class extends(Wy(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()}}));gl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const mw=(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 vw,bw,yw,ww,$w,Ew,kw,Cw,xw,Iw;const Ow=document.createElement("template");Ow.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 Sw extends HTMLElement{constructor(){var e;super(),vw.add(this),bw.set(this,new kl({messages:[]})),yw.set(this,void 0),ww.set(this,void 0),$w.set(this,void 0),Ew.set(this,{resize:h(this,vw,"m",Iw).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ow.content.cloneNode(!0)),p(this,yw,this.shadowRoot.querySelector(".debugger"),"f"),p(this,ww,h(this,yw,"f").querySelector(".content"),"f"),p(this,$w,h(this,yw,"f").querySelector(".header"),"f")}updateData(e){h(this,bw,"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]=mw(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,yw,"f"),h(this,$w,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Ew,"f").resize),(e=h(this,yw,"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,yw,"f").onresize=h(this,vw,"m",xw).bind(this),h(this,bw,"f").subscribe(h(this,vw,"m",kw).bind(this))}disconnectedCallback(){h(this,bw,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Ew,"f").resize)}}bw=new WeakMap,yw=new WeakMap,ww=new WeakMap,$w=new WeakMap,Ew=new WeakMap,vw=new WeakSet,kw=function(e){h(this,vw,"m",Cw).call(this,e),h(this,vw,"m",xw).call(this)},Cw=function(e){h(this,ww,"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("")},xw=function(){h(this,ww,"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)}))},Iw=function(){const[e,t]=mw(h(this,yw,"f"),Number.parseInt(h(this,yw,"f").style.left,10),Number.parseInt(h(this,yw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,yw,"f").style.top=`${t}px`,h(this,yw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Sw);var jw=Object.freeze({__proto__:null});const Aw=e=>e.selectedAccessKeysIds,Rw=e=>e.notifications,Nw=eu((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}))))),Mw=eu(Aw,Nw,((e,t)=>t.filter((t=>e.includes(t.id))))),Uw=eu(Aw,(e=>!!e.length)),Tw=eu(Mw,(e=>e.every((e=>e.editable)))),Dw=eu(Tw,Uw,((e,t)=>e&&t));eu(Aw,(e=>1===e.length));const Pw=eu(Mw,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Lw=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}}),Ww=({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)})}}),Fw=xy("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),Vw=Lw(Fw)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},_w((e=>e.createAccessKey)),Ww({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>`}})),qw={action:Fw,reducer:Vw},Bw=xy("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),zw=Lw(Bw)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},_w((e=>e.deleteAccessKey)),Ww({getSuccessMsg:e=>pl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>pl(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),Kw={action:Bw,reducer:zw},Hw=xy("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),Gw=Lw(Hw)({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))),Jw={action:Hw,reducer:Gw},Zw=xy("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),Xw=Lw(Zw)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},_w((e=>e.activateAccessKey)),Ww({getSuccessMsg:e=>pl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>pl(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),Yw={action:Zw,reducer:Xw},Qw=xy("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),e$=Lw(Qw)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},_w((e=>e.deactivateAccessKey)),Ww({getSuccessMsg:e=>pl(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>pl(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),t$={action:Qw,reducer:e$},n$=xy("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),o$={action:n$,reducer:Lw(n$)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},_w((e=>e.tenantRoles)))},r$={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:[]},i$="/v1/mgmt/accesskey/search",s$="/v1/mgmt/accesskey/delete/batch",a$="/v1/mgmt/accesskey/create",d$="/v1/mgmt/accesskey/deactivate/batch",l$="/v1/mgmt/accesskey/activate/batch",c$="/v1/mgmt/role/all",u$=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)})),h$=({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(i$,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield u$(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(s$,{ids:o},{queryParams:{tenant:t}});return yield u$(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(a$,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield u$(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(l$,{ids:o},{queryParams:{tenant:t}});return yield u$(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(d$,{ids:o},{queryParams:{tenant:t}});return yield u$(r),yield r.json()}))}),p$=({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(c$,{queryParams:{tenant:t}});return yield u$(o),o.json()}))}),f$=gl((e=>{var t,n,o,r;const i=dl(Hy,zy,Wy,Gy,Ky({tenant:Ky.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.102"}}));return{accesskey:h$({httpClient:r.httpClient,tenant:t,mock:n}),tenant:p$({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),g$=gl((e=>{const t=dl(fw({name:"widget",initialState:r$,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{qw.reducer(e),Kw.reducer(e),Jw.reducer(e),Yw.reducer(e),t$.reducer(e),o$.reducer(e)},asyncActions:{searchAccessKeys:Jw.action,createAccessKey:qw.action,activateAccessKeys:Yw.action,deactivateAccessKeys:t$.action,deleteAccessKeys:Kw.action,getTenantRoles:o$.action}}),By,Wy,f$)(e);return class extends t{constructor(...e){super(...e),this.state=r$,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),m$=gl((e=>{const t=dl(Jy,Ky({"widget-id":Ky.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}))}}})),v$=gl((e=>{var t,n,o;return o=class extends(dl(Wy,By,rw,aw,m$,g$)(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=ll(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),b$=gl((e=>{var t,n,o,r,i;return i=class extends(dl(g$,Wy,v$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((e=>{this.accessKeysTable.data=e}))),r.set(this,fl(((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,Nw(this.state)),this.subscribe(h(this,o,"f").bind(this),Nw)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Ol(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})),y$=gl((e=>{var t,n,o;return o=class extends(dl(g$,lw,Wy,v$)(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(ll(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Sl((()=>{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 Sl((()=>{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=Mw(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new Ul(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Pw(this.state);o.text=`Activate ${e}?`}}))},o})),w$=gl((e=>{var t,n,o,r;return r=class extends(dl(Wy,v$,g$,y$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),Dw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Sl(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})),$$=gl((e=>{var t,n,o;return o=class extends(dl(g$,lw,gw,Wy,v$)(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(ll(yield this.fetchWidgetPage("created-access-key-modal.html")));new Sl((()=>{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})),E$=gl((e=>{var t,n,o,r,i;return i=class extends(dl(g$,lw,gw,Wy,v$,$$)(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(ll(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Sl((()=>{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 Sl((()=>{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})),k$=gl((e=>{var t,n,o;return o=class extends(dl(Wy,E$,v$)(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 Sl(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})),C$=gl((e=>{var t,n,o;return o=class extends(dl(g$,lw,Wy,v$)(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(ll(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Sl((()=>{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 Sl((()=>{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=Mw(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new Ul(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Pw(this.state);o.text=`Deactivate ${e}?`}}))},o})),x$=gl((e=>{var t,n,o,r;return r=class extends(dl(Wy,v$,g$,C$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),Dw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Sl(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})),I$=gl((e=>{var t,n,o;return o=class extends(dl(g$,lw,Wy,v$)(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(ll(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Sl((()=>{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 Sl((()=>{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=Mw(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new Ul(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Pw(this.state);o.text=`Delete ${e}?`}}))},o})),O$=gl((e=>{var t,n,o,r;return r=class extends(dl(Wy,v$,g$,I$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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),Dw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Sl(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})),S$=gl((e=>{var t,n,o,r;return r=class extends(dl(Wy,v$,g$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,fl((()=>{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 Tl(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})),j$={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},A$=gl((e=>{var t,n,o,r,i;return i=class extends(dl(Wy,g$,uw,By)(e)){constructor(){super(...arguments),t.add(this),r.set(this,hl((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=j$[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$=gl((e=>class extends(dl(Xy,pw,b$,k$,O$,S$,w$,x$,A$)(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)}))}})),N$=dl((e=>class extends(R$(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",N$);var M$=Object.freeze({__proto__:null,default:N$});((...e)=>{const t=Qc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(ic(e)?Wc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Yc);var U$="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Zl:Zl.apply(null,arguments)},T$=e=>e&&"function"==typeof e.match;function D$(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?$E(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=>Yl(t)&&t.type===e,n}function P$(e){return"function"==typeof e&&"type"in e&&T$(e)}function L$(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 W$(e){return sc(e)?qc(e,(()=>{})):e}function F$(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?$E(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function V$(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function q$(e,t,n){const o=B$(e,t,n);return{detectMutations:()=>z$(e,t,o,n)}}function B$(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]=B$(e,t,n[r],s))}}return i}function z$(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=z$(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function K$(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Bl(e)}function H$(e,t="",n=K$,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=H$(l,a,n,o,r,i),s))return s}return i&&G$(e)&&i.add(e),!1}function G$(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!G$(t))return!1;return!0}function J$(e){return"boolean"==typeof e}var Z$=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new _$;if(t&&(J$(t)?i.push(ou):i.push(ru(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};J$(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=V$,ignoredPaths:r,warnAfter:i=32}=e;const s=q$.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=L$(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?$E(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?$E(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={};J$(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=K$,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(!Yl(u))return l(u);const h=l(u),p=L$(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=H$(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=H$(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={};J$(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=P$}=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},X$=e=>t=>{setTimeout(t,e)},Y$="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:X$(10),Q$=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?Y$:"callback"===e.type?e.queueNotification:X$(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},eE="production"===process.env.NODE_ENV;function tE(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?$E(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?$E(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?$E(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?$E(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?$E(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?$E(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var nE=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function oE(...e){return t=>e.some((e=>((e,t)=>T$(e)?e.match(t):e(t))(e,t)))}var rE=["name","message","stack","code"],iE=class{constructor(e,t){this.payload=e,this.meta=t}_type},sE=class{constructor(e,t){this.payload=e,this.meta=t}_type},aE=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of rE)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},dE=(()=>{function e(e,t,n){const o=D$(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=D$(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=D$(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||aE)(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):nE(),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 iE(e,t),fulfillWithValue:(e,t)=>new sE(e,t)})).then((t=>{if(t instanceof iE)throw t;return t instanceof sE?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof iE?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(lE)})}}),{pending:r,rejected:i,fulfilled:o,settled:oE(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function lE(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var cE=Symbol.for("rtk-slice-createasyncthunk");function uE(e,t){return`${e}/${t}`}function hE({creators:e}={}){const t=e?.asyncThunk?.[cE];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?$E(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?$E(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?$E(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?$E(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?tE(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?$E(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]=tE(t);if(function(e){return"function"==typeof e}(e))n=()=>W$(e());else{const t=W$(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(ic(e)){const o=n(e,t);return void 0===o?e:o}if(sc(e))return qc(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?$E(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:uE(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?$E(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?D$(e,s):D$(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?$E(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||gE,pending:a||gE,rejected:d||gE,settled:l||gE})}(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?$E(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=F$(c,n,{insert:()=>new WeakMap});return F$(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=pE(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 pE(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?$E(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var fE=hE();function gE(){}var mE="listenerMiddleware",vE=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=D$(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?$E(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?$E(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},bE=Object.assign((e=>{const{type:t,predicate:n,effect:o}=vE(e);return{id:nE(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?$E(22):"Unsubscribe not initialized")}}}),{withTypes:()=>bE}),yE=Object.assign(D$(`${mE}/add`),{withTypes:()=>yE});D$(`${mE}/removeAll`);var wE=Object.assign(D$(`${mE}/remove`),{withTypes:()=>wE});function $E(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 EE=["error","warn","info","debug"],kE=gl((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 EE.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})),CE="undefined"!=typeof localStorage,xE=CE&&localStorage.getItem("base.content.url")||"",IE=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,OE=gl((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})),SE=gl((e=>{var t,n;const o=dl(kE,OE)(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})),jE=e=>t=>{var n,o,r;const i=dl(kE,OE,SE)(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};jE.missingAttrValidator=IE;const AE=gl((e=>{const t=dl(jE({"project-id":IE}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),RE=gl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const NE=gl((e=>{const t=dl(kE,AE,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(xE||o||"https://static.descope.com/pages");return r.pathname=cl(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")}}})),ME=gl((e=>{var t,n,o;const r=dl(NE)(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})),UE=gl((e=>{var t,n,o,r,i,s,a;return a=class extends(dl(OE,kE)(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 lk})),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})),TE="load-descope-ui",DE="base.ui.components.url",PE=CE&&localStorage.getItem(DE)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",LE=CE&&localStorage.getItem(DE)||"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},WE=(e,t)=>e.replace("<version>",t),FE=gl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=dl(kE,ME)(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=WE(LE,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#${TE}`))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(TE);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=WE(PE,await h(this,t,"m",r).call(this))}return document.getElementById(TE)},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})),VE="content-root",qE="root",BE=gl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${qE}, #${VE} {\n height: 100%;\n }\n #${qE} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${qE}">\n <div id="${VE}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(VE),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(qE)}})),zE="descope-modal";gl((e=>{var t,n;const o=dl(OE,BE,FE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Al{setContent(t){e(t),super.setContent(t)}}})())}createModal(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;this.loadDescopeUiComponents([zE]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const KE="descope-notification";gl((e=>{var t,n;const o=dl(OE,BE,FE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ml{setContent(t){const n="string"==typeof t?ll(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(KE);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([KE])}},t=new WeakMap,n}));const HE=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',GE=gl((e=>{var t,n,o,r,i,s,a,d,l;const c=dl(jE({theme:HE}),NE,OE,FE,ME,BE,SE)(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(DE)))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(DE),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})),JE=e=>gl((t=>{const n=fE(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(dl(kE)(t)){constructor(...e){super(...e);const t=function(e){const t=Z$(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Bl(n))throw new Error("production"===process.env.NODE_ENV?$E(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Jl(n)}if(!eE&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?$E(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!eE&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?$E(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!eE&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?$E(4):"each middleware provided to configureStore must be a function");let l=Zl;r&&(l=U$({trace:!eE,..."object"==typeof r&&r}));const c=Xl(...d),u=Q$(c);if(!eE&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?$E(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!eE&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?$E(6):"`enhancers` callback must return an array");if(!eE&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?$E(7):"each enhancer provided to configureStore must be a function");return eE||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Hl(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{lE(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()))))}}}));gl((e=>class extends(kE(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()}})),gl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const ZE=(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 XE,YE,QE,ek,tk,nk,ok,rk,ik,sk;const ak=document.createElement("template");ak.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 dk extends HTMLElement{constructor(){var e;super(),XE.add(this),YE.set(this,new kl({messages:[]})),QE.set(this,void 0),ek.set(this,void 0),tk.set(this,void 0),nk.set(this,{resize:h(this,XE,"m",sk).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(ak.content.cloneNode(!0)),p(this,QE,this.shadowRoot.querySelector(".debugger"),"f"),p(this,ek,h(this,QE,"f").querySelector(".content"),"f"),p(this,tk,h(this,QE,"f").querySelector(".header"),"f")}updateData(e){h(this,YE,"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]=ZE(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,QE,"f"),h(this,tk,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,nk,"f").resize),(e=h(this,QE,"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,QE,"f").onresize=h(this,XE,"m",ik).bind(this),h(this,YE,"f").subscribe(h(this,XE,"m",ok).bind(this))}disconnectedCallback(){h(this,YE,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,nk,"f").resize)}}YE=new WeakMap,QE=new WeakMap,ek=new WeakMap,tk=new WeakMap,nk=new WeakMap,XE=new WeakSet,ok=function(e){h(this,XE,"m",rk).call(this,e),h(this,XE,"m",ik).call(this)},rk=function(e){h(this,ek,"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("")},ik=function(){h(this,ek,"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)}))},sk=function(){const[e,t]=ZE(h(this,QE,"f"),Number.parseInt(h(this,QE,"f").style.left,10),Number.parseInt(h(this,QE,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,QE,"f").style.top=`${t}px`,h(this,QE,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",dk);var lk=Object.freeze({__proto__:null});const ck=e=>e.selectedAuditId,uk=eu((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"})))));eu(ck,uk,((e,t)=>t.find((t=>e===t.id)))),eu(ck,(e=>!!e));const hk=dE("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),pk=(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)}))}))})(hk)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(fk=e=>e.auditList,{onFulfilled:e=>{fk(e).loading=!1},onPending:e=>{fk(e).loading=!0,fk(e).error=null},onRejected:(e,t)=>{fk(e).loading=!1,fk(e).error=t.error}}));var fk;const gk={action:hk,reducer:pk},mk={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},vk="/v1/mgmt/audit/search",bk=({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(vk,{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}))}),yk=gl((e=>{var t,n,o,r;const i=dl(AE,SE,kE,RE,jE({tenant:jE.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.65"}}));return{audit:bk({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),wk=gl((e=>{const t=dl(JE({name:"widget",initialState:mk,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{gk.reducer(e)},asyncActions:{searchAudit:gk.action}}),OE,kE,yk)(e);return class extends t{constructor(...e){super(...e),this.state=mk,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),$k=gl((e=>{const t=dl(NE,jE({"widget-id":jE.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}))}}})),Ek=gl((e=>{var t,n,o;return o=class extends(dl(kE,OE,FE,BE,$k,wk)(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=ll(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),kk=gl((e=>{var t,n,o,r,i;return i=class extends(dl(kE,Ek,wk)(e)){constructor(){super(...arguments),t.add(this),n.set(this,fl((()=>{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 Tl(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 Nl(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})),Ck=gl((e=>{var t,n,o,r;return r=class extends(dl(wk,kE,Ek)(e)){constructor(){super(...arguments),t.add(this),o.set(this,hl((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,uk(this.state)),this.subscribe(h(this,o,"f").bind(this),uk)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Ol(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})),xk=gl((e=>class extends(dl(UE,GE,Ck,kk)(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)}))}})),Ik=dl((e=>class extends(xk(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Ik);var Ok=Object.freeze({__proto__:null,default:Ik});const Sk="undefined"!=typeof localStorage,jk=Sk&&localStorage.getItem("base.content.url")||"",Ak="config.json",Rk="base.ui.components.url",Nk=Sk&&localStorage.getItem(Rk)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Mk=Sk&&localStorage.getItem(Rk)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Uk="descope-login-flow",Tk="code",Dk="ra-challenge",Pk="ra-callback",Lk="ra-backup-callback",_k="ra-initiator",Wk="data-exclude-field",Fk="dls_last_auth",Vk="state_id",qk="saml_idp_state_id",Bk="saml_idp_username",zk="descope_idp_initiated",Kk="sso_app_id",Hk="oidc_login_hint",Gk="data-type",Jk="poll",Zk="webauthnCreate",Xk="submit",Yk="polling",Qk=["descope-multi-select-combo-box","descope-text-area"];var eC;function tC(e){return new URLSearchParams(window.location.search).get(e)}function nC(e){if(window.history.replaceState&&tC(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 oC(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 rC({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(jk||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function iC(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?eC.forward:n<o?eC.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(eC||(eC={}));const sC=()=>{const[e="",t=""]=(tC(Uk)||"").split("_");return{executionId:e,stepId:t}};function aC(){nC(Uk)}const dC=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),lC=()=>{const{executionId:e,stepId:t}=sC();(e||t)&&aC();const n=tC("t")||void 0;n&&nC("t");const o=tC(Tk)||void 0;o&&nC(Tk);const r=tC("err")||void 0;r&&nC("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:tC(Dk),redirectAuthCallbackUrl:tC(Pk),redirectAuthBackupCallbackUri:tC(Lk),redirectAuthInitiator:tC(_k)};(i||s||a||d)&&(nC(Dk),nC(Pk),nC(Lk),nC(_k));const l=tC(Vk);l&&nC(Vk);const c=tC(qk);c&&nC(qk);const u=tC(Bk);c&&nC(Bk);const h=tC(zk);h&&nC(zk);const p=tC(Kk);p&&nC(Kk);const f=tC(Hk);return f&&nC(Hk),{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}},cC=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}},uC=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,hC=e=>null==e?void 0:e.submit(),pC=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},fC=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function gC(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var mC,vC,bC,yC;function wC(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(!wC(i,s))return!1}else if(i!==s)return!1}return!0}class $C{constructor(e={},{updateOnlyOnChange:t=!0}={}){mC.set(this,void 0),vC.set(this,{}),bC.set(this,0),yC.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,mC,"f")):e,n=Object.assign(Object.assign({},h(this,mC,"f")),t);if(!h(this,yC,"f")||!wC(h(this,mC,"f"),n)){const e=h(this,mC,"f");p(this,mC,n,"f"),Object.freeze(h(this,mC,"f")),setTimeout((()=>{Object.values(h(this,vC,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,mC,e,"f"),p(this,yC,t,"f")}get current(){return Object.assign({},h(this,mC,"f"))}subscribe(e){return p(this,bC,h(this,bC,"f")+1,"f"),h(this,vC,"f")[h(this,bC,"f")]=e,h(this,bC,"f").toString()}unsubscribe(e){const t=!!h(this,vC,"f")[e];return t&&delete h(this,vC,"f")[e],t}unsubscribeAll(){return p(this,vC,{},"f"),!0}}mC=new WeakMap,vC=new WeakMap,bC=new WeakMap,yC=new WeakMap;const EC=["disabled"],kC=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Wk}])`)).forEach((e=>{e.value=n}))}))},CC=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),xC=(e,t,n)=>{e.querySelectorAll(`[${Gk}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},IC=(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})`))},OC=cC((()=>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}})))),SC={"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 jC(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Fk)))}catch(e){}return t}const AC="dls_ab_testing_id",RC=document.createElement("template");var NC,MC,UC,TC,DC,PC,LC,_C,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,Sx;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 jx 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(),NC.add(this),this.logger=console,MC.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,NC,"m",sx).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)}},UC.set(this,new $C({deferredRedirect:!1})),TC.set(this,new $C),DC.set(this,{}),this.getComponentsContext=()=>h(this,DC,"f"),this.nextRequestStatus=new $C({isLoading:!1}),PC.set(this,void 0),LC.set(this,{popstate:h(this,NC,"m",BC).bind(this),visibilitychange:h(this,NC,"m",zC).bind(this),componentsContext:h(this,NC,"m",nx).bind(this)}),_C.set(this,void 0),ZC.set(this,cC((()=>u(this,void 0,void 0,(function*(){const e=rC({projectId:this.projectId,filename:Ak,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield oC(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),YC.set(this,void 0),p(this,_C,e,"f"),h(this,NC,"m",WC).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 h(this,ZC,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,ZC,"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,TC,"f").subscribe(h(this,NC,"m",ix).bind(this)),h(this,TC,"f").update({isDebug:this.debug}),h(this,NC,"m",FC).call(this))return void h(this,NC,"m",VC).call(this);if(h(this,NC,"m",qC).call(this),p(this,YC,h(this,NC,"m",XC).call(this),"f"),yield h(this,NC,"m",GC).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,ZC,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,NC,"m",QC).call(this),yield h(this,NC,"m",lx).call(this),yield h(this,NC,"m",ex).call(this),h(this,NC,"m",ax).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}=lC();window.addEventListener("popstate",h(this,LC,"f").popstate),window.addEventListener("components-context",h(this,LC,"f").componentsContext),window.addEventListener("visibilitychange",h(this,LC,"f").visibilitychange),h(this,UC,"f").subscribe(h(this,NC,"m",HC).bind(this)),h(this,UC,"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,MC,!0,"f")}}))}disconnectedCallback(){h(this,UC,"f").unsubscribeAll(),h(this,TC,"f").unsubscribeAll(),h(this,NC,"m",rx).call(this),window.removeEventListener("popstate",h(this,LC,"f").popstate),window.removeEventListener("visibilitychange",h(this,LC,"f").visibilitychange),window.removeEventListener("components-context",h(this,LC,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,MC,"f")&&t!==n&&jx.observedAttributes.includes(e)){h(this,NC,"m",qC).call(this);const o=null===t;h(this,UC,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,aC()),{[dC(e)]:n,stepId:i,executionId:s}})),h(this,TC,"f").update({isDebug:this.debug})}}}MC=new WeakMap,UC=new WeakMap,TC=new WeakMap,DC=new WeakMap,PC=new WeakMap,LC=new WeakMap,_C=new WeakMap,ZC=new WeakMap,YC=new WeakMap,NC=new WeakSet,WC=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(RC.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},FC=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},VC=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)},qC=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(jx.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[dC(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')},BC=function(){const{stepId:e,executionId:t}=sC();h(this,UC,"f").update({stepId:e,executionId:t})},zC=function(){document.hidden||setTimeout((()=>{h(this,UC,"f").update({deferredRedirect:!1})}),300)},KC=function(e,t){this.sdk=so(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout},jx.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})}}))}))},HC=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,NC,"m",KC).call(this,t,o)}h(this,_C,"f").call(this,e)}))},GC=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,ZC,"f").call(this)).isMissingConfig&&(yield h(this,NC,"m",JC).call(this))}))},JC=function(){return u(this,void 0,void 0,(function*(){const e=rC({projectId:this.projectId,filename:Ak,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield oC(e,"json"),!0}catch(e){return!1}}))},XC=function(){return u(this,void 0,void 0,(function*(){const e=rC({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield oC(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},QC=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,ZC,"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)))}))},ex=function(){return u(this,void 0,void 0,(function*(){yield h(this,NC,"m",tx).call(this),yield h(this,NC,"m",ox).call(this)}))},tx=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield h(this,YC,"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 jx.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)}))},nx=function(e){p(this,DC,Object.assign(Object.assign({},h(this,DC,"f")),e.detail),"f")},ox=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield jx.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},rx=function(){var e;null===(e=h(this,PC,"f"))||void 0===e||e.remove(),p(this,PC,null,"f")},ix=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,PC,document.createElement("descope-debugger"),"f"),Object.assign(h(this,PC,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return bS})),document.body.appendChild(h(this,PC,"f"))):h(this,NC,"m",rx).call(this)}))},sx=function(e,t){var n;e&&this.debug&&(null===(n=h(this,PC,"f"))||void 0===n||n.updateData({title:e,description:t}))},ax=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=Qk.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()}}},dx=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,ZC,"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")}))},lx=function(){return u(this,void 0,void 0,(function*(){jx.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):jx.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,NC,"m",dx).call(this),i=t(n(Nk,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Mk,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},jx.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.18.1"}};class Ax extends jx{static set sdkConfigOverrides(e){jx.sdkConfigOverrides=e}constructor(){const e=new $C;super(e.update.bind(e)),cx.add(this),this.stepState=new $C({},{updateOnlyOnChange:!1}),ux.set(this,void 0),hx.set(this,null),px.set(this,((e,t,n,o,r)=>{n===Jk&&p(this,ux,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,Yk,o,r,{});h(this,gx,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,px,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),fx.set(this,(()=>{clearTimeout(h(this,ux,"f")),p(this,ux,null,"f")})),gx.set(this,(e=>{var t,n,o,r,i,s,a,d,l,c,u;if(!(null==e?void 0:e.ok)){h(this,cx,"m",Sx).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 p=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}`,`${p?`${p} - `:""}${e.data.error.message}`):p&&this.loggerWrapper.error(p);const{status:f,authInfo:g,lastAuth:m}=e.data;if("completed"===f)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&Sk&&localStorage.setItem(Fk,JSON.stringify(e))}(m),void h(this,cx,"m",Sx).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!==Jk?(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})})),mx.set(this,cC((()=>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)}}))))),Cx.set(this,fC(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,cx,"m",wx).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,cx,"m",Ex).call(this,e);const r=yield h(this,cx,"m",$x).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,gx,"f").call(this,c),h(this,cx,"m",kx).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,hx,"f"))||void 0===e||e.abort(),p(this,hx,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=gC(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 oC(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 oC(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:A,descopeIdpInitiated:R,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,L;const _=(()=>{const e=localStorage.getItem(AC);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(AC,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(Pn),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=SC[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=SC[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,!uC(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:jC(W),abTestingKey:_,locale:gC(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 h(this,gx,"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,Xk,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return h(this,gx,"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||"",hC)}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===Zk||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=h(this,hx,"f"))||void 0===r||r.abort(),p(this,hx,null,"f");try{e=c===Zk?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,Xk,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});h(this,gx,"f").call(this,n)}if(h(this,px,"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:iC(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:rC({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&rC({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:A,oidcLoginHint:D,openInNewTabUrl:m},H=jC(W);uC(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:gC(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 jx.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,cx,"m",yx).call(this,p,a):p.querySelectorAll(`descope-button[${Gk}="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(`[${Gk}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),xC(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),xC(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=CC(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",CC(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=CC(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])=>{EC.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,IC(r,"descope-totp-image",i),((e,t)=>{IC(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)=>{kC(e,null==t?void 0:t.inputs),kC(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=>h(this,cx,"m",bx).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,cx,"m",Ix).call(this,a),s&&h(this,cx,"m",Sx).call(this,"ready",{}),h(this,cx,"m",Sx).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Gk}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(Yk,e.version,t.componentsVersion,{});h(this,gx,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?h(this,cx,"m",Ox).call(this,m,s):m()}))}}ux=new WeakMap,hx=new WeakMap,px=new WeakMap,fx=new WeakMap,gx=new WeakMap,mx=new WeakMap,Cx=new WeakMap,cx=new WeakSet,vx=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)}))}},bx=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)}))},yx=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,hx,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield OC())){const{options:e,transactionId:n}=(yield h(this,mx,"f").call(this))||{};if(e&&n){h(this,cx,"m",vx).call(this,o),p(this,hx,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,hx,"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,gx,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},wx=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},$x=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Wk}])`));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})),{})}))},Ex=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},kx=function(e={}){var t,n;const o=pC(e,["externalId","email","phone"]),r=pC(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)}},xx=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,Cx,"f").call(this,t,e)}))}))},Ix=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,Cx,"f").call(this,t,e)}})),h(this,cx,"m",xx).call(this,e)},Ox=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===eC.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")},Sx=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",Ax);((...e)=>{const t=Qc(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(ic(e)?Wc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(Yc);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]?Zl:Zl.apply(null,arguments)},Nx=e=>e&&"function"==typeof e.match;function Mx(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?bI(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=>Yl(t)&&t.type===e,n}function Ux(e){return"function"==typeof e&&"type"in e&&Nx(e)}function Tx(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 Dx=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 Px(e){return sc(e)?qc(e,(()=>{})):e}function Lx(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?bI(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 Wx(e,t,n){const o=Fx(e,t,n);return{detectMutations:()=>Vx(e,t,o,n)}}function Fx(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]=Fx(e,t,n[r],s))}}return i}function Vx(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=Vx(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function qx(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Bl(e)}function Bx(e,t="",n=qx,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=Bx(l,a,n,o,r,i),s))return s}return i&&zx(e)&&i.add(e),!1}function zx(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!zx(t))return!1;return!0}function Kx(e){return"boolean"==typeof e}var Hx=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Dx;if(t&&(Kx(t)?i.push(ou):i.push(ru(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Kx(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=Wx.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Tx(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?bI(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?bI(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={};Kx(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=qx,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(!Yl(u))return l(u);const h=l(u),p=Tx(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Bx(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=Bx(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={};Kx(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Ux}=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},Gx=e=>t=>{setTimeout(t,e)},Jx="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Gx(10),Zx=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Dx(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?Jx:"callback"===e.type?e.queueNotification:Gx(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},Xx="production"===process.env.NODE_ENV;function Yx(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?bI(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?bI(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?bI(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?bI(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?bI(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?bI(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Qx=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function eI(...e){return t=>e.some((e=>((e,t)=>Nx(e)?e.match(t):e(t))(e,t)))}var tI=["name","message","stack","code"],nI=class{constructor(e,t){this.payload=e,this.meta=t}_type},oI=class{constructor(e,t){this.payload=e,this.meta=t}_type},rI=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of tI)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},iI=(()=>{function e(e,t,n){const o=Mx(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Mx(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Mx(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||rI)(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):Qx(),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 nI(e,t),fulfillWithValue:(e,t)=>new oI(e,t)})).then((t=>{if(t instanceof nI)throw t;return t instanceof oI?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof nI?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(sI)})}}),{pending:r,rejected:i,fulfilled:o,settled:eI(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function sI(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var aI=Symbol.for("rtk-slice-createasyncthunk");function dI(e,t){return`${e}/${t}`}function lI({creators:e}={}){const t=e?.asyncThunk?.[aI];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?bI(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?bI(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?bI(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?bI(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?Yx(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?bI(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]=Yx(t);if(function(e){return"function"==typeof e}(e))n=()=>Px(e());else{const t=Px(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(ic(e)){const o=n(e,t);return void 0===o?e:o}if(sc(e))return qc(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?bI(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:dI(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?bI(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?Mx(e,s):Mx(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?bI(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||hI,pending:a||hI,rejected:d||hI,settled:l||hI})}(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?bI(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Lx(c,n,{insert:()=>new WeakMap});return Lx(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=cI(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 cI(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?bI(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var uI=lI();function hI(){}var pI="listenerMiddleware",fI=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Mx(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?bI(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?bI(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},gI=Object.assign((e=>{const{type:t,predicate:n,effect:o}=fI(e);return{id:Qx(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?bI(22):"Unsubscribe not initialized")}}}),{withTypes:()=>gI}),mI=Object.assign(Mx(`${pI}/add`),{withTypes:()=>mI});Mx(`${pI}/removeAll`);var vI=Object.assign(Mx(`${pI}/remove`),{withTypes:()=>vI});function bI(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 yI=["error","warn","info","debug"],wI=gl((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 yI.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})),$I="undefined"!=typeof localStorage,EI=$I&&localStorage.getItem("base.content.url")||"",kI=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,CI=gl((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})),xI=gl((e=>{var t,n;const o=dl(wI,CI)(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})),II=e=>t=>{var n,o,r;const i=dl(wI,CI,xI)(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};II.missingAttrValidator=kI;const OI=gl((e=>{const t=dl(II({"project-id":kI}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),SI=gl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const jI=gl((e=>{const t=dl(wI,OI,SI)(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(EI||o||"https://static.descope.com/pages");return r.pathname=cl(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")}}})),AI=gl((e=>{var t,n,o;const r=dl(jI)(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=gl((e=>{var t,n,o,r,i,s,a;return a=class extends(dl(CI,wI)(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 dO})),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})),NI="load-descope-ui",MI="base.ui.components.url",UI=$I&&localStorage.getItem(MI)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",TI=$I&&localStorage.getItem(MI)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",DI=e=>{const t=document.createElement("script");return t.id=e,t},PI=(e,t)=>e.replace("<version>",t),LI=gl((e=>{var t,n,o,r,i,s,a,d,l,c,u,f;const g=dl(wI,AI)(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=DI("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=PI(TI,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#${NI}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=DI(NI);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=PI(UI,await h(this,t,"m",r).call(this))}return document.getElementById(NI)},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",WI="root",FI=gl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${WI}, #${_I} {\n height: 100%;\n }\n #${WI} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${WI}">\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(WI)}})),VI="descope-modal",qI=gl((e=>{var t,n;const o=dl(CI,FI,LI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Al{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(VI);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([VI]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),BI="descope-notification";gl((e=>{var t,n;const o=dl(CI,FI,LI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ml{setContent(t){const n="string"==typeof t?ll(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(BI);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([BI])}},t=new WeakMap,n}));const zI=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',KI=gl((e=>{var t,n,o,r,i,s,a,d,l;const c=dl(II({theme:zI}),jI,CI,LI,AI,FI,xI)(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(MI)))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(MI),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})),HI=e=>gl((t=>{const n=uI(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(dl(wI)(t)){constructor(...e){super(...e);const t=function(e){const t=Hx(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Bl(n))throw new Error("production"===process.env.NODE_ENV?bI(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Jl(n)}if(!Xx&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?bI(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Xx&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?bI(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Xx&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?bI(4):"each middleware provided to configureStore must be a function");let l=Zl;r&&(l=Rx({trace:!Xx,..."object"==typeof r&&r}));const c=Xl(...d),u=Zx(c);if(!Xx&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?bI(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Xx&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?bI(6):"`enhancers` callback must return an array");if(!Xx&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?bI(7):"each enhancer provided to configureStore must be a function");return Xx||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Hl(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{sI(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()))))}}}));gl((e=>class extends(wI(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 GI=gl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}})),JI=(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 ZI,XI,YI,QI,eO,tO,nO,oO,rO,iO;const sO=document.createElement("template");sO.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 aO extends HTMLElement{constructor(){var e;super(),ZI.add(this),XI.set(this,new kl({messages:[]})),YI.set(this,void 0),QI.set(this,void 0),eO.set(this,void 0),tO.set(this,{resize:h(this,ZI,"m",iO).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sO.content.cloneNode(!0)),p(this,YI,this.shadowRoot.querySelector(".debugger"),"f"),p(this,QI,h(this,YI,"f").querySelector(".content"),"f"),p(this,eO,h(this,YI,"f").querySelector(".header"),"f")}updateData(e){h(this,XI,"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]=JI(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,YI,"f"),h(this,eO,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,tO,"f").resize),(e=h(this,YI,"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,YI,"f").onresize=h(this,ZI,"m",rO).bind(this),h(this,XI,"f").subscribe(h(this,ZI,"m",nO).bind(this))}disconnectedCallback(){h(this,XI,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,tO,"f").resize)}}XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,eO=new WeakMap,tO=new WeakMap,ZI=new WeakSet,nO=function(e){h(this,ZI,"m",oO).call(this,e),h(this,ZI,"m",rO).call(this)},oO=function(e){h(this,QI,"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("")},rO=function(){h(this,QI,"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)}))},iO=function(){const[e,t]=JI(h(this,YI,"f"),Number.parseInt(h(this,YI,"f").style.left,10),Number.parseInt(h(this,YI,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,YI,"f").style.top=`${t}px`,h(this,YI,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",aO);var dO=Object.freeze({__proto__:null});const lO=e=>e.me.data,cO=eu(lO,(e=>e.picture)),uO=eu(lO,(e=>e.email)),hO=eu(lO,(e=>e.verifiedEmail)),pO=eu(lO,(e=>e.name)),fO=eu(lO,(e=>e.phone)),gO=eu(lO,(e=>e.verifiedPhone)),mO=eu(lO,(e=>e.webauthn));eu(lO,(e=>e.password));const vO=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)}))}))},bO=iI("users/me",((e,{extra:{api:t}})=>t.user.me())),yO=vO(bO)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(wO=e=>e.me,{onFulfilled:e=>{wO(e).loading=!1},onPending:e=>{wO(e).loading=!0,wO(e).error=null},onRejected:(e,t)=>{wO(e).loading=!1,wO(e).error=t.error}}));var wO;const $O={action:bO,reducer:yO},EO=iI("users/logout",((e,{extra:{api:t}})=>t.user.logout())),kO={action:EO,reducer:vO(EO)({})},CO={me:{loading:!1,error:null,data:{}}},xO="/v1/auth/me",IO=({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(xO);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()}))}),OO=gl((e=>{var t,n,o,r;const i=dl(OI,xI,wI,SI)(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.75"}}));return{user:Object.assign(Object.assign({},IO({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})),SO=gl((e=>{const t=dl(HI({name:"widget",initialState:CO,reducers:{},extraReducers:e=>{$O.reducer(e),kO.reducer(e)},asyncActions:{getMe:$O.action,logout:kO.action}}),CI,wI,OO)(e);return class extends t{constructor(...e){super(...e),this.state=CO,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),jO=gl((e=>{const t=dl(jI,II({"widget-id":II.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}))}}})),AO=gl((e=>{var t,n,o;return o=class extends(dl(wI,CI,LI,FI,jO,SO)(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=ll(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),RO=(e={})=>{const t=ll("<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 NO(e){return new URLSearchParams(window.location.search).get(e)}const MO=gl((e=>{var t,n,o,r,i,s,a,d,l;return l=class extends(dl(SO,wI,AO,qI,GI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,hl((e=>{this.avatar.image=e}))),d.set(this,hl((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,cO(this.state)),h(this,d,"f").call(this,pO(this.state)),this.subscribe(h(this,a,"f").bind(this),cO),this.subscribe(h(this,d,"f").bind(this),pO)}))}},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 Dl((()=>{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})),UO=gl((e=>{var t,n,o,r,i,s,a,d,l,c,f,g,m;return m=class extends(dl(SO,wI,AO,qI)(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,hl((e=>{this.emailUserAttr.value=e}))),g.set(this,hl((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,uO(this.state)),h(this,g,"f").call(this,hO(this.state)),this.subscribe(h(this,f,"f").bind(this),uO),this.subscribe(h(this,g,"f").bind(this),hO)}))}},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 Pl((()=>{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})),TO=gl((e=>{var t,n,o,r,i,s,a,d,l,c,f,g;return g=class extends(dl(SO,wI,AO,qI)(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,hl((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,pO(this.state)),this.subscribe(h(this,f,"f").bind(this),pO)}))}},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 Pl((()=>{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})),DO=gl((e=>{var t,n,o,r,i,s,a,d,l,c,f,g,m;return m=class extends(dl(SO,wI,AO,qI)(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,hl((e=>{this.phoneUserAttr.value=e}))),g.set(this,hl((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,fO(this.state)),h(this,g,"f").call(this,gO(this.state)),this.subscribe(h(this,f,"f").bind(this),fO),this.subscribe(h(this,g,"f").bind(this),gO)}))}},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 Pl((()=>{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})),PO=gl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(dl(SO,wI,AO,qI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,hl((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,mO(this.state)),this.subscribe(h(this,a,"f").bind(this),mO)}))}},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 Ll((()=>{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})),LO=gl((e=>{var t,n,o,r,i,s,a;return a=class extends(dl(SO,wI,AO,qI)(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 Ll((()=>{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=gl((e=>{var t,n,o;return o=class extends(dl(SO,wI,AO,qI)(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 Sl((()=>{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})),WO="widget-flow",FO=gl((e=>{var t,n,o;return o=class extends(dl(CI,qI,SO,wI)(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=NO(WO);r&&(function(e){if(window.history.replaceState&&NO(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())}}(WO),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})),VO=gl((e=>class extends(dl(RI,KI,FO,UO,MO,TO,DO,PO,LO,_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)}))}})),qO=dl((e=>class extends(VO(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),Ax.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.75"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",qO);var BO=Object.freeze({__proto__:null,default:qO});const zO=(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 KO,HO,GO,JO,ZO,XO,YO,QO,eS,tS;const nS=document.createElement("template");nS.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 oS extends HTMLElement{constructor(){super(),KO.add(this),HO.set(this,new Xa({messages:[]})),GO.set(this,void 0),JO.set(this,void 0),ZO.set(this,void 0),XO.set(this,{resize:h(this,KO,"m",tS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(nS.content.cloneNode(!0)),p(this,GO,this.shadowRoot.querySelector(".debugger"),"f"),p(this,JO,h(this,GO,"f").querySelector(".content"),"f"),p(this,ZO,h(this,GO,"f").querySelector(".header"),"f")}updateData(e){h(this,HO,"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]=zO(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,GO,"f"),h(this,ZO,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,XO,"f").resize),(e=h(this,GO,"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,GO,"f").onresize=h(this,KO,"m",eS).bind(this),h(this,HO,"f").subscribe(h(this,KO,"m",YO).bind(this))}disconnectedCallback(){h(this,HO,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,XO,"f").resize)}}HO=new WeakMap,GO=new WeakMap,JO=new WeakMap,ZO=new WeakMap,XO=new WeakMap,KO=new WeakSet,YO=function(e){h(this,KO,"m",QO).call(this,e),h(this,KO,"m",eS).call(this)},QO=function(e){h(this,JO,"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("")},eS=function(){h(this,JO,"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)}))},tS=function(){const[e,t]=zO(h(this,GO,"f"),Number.parseInt(h(this,GO,"f").style.left,10),Number.parseInt(h(this,GO,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,GO,"f").style.top=`${t}px`,h(this,GO,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",oS);var rS=Object.freeze({__proto__:null,default:oS});const iS=(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 sS,aS,dS,lS,cS,uS,hS,pS,fS,gS;const mS=document.createElement("template");mS.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 vS extends HTMLElement{constructor(){super(),sS.add(this),aS.set(this,new $C({messages:[]})),dS.set(this,void 0),lS.set(this,void 0),cS.set(this,void 0),uS.set(this,{resize:h(this,sS,"m",gS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(mS.content.cloneNode(!0)),p(this,dS,this.shadowRoot.querySelector(".debugger"),"f"),p(this,lS,h(this,dS,"f").querySelector(".content"),"f"),p(this,cS,h(this,dS,"f").querySelector(".header"),"f")}updateData(e){h(this,aS,"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]=iS(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,dS,"f"),h(this,cS,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,uS,"f").resize),(e=h(this,dS,"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,dS,"f").onresize=h(this,sS,"m",fS).bind(this),h(this,aS,"f").subscribe(h(this,sS,"m",hS).bind(this))}disconnectedCallback(){h(this,aS,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,uS,"f").resize)}}aS=new WeakMap,dS=new WeakMap,lS=new WeakMap,cS=new WeakMap,uS=new WeakMap,sS=new WeakSet,hS=function(e){h(this,sS,"m",pS).call(this,e),h(this,sS,"m",fS).call(this)},pS=function(e){h(this,lS,"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("")},fS=function(){h(this,lS,"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)}))},gS=function(){const[e,t]=iS(h(this,dS,"f"),Number.parseInt(h(this,dS,"f").style.left,10),Number.parseInt(h(this,dS,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,dS,"f").style.top=`${t}px`,h(this,dS,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",vS);var bS=Object.freeze({__proto__:null,default:vS});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})}));
|
|
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 i=n(t);const o=i.default.createContext(void 0),r=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},d={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.0.45"},a="undefined"!=typeof window;var l=function(){return l=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},l.apply(this,arguments)};function c(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function u(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{a(i.next(e))}catch(e){r(e)}}function d(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,d)}a((i=i.apply(e,t||[])).next())}))}function h(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function f(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}function p(e){this.message=e}"function"==typeof SuppressedError&&SuppressedError,p.prototype=new Error,p.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 p("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,r=0,s="";i=t.charAt(r++);~i&&(n=o%4?64*n+i:i,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};function v(e){this.message=e}function m(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(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 v("Invalid token specified: "+e.message)}}v.prototype=new Error,v.prototype.name="InvalidTokenError";var $="/v1/auth/accesskey/exchange",y="/v1/auth/otp/verify",b="/v1/auth/otp/signin",w="/v1/auth/otp/signup",k={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},C="/v1/auth/otp/signup-in",I="/v1/auth/magiclink/verify",R="/v1/auth/magiclink/signin",S="/v1/auth/magiclink/signup",O={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},E="/v1/auth/magiclink/signup-in",x="/v1/auth/enchantedlink/verify",j="/v1/auth/enchantedlink/signin",M="/v1/auth/enchantedlink/signup",A="/v1/auth/enchantedlink/pending-session",P={email:"/v1/auth/enchantedlink/update/email"},N="/v1/auth/enchantedlink/signup-in",U="/v1/auth/oauth/authorize",W="/v1/auth/oauth/exchange",L="v1/auth/oauth/native/start",T="v1/auth/oauth/native/finish",_="/v1/auth/saml/authorize",D="/v1/auth/saml/exchange",F="/v1/auth/totp/verify",q="/v1/auth/totp/signup",B="/v1/auth/totp/update",K="/v1/auth/notp/whatsapp/signin",V="/v1/auth/notp/whatsapp/signup",H="/v1/auth/notp/whatsapp/signup-in",z="/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"},Y={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},X="/v1/auth/password/signup",Q="/v1/auth/password/signin",ee="/v1/auth/password/reset",te="/v1/auth/password/update",ne="/v1/auth/password/replace",ie="/v1/auth/password/policy",oe="/v1/auth/refresh",re="/v1/auth/tenant/select",se="/v1/auth/logout",de="/v1/auth/logoutall",ae="/v1/auth/me",le="/v1/auth/me/history",ce="/v1/flow/start",ue="/v1/flow/next";const he="<region>",fe=`https://api.${he}descope.com`,pe=6e5,ge="dct",ve=()=>{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",e.patch="PATCH"}(me||(me={}));const $e=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const o=i.slice(1,-27);t=t.replace(he,o?o+".":"");let r=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){r=`${r}?`;const e=Object.keys(n);e.forEach(((t,i)=>{r=`${r}${t}=${n[t]}${i===e.length-1?"":"&"}`}))}return r},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,i])=>(e[n]=i,e)),e),e}),{})),be={"Content-Type":"application/json"},we=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},ke=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},Ce=({baseUrl:e,projectId:t,baseConfig:n,logger:i,hooks:o,cookiePolicy:r,fetch:s})=>{const d=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),i=await n.text();return n.text=()=>Promise.resolve(i),n.json=()=>Promise.resolve(JSON.parse(i)),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=>ve().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await n(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return ve().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(i)),i}:n})(i,s),a=async i=>{var s;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(i):i,{path:l,body:c,headers:u,queryParams:h,method:f,token:p}=a,g=(e=>void 0===e?void 0:JSON.stringify(e))(c),v={headers:ye(we(t,p),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.23.2"},(null==n?void 0:n.baseHeaders)||{},ke(g)?be:{},u),method:f,body:g};null!==r&&(v.credentials=r||"include");const m=await d($e({path:l,baseUrl:e,queryParams:h,projectId:t}),v);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(i,null==m?void 0:m.clone()),null==o?void 0:o.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,i]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:i})}),{}),n=Object.assign(Object.assign({},m),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}return m};return{get:(e,{headers:t,queryParams:n,token:i}={})=>a({path:e,headers:t,queryParams:n,body:void 0,method:me.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:o}={})=>a({path:e,headers:n,queryParams:i,body:t,method:me.post,token:o}),patch:(e,t,{headers:n,queryParams:i,token:o}={})=>a({path:e,headers:n,queryParams:i,body:t,method:me.patch,token:o}),put:(e,t,{headers:n,queryParams:i,token:o}={})=>a({path:e,headers:n,queryParams:i,body:t,method:me.put,token:o}),delete:(e,{headers:t,queryParams:n,token:i}={})=>a({path:e,headers:t,queryParams:n,body:void 0,method:me.delete,token:i}),hooks:o,buildUrl:(n,i)=>$e({projectId:t,baseUrl:e,path:n,queryParams:i})}};var Ie=429;function Re(e,t,n){var i;let o=Se(e);if(t){if(!(null==o?void 0:o.tenants)&&(null==o?void 0:o[ge])===t)return(null==o?void 0:o[n])||[];o=null===(i=null==o?void 0:o.tenants)||void 0===i?void 0:i[t]}const r=null==o?void 0:o[n];return Array.isArray(r)?r:[]}function Se(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return m(e)}function Oe(e){const{exp:t}=Se(e);return(new Date).getTime()/1e3>t}function Ee(e){let t=Se(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function xe(e,t){return Re(e,t,"permissions")}function je(e,t){return Re(e,t,"roles")}const Me=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Ae(e,t){var n;const i=await e,o={code:i.status,ok:i.ok,response:i},r=await i.clone().json();return i.ok?o.data=t?t(r):r:(o.error=r,i.status===Ie&&Object.assign(o.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),o}const Pe=(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)}),Ue=e=>t=>e.test(t),We=Ue(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Le=Ue(/^\+[1-9]{1}[0-9]{3,14}$/),Te=Pe(We,'"{val}" is not a valid email'),_e=Pe(Le,'"{val}" is not a valid phone number'),De=Pe((1,e=>e.length>=1),"Minimum length is 1");const Fe=Pe((e=>"string"==typeof e),"Input is not a string"),qe=Pe((e=>void 0===e),"Input is defined"),Be=(Ke=[Fe(),qe()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=Ke.filter((e=>e(t)));return!(n.length<Ke.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var Ke;const Ve=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Ne(...e).validate(n[t]))),t(...n)),He=e=>[Fe(`"${e}" must be a string`)],ze=e=>[Fe(`"${e}" must be a string`),De(`"${e}" must not be empty`)],Ge=e=>[Fe(`"${e}" must be a string`),Te()],Je=e=>[Fe(`"${e}" must be a string`),_e()],Ze=Ve(ze("accessKey")),Ye=e=>({exchange:Ze(((t,n)=>Ae(e.post($,{loginOptions:n},{token:t}))))}),Xe=(e,t,n)=>(t.forEach((t=>{const i=t.split(".");let o=i.shift(),r=e;for(;i.length>0;){if(r=r[o],!o||!r)throw Error(`Invalid path "${t}", "${o}" is missing or has no value`);o=i.shift()}if("function"!=typeof r[o])throw Error(`"${t}" is not a function`);const s=r[o];r[o]=n(s)})),e),Qe=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||pe,pe)});var et,tt;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(et||(et={})),function(e){e.email="email"}(tt||(tt={}));const nt=Object.assign(Object.assign({},et),tt);var it;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(it||(it={}));const ot=ze("loginId"),rt=Ve(ze("token")),st=Ve(ot),dt=Ve(ze("pendingRef")),at=Ve(ot,Ge("email")),lt=e=>({verify:rt((t=>Ae(e.post(x,{token:t})))),signIn:st(((t,n,i,o)=>Ae(e.post(Me(j,nt.email),{loginId:t,URI:n,loginOptions:i},{token:o})))),signUpOrIn:st(((t,n,i)=>Ae(e.post(Me(N,nt.email),{loginId:t,URI:n,loginOptions:i})))),signUp:st(((t,n,i,o)=>Ae(e.post(Me(M,nt.email),{loginId:t,URI:n,user:i,loginOptions:o})))),waitForSession:dt(((t,n)=>new Promise((i=>{const{pollingIntervalMs:o,timeoutMs:r}=Qe(n);let s;const d=setInterval((async()=>{const n=await e.post(A,{pendingRef:t});n.ok&&(clearInterval(d),s&&clearTimeout(s),i(Ae(Promise.resolve(n))))}),o);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${r}ms`,errorCode:"0"},ok:!1}),clearInterval(d)}),r)})))),update:{email:at(((t,n,i,o,r)=>Ae(e.post(P.email,Object.assign({loginId:t,email:n,URI:i},r),{token:o}))))}}),ct=Ve(ze("flowId")),ut=Ve(ze("executionId"),ze("stepId"),ze("interactionId")),ht=e=>({start:ct(((t,n,i,o,r,s,d)=>Ae(e.post(ce,{flowId:t,options:n,conditionInteractionId:i,interactionId:o,version:r,componentsVersion:s,input:d})))),next:ut(((t,n,i,o,r,s)=>Ae(e.post(ue,{executionId:t,stepId:n,interactionId:i,version:o,componentsVersion:r,input:s}))))}),ft=ze("loginId"),pt=Ve(ze("token")),gt=Ve(ft),vt=Ve(ft,Je("phone")),mt=Ve(ft,Ge("email")),$t=Object.keys(nt).filter((e=>e!==et.voice)),yt=e=>({verify:pt((t=>Ae(e.post(I,{token:t})))),signIn:$t.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:gt(((t,i,o,r)=>Ae(e.post(Me(R,n),{loginId:t,URI:i,loginOptions:o},{token:r}))))})),{}),signUp:$t.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:gt(((t,i,o,r)=>Ae(e.post(Me(S,n),{loginId:t,URI:i,user:o,loginOptions:r}))))})),{}),signUpOrIn:$t.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:gt(((t,i,o)=>Ae(e.post(Me(E,n),{loginId:t,URI:i,loginOptions:o}))))})),{}),update:{email:mt(((t,n,i,o,r)=>Ae(e.post(O.email,Object.assign({loginId:t,email:n,URI:i},r),{token:o})))),phone:Object.keys(et).filter((e=>e!==et.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:vt(((t,i,o,r,s)=>Ae(e.post(Me(O.phone,n),Object.assign({loginId:t,phone:i,URI:o},s),{token:r}))))})),{})}});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 wt=Ve(ze("code")),kt=e=>({start:Object.assign(((t,n,i,o)=>Ae(e.post(U,i||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:o}))),Object.keys(bt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,o)=>Ae(e.post(U,i||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:o}))})),{})),exchange:wt((t=>Ae(e.post(W,{code:t})))),startNative:(t,n,i)=>Ae(e.post(L,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,o,r)=>Ae(e.post(T,{provider:t,stateId:n,user:i,code:o,idToken:r}))}),Ct=ze("loginId"),It=Ve(Ct,ze("code")),Rt=Ve(Ct),St=Ve(Ct,Je("phone")),Ot=Ve(Ct,Ge("email")),Et=e=>({verify:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:It(((t,i)=>Ae(e.post(Me(y,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,i,o)=>Ae(e.post(Me(b,n),{loginId:t,loginOptions:i},{token:o}))))})),{}),signUp:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,i,o)=>Ae(e.post(Me(w,n),{loginId:t,user:i,loginOptions:o}))))})),{}),signUpOrIn:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,i)=>Ae(e.post(Me(C,n),{loginId:t,loginOptions:i}))))})),{}),update:{email:Ot(((t,n,i,o)=>Ae(e.post(k.email,Object.assign({loginId:t,email:n},o),{token:i})))),phone:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:St(((t,i,o,r)=>Ae(e.post(Me(k.phone,n),Object.assign({loginId:t,phone:i},r),{token:o}))))})),{})}}),xt=Ve(ze("tenant")),jt=Ve(ze("code")),Mt=e=>({start:xt(((t,n,i,o)=>Ae(e.post(_,i||{},{queryParams:{tenant:t,redirectURL:n},token:o})))),exchange:jt((t=>Ae(e.post(D,{code:t}))))}),At=ze("loginId"),Pt=Ve(At,ze("code")),Nt=Ve(At),Ut=Ve(At),Wt=e=>({signUp:Nt(((t,n)=>Ae(e.post(q,{loginId:t,user:n})))),verify:Pt(((t,n,i,o)=>Ae(e.post(F,{loginId:t,code:n,loginOptions:i},{token:o})))),update:Ut(((t,n)=>Ae(e.post(B,{loginId:t},{token:n}))))}),Lt=ze("loginId"),Tt=ze("newPassword"),_t=Ve(Lt,ze("password")),Dt=Ve(Lt),Ft=Ve(Lt,Tt),qt=Ve(Lt,ze("oldPassword"),Tt),Bt=e=>({signUp:_t(((t,n,i,o)=>Ae(e.post(X,{loginId:t,password:n,user:i,loginOptions:o})))),signIn:_t(((t,n,i)=>Ae(e.post(Q,{loginId:t,password:n,loginOptions:i})))),sendReset:Dt(((t,n,i)=>Ae(e.post(ee,{loginId:t,redirectUrl:n,templateOptions:i})))),update:Ft(((t,n,i)=>Ae(e.post(te,{loginId:t,newPassword:n},{token:i})))),replace:qt(((t,n,i)=>Ae(e.post(ne,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>Ae(e.get(ie))}),Kt=He("loginId"),Vt=ze("loginId"),Ht=ze("origin"),zt=Ve(Vt,Ht,ze("name")),Gt=Ve(Vt,Ht),Jt=Ve(Kt,Ht),Zt=Ve(Vt,Ht,ze("token")),Yt=Ve(ze("transactionId"),ze("response")),Xt=e=>({signUp:{start:zt(((t,n,i)=>Ae(e.post(G.start,{user:{loginId:t,name:i},origin:n})))),finish:Yt(((t,n)=>Ae(e.post(G.finish,{transactionId:t,response:n}))))},signIn:{start:Jt(((t,n,i,o)=>Ae(e.post(J.start,{loginId:t,origin:n,loginOptions:i},{token:o})))),finish:Yt(((t,n)=>Ae(e.post(J.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Gt(((t,n)=>Ae(e.post(Z.start,{loginId:t,origin:n}))))},update:{start:Zt(((t,n,i)=>Ae(e.post(Y.start,{loginId:t,origin:n},{token:i})))),finish:Yt(((t,n)=>Ae(e.post(Y.finish,{transactionId:t,response:n}))))}}),Qt=He("loginId"),en=Ve(Qt),tn=Ve(ze("pendingRef")),nn=e=>({signUpOrIn:en(((t,n)=>Ae(e.post(H,{loginId:t,loginOptions:n})))),signUp:en(((t,n,i)=>Ae(e.post(V,{loginId:t,user:n,loginOptions:i})))),signIn:en(((t,n,i)=>Ae(e.post(K,{loginId:t,loginOptions:n},{token:i})))),waitForSession:tn(((t,n)=>new Promise((i=>{const{pollingIntervalMs:o,timeoutMs:r}=Qe(n);let s;const d=setInterval((async()=>{const n=await e.post(z,{pendingRef:t});n.ok&&(clearInterval(d),s&&clearTimeout(s),i(Ae(Promise.resolve(n))))}),o);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${r}ms`,errorCode:"0"},ok:!1}),clearInterval(d)}),r)}))))}),on=Ve(ze("token")),rn=Ve([Be('"token" must be string or undefined')]);var sn,dn=Ve([("projectId",sn=ze("projectId"),Pe(((e,t)=>n=>Ne(...t).validate(((e,t,n)=>{const i=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),o=i.length;let r=0,s=e===Object(e)?e:void 0;for(;null!=s&&r<o;)s=s[i[r++]];return r&&r===o&&void 0!==s?s:void 0})(n,e)))("projectId",sn))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:i,cookiePolicy:o,baseHeaders:r={},fetch:s})=>{return d=Ce({baseUrl:n||fe,projectId:e,logger:t,hooks:i,cookiePolicy:o,baseConfig:{baseHeaders:r},fetch:s}),{accessKey:Ye(d),otp:Et(d),magicLink:yt(d),enchantedLink:lt(d),oauth:kt(d),saml:Mt(d),totp:Wt(d),notp:nn(d),webauthn:Xt(d),password:Bt(d),flow:ht(d),refresh:rn((e=>Ae(d.post(oe,{},{token:e})))),selectTenant:Ve([Fe("tenantId")],[Be('"token" must be string or undefined')])(((e,t)=>Ae(d.post(re,{tenant:e},{token:t})))),logout:rn((e=>Ae(d.post(se,{},{token:e})))),logoutAll:rn((e=>Ae(d.post(de,{},{token:e})))),me:rn((e=>Ae(d.get(ae,{token:e})))),history:rn((e=>Ae(d.get(le,{token:e})))),isJwtExpired:on(Oe),getTenants:on(Ee),getJwtPermissions:on(xe),getJwtRoles:on(je),httpClient:d};var d})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const i=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==i?void 0:i.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var i;const o=[].concat((null===(i=e.hooks)||void 0===i?void 0:i.afterRequest)||[]);0!=o.length&&(await Promise.allSettled(null==o?void 0:o.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(dn,{DeliveryMethods:nt});
|
|
2
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
3
|
+
function ln(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var cn=function e(t,n){function i(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=ln({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var s in o)o[s]&&(r+="; "+s,!0!==o[s]&&(r+="="+o[s].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+r}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},o=0;o<n.length;o++){var r=n[o].split("="),s=r.slice(1).join("=");try{var d=decodeURIComponent(r[0]);if(i[d]=t.read(s,d),e===d)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",ln({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,ln({},this.attributes,t))},withConverter:function(t){return e(ln({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(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:"/"});var un={default:"endpoint"},hn="Blocked by CSP",fn="The endpoint parameter is not a valid URL",pn="Failed to load the JS script of the agent",gn="9319";function vn(e,t){var n,i,o,r,s=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([],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,r=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,r++))},o=new Set,[n.current(),function(e,t){var r,s=t instanceof Error?t.message:"";if(s===hn||s===fn)n.exclude(),r=0;else if(s===gn)n.exclude();else if(s===pn){var d=Date.now()-e.getTime()<50,a=n.current();a&&d&&!o.has(a)&&(o.add(a),r=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=r?r:e.getTime()+i()-Date.now()]}]),a=d[0],l=d[1];if(void 0===a)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var c=function(e){var n=new Date,i=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},o=t(e);return o.then((function(){return i()}),i),o.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var i,o=t[0],r=t[1];return(i=r,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return c(o)}))}))};return c(a).then((function(e){return[e,s]}))}var mn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",$n=mn;function yn(e){var t;e.scriptUrlPattern;var n=e.token,i=e.apiKey,o=void 0===i?n:i,r=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,d=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,i){return e.addEventListener(t,n,i),function(){return e.removeEventListener(t,n,i)}}(document,"visibilitychange",t);return t(),[e,n]}(),a=d[0],u=d[1];return Promise.resolve().then((function(){if(!o||"string"!=typeof o)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,o);return vn(e,bn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===gn?new Error(pn):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(l(l({},r),{ldi:{attempts:n,visibilityStates:a}}))}))}function bn(e){return function(e,t,n,i){var o,r=document,s="securitypolicyviolation",d=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(o=t,a())};r.addEventListener(s,d);var a=function(){return r.removeEventListener(s,d)};return Promise.resolve().then(t).then((function(e){return a(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(a(),o)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(fn);var i=document.createElement("script"),o=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},r=document.head||document.getElementsByTagName("head")[0];i.onload=function(){o(),t()},i.onerror=function(){o(),n(new Error(pn))},i.async=!0,i.src=e,r.appendChild(i)}))}(e)})).then(wn)}function wn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==i?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(gn);return n}const kn=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,i)=>{var o;return n[i]=[].concat((null===(o=e.hooks)||void 0===o?void 0:o[i])||[]).concat((null==t?void 0:t[i])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Cn=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||{}},In=async e=>{const t=await Cn(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Rn="undefined"!=typeof localStorage,Sn=(e,t)=>Rn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),On=e=>Rn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),En=e=>Rn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),xn=(...e)=>{console.debug(...e)},jn="undefined"!=typeof window,Mn=Math.pow(2,31)-1,An="DS",Pn="DSR";function Nn(e=""){return On(`${e}${Pn}`)||""}function Un(e=""){En(`${e}${Pn}`),En(`${e}${An}`),cn.remove(An)}const Wn=jn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Ln="fp",Tn=(e=!1)=>{const t=localStorage.getItem(Ln);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},_n=async(e,t=Wn)=>{try{if(Tn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),i=new URL(t);i.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const r=o.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=yn({apiKey:e,endpoint:[i.toString(),un],scriptUrlPattern:[r,$n]}),d=await s,{requestId:a}=await d.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,a);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Ln,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Dn=e=>{const t=Tn(!0);return t&&e.body&&(e.body.fpData=t),e},Fn="dls_last_user_login_id",qn="dls_last_user_display_name",Bn=()=>On(Fn),Kn=()=>On(qn),Vn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,o=Bn(),r=Kn();return o&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=o,i.lastAuth.name=r),await e(...t)};function Hn(){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 zn(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:ei(n.rawId),type:n.type,response:{attestationObject:ei(n.response.attestationObject),clientDataJSON:ei(n.response.clientDataJSON)}});var n}async function Gn(e){const t=Yn(e);return Xn(await navigator.credentials.get(t))}async function Jn(e,t){const n=Yn(e);return n.signal=t.signal,n.mediation="conditional",Xn(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 Yn(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 Xn(e){return JSON.stringify({id:e.id,rawId:ei(e.rawId),type:e.type,response:{authenticatorData:ei(e.response.authenticatorData),clientDataJSON:ei(e.response.clientDataJSON),signature:ei(e.response.signature),userHandle:e.response.userHandle?ei(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 ei(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var ti,ni=(ti=e=>({async signUp(t,n){const i=await e.webauthn.signUp.start(t,window.location.origin,n);if(!i.ok)return i;const o=await zn(i.data.options);return await e.webauthn.signUp.finish(i.data.transactionId,o)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const i=await Gn(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,i)},async signUpOrIn(t){var n;const i=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!i.ok)return i;if(null===(n=i.data)||void 0===n?void 0:n.create){const t=await zn(i.data.options);return await e.webauthn.signUp.finish(i.data.transactionId,t)}{const t=await Gn(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,t)}},async update(t,n){const i=await e.webauthn.update.start(t,window.location.origin,n);if(!i.ok)return i;const o=await zn(i.data.options);return await e.webauthn.update.finish(i.data.transactionId,o)},helpers:{create:zn,get:Gn,isSupported:Zn,conditional:Jn}}),(...e)=>{const t=ti(...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 ii="/fedcm/config",oi=(e,t)=>({async oneTap(t,n,i,o){const r=null!=t?t:"google",s=await e.oauth.startNative(r,i,!0);if(!s.ok)return s;const{clientId:d,stateId:a,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 i,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(i=null==n?void 0:n.itp_support)||void 0===i||i,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:d,callback:n=>{t(e.oauth.finishNative(r,a,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==o||o())}))}))},async launch(n){var i;const o={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+ii),clientId:t}]}},r=await(null===(i=navigator.credentials)||void 0===i?void 0:i.get(o));return e.refresh(r.token)},isSupported:()=>jn&&"IdentityCredential"in window});var ri=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Zn(),i=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=i,e.flow.start(...t)}});const si=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:i}=t,o=c(t,["fpKey","fpLoad"]);return jn?(n&&i&&_n(n).catch((()=>null)),e(kn(o,{beforeRequest:Dn}))):e(o)}),(e=>t=>{var{autoRefresh:n}=t,i=c(t,["autoRefresh"]);if(!n)return e(i);const{clearAllTimers:o,setTimer:r}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,d;jn&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(xn("Expiration time passed, refreshing session"),a.refresh(Nn()||d))}));const a=e(kn(i,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:i}=await Cn(t);if(401===(null==t?void 0:t.status))xn("Received 401, canceling all timers"),o();else if(i){if(s=(e=>{try{const t=m(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(i),!s)return void xn("Could not extract expiration time from session token");d=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Mn&&(xn(`Timeout is too large (${e}ms), setting it to ${Mn}ms`),e=Mn),o();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});xn(`Setting refresh timer for ${t}. (${e}ms)`),r((()=>{xn("Refreshing session due to timer"),a.refresh(Nn()||n)}),e)}var l}}));return Xe(a,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return xn("Clearing all timers"),o(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.15.4"},t.baseHeaders)}))),(e=>t=>{const n=Hn(),i=Hn(),o=e(kn(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),i.pub(null);else{const e=await In(t);e&&i.pub(e);const{sessionJwt:o}=await Cn(t);o&&n.pub(o)}}})),r=Xe(o,["logout","logoutAll"],(e=>async(...t)=>{const o=await e(...t);return n.pub(null),i.pub(null),o}));return Object.assign(r,{onSessionTokenChange:n.sub,onUserChange:i.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=t,o=c(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:Bn,getLastUserDisplayName:Kn});const r=e(kn(o,{afterRequest:async(e,t)=>{var n;const i=await In(t),o=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],r=null==i?void 0:i.name;o&&((e=>{Sn(Fn,e)})(o),(e=>{Sn(qn,e)})(r))}}));let s=Xe(r,["flow.start"],Vn);return s=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(En(Fn),En(qn)),i})(i)),Object.assign(s,{getLastUserLoginId:Bn,getLastUserDisplayName:Kn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:i,storagePrefix:o}=t,r=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!jn)return e(r);const s=e(kn(r,{beforeRequest:(d=o,e=>Object.assign(e,{token:e.token||Nn(d)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Un(o):((e={},t,n)=>{var{refreshJwt:i,sessionJwt:o}=e,r=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),i&&Sn(`${n}${Pn}`,i),o&&(t?function(e,t,{cookiePath:n,cookieDomain:i,cookieExpiration:o}){if(t){const r=new Date(1e3*o),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(i);cn.set(e,t,{path:n,domain:s?i:void 0,expires:r,sameSite:"Strict",secure:!0})}}(An,o,r):Sn(`${n}${An}`,o))})(await Cn(t),i,o)}}));var d;const a=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return Un(e),i})(o));return Object.assign(a,{getRefreshToken:()=>Nn(o),getSessionToken:()=>function(e=""){return cn.get(An)||On(`${e}${An}`)||""}(o)})}))(((...e)=>{const t=an(...e);return Object.assign(Object.assign({},t),{flow:ri(t),webauthn:ni(t),fedcm:oi(t,e[0].projectId)})}));let di;const ai=e=>{const t=si(Object.assign({persistTokens:a,autoRefresh:a},e));return di=t,t},li=()=>ai({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});di=li();const ci=()=>a?null==di?void 0:di.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),ui=()=>a?null==di?void 0:di.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),hi=s(((e=ci(),t)=>null==di?void 0:di.getJwtPermissions(e,t))),fi=s(((e=ci(),t)=>null==di?void 0:di.getJwtRoles(e,t)));const pi=t.lazy((async()=>((await Promise.resolve().then((function(){return Nr}))).default.sdkConfigOverrides={baseHeaders:d,persistTokens:!1,hooks:{get beforeRequest(){return di.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,baseStaticUrl:o,innerRef:r,tenant:s,theme:d,locale:a,debug:l,redirectUrl:c,client:u,form:h,autoFocus:f,validateOnBlur:p})=>i.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,"base-static-url":o,ref:r,tenant:s,theme:d,locale:a,debug:l,client:u,form:h,"redirect-url":c,"auto-focus":f,"validate-on-blur":p})}))),gi=i.default.forwardRef((({flowId:e,onSuccess:n,onError:r,onReady:s,logger:d,tenant:a,theme:l,locale:c,debug:u,client:h,form:f,telemetryKey:p,redirectUrl:g,autoFocus:v,validateOnBlur:m,errorTransformer:$},y)=>{const[b,w]=t.useState(null);t.useImperativeHandle(y,(()=>b));const{projectId:k,baseUrl:C,baseStaticUrl:I,storeLastAuthenticatedUser:R,keepLastAuthenticatedUserAfterLogout:S,sdk:O}=i.default.useContext(o),E=t.useCallback((async e=>{await O.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=b;return null==e||e.addEventListener("success",E),r&&(null==e||e.addEventListener("error",r)),s&&(null==e||e.addEventListener("ready",s)),()=>{r&&(null==e||e.removeEventListener("error",r)),s&&(null==e||e.removeEventListener("ready",s)),null==e||e.removeEventListener("success",E)}}),[b,r,E]),t.useEffect((()=>{const e=b;return null==e||e.addEventListener("success",E),()=>{null==e||e.removeEventListener("success",E)}}),[b,E]),t.useEffect((()=>{const e=b;return r&&(null==e||e.addEventListener("error",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[b,r]),t.useEffect((()=>{const e=b;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[b,s]),t.useEffect((()=>{b&&(b.errorTransformer=$)}),[b,$]),t.useEffect((()=>{b&&d&&(b.logger=d)}),[b,d]);const{form:x,client:j}=t.useMemo((()=>({form:JSON.stringify(f||{}),client:JSON.stringify(h||{})})),[f,h]);return i.default.createElement("form",null,i.default.createElement(t.Suspense,{fallback:null},i.default.createElement(pi,{projectId:k,flowId:e,baseUrl:C,baseStaticUrl:I,innerRef:w,tenant:a,theme:l,locale:c,debug:u,form:x,client:j,telemetryKey:p,redirectUrl:g,autoFocus:v,validateOnBlur:m,storeLastAuthenticatedUser:R,keepLastAuthenticatedUserAfterLogout:S})))})),vi=t.lazy((async()=>(await Promise.resolve().then((function(){return Jh})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:o,tenant:r,widgetId:s,theme:d,debug:a})=>i.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:d,tenant:r,debug:a,ref:o})}))),mi=i.default.forwardRef((({logger:e,tenant:n,theme:r,debug:s,widgetId:d},a)=>{const[l,c]=t.useState(null);t.useImperativeHandle(a,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f}=i.default.useContext(o);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),i.default.createElement(t.Suspense,{fallback:null},i.default.createElement(vi,{projectId:u,widgetId:d,baseUrl:h,baseStaticUrl:f,innerRef:c,tenant:n,theme:r,debug:s}))})),$i=t.lazy((async()=>(await Promise.resolve().then((function(){return zf})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:o,tenant:r,widgetId:s,theme:d,debug:a})=>i.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:d,tenant:r,debug:a,ref:o})}))),yi=i.default.forwardRef((({logger:e,tenant:n,theme:r,debug:s,widgetId:d},a)=>{const[l,c]=t.useState(null);t.useImperativeHandle(a,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f}=i.default.useContext(o);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),i.default.createElement(t.Suspense,{fallback:null},i.default.createElement($i,{projectId:u,widgetId:d,baseUrl:h,baseStaticUrl:f,innerRef:c,tenant:n,theme:r,debug:s}))})),bi=t.lazy((async()=>(await Promise.resolve().then((function(){return Yp})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:o,tenant:r,widgetId:s,theme:d,debug:a})=>i.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:d,tenant:r,debug:a,ref:o})}))),wi=i.default.forwardRef((({logger:e,tenant:n,theme:r,debug:s,widgetId:d},a)=>{const[l,c]=t.useState(null);t.useImperativeHandle(a,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f}=i.default.useContext(o);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),i.default.createElement(t.Suspense,{fallback:null},i.default.createElement(bi,{projectId:u,widgetId:d,baseUrl:h,baseStaticUrl:f,innerRef:c,tenant:n,theme:r,debug:s}))})),ki=t.lazy((async()=>(await Promise.resolve().then((function(){return gg})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:o,tenant:r,widgetId:s,theme:d,debug:a})=>i.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:d,tenant:r,debug:a,ref:o})}))),Ci=i.default.forwardRef((({logger:e,tenant:n,theme:r,debug:s,widgetId:d},a)=>{const[l,c]=t.useState(null);t.useImperativeHandle(a,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f}=i.default.useContext(o);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),i.default.createElement(t.Suspense,{fallback:null},i.default.createElement(ki,{projectId:u,widgetId:d,baseUrl:h,baseStaticUrl:f,innerRef:c,tenant:n,theme:r,debug:s}))})),Ii=t.lazy((async()=>(await Promise.resolve().then((function(){return Yg})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:o,widgetId:r,theme:s,debug:d})=>i.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":r,"base-url":t,"base-static-url":n,theme:s,debug:d,ref:o})}))),Ri=i.default.forwardRef((({logger:e,theme:n,debug:r,widgetId:s,onLogout:d},a)=>{const[l,c]=t.useState(null);t.useImperativeHandle(a,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f}=i.default.useContext(o);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),t.useEffect((()=>{if(l&&d)return l.addEventListener("logout",d),()=>l.removeEventListener("logout",d)}),[l,d]),i.default.createElement(t.Suspense,{fallback:null},i.default.createElement(Ii,{projectId:u,widgetId:s,baseUrl:h,baseStaticUrl:f,innerRef:c,theme:n,debug:r}))}));var Si=()=>{const e=t.useContext(o);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const Oi=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,Ei={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],Ei);if("function"==typeof e[t])return()=>{throw Error(Oi("function"))};throw Error(Oi("attribute"))}},xi="undefined"!=typeof localStorage,ji=xi&&localStorage.getItem("base.content.url")||"",Mi="config.json",Ai="base.ui.components.url",Pi=xi&&localStorage.getItem(Ai)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Ni=xi&&localStorage.getItem(Ai)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Ui="descope-login-flow",Wi="code",Li="ra-challenge",Ti="ra-callback",_i="ra-backup-callback",Di="ra-initiator",Fi="data-exclude-field",qi="dls_last_auth",Bi="state_id",Ki="saml_idp_state_id",Vi="saml_idp_username",Hi="descope_idp_initiated",zi="sso_app_id",Gi="oidc_login_hint",Ji="oidc_prompt",Zi="data-type",Yi="poll",Xi="webauthnCreate",Qi="submit",eo="polling",to=["descope-multi-select-combo-box","descope-text-area"];var no;function io(e){return new URLSearchParams(window.location.search).get(e)}function oo(e){if(window.history.replaceState&&io(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 ro(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 so({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const o=new URL(ji||i||"https://static.descope.com/pages");return o.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(o.pathname,e,n,t),o.toString()}function ao(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?no.forward:n<i?no.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(no||(no={}));const lo=()=>{const[e="",t=""]=(io(Ui)||"").split("_");return{executionId:e,stepId:t}};function co(){oo(Ui)}const uo=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),ho=e=>{let t,n;return(...i)=>{return t&&(r=i,(o=t).length===r.length&&o.every(((e,t)=>e===r[t])))||(t=i,n=e(...i)),n;var o,r}},fo=(e,t,n,i,o,r,s)=>e&&!t&&e&&!n&&!i&&e&&!o&&e&&!r&&e&&!s,po=e=>null==e?void 0:e.submit(),go=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},vo=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function mo(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var $o,yo,bo,wo;function ko(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i+=1){const o=n[i],r=e[o],s=t[o];if(null===r||null===s){if(r!==s)return!1}else if("object"==typeof r&&"object"==typeof s){if(!ko(r,s))return!1}else if(r!==s)return!1}return!0}class Co{constructor(e={},{updateOnlyOnChange:t=!0}={}){$o.set(this,void 0),yo.set(this,{}),bo.set(this,0),wo.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,$o,"f")):e,n=Object.assign(Object.assign({},h(this,$o,"f")),t);if(!h(this,wo,"f")||!ko(h(this,$o,"f"),n)){const e=h(this,$o,"f");f(this,$o,n,"f"),Object.freeze(h(this,$o,"f")),setTimeout((()=>{Object.values(h(this,yo,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,$o,e,"f"),f(this,wo,t,"f")}get current(){return Object.assign({},h(this,$o,"f"))}subscribe(e){return f(this,bo,h(this,bo,"f")+1,"f"),h(this,yo,"f")[h(this,bo,"f")]=e,h(this,bo,"f").toString()}unsubscribe(e){const t=!!h(this,yo,"f")[e];return t&&delete h(this,yo,"f")[e],t}unsubscribeAll(){return f(this,yo,{},"f"),!0}}$o=new WeakMap,yo=new WeakMap,bo=new WeakMap,wo=new WeakMap;const Io=["disabled"],Ro=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Fi}])`)).forEach((e=>{e.value=n}))}))},So=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return i=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),i);var i})),Oo=(e,t,n)=>{e.querySelectorAll(`[${Zi}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Eo=(e,t,n)=>{var i,o;const r=null===(i=customElements.get(t))||void 0===i?void 0:i.cssVarList.url;n&&r&&(null===(o=null==e?void 0:e.style)||void 0===o||o.setProperty(r,`url(data:image/jpg;base64,${n})`))},xo=ho((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,i;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const o=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)))),r=(()=>{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=o,i=r,new Promise(((e,t)=>{let o=!1;const r=setTimeout((()=>{o=!0,void 0!==i?e(i):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{o||(clearTimeout(r),e(t))})).catch((e=>{o||(clearTimeout(r),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),jo={"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 Mo(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(qi)))}catch(e){}return t}const Ao="dls_ab_testing_id",Po=document.createElement("template");Po.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';const No=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var o;if("object"==typeof e[i]&&null!==e[i]&&!(null===(o=e[i])||void 0===o?void 0:o.value))return Object.assign(Object.assign({},n),No(e[i],`${t+i}.`));const r="object"==typeof e[i]?e[i]:{value:e[i]},s=Object.assign(Object.assign({},n),{[t+i]:r,[`form.${t}${i}`]:r});return"displayName"===i?Object.assign(Object.assign({},s),{[`${t}fullName`]:r,[`form.${t}fullName`]:r}):s}),[]);var Uo,Wo,Lo,To,_o,Do,Fo,qo,Bo,Ko,Vo,Ho,zo,Go,Jo,Zo,Yo,Xo,Qo,er,tr,nr,ir,or,rr,sr,dr,ar,lr,cr,ur,hr,fr,pr,gr,vr,mr,$r,yr,br,wr,kr,Cr,Ir,Rr,Sr,Or,Er,xr,jr,Mr;class Ar 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(),Uo.add(this),this.logger=console,Wo.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,Uo,"m",lr).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)}},Lo.set(this,new Co({deferredRedirect:!1})),To.set(this,new Co),_o.set(this,{}),this.getComponentsContext=()=>h(this,_o,"f"),this.nextRequestStatus=new Co({isLoading:!1}),Do.set(this,void 0),Fo.set(this,{popstate:h(this,Uo,"m",zo).bind(this),visibilitychange:h(this,Uo,"m",Go).bind(this),componentsContext:h(this,Uo,"m",rr).bind(this)}),qo.set(this,void 0),Qo.set(this,ho((()=>u(this,void 0,void 0,(function*(){const e=so({projectId:this.projectId,filename:Mi,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield ro(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),tr.set(this,void 0),f(this,qo,e,"f"),h(this,Uo,"m",Bo).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{return No(JSON.parse(e))}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,Qo,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,Qo,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),i=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=i.version)&&void 0!==t||(i.version=0),i}))}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,To,"f").subscribe(h(this,Uo,"m",ar).bind(this)),h(this,To,"f").update({isDebug:this.debug}),h(this,Uo,"m",Ko).call(this))return void h(this,Uo,"m",Vo).call(this);if(h(this,Uo,"m",Ho).call(this),f(this,tr,h(this,Uo,"m",er).call(this),"f"),yield h(this,Uo,"m",Yo).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,Qo,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,Uo,"m",nr).call(this),yield h(this,Uo,"m",hr).call(this),yield h(this,Uo,"m",ir).call(this),h(this,Uo,"m",cr).call(this);const{executionId:e,stepId:t,token:n,code:i,exchangeError:o,redirectAuthCallbackUrl:r,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:d,redirectAuthInitiator:a,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:p,ssoAppId:g,oidcLoginHint:v,oidcPrompt:m}=(()=>{const{executionId:e,stepId:t}=lo();(e||t)&&co();const n=io("t")||void 0;n&&oo("t");const i=io(Wi)||void 0;i&&oo(Wi);const o=io("err")||void 0;o&&oo("err");const{redirectAuthCodeChallenge:r,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:d,redirectAuthInitiator:a}={redirectAuthCodeChallenge:io(Li),redirectAuthCallbackUrl:io(Ti),redirectAuthBackupCallbackUri:io(_i),redirectAuthInitiator:io(Di)};(r||s||d||a)&&(oo(Li),oo(Ti),oo(_i),oo(Di));const l=io(Bi);l&&oo(Bi);const c=io(Ki);c&&oo(Ki);const u=io(Vi);c&&oo(Vi);const h=io(Hi);h&&oo(Hi);const f=io(zi);f&&oo(zi);const p=io(Gi);p&&oo(Gi);const g=io(Ji);return g&&oo(Ji),{executionId:e,stepId:t,token:n,code:i,exchangeError:o,redirectAuthCodeChallenge:r,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:d,redirectAuthInitiator:a,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:f,oidcLoginHint:p,oidcPrompt:g}})();window.addEventListener("popstate",h(this,Fo,"f").popstate),window.addEventListener("components-context",h(this,Fo,"f").componentsContext),window.addEventListener("visibilitychange",h(this,Fo,"f").visibilitychange),h(this,Lo,"f").subscribe(h(this,Uo,"m",Zo).bind(this)),h(this,Lo,"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:i,exchangeError:o,redirectAuthCallbackUrl:r,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:d,redirectAuthInitiator:a,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:p,ssoAppId:g,oidcLoginHint:v,oidcPrompt:m}),f(this,Wo,!0,"f")}}))}disconnectedCallback(){h(this,Lo,"f").unsubscribeAll(),h(this,To,"f").unsubscribeAll(),h(this,Uo,"m",dr).call(this),window.removeEventListener("popstate",h(this,Fo,"f").popstate),window.removeEventListener("visibilitychange",h(this,Fo,"f").visibilitychange),window.removeEventListener("components-context",h(this,Fo,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,Wo,"f")&&t!==n&&Ar.observedAttributes.includes(e)){h(this,Uo,"m",Ho).call(this);const i=null===t;h(this,Lo,"f").update((({stepId:t,executionId:o})=>{let r=t,s=o;return i||(s=null,r=null,co()),{[uo(e)]:n,stepId:r,executionId:s}})),h(this,To,"f").update({isDebug:this.debug}),"theme"===e&&h(this,Uo,"m",sr).call(this)}}}Wo=new WeakMap,Lo=new WeakMap,To=new WeakMap,_o=new WeakMap,Do=new WeakMap,Fo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,tr=new WeakMap,Uo=new WeakSet,Bo=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Po.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},Ko=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},Vo=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)},Ho=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(Ar.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[uo(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')},zo=function(){const{stepId:e,executionId:t}=lo();h(this,Lo,"f").update({stepId:e,executionId:t})},Go=function(){document.hidden||setTimeout((()=>{h(this,Lo,"f").update({deferredRedirect:!1})}),300)},Jo=function(e,t){this.sdk=si(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout},Ar.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})}}))}))},Zo=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;h(this,Uo,"m",Jo).call(this,t,i)}h(this,qo,"f").call(this,e)}))},Yo=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,Qo,"f").call(this)).isMissingConfig&&(yield h(this,Uo,"m",Xo).call(this))}))},Xo=function(){return u(this,void 0,void 0,(function*(){const e=so({projectId:this.projectId,filename:Mi,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield ro(e,"json"),!0}catch(e){return!1}}))},er=function(){return u(this,void 0,void 0,(function*(){const e=so({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield ro(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},nr=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,Qo,"f").call(this),i=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;i&&Object.values(i).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},ir=function(){return u(this,void 0,void 0,(function*(){yield h(this,Uo,"m",or).call(this),yield h(this,Uo,"m",sr).call(this)}))},or=function(){var e,t,n,i;return u(this,void 0,void 0,(function*(){const o=document.createElement("style"),r=yield h(this,tr,"f");o.innerText=((null===(e=null==r?void 0:r.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==r?void 0:r.dark)||void 0===t?void 0:t.globals)||"");const s=yield Ar.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==r?void 0:r.light)||void 0===n?void 0:n.components,dark:null===(i=null==r?void 0:r.dark)||void 0===i?void 0:i.components}),this.shadowRoot.appendChild(o)}))},rr=function(e){f(this,_o,Object.assign(Object.assign({},h(this,_o,"f")),e.detail),"f")},sr=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Ar.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},dr=function(){var e;null===(e=h(this,Do,"f"))||void 0===e||e.remove(),f(this,Do,null,"f")},ar=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(f(this,Do,document.createElement("descope-debugger"),"f"),Object.assign(h(this,Do,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return uv})),document.body.appendChild(h(this,Do,"f"))):h(this,Uo,"m",dr).call(this)}))},lr=function(e,t){var n;e&&this.debug&&(null===(n=h(this,Do,"f"))||void 0===n||n.updateData({title:e,description:t}))},cr=function(){this.rootElement.onkeydown=e=>{var t,n,i;const o=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),r=to.includes(null!==(i=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==i?i:"");if("Enter"!==e.key||o||r)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 d=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===d.length)return void d[0].click();const a=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===a.length)"false"!==a[0].getAttribute("auto-submit")&&a[0].click();else if(0===a.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()}}},ur=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,Qo,"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")}))},hr=function(){return u(this,void 0,void 0,(function*(){Ar.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Ar.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),i=(t,n)=>{const i=()=>{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||i(),e(globalThis.DescopeUI)})),t.addEventListener("error",i)};(()=>{u(this,void 0,void 0,(function*(){const o=yield h(this,Uo,"m",ur).call(this),r=t(n(Pi,o));i(r,(()=>{r.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Ni,o));i(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(r)}))})()}))}))},Ar.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.19.5"}};class Pr extends Ar{static set sdkConfigOverrides(e){Ar.sdkConfigOverrides=e}constructor(){const e=new Co;super(e.update.bind(e)),fr.add(this),this.stepState=new Co({},{updateOnlyOnChange:!1}),pr.set(this,void 0),gr.set(this,null),vr.set(this,((e,t,n,i,o)=>{n===Yi&&f(this,pr,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const r=yield this.sdk.flow.next(e,t,eo,i,o,{});h(this,$r,"f").call(this,r);const{action:s}=null!==(n=null==r?void 0:r.data)&&void 0!==n?n:{};h(this,vr,"f").call(this,e,t,s,i,o)}))),2e3),"f")})),mr.set(this,(()=>{clearTimeout(h(this,pr,"f")),f(this,pr,null,"f")})),$r.set(this,(e=>{var t,n,i,o,r,s,d,a,l,c,u;if(!(null==e?void 0:e.ok)){h(this,fr,"m",Mr).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,d=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.statusText}`;return void this.loggerWrapper.error((null===(o=null==e?void 0:e.error)||void 0===o?void 0:o.errorDescription)||s,(null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorMessage)||d)}null===(d=null===(s=e.data)||void 0===s?void 0:s.runnerLogs)||void 0===d||d.forEach((e=>{const{level:t,title:n,log:i}=e;t&&this.loggerWrapper[t]?this.loggerWrapper[t](n,i):this.loggerWrapper.info(n,i)}));const f=null===(c=null===(l=null===(a=e.data)||void 0===a?void 0:a.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}`,`${f?`${f} - `:""}${e.data.error.message}`):f&&this.loggerWrapper.error(f);const{status:p,authInfo:g,lastAuth:v}=e.data;if("completed"===p)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&xi&&localStorage.setItem(qi,JSON.stringify(e))}(v),void h(this,fr,"m",Mr).call(this,"success",g);const{executionId:m,stepId:$,stepName:y,action:b,screen:w,redirect:k,openInNewTabUrl:C,webauthn:I,error:R,samlIdpResponse:S}=e.data;b!==Yi?(this.loggerWrapper.info(`Step "${y||`#${$}`}" is ${p}`,"",{screen:w,status:p,stepId:$,stepName:y,action:b,error:R}),this.flowState.update({stepId:$,executionId:m,action:b,redirectTo:null==k?void 0:k.url,openInNewTabUrl:C,screenId:null==w?void 0:w.id,screenState:null==w?void 0:w.state,webauthnTransactionId:null==I?void 0:I.transactionId,webauthnOptions:null==I?void 0:I.options,samlIdpResponseUrl:null==S?void 0:S.url,samlIdpResponseSamlResponse:null==S?void 0:S.samlResponse,samlIdpResponseRelayState:null==S?void 0:S.relayState})):this.flowState.update({action:b})})),yr.set(this,ho((()=>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)}}))))),Or.set(this,vo(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,fr,"m",Cr).call(this)){const i=null==e?void 0:e.getAttribute("id");h(this,fr,"m",Rr).call(this,e);const o=yield h(this,fr,"m",Ir).call(this),r=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const i=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return i?Object.assign(e,{[i]:t.value}):e}),{})),s=this.getComponentsContext(),d=Object.assign(Object.assign(Object.assign(Object.assign({},s),r),o),{origin:window.location.origin}),a=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(i,a.version,l.componentsVersion,d);h(this,$r,"f").call(this,c),h(this,fr,"m",Sr).call(this,o)}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,gr,"f"))||void 0===e||e.abort(),f(this,gr,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const i=mo(e);return(yield this.getTargetLocales()).includes(i)&&(n=`${t}-${i}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield ro(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 ro(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var i,o;return u(this,void 0,void 0,(function*(){const{projectId:r,flowId:s,tenant:d,stepId:a,executionId:l,action:c,screenId:u,screenState:p,redirectTo:g,openInNewTabUrl:v,redirectUrl:m,token:$,code:y,exchangeError:b,webauthnTransactionId:w,webauthnOptions:k,redirectAuthCodeChallenge:C,redirectAuthCallbackUrl:I,redirectAuthBackupCallbackUri:R,redirectAuthInitiator:S,oidcIdpStateId:O,locale:E,samlIdpStateId:x,samlIdpUsername:j,descopeIdpInitiated:M,samlIdpResponseUrl:A,samlIdpResponseSamlResponse:P,samlIdpResponseRelayState:N,ssoAppId:U,oidcLoginHint:W,oidcPrompt:L}=e;let T,_;const D=(()=>{const e=localStorage.getItem(Ao);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Ao,e.toString()),e}return Number(e)})(),F=this.sdk.getLastUserLoginId(),q=yield this.getFlowConfig(),B=yield this.getProjectConfig(),K=I&&C?{callbackUrl:I,codeChallenge:C,backupCallbackUri:R}:void 0;if(!l&&(q.fingerprintEnabled&&q.fingerprintKey?yield _n(q.fingerprintKey,this.baseUrl):localStorage.removeItem(Ln),q.conditions?({startScreenId:T,conditionInteractionId:_}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:i})=>{var o;if("ELSE"===t)return!0;const r=null===(o=jo[t])||void 0===o?void 0:o[n];return!!(null==r?void 0:r(e,i))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:F,code:y,token:$,abTestingKey:D},q.conditions)):q.condition?({startScreenId:T,conditionInteractionId:_}=((e,t)=>{var n;const i=null===(n=jo[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!i)return{};const o=i(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==o?void 0:o.screenId,conditionInteractionId:null==o?void 0:o.interactionId}})(q.condition,{loginId:F,code:y,token:$,abTestingKey:D})):T=q.startScreenId,!fo(T,O,x,j,U,W,L))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:d,redirectAuth:K,oidcIdpStateId:O,samlIdpStateId:x,samlIdpUsername:j,ssoAppId:U,oidcLoginHint:W,oidcPrompt:L,client:this.client},m&&{redirectUrl:m}),{lastAuth:Mo(F),abTestingKey:D,locale:mo(E)}),_,"",q.version,B.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),M&&{idpInitiated:!0}),$?{token:$}:{}),W?{externalId:W}:{}));return h(this,$r,"f").call(this,e),void("completed"!==(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&$||n("code")&&y||n("exchangeError")&&b)){const e=yield this.sdk.flow.next(l,a,Qi,q.version,B.componentsVersion,{token:$,exchangeCode:y,exchangeError:b});return h(this,$r,"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(!A||!P)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,i)=>{const o=document.createElement("form");o.method="POST",o.action=e,o.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(o),i(o)})(A,P,N||"",po)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===S&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===Xi||"webauthnGet"===c){if(!w||!k)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(o=h(this,gr,"f"))||void 0===o||o.abort(),f(this,gr,null,"f");try{e=c===Xi?yield this.sdk.webauthn.helpers.create(k):yield this.sdk.webauthn.helpers.get(k)}catch(r){"InvalidStateError"===r.name?this.loggerWrapper.warn("WebAuthn operation failed",r.message):"NotAllowedError"!==r.name&&this.loggerWrapper.error(r.message),t=r.name}const n=yield this.sdk.flow.next(l,a,Qi,q.version,B.componentsVersion,{transactionId:w,response:e,failure:t});h(this,$r,"f").call(this,n)}if(h(this,vr,"f").call(this,l,a,c,q.version,B.componentsVersion),!u&&!T)return void this.loggerWrapper.warn("No screen was found to show");const V=T||u,H=yield this.getHtmlFilenameWithLocale(E,V),z={direction:ao(a,t.stepId),screenState:Object.assign(Object.assign({},p),{form:Object.assign(Object.assign({},this.formConfigValues),null==p?void 0:p.form),lastAuth:{loginId:F,name:this.sdk.getLastUserDisplayName()||F}}),htmlUrl:so({projectId:r,filename:`${V}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:H&&so({projectId:r,filename:H,baseUrl:this.baseStaticUrl}),samlIdpUsername:j,oidcLoginHint:W,oidcPrompt:L,openInNewTabUrl:v},G=Mo(F);fo(T,O,x,j,U,W,L)?z.next=(e,t,n,i)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:d,redirectAuth:K,oidcIdpStateId:O,samlIdpStateId:x,samlIdpUsername:j,ssoAppId:U,oidcLoginHint:W,lastAuth:G,preview:this.preview,abTestingKey:D,client:this.client},m&&{redirectUrl:m}),{locale:mo(E),oidcPrompt:L}),_,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),i),y&&{exchangeCode:y,idpInitiated:!0}),M&&{idpInitiated:!0}),$&&{token:$})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(z.next=(...e)=>this.sdk.flow.next(l,a,...e)),this.stepState.update(z)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield Ar.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,i;return u(this,void 0,void 0,(function*(){const{htmlUrl:o,htmlLocaleUrl:r,direction:s,next:d,screenState:a,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(o,r);const f=c.content.cloneNode(!0),p=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield h(this,fr,"m",kr).call(this,f,d):f.querySelectorAll(`descope-button[${Zi}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=a.form)||void 0===n?void 0:n.loginId)||(null===(i=a.form)||void 0===i?void 0:i.email)||(a.form||(a.form={}),a.form.loginId=e.samlIdpUsername,a.form.email=e.samlIdpUsername),((e,t,n,i,o,r)=>{var s,d;let a=null==t?void 0:t.errorText;try{a=(null==o?void 0:o({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){r.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Zi}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",a),Oo(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),Oo(e,"notp-link",null===(d=null==t?void 0:t.notp)||void 0===d?void 0:d.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=So(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",So(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((i=>{e.querySelectorAll(`[name=${i}]`).forEach((e=>{const o=t[i];Object.keys(o).forEach((t=>{let i=o[t];if("string"!=typeof i)try{i=JSON.stringify(i)}catch(e){n.error(`Could not stringify value "${i}" for "${t}"`,e.message),i=""}e.setAttribute(t,i)}))}))}))})(e,n,r),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=So(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])=>{Io.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,i)})(f,a,a.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)}))})(f,g);const v=()=>u(this,void 0,void 0,(function*(){var e,n;yield p;const i=this.shadowRoot.querySelector("div");var o,r;o=i,r=null===(e=null==a?void 0:a.totp)||void 0===e?void 0:e.image,Eo(o,"descope-totp-image",r),((e,t)=>{Eo(e,"descope-notp-image",t)})(i,null===(n=null==a?void 0:a.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(f),setTimeout((()=>{((e,t)=>{Ro(e,null==t?void 0:t.inputs),Ro(e,null==t?void 0:t.form)})(this.rootElement,a);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=>h(this,fr,"m",wr).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,fr,"m",xr).call(this,d),s&&h(this,fr,"m",Mr).call(this,"ready",{}),h(this,fr,"m",Mr).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Zi}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield d(eo,e.version,t.componentsVersion,{});h(this,$r,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?h(this,fr,"m",jr).call(this,v,s):v()}))}}pr=new WeakMap,gr=new WeakMap,vr=new WeakMap,mr=new WeakMap,$r=new WeakMap,yr=new WeakMap,Or=new WeakMap,fr=new WeakSet,br=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)}))}},wr=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),i=`input-${e.id}-${n}`,o=document.createElement("slot");o.setAttribute("name",i),o.setAttribute("slot",n),e.appendChild(o),t.setAttribute("slot",i),this.appendChild(t)}))},kr=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,gr,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield xo())){const{options:e,transactionId:n}=(yield h(this,yr,"f").call(this))||{};if(e&&n){h(this,fr,"m",br).call(this,i),f(this,gr,new AbortController,"f");const o=yield this.getFlowConfig(),r=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,gr,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(i.id,o.version,r.componentsVersion,{transactionId:n,response:e});h(this,$r,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},Cr=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,i;"slot"!==t.localName&&(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(i=t.checkValidity)||void 0===i?void 0:i.call(t)))})),e},Ir=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Fi}])`));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})),{})}))},Rr=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Sr=function(e={}){var t,n;const i=go(e,["externalId","email","phone"]),o=go(e,["newPassword","password"]);if(i&&o)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:i,password:o});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)}},Er=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,Or,"f").call(this,t,e)}))}))},xr=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,Or,"f").call(this,t,e)}})),h(this,fr,"m",Er).call(this,e)},jr=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===no.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")},Mr=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",Pr);var Nr=Object.freeze({__proto__:null,default:Pr});function Ur(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Wr=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Lr=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Tr=e=>{let t,n;return(...i)=>(t&&Lr(t,i)||(t=i,n=e(...i)),n)},_r=e=>(t,...n)=>t.reduce(((t,i,o)=>{var r;return`${t}${i}${(null===(r=null==n?void 0:n[o])||void 0===r?void 0:r[e>1?1:0])||""}`}),""),Dr=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},Fr=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 i=e(n);return i[t]=!0,i}};var qr,Br,Kr,Vr,Hr,zr;function Gr(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i+=1){const o=n[i],r=e[o],s=t[o];if(null===r||null===s){if(r!==s)return!1}else if("object"==typeof r&&"object"==typeof s){if(!Gr(r,s))return!1}else if(r!==s)return!1}return!0}class Jr{constructor(e={},{updateOnlyOnChange:t=!0}={}){qr.set(this,void 0),Br.set(this,{}),Kr.set(this,0),Vr.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,qr,"f")):e,n=Object.assign(Object.assign({},h(this,qr,"f")),t);if(!h(this,Vr,"f")||!Gr(h(this,qr,"f"),n)){const e=h(this,qr,"f");f(this,qr,n,"f"),Object.freeze(h(this,qr,"f")),setTimeout((()=>{Object.values(h(this,Br,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,qr,e,"f"),f(this,Vr,t,"f")}get current(){return Object.assign({},h(this,qr,"f"))}subscribe(e){return f(this,Kr,h(this,Kr,"f")+1,"f"),h(this,Br,"f")[h(this,Kr,"f")]=e,h(this,Kr,"f").toString()}unsubscribe(e){const t=!!h(this,Br,"f")[e];return t&&delete h(this,Br,"f")[e],t}unsubscribeAll(){return f(this,Br,{},"f"),!0}}qr=new WeakMap,Br=new WeakMap,Kr=new WeakMap,Vr=new WeakMap;class Zr{constructor(e,t){Hr.set(this,void 0),this.nodeName="",f(this,Hr,e,"f"),this.logger=t.logger}get asyncEle(){return(async(e,t)=>new Promise((t=>{const n=setInterval((()=>{const i="function"==typeof e?e():e;i&&(clearInterval(n),t(i))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(h(this,Hr,"f"))}get ele(){var e,t;const n="function"==typeof h(this,Hr,"f")?h(this,Hr,"f").call(this):h(this,Hr,"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)}}Hr=new WeakMap;const Yr=/^descope-grid-([^-]+)-column$/,Xr={text:class extends Zr{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 Zr{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 Qr extends Zr{constructor(){super(...arguments),this.nodeName="descope-grid",zr.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 i=null===(n=Yr.exec(t.localName))||void 0===n?void 0:n[1],o=Xr[i];return o?(e.push(new o(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const i=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);Lr(i,this.ele.columns)||(this.ele.columns=i,null===(n=h(this,zr,"f"))||void 0===n||n.call(this,i))}onColumnsChange(e){f(this,zr,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}zr=new WeakMap;class es extends Zr{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 ts;class ns extends Zr{constructor(){super(...arguments),ts.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,ts,"f")&&(null===(e=this.ele)||void 0===e||e.append(h(this,ts,"f").content.cloneNode(!0)))}setContent(e){f(this,ts,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}ts=new WeakMap;class is extends Zr{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 os extends Zr{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 rs extends Zr{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 ss extends Zr{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 ds extends Zr{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 as extends Zr{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 ls extends Zr{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 cs extends Zr{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 us extends Zr{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 hs(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 fs=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ps=()=>Math.random().toString(36).substring(7).split("").join("."),gs={INIT:`@@redux/INIT${ps()}`,REPLACE:`@@redux/REPLACE${ps()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ps()}`};function vs(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 ms(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 $s(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=ms(e)),t}function ys(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?hs(2):`Expected the root reducer to be a function. Instead, received: '${$s(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?hs(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?hs(1):`Expected the enhancer to be a function. Instead, received: '${$s(n)}'`);return n(ys)(e,t)}let i=e,o=t,r=new Map,s=r,d=0,a=!1;function l(){s===r&&(s=new Map,r.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(a)throw new Error("production"===process.env.NODE_ENV?hs(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 o}function u(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?hs(4):`Expected the listener to be a function. Instead, received: '${$s(e)}'`);if(a)throw new Error("production"===process.env.NODE_ENV?hs(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=d++;return s.set(n,e),function(){if(t){if(a)throw new Error("production"===process.env.NODE_ENV?hs(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),r=null}}}function h(e){if(!vs(e))throw new Error("production"===process.env.NODE_ENV?hs(7):`Actions must be plain objects. Instead, the actual type was: '${$s(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?hs(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?hs(17):`Action "type" property must be a string. Instead, the actual type was: '${$s(e.type)}'. Value was: '${e.type}' (stringified)`);if(a)throw new Error("production"===process.env.NODE_ENV?hs(9):"Reducers may not dispatch actions.");try{a=!0,o=i(o,e)}finally{a=!1}return(r=s).forEach((e=>{e()})),e}h({type:gs.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?hs(10):`Expected the nextReducer to be a function. Instead, received: '${$s(e)}`);i=e,h({type:gs.REPLACE})},[fs]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?hs(11):`Expected the observer to be an object. Instead, received: '${$s(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[fs](){return this}}}}}function bs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function ws(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const o=t[i];"production"!==process.env.NODE_ENV&&void 0===e[o]&&bs(`No reducer provided for key "${o}"`),"function"==typeof e[o]&&(n[o]=e[o])}const i=Object.keys(n);let o,r;"production"!==process.env.NODE_ENV&&(o={});try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:gs.INIT}))throw new Error("production"===process.env.NODE_ENV?hs(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:gs.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?hs(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${gs.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){r=e}return function(e={},t){if(r)throw r;if("production"!==process.env.NODE_ENV){const i=function(e,t,n,i){const o=Object.keys(t),r=n&&n.type===gs.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===o.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!vs(e))return`The ${r} has unexpected type of "${$s(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!i[e]));return s.forEach((e=>{i[e]=!0})),n&&n.type===gs.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${r}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,o);i&&bs(i)}let s=!1;const d={};for(let o=0;o<i.length;o++){const r=i[o],a=n[r],l=e[r],c=a(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?hs(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${r}" 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.`)}d[r]=c,s=s||c!==l}return s=s||i.length!==Object.keys(e).length,s?d:e}}function ks(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Cs(e){return vs(e)&&"type"in e&&"string"==typeof e.type}var Is=Symbol.for("immer-nothing"),Rs=Symbol.for("immer-draftable"),Ss=Symbol.for("immer-state"),Os="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 Es(e,...t){if("production"!==process.env.NODE_ENV){const n=Os[e],i="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var xs=Object.getPrototypeOf;function js(e){return!!e&&!!e[Ss]}function Ms(e){return!!e&&(Ps(e)||Array.isArray(e)||!!e[Rs]||!!e.constructor?.[Rs]||Ts(e)||_s(e))}var As=Object.prototype.constructor.toString();function Ps(e){if(!e||"object"!=typeof e)return!1;const t=xs(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)===As}function Ns(e,t){0===Us(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function Us(e){const t=e[Ss];return t?t.type_:Array.isArray(e)?1:Ts(e)?2:_s(e)?3:0}function Ws(e,t){return 2===Us(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ls(e,t,n){const i=Us(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function Ts(e){return e instanceof Map}function _s(e){return e instanceof Set}function Ds(e){return e.copy_||e.base_}function Fs(e,t){if(Ts(e))return new Map(e);if(_s(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Ps(e)){if(!xs(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Ss];let i=Reflect.ownKeys(n);for(let t=0;t<i.length;t++){const o=i[t],r=n[o];!1===r.writable&&(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(n[o]={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[o]})}return Object.create(xs(e),n)}function qs(e,t=!1){return Ks(e)||js(e)||!Ms(e)||(Us(e)>1&&(e.set=e.add=e.clear=e.delete=Bs),Object.freeze(e),t&&Ns(e,((e,t)=>qs(t,!0)))),e}function Bs(){Es(2)}function Ks(e){return Object.isFrozen(e)}var Vs,Hs={};function zs(e){const t=Hs[e];return t||Es(0,e),t}function Gs(){return Vs}function Js(e,t){t&&(zs("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Zs(e){Ys(e),e.drafts_.forEach(Qs),e.drafts_=null}function Ys(e){e===Vs&&(Vs=e.parent_)}function Xs(e){return Vs={drafts_:[],parent_:Vs,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Qs(e){const t=e[Ss];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ed(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ss].modified_&&(Zs(t),Es(4)),Ms(e)&&(e=td(t,e),t.parent_||id(t,e)),t.patches_&&zs("Patches").generateReplacementPatches_(n[Ss].base_,e,t.patches_,t.inversePatches_)):e=td(t,n,[]),Zs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Is?e:void 0}function td(e,t,n){if(Ks(t))return t;const i=t[Ss];if(!i)return Ns(t,((o,r)=>nd(e,i,t,o,r,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return id(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let o=t,r=!1;3===i.type_&&(o=new Set(t),t.clear(),r=!0),Ns(o,((o,s)=>nd(e,i,t,o,s,n,r))),id(e,t,!1),n&&e.patches_&&zs("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function nd(e,t,n,i,o,r,s){if("production"!==process.env.NODE_ENV&&o===n&&Es(5),js(o)){const s=td(e,o,r&&t&&3!==t.type_&&!Ws(t.assigned_,i)?r.concat(i):void 0);if(Ls(n,i,s),!js(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(Ms(o)&&!Ks(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;td(e,o),t&&t.scope_.parent_||id(e,o)}}function id(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&qs(t,n)}var od={get(e,t){if(t===Ss)return e;const n=Ds(e);if(!Ws(n,t))return function(e,t,n){const i=dd(t,n);return i?"value"in i?i.value:i.get?.call(e.draft_):void 0}(e,n,t);const i=n[t];return e.finalized_||!Ms(i)?i:i===sd(e.base_,t)?(ld(e),e.copy_[t]=cd(i,e)):i},has:(e,t)=>t in Ds(e),ownKeys:e=>Reflect.ownKeys(Ds(e)),set(e,t,n){const i=dd(Ds(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=sd(Ds(e),t),o=i?.[Ss];if(o&&o.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,i)&&(void 0!==n||Ws(e.base_,t)))return!0;ld(e),ad(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!==sd(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ld(e),ad(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ds(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){Es(11)},getPrototypeOf:e=>xs(e.base_),setPrototypeOf(){Es(12)}},rd={};function sd(e,t){const n=e[Ss];return(n?Ds(n):e)[t]}function dd(e,t){if(!(t in e))return;let n=xs(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=xs(n)}}function ad(e){e.modified_||(e.modified_=!0,e.parent_&&ad(e.parent_))}function ld(e){e.copy_||(e.copy_=Fs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ns(od,((e,t)=>{rd[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),rd.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Es(13),rd.set.call(this,e,t,void 0)},rd.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Es(14),od.set.call(this,e[0],t,n,e[0])};function cd(e,t){const n=Ts(e)?zs("MapSet").proxyMap_(e,t):_s(e)?zs("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:Gs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=i,r=od;n&&(o=[i],r=rd);const{revoke:s,proxy:d}=Proxy.revocable(o,r);return i.draft_=d,i.revoke_=s,d}(e,t);return(t?t.scope_:Gs()).drafts_.push(n),n}function ud(e){return js(e)||Es(10,e),hd(e)}function hd(e){if(!Ms(e)||Ks(e))return e;const t=e[Ss];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fs(e,!0);return Ns(n,((e,t)=>{Ls(n,e,hd(t))})),t&&(t.finalized_=!1),n}var fd=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 i=this;return function(e=n,...o){return i.produce(e,(e=>t.call(this,e,...o)))}}let i;if("function"!=typeof t&&Es(6),void 0!==n&&"function"!=typeof n&&Es(7),Ms(e)){const o=Xs(this),r=cd(e,void 0);let s=!0;try{i=t(r),s=!1}finally{s?Zs(o):Ys(o)}return Js(o,n),ed(i,o)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===Is&&(i=void 0),this.autoFreeze_&&qs(i,!0),n){const t=[],o=[];zs("Patches").generateReplacementPatches_(e,i,t,o),n(t,o)}return i}Es(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,i;const o=this.produce(e,t,((e,t)=>{n=e,i=t}));return[o,n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Ms(e)||Es(8),js(e)&&(e=ud(e));const t=Xs(this),n=cd(e,void 0);return n[Ss].isManual_=!0,Ys(t),n}finishDraft(e,t){const n=e&&e[Ss];n&&n.isManual_||Es(9);const{scope_:i}=n;return Js(i,t),ed(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));const i=zs("Patches").applyPatches_;return js(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},pd=fd.produce;fd.produceWithPatches.bind(fd),fd.setAutoFreeze.bind(fd),fd.setUseStrictShallowCopy.bind(fd),fd.applyPatches.bind(fd),fd.createDraft.bind(fd),fd.finishDraft.bind(fd);var gd=(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})}}},vd=(e,t,n)=>{const{memoize:i,memoizeOptions:o}=t,{inputSelectorResults:r,inputSelectorResultsCopy:s}=e,d=i((()=>({})),...o);if(!(d.apply(null,r)===d.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:r,secondInputs:s,stack:e})}},md={inputStabilityCheck:"once",identityFunctionCheck:"once"};var $d=e=>Array.isArray(e)?e:[e];function yd(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 bd(e,t){const n=[],{length:i}=e;for(let o=0;o<i;o++)n.push(e[o].apply(null,t));return n}var wd="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},kd=0,Cd=1;function Id(){return{s:kd,v:void 0,o:null,p:null}}function Rd(e,t={}){let n=Id();const{resultEqualityCheck:i}=t;let o,r=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 i=e.get(n);void 0===i?(t=Id(),e.set(n,t)):t=i}else{let e=t.p;null===e&&(t.p=e=new Map);const i=e.get(n);void 0===i?(t=Id(),e.set(n,t)):t=i}}const d=t;let a;if(t.s===Cd)a=t.v;else if(a=e.apply(null,arguments),r++,i){const e=o?.deref?.()??o;null!=e&&i(e,a)&&(a=e,0!==r&&r--);o="object"==typeof a&&null!==a||"function"==typeof a?new wd(a):a}return d.s=Cd,d.v=a,a}return s.clearCache=()=>{n=Id(),s.resetResultsCount()},s.resultsCount=()=>r,s.resetResultsCount=()=>{r=0},s}function Sd(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,i=(...e)=>{let t,i=0,o=0,r={},s=e.pop();"object"==typeof s&&(r=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 d={...n,...r},{memoize:a,memoizeOptions:l=[],argsMemoize:c=Rd,argsMemoizeOptions:u=[],devModeChecks:h={}}=d,f=$d(l),p=$d(u),g=yd(e),v=a((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const $=c((function(){o++;const e=bd(g,arguments);if(t=v.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:i}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:i}={...md,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:gd},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:vd}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=bd(g,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:a,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign($,{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:a,argsMemoize:c})};return Object.assign(i,{withTypes:()=>i}),i}var Od=Sd(Rd),Ed=Object.assign(((e,t=Od)=>{!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),i=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,i)=>(e[n[i]]=t,e)),{})));return i}),{withTypes:()=>Ed});function xd(e){return({dispatch:t,getState:n})=>i=>o=>"function"==typeof o?o(t,n,e):i(o)}var jd=xd(),Md=xd;((...e)=>{const t=Sd(...e)})(Rd);var Ad="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ks:ks.apply(null,arguments)},Pd=e=>e&&"function"==typeof e.match;function Nd(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?pa(0):"prepareAction did not return an object");return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Cs(t)&&t.type===e,n}function Ud(e){return"function"==typeof e&&"type"in e&&Pd(e)}function Wd(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 Ld=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 Td(e){return Ms(e)?pd(e,(()=>{})):e}function _d(e,t,n){if(e.has(t)){let i=e.get(t);return n.update&&(i=n.update(i,t,e),e.set(t,i)),i}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?pa(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function Dd(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Fd(e,t,n){const i=qd(e,t,n);return{detectMutations:()=>Bd(e,t,i,n)}}function qd(e,t=[],n,i="",o=new Set){const r={value:n};if(!e(n)&&!o.has(n)){o.add(n),r.children={};for(const o in n){const s=i?i+"."+o:o;t.length&&-1!==t.indexOf(s)||(r.children[o]=qd(e,t,n[o],s))}}return r}function Bd(e,t=[],n,i,o=!1,r=""){const s=n?n.value:void 0,d=s===i;if(o&&!d&&!Number.isNaN(i))return{wasMutated:!0,path:r};if(e(s)||e(i))return{wasMutated:!1};const a={};for(let e in n.children)a[e]=!0;for(let e in i)a[e]=!0;const l=t.length>0;for(let o in a){const s=r?r+"."+o:o;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const a=Bd(e,t,n.children[o],i[o],d,s);if(a.wasMutated)return a}return{wasMutated:!1}}function Kd(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||vs(e)}function Vd(e,t="",n=Kd,i,o=[],r){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(r?.has(e))return!1;const d=null!=i?i(e):Object.entries(e),a=o.length>0;for(const[e,l]of d){const d=t?t+"."+e:e;if(a){if(o.some((e=>e instanceof RegExp?e.test(d):d===e)))continue}if(!n(l))return{keyPath:d,value:l};if("object"==typeof l&&(s=Vd(l,d,n,i,o,r),s))return s}return r&&Hd(e)&&r.add(e),!1}function Hd(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Hd(t))return!1;return!0}function zd(e){return"boolean"==typeof e}var Gd=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=e??{};let r=new Ld;if(t&&(zd(t)?r.push(jd):r.push(Md(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};zd(n)||(e=n),r.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,i,o){return JSON.stringify(e,n(t,o),i)},n=function(e,t){let n=[],i=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]"}),function(o,r){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,o):i.push(o),~n.indexOf(r)&&(r=t.call(this,o,r))}else n.push(r);return null==e?r:e.call(this,o,r)}},{isImmutable:i=Dd,ignoredPaths:o,warnAfter:r=32}=e;const s=Fd.bind(null,i,o);return({getState:e})=>{let n,i=e(),o=s(i);return d=>a=>{const l=Wd(r,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=o.detectMutations(),o=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?pa(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=d(a);return l.measureTime((()=>{if(i=e(),n=o.detectMutations(),o=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?pa(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(a)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(i){let e={};zd(i)||(e=i),r.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Kd,getEntries:n,ignoredActions:i=[],ignoredActionPaths:o=["meta.arg","meta.baseQueryMeta"],ignoredPaths:r=[],warnAfter:s=32,ignoreState:d=!1,ignoreActions:a=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!Cs(u))return l(u);const h=l(u),f=Wd(s,"SerializableStateInvariantMiddleware");return a||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=Vd(u,"",t,n,o,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)")}})),d||(f.measureTime((()=>{const i=Vd(e.getState(),"",t,n,r,c);if(i){const{keyPath:e,value:t}=i;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)`)}})),f.warnIfExceeded()),h}}}(e))}if(o){let e={};zd(o)||(e=o),r.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Ud}=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 r},Jd=e=>t=>{setTimeout(t,e)},Zd="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Jd(10),Yd=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new Ld(e);return n&&i.push(((e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let o=!0,r=!1,s=!1;const d=new Set,a="tick"===e.type?queueMicrotask:"raf"===e.type?Zd:"callback"===e.type?e.queueNotification:Jd(e.timeout),l=()=>{s=!1,r&&(r=!1,d.forEach((e=>e())))};return Object.assign({},i,{subscribe(e){const t=i.subscribe((()=>o&&e()));return d.add(e),()=>{t(),d.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,r=!o,r&&(s||(s=!0,a(l))),i.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),i},Xd="production"===process.env.NODE_ENV;function Qd(e){const t=Gd(),{reducer:n,middleware:i,devTools:o=!0,preloadedState:r,enhancers:s}=e||{};let d,a;if("function"==typeof n)d=n;else{if(!vs(n))throw new Error("production"===process.env.NODE_ENV?pa(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");d=ws(n)}if(!Xd&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?pa(2):"`middleware` field must be a callback");if("function"==typeof i){if(a=i(t),!Xd&&!Array.isArray(a))throw new Error("production"===process.env.NODE_ENV?pa(3):"when using a middleware builder function, an array of middleware must be returned")}else a=t();if(!Xd&&a.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?pa(4):"each middleware provided to configureStore must be a function");let l=ks;o&&(l=Ad({trace:!Xd,..."object"==typeof o&&o}));const c=function(...e){return t=>(n,i)=>{const o=t(n,i);let r=()=>{throw new Error("production"===process.env.NODE_ENV?hs(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:o.getState,dispatch:(e,...t)=>r(e,...t)},d=e.map((e=>e(s)));return r=ks(...d)(o.dispatch),{...o,dispatch:r}}}(...a),u=Yd(c);if(!Xd&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?pa(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Xd&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?pa(6):"`enhancers` callback must return an array");if(!Xd&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?pa(7):"each enhancer provided to configureStore must be a function");Xd||!a.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return ys(d,r,l(...h))}function ea(e){const t={},n=[];let i;const o={addCase(e,r){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?pa(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?pa(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?pa(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?pa(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=r,o},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?pa(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),o},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?pa(31):"`builder.addDefaultCase` can only be called once");return i=e,o}};return e(o),[t,n,i]}function ta(...e){return t=>e.some((e=>((e,t)=>Pd(e)?e.match(t):e(t))(e,t)))}var na=["name","message","stack","code"],ia=class{constructor(e,t){this.payload=e,this.meta=t}_type},oa=class{constructor(e,t){this.payload=e,this.meta=t}_type},ra=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of na)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},sa=(()=>{function e(e,t,n){const i=Nd(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=Nd(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),r=Nd(e+"/rejected",((e,t,i,o,r)=>({payload:o,error:(n&&n.serializeError||ra)(e||"Rejected"),meta:{...r||{},arg:i,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,d,a)=>{const l=n?.idGenerator?n.idGenerator(e):((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),c=new AbortController;let u;function h(e){u=e,c.abort()}const f=async function(){let f;try{let r=n?.condition?.(e,{getState:d,extra:a});if(null!==(p=r)&&"object"==typeof p&&"function"==typeof p.then&&(r=await r),!1===r||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const g=new Promise(((e,t)=>c.signal.addEventListener("abort",(()=>t({name:"AbortError",message:u||"Aborted"})))));s(o(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:d,extra:a}))),f=await Promise.race([g,Promise.resolve(t(e,{dispatch:s,getState:d,extra:a,requestId:l,signal:c.signal,abort:h,rejectWithValue:(e,t)=>new ia(e,t),fulfillWithValue:(e,t)=>new oa(e,t)})).then((t=>{if(t instanceof ia)throw t;return t instanceof oa?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof ia?r(null,l,e,t.payload,t.meta):r(t,l,e)}var p;return n&&!n.dispatchConditionRejection&&r.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(da)})}}),{pending:o,rejected:r,fulfilled:i,settled:ta(r,i),typePrefix:e})}return e.withTypes=()=>e,e})();function da(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var aa=Symbol.for("rtk-slice-createasyncthunk");function la(e,t){return`${e}/${t}`}function ca(e,t,n,i){function o(o,...r){let s=n.call(e,o);if(void 0===s)if(i)s=e.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?pa(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...r)}return o.unwrapped=t,o}var ua=function({creators:e}={}){const t=e?.asyncThunk?.[aa];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?pa(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 o=("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)||{},r=Object.keys(o),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?pa(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?pa(13):"`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,d},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(s.actionCreators[e]=t,d),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,d)};function a(){if("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?pa(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=[],i]="function"==typeof e.extraReducers?ea(e.extraReducers):[e.extraReducers],o={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?pa(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,[i,o,r]=ea(t);if(function(e){return"function"==typeof e}(e))n=()=>Td(e());else{const t=Td(e);n=()=>t}function s(e=n(),t){let s=[i[t.type],...o.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[r]),s.reduce(((e,n)=>{if(n){if(js(e)){const i=n(e,t);return void 0===i?e:i}if(Ms(e))return pd(e,(e=>n(e,t)));{const i=n(e,t);if(void 0===i){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?pa(9):"A case reducer on a non-draftable value must not return undefined")}return i}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in o)e.addCase(t,o[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);i&&e.addDefaultCase(i)}))}r.forEach((i=>{const r=o[i],s={reducerName:i,type:la(n,i),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(r)?function({type:e,reducerName:t,createNotation:n},i,o){let r,s;if("reducer"in i){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(i))throw new Error("production"===process.env.NODE_ENV?pa(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");r=i.reducer,s=i.prepare}else r=i;o.addCase(e,r).exposeCaseReducer(t,r).exposeAction(t,s?Nd(e,s):Nd(e))}(s,r,d):function({type:e,reducerName:t},n,i,o){if(!o)throw new Error("production"===process.env.NODE_ENV?pa(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:r,fulfilled:s,pending:d,rejected:a,settled:l,options:c}=n,u=o(e,r,c);i.exposeAction(t,u),s&&i.addCase(u.fulfilled,s);d&&i.addCase(u.pending,d);a&&i.addCase(u.rejected,a);l&&i.addMatcher(u.settled,l);i.exposeCaseReducer(t,{fulfilled:s||ha,pending:d||ha,rejected:a||ha,settled:l||ha})}(s,r,d,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:i,reducer:(e,t)=>(u||(u=a()),u(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(u||(u=a()),u.getInitialState()),getSelectors(t=l){const n=_d(c,this,{insert:()=>new WeakMap});return _d(n,t,{insert:()=>{const n={};for(const[i,o]of Object.entries(e.selectors??{}))n[i]=ca(this,o,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t)if(this!==h)t=this.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?pa(15):"selectSlice returned undefined for an uninjected slice reducer");return t},get selectors(){return this.getSelectors(this.selectSlice)},injectInto(e,{reducerPath:t,...n}={}){const i=t??this.reducerPath;return e.inject({reducerPath:i,reducer:this.reducer},n),{...this,reducerPath:i}}};return h}}();function ha(){}var fa="listenerMiddleware";function pa(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. `}Nd(`${fa}/add`),Nd(`${fa}/removeAll`),Nd(`${fa}/remove`);const ga=["error","warn","info","debug"],va=Fr((e=>{var t,n,i,o;return o=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",i).call(this,console))}set logger(e){f(this,n,h(this,t,"m",i).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return ga.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},o})),ma="undefined"!=typeof localStorage,$a=ma&&localStorage.getItem("base.content.url")||"",ya=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,ba=Fr((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")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),wa=Fr((e=>{var t,n;const i=Ur(va,ba)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,i;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,i=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=>i(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&i(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const i=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(i,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})),ka=e=>t=>{var n,i,o;const r=Ur(va,ba,wa)(t),s=Object.keys(e);return o=class extends r{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",i).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",i).call(this,e,this.getAttribute(e))))}},n=new WeakSet,i=function(t,n){const i=e[t],o="function"==typeof i?i(t,n):i;o&&this.logger.error(o)},o};ka.missingAttrValidator=ya;const Ca=Fr((e=>{const t=Ur(ka({"project-id":ya}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Ia=Fr((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Ra=Fr((e=>{const t=Ur(va,Ca,Ia)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const o=new URL($a||i||"https://static.descope.com/pages");return o.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(o.pathname,e,n,t),o.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),i=await fetch(n,{cache:"default"});return i.ok||this.logger.error(`Error fetching URL ${n} [${i.status}]`),{body:await i[t](),headers:Object.fromEntries(i.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),Sa=Fr((e=>{var t,n,i;const o=Ur(Ra)(e);return i=class extends o{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")||f(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,i})),Oa=Fr((e=>{var t,n,i,o,r,s,d;return d=class extends(Ur(ba,va)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,i),"debug"===e&&h(this,t,"m",r).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var i;null===(i=super.onLogEvent)||void 0===i||i.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",r).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},o=async function(){f(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 sl})),document.body.appendChild(h(this,n,"f"))},r=function(){this.debug?h(this,t,"m",o).call(this):h(this,t,"m",i).call(this)},s=function(e,t){var i;e&&(null===(i=h(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},d})),Ea="load-descope-ui",xa="base.ui.components.url",ja=ma&&localStorage.getItem(xa)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Ma=ma&&localStorage.getItem(xa)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Aa=e=>{const t=document.createElement("script");return t.id=e,t},Pa=(e,t)=>e.replace("<version>",t),Na=Fr((e=>{var t,n,i,o,r,s,d,a,l,c,u,p;const g=Ur(va,Sa)(e);return p=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),i.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return h(this,l,"f")||f(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,i=new WeakMap,l=new WeakMap,t=new WeakSet,o=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},r=function(e){const t=h(this,n,"f"),o=h(this,i,"f");e[t]=[],e[o]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[o].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const i=Aa("load-descope-ui-fallback-script");document.body.append(i),i.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${i.src}"`)))})),i.addEventListener("load",(()=>{n.forEach((e=>e()))})),i.src=Pa(Ma,await h(this,t,"m",o).call(this))},d=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,i,"f")])})),e.addEventListener("load",(()=>{e[h(this,i,"f")].forEach((e=>e()))}))},a=async function(){if(document.querySelector(`script#${Ea}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Aa(Ea);document.body.append(e),h(this,t,"m",r).call(this,e),h(this,t,"m",d).call(this,e),e.src=Pa(ja,await h(this,t,"m",o).call(this))}return document.getElementById(Ea)},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",a).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)}))}))}))},p})),Ua="content-root",Wa="root",La=Fr((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Wa}, #${Ua} {\n height: 100%;\n }\n #${Wa} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Wa}">\n <div id="${Ua}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Ua),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Wa)}})),Ta="descope-modal",_a=Fr((e=>{var t,n;const i=Ur(ba,La,Na)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ns{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Ta);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([Ta]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Da="descope-notification",Fa=Fr((e=>{var t,n;const i=Ur(ba,La,Na)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends rs{setContent(t){const n="string"==typeof t?Wr(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Da);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([Da])}},t=new WeakMap,n})),qa=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Ba=Fr((e=>{var t,n,i,o,r,s,d,a,l;const c=Ur(ka({theme:qa}),Ra,ba,Na,Sa,La,wa)(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",r).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,t,"m",a).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",d).call(this),h(this,t,"m",a).call(this)}))}},n=new WeakMap,t=new WeakSet,i=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(xa)))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(xa),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")}},o=function(){return h(this,n,"f")||(f(this,n,h(this,t,"m",i).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},r=async function(){var e,n;const i=await h(this,t,"a",o);if(!i)return;const r=document.createElement("style");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==i?void 0:i.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(r)},s=async function(){var e,n;const i=Object.assign({},await h(this,t,"a",o));if(!i)return;const r=await this.descopeUi;(null==r?void 0:r.componentsThemeManager)&&(r.componentsThemeManager.themes={light:null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.components,dark:null===(n=null==i?void 0:i.dark)||void 0===n?void 0:n.components})},d=async function(){var e,t;const{projectConfig:n}=await this.config,i=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;i&&Object.values(i).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))}))},a=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})),Ka=e=>Fr((t=>{const n=ua(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ur(va)(t)){constructor(...e){super(...e);const t=Qd({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),o=e=>async(...n)=>{const i=await t.dispatch(e(...n));try{da(i)}catch(e){this.logger.error(e.message,i.type,e.stack)}return i},r=Object.keys(i).reduce(((e,t)=>(e[t]=o(i[t]),e)),{});this.actions=r,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Va=Fr((e=>class extends(va(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()}})),Ha=Fr((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}})),za=(e,t,n,i={})=>{var o,r,s,d;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(o=i.left)&&void 0!==o?o:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(r=i.right)&&void 0!==r?r:0)),Math.min(Math.max(n,("all"===i.top?e.offsetHeight:null!==(s=i.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===i.bottom?e.offsetHeight:null!==(d=i.bottom)&&void 0!==d?d:0))]};var Ga,Ja,Za,Ya,Xa,Qa,el,tl,nl,il;const ol=document.createElement("template");ol.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 rl extends HTMLElement{constructor(){var e;super(),Ga.add(this),Ja.set(this,new Jr({messages:[]})),Za.set(this,void 0),Ya.set(this,void 0),Xa.set(this,void 0),Qa.set(this,{resize:h(this,Ga,"m",il).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(ol.content.cloneNode(!0)),f(this,Za,this.shadowRoot.querySelector(".debugger"),"f"),f(this,Ya,h(this,Za,"f").querySelector(".content"),"f"),f(this,Xa,h(this,Za,"f").querySelector(".header"),"f")}updateData(e){h(this,Ja,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let i=0,o=0,r=0,s=0;function d(t){t.preventDefault(),i=r-t.clientX,o=s-t.clientY,r=t.clientX,s=t.clientY;const[d,a]=za(e,e.offsetLeft-i,e.offsetTop-o,n);e.style.top=`${a}px`,e.style.left=`${d}px`}function a(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),r=e.clientX,s=e.clientY,document.onmouseup=a,document.onmousemove=d}t?t.onmousedown=l:e.onmousedown=l})(h(this,Za,"f"),h(this,Xa,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Qa,"f").resize),(e=h(this,Za,"f")).onmousemove=t=>{var n;const i=t.target;(i.w&&i.w!==i.offsetWidth||i.h&&i.h!==i.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),i.w=i.offsetWidth,i.h=i.offsetHeight},h(this,Za,"f").onresize=h(this,Ga,"m",nl).bind(this),h(this,Ja,"f").subscribe(h(this,Ga,"m",el).bind(this))}disconnectedCallback(){h(this,Ja,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Qa,"f").resize)}}Ja=new WeakMap,Za=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,Qa=new WeakMap,Ga=new WeakSet,el=function(e){h(this,Ga,"m",tl).call(this,e),h(this,Ga,"m",nl).call(this)},tl=function(e){h(this,Ya,"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("")},nl=function(){h(this,Ya,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),i=n.scrollWidth>n.clientWidth,o=n.clientHeight>20;i||o?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},il=function(){const[e,t]=za(h(this,Za,"f"),Number.parseInt(h(this,Za,"f").style.left,10),Number.parseInt(h(this,Za,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Za,"f").style.top=`${t}px`,h(this,Za,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",rl);var sl=Object.freeze({__proto__:null}),dl={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[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-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[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-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","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[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[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-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[0-35])|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-3]))|(?: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]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,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[0467]"]]]],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[278]|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]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|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,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[468])|7302[0-4]\\d)\\d{4}|(?:305[3-9]|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-47-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}"],0,0,0,["305209\\d{4}"]]],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","00","(?:20|33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],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 al(e){return al="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},al(e)}function ll(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function cl(e){var t=pl();return function(){var n,i=vl(e);if(t){var o=vl(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===al(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ul(e)}(this,n)}}function ul(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hl(e){var t="function"==typeof Map?new Map:void 0;return hl=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,i)}function i(){return fl(e,arguments,vl(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),gl(i,e)},hl(e)}function fl(e,t,n){return fl=pl()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&gl(o,n.prototype),o},fl.apply(null,arguments)}function pl(){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 gl(e,t){return gl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},gl(e,t)}function vl(e){return vl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vl(e)}var ml=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&&gl(e,t)}(r,e);var t,n,i,o=cl(r);function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),t=o.call(this,e),Object.setPrototypeOf(ul(t),r.prototype),t.name=t.constructor.name,t}return t=r,n&&ll(t.prototype,n),i&&ll(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(hl(Error)),$l=2,yl=17,bl=3,wl="0-90-9٠-٩۰-۹",kl="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function Cl(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),i=t[0].split("."),o=0;o<3;o++){var r=Number(n[o]),s=Number(i[o]);if(r>s)return 1;if(s>r)return-1;if(!isNaN(r)&&isNaN(s))return 1;if(isNaN(r)&&!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 Il={}.constructor;function Rl(e){return null!=e&&e.constructor===Il}function Sl(e){return Sl="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},Sl(e)}function Ol(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function El(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function xl(e,t,n){return t&&El(e.prototype,t),n&&El(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var jl=" ext. ",Ml=/^\d+$/,Al=function(){function e(t){Ol(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Rl(e)||!Rl(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(Rl(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Tl(e)+": "+e,"."))}(t),this.metadata=t,Dl.call(this,t)}return xl(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&&Ml.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Pl(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Pl(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 i=this.countryCallingCodes()[e];if(i&&1===i.length&&"001"===i[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}(),Pl=function(){function e(t,n){Ol(this,e),this.globalMetadataObject=n,this.metadata=t,Dl.call(this,n.metadata)}return xl(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 Nl(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()&&Ll(this.types(),e))return new Wl(Ll(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?jl:this.metadata[13]||jl}}]),e}(),Nl=function(){function e(t,n){Ol(this,e),this._format=t,this.metadata=n}return xl(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()||Ul.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Ul=/^\(?\$1\)?$/,Wl=function(){function e(t,n){Ol(this,e),this.type=t,this.metadata=n}return xl(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 Ll(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 Tl=function(e){return Sl(e)};function _l(e,t){if((t=new Al(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Dl(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===Cl(t,"1.2.0")?this.v2=!0:-1===Cl(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Fl=function(e){return"([".concat(wl,"]{1,").concat(e,"})")};function ql(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",o="[ \\t]*";return";ext="+Fl("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+Fl("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+Fl("9")+i)+"|"+("[- ]+"+Fl("6")+"#")+"|"+(o+"(?:,{2}|;)"+n+Fl("15")+i)+"|"+(o+"(?:,)+"+n+Fl("9")+i)}var Bl="["+wl+"]{"+$l+"}",Kl="[++]{0,1}(?:["+kl+"]*["+wl+"]){3,}["+kl+wl+"]*",Vl=new RegExp("^[++]{0,1}(?:["+kl+"]*["+wl+"]){1,2}$","i"),Hl=Kl+"(?:"+ql()+")?",zl=new RegExp("^"+Bl+"$|^"+Hl+"$","i");var Gl=new RegExp("(?:"+ql()+")$","i");var Jl={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 Zl(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 Yl(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 Yl(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Xl(e){for(var t,n="",i=Zl(e.split(""));!(t=i()).done;){n+=Ql(t.value,n)||""}return n}function Ql(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return Jl[e]}(e)}function ec(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 tc(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 tc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 tc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function nc(e,t){return ic(e,void 0,t)}function ic(e,t,n){var i=n.type(t),o=i&&i.possibleLengths()||n.possibleLengths();if(!o)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!n.type("FIXED_LINE"))return ic(e,"MOBILE",n);var r=n.type("MOBILE");r&&(o=function(e,t){for(var n,i=e.slice(),o=ec(t);!(n=o()).done;){var r=n.value;e.indexOf(r)<0&&i.push(r)}return i.sort((function(e,t){return e-t}))}(o,r.possibleLengths()))}else if(t&&!i)return"INVALID_LENGTH";var s=e.length,d=o[0];return d===s?"IS_POSSIBLE":d>s?"TOO_SHORT":o[o.length-1]<s?"TOO_LONG":o.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function oc(e,t){return"IS_POSSIBLE"===nc(e,t)}function rc(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function sc(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 dc(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 dc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var ac=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function lc(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Al(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(rc(i,n.nationalNumberPattern())){if(cc(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?cc(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var o,r=sc(ac);!(o=r()).done;){var s=o.value;if(cc(i,s,n))return s}}}}function cc(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&rc(e,t.pattern()))}function uc(e,t,n){var i=new Al(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new Al(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var hc=/(\$\d)/;function fc(e,t,n){var i=n.useInternationalFormat,o=n.withNationalPrefix;n.carrierCode,n.metadata;var r=e.replace(new RegExp(t.pattern()),i?t.internationalFormat():o&&t.nationalPrefixFormattingRule()?t.format().replace(hc,t.nationalPrefixFormattingRule()):t.format());return i?function(e){return e.replace(new RegExp("[".concat(kl,"]+"),"g")," ").trim()}(r):r}var pc=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function gc(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 vc(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 vc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 vc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mc(Object(n),!0).forEach((function(t){yc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bc={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function wc(e,t,n,i){if(n=n?$c($c({},bc),n):bc,i=new Al(i),e.country&&"001"!==e.country){if(!i.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));i.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";i.selectNumberingPlan(e.countryCallingCode)}var o,r=i.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?Cc(o=kc(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(o=kc(s,null,"INTERNATIONAL",i,n),Cc(o="+".concat(r," ").concat(o),e.ext,i,n.formatExtension)):"+".concat(r);case"E.164":return"+".concat(r).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(r).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var d=function(e,t,n,i,o){var r=_l(i,o.metadata);if(r===n){var s=kc(e,t,"NATIONAL",o);return"1"===n?n+" "+s:s}var d=function(e,t,n){var i=new Al(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():pc.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,o.metadata);if(d)return"".concat(d," ").concat(n," ").concat(kc(e,null,"INTERNATIONAL",o))}(s,e.carrierCode,r,n.fromCountry,i);return Cc(d,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function kc(e,t,n,i,o){var r=function(e,t){for(var n,i=gc(e);!(n=i()).done;){var o=n.value;if(o.leadingDigitsPatterns().length>0){var r=o.leadingDigitsPatterns()[o.leadingDigitsPatterns().length-1];if(0!==t.search(r))continue}if(rc(t,o.pattern()))return o}}(i.formats(),e);return r?fc(e,r,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!r.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!o||!1!==o.nationalPrefix,carrierCode:t,metadata:i}):e}function Cc(e,t,n,i){return t?i(e,t,n):e}function Ic(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Rc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ic(Object(n),!0).forEach((function(t){Sc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ic(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oc(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ec=function(){function e(t,n,i){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(!i)throw new TypeError("`metadata` not passed");var o=function(e,t){var n,i,o=new Al(t);xc(e)?(n=e,o.selectNumberingPlan(n),i=o.countryCallingCode()):i=e;return{country:n,countryCallingCode:i}}(t,i),r=o.country,s=o.countryCallingCode;this.country=r,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return i}}var t,n,i;return t=e,n=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:uc(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Al(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 oc(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 Al(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==lc(e,t,n.metadata):rc(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Al(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return lc(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return wc(this,e,t?Rc(Rc({},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&&Oc(t.prototype,n),i&&Oc(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),xc=function(e){return/^[A-Z]{2}$/.test(e)};var jc=new RegExp("(["+wl+"])");function Mc(e,t){var n=function(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),i=n.exec(e);if(i){var o,r,s,d=i.length-1,a=d>0&&i[d];if(t.nationalPrefixTransformRule()&&a)o=e.replace(n,t.nationalPrefixTransformRule()),d>1&&(r=i[1]);else{var l=i[0];o=e.slice(l.length),a&&(r=i[1])}if(a){var c=e.indexOf(i[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=i[0];return{nationalNumber:o,nationalPrefix:s,carrierCode:r}}}return{nationalNumber:e}}(e,t),i=n.carrierCode,o=n.nationalNumber;if(o!==e){if(!function(e,t,n){if(rc(e,n.nationalNumberPattern())&&!rc(t,n.nationalNumberPattern()))return!1;return!0}(e,o,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(nc(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(o,t))return{nationalNumber:e}}return{nationalNumber:o,carrierCode:i}}function Ac(e,t,n,i){if(!e)return{};var o;if("+"!==e[0]){var r=function(e,t,n,i){if(t){var o=new Al(i);o.selectNumberingPlan(t,n);var r=new RegExp(o.IDDPrefix());if(0===e.search(r)){var s=(e=e.slice(e.match(r)[0].length)).match(jc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}(e,t,n,i);if(!r||r===e){if(t||n){var s=function(e,t,n,i){var o=t?_l(t,i):n;if(0===e.indexOf(o)){(i=new Al(i)).selectNumberingPlan(t,n);var r=e.slice(o.length),s=Mc(r,i).nationalNumber,d=Mc(e,i).nationalNumber;if(!rc(d,i.nationalNumberPattern())&&rc(s,i.nationalNumberPattern())||"TOO_LONG"===nc(d,i))return{countryCallingCode:o,number:r}}return{number:e}}(e,t,n,i),d=s.countryCallingCode,a=s.number;if(d)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:d,number:a}}return{number:e}}o=!0,e="+"+r}if("0"===e[1])return{};i=new Al(i);for(var l=2;l-1<=bl&&l<=e.length;){var c=e.slice(1,l);if(i.hasCallingCode(c))return i.selectNumberingPlan(c),{countryCallingCodeSource:o?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function Pc(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 Nc(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 Nc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Nc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Uc(e,t){var n=t.nationalNumber,i=t.defaultCountry,o=t.metadata,r=o.getCountryCodesForCallingCode(e);if(r)return 1===r.length?r[0]:function(e,t){var n=t.countries,i=t.defaultCountry,o=t.metadata;o=new Al(o);for(var r,s=[],d=Pc(n);!(r=d()).done;){var a=r.value;if(o.country(a),o.leadingDigits()){if(e&&0===e.search(o.leadingDigits()))return a}else if(lc({phone:e,country:a},void 0,o.metadata)){if(!i)return a;if(a===i)return a;s.push(a)}}if(s.length>0)return s[0]}(n,{countries:r,defaultCountry:i,metadata:o.metadata})}var Wc="+",Lc="(["+wl+"]|[\\-\\.\\(\\)]?)",Tc=new RegExp("^\\"+Wc+Lc+"*["+wl+"]"+Lc+"*$","g"),_c=new RegExp("^("+("["+wl+"]+((\\-)*["+wl+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+wl+"])*")+"\\.?$","g"),Dc="tel:",Fc=";phone-context=",qc=";isub=";function Bc(e,t){var n,i=t.extractFormattedPhoneNumber,o=function(e){var t=e.indexOf(Fc);if(t<0)return null;var n=t+Fc.length;if(n>=e.length)return"";var i=e.indexOf(";",n);return i>=0?e.substring(n,i):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(Tc.test(e)||_c.test(e))}(o))throw new ml("NOT_A_NUMBER");if(null===o)n=i(e)||"";else{n="",o.charAt(0)===Wc&&(n+=o);var r,s=e.indexOf(Dc);r=s>=0?s+Dc.length:0;var d=e.indexOf(Fc);n+=e.substring(r,d)}var a=n.indexOf(qc);if(a>0&&(n=n.substring(0,a)),""!==n)return n}var Kc=250,Vc=new RegExp("[++"+wl+"]"),Hc=new RegExp("[^"+wl+"#]+$");function zc(e,t,n){if(t=t||{},n=new Al(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new ml("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=Bc(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>Kc){if(n)throw new ml("TOO_LONG");return}if(!1===t)return e;var i=e.search(Vc);if(i<0)return;return e.slice(i).replace(Hc,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=$l&&zl.test(e)}(i))return function(e){return Vl.test(e)}(i)?{error:"TOO_SHORT"}:{};var o=function(e){var t=e.search(Gl);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(Gl),o=1;o<i.length;){if(i[o])return{number:n,ext:i[o]};o++}}(i);if(o.ext)return o;return{number:i}}(e,t.v2,t.extract),o=i.number,r=i.ext,s=i.error;if(!o){if(t.v2){if("TOO_SHORT"===s)throw new ml("TOO_SHORT");throw new ml("NOT_A_NUMBER")}return{}}var d=function(e,t,n,i){var o,r=Ac(Xl(e),t,n,i.metadata),s=r.countryCallingCodeSource,d=r.countryCallingCode,a=r.number;if(d)i.selectNumberingPlan(d);else{if(!a||!t&&!n)return{};i.selectNumberingPlan(t,n),t&&(o=t),d=n||_l(t,i.metadata)}if(!a)return{countryCallingCodeSource:s,countryCallingCode:d};var l=Mc(Xl(a),i),c=l.nationalNumber,u=l.carrierCode,h=Uc(d,{nationalNumber:c,defaultCountry:t,metadata:i});h&&(o=h,"001"===h||i.country(o));return{country:o,countryCallingCode:d,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(o,t.defaultCountry,t.defaultCallingCode,n),a=d.country,l=d.nationalNumber,c=d.countryCallingCode,u=d.countryCallingCodeSource,h=d.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2)throw new ml("INVALID_COUNTRY");return{}}if(!l||l.length<$l){if(t.v2)throw new ml("TOO_SHORT");return{}}if(l.length>yl){if(t.v2)throw new ml("TOO_LONG");return{}}if(t.v2){var f=new Ec(c,l,n.metadata);return a&&(f.country=a),h&&(f.carrierCode=h),r&&(f.ext=r),f.__countryCallingCodeSource=u,f}var p=!!(t.extended?n.hasSelectedNumberingPlan():a)&&rc(l,n.nationalNumberPattern());return t.extended?{country:a,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!oc(l,n)),phone:l,ext:r}:p?function(e,t,n){var i={country:e,phone:t};n&&(i.ext=n);return i}(a,l,r):{}}function Gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Jc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gc(Object(n),!0).forEach((function(t){Zc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Xc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qc(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 i,o,r=[],s=!0,d=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(r.push(i.value),!t||r.length!==t);s=!0);}catch(e){d=!0,o=e}finally{try{s||null==n.return||n.return()}finally{if(d)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return eu(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 eu(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 eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function tu(e){var t,n,i,o=Qc(Array.prototype.slice.call(e),4),r=o[0],s=o[1],d=o[2],a=o[3];if("string"!=typeof r)throw new TypeError("A text for parsing must be a string.");if(t=r,s&&"string"!=typeof s){if(!Rl(s))throw new Error("Invalid second argument: ".concat(s));d?(n=s,i=d):i=s}else a?(n=d,i=a):(n=void 0,i=d),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yc(Object(n),!0).forEach((function(t){Xc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:i}}function nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function iu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nu(Object(n),!0).forEach((function(t){ou(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ou(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ru(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=iu(iu({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return zc(e,Jc(Jc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof ml))throw e}}function su(){var e=tu(arguments);return ru(e.text,e.options,e.metadata)}function du(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(dl),e.apply(this,n)}(su,arguments)}const au=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>{const[o,...r]=n.split(".");return t!==o?Object.assign(e,{[n]:i}):(e[o]||(e[o]={}),e[o][r.join(".")]=i,e)}),{}),lu=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),cu={enabled:"active",disabled:"disabled",invited:"invited"},uu=e=>e.tenantRoles.data,hu=e=>e.selectedUsersLoginIds,fu=e=>e.notifications,pu=e=>e.customAttributes.data,gu=Od((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),lu(null==e?void 0:e.customAttributes,"customAttributes")),{status:cu[e.status]||e.status,roles:e.roleNames}))))),vu=Od(hu,gu,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),mu=Od(vu,(e=>e.map((e=>e.userId)))),$u=Od(vu,(e=>e.map((e=>e.status)))),yu=Od(vu,(e=>e.every((e=>e.editable)))),bu=Od(hu,(e=>!!e.length)),wu=Od(hu,(e=>1===e.length)),ku=Od(hu,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),Cu=Od(wu,$u,((e,t)=>e&&t.every((e=>e===cu.enabled)))),Iu=Od($u,(e=>e.every((e=>e===cu.disabled)))),Ru=Od(vu,(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`})),Su=Od(wu,Iu,yu,((e,t,n)=>e&&t&&n)),Ou=Od(wu,Cu,yu,((e,t,n)=>e&&t&&n)),Eu=Od(wu,yu,((e,t)=>e&&t)),xu=Od(wu,yu,((e,t)=>e&&t)),ju=Od(wu,yu,((e,t)=>e&&t)),Mu=Od(bu,(e=>e)),Au=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)}))}))},Pu=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}}),Nu=({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)})}}),Uu=sa("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Wu=Au(Uu)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},Pu((e=>e.createUser)),Nu({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>`}})),Lu={action:Uu,reducer:Wu},Tu=sa("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),_u=Au(Tu)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Pu((e=>e.deleteUser)),Nu({getSuccessMsg:e=>_r(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>_r(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Du={action:Tu,reducer:_u},Fu=sa("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),qu=Au(Fu)(Pu((e=>e.setTempUserPassword)),Nu({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>`}})),Bu={action:Fu,reducer:qu},Ku=sa("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Vu=Au(Ku)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Pu((e=>e.customAttributes))),Hu={action:Ku,reducer:Vu},zu=sa("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),Gu=Au(zu)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Pu((e=>e.usersList))),Ju={action:zu,reducer:Gu},Zu=sa("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Yu=Au(Zu)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Pu((e=>e.tenantRoles))),Xu={action:Zu,reducer:Yu},Qu=sa("users/update",((e,{extra:{api:t}})=>t.user.update(e))),eh=Au(Qu)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Lr(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Pu((e=>e.updateUser)),Nu({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>`}})),th={action:Qu,reducer:eh},nh=sa("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),ih=Au(nh)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Lr(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==i&&(e.usersList.data[i].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Pu((e=>e.enableUser)),Nu({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>`}})),oh={action:nh,reducer:ih},rh=sa("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),sh=Au(rh)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Lr(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==i&&(e.usersList.data[i].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Pu((e=>e.disableUser)),Nu({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>`}})),dh={action:rh,reducer:sh},ah=sa("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),lh={action:ah,reducer:Au(ah)(Pu((e=>e.removePasskey)),Nu({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>`}}))},ch={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:[]},uh="/v1/mgmt/user/search",hh="/v1/mgmt/user/delete/batch",fh="/v1/mgmt/user/create",ph="/v1/mgmt/user/update",gh="/v1/mgmt/user/update/status",vh="/v1/mgmt/user/password/set/temporary",mh="/v1/mgmt/user/passkeys/delete",$h="/v1/mgmt/user/customattributes",yh="/v1/mgmt/role/all",bh=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)})),wh=({httpClient:e,tenant:t,mock:n})=>({search:({page:i,limit:o=1e4,customAttributes:r,statuses:s,emails:d,phones:a,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 i=[];for(let e=1;e<10;e+=1)i.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=>{i.sort(((t,n)=>{var i,o;return e.desc?null===(o=n[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.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:i,limit:o,customAttributes:r,statuses:s,emails:d,phones:a,text:l,sort:c});const h=yield e.post(uh,{limit:o,page:i,withTestUser:!1,customAttributes:r,statuses:s,emails:d,phones:a,text:l,sort:c},{queryParams:{tenant:t}});return yield bh(h),(yield h.json()).users})),deleteBatch:i=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const o=yield e.post(hh,{userIds:i},{queryParams:{tenant:t}});return yield bh(o),o.json()})),create:({loginId:i,email:o,phone:r,displayName:s,roles:d,customAttributes:a,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:$,inviteUrl:y,invite:b})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:i,roles:o,customAttributes:r,picture:s,verifiedEmail:d,verifiedPhone:a,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{const f=Math.random().toString(10).substring(15);u({loginIds:[e],externalIds:[e],userId:`user-${f}`,email:t,phone:n,name:i,roleNames:o,customAttributes:r,picture:s,verifiedEmail:d,verifiedPhone:a,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:i,email:o,phone:r,displayName:s,roles:d,customAttributes:a,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:$,inviteUrl:y,invite:b});const w=yield e.post(fh,{loginId:i,email:o,phone:r,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:d,userTenants:[{tenantId:t}],customAttributes:a,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:v,sendSMS:m,sendMail:$,inviteUrl:y,invite:b},{queryParams:{tenant:t}});return yield bh(w),(yield w.json()).user})),update:({loginId:i,email:o,phone:r,displayName:s,roles:d,customAttributes:a,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:i,roles:o,customAttributes:r,picture:s,verifiedEmail:d,verifiedPhone:a,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:i,roleNames:o,customAttributes:r,picture:s,verifiedEmail:d,verifiedPhone:a,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:i,email:o,phone:r,displayName:s,roles:d,customAttributes:a,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v});const m=yield e.post(ph,{loginId:i,email:o,phone:r,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:d,customAttributes:a,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:v},{queryParams:{tenant:t}});return yield bh(m),(yield m.json()).user})),enable:i=>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"}})}))})))(i);const o=yield e.post(gh,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield bh(o),o.json()})),disable:i=>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"}})}))})))(i);const o=yield e.post(gh,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield bh(o),o.json()})),removePasskey:i=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const o=yield e.post(mh,{loginId:i},{queryParams:{tenant:t}});return yield bh(o),o.json()})),setTempPassword:i=>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 o=yield e.post(vh,{loginId:i},{queryParams:{tenant:t}});return yield bh(o),o.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 i=yield e.get($h,{queryParams:{tenant:t}});return yield bh(i),(yield i.json()).data}))}),kh=({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 i=yield e.get(yh,{queryParams:{tenant:t}});return yield bh(i),i.json()}))}),Ch=Fr((e=>{var t,n,i,o;const r=Ur(Ca,wa,va,Ia,ka({tenant:ka.missingAttrValidator}))(e);return o=class extends r{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",i).call(this),h(this,n,"f")}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),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,i)=>{const o=si(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.110"}}));return{user:wh({httpClient:o.httpClient,tenant:t,mock:n}),tenant:kh({httpClient:o.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},o})),Ih=Fr((e=>{const t=Ur(Ka({name:"widget",initialState:ch,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Lu.reducer(e),th.reducer(e),oh.reducer(e),dh.reducer(e),Du.reducer(e),Ju.reducer(e),Bu.reducer(e),lh.reducer(e),Hu.reducer(e),Xu.reducer(e)},asyncActions:{searchUsers:Ju.action,createUser:Lu.action,updateUser:th.action,enableUser:oh.action,disableUser:dh.action,deleteUsers:Du.action,removePasskey:lh.action,getCustomAttributes:Hu.action,getTenantRoles:Xu.action,setTempUserPassword:Bu.action}}),ba,va,Ch)(e);return class extends t{constructor(...e){super(...e),this.state=ch,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Rh=Fr((e=>{const t=Ur(Ra,ka({"widget-id":ka.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}))}}})),Sh=Fr((e=>{var t,n,i;return i=class extends(Ur(va,ba,Na,La,Rh,Ih)(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 i;return u(this,void 0,void 0,(function*(){yield null===(i=e.init)||void 0===i?void 0:i.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=Wr(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Oh=Fr((e=>{var t,n,i,o,r,s;return s=class extends(Ur(Ih,_a,Va,va,Sh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){yield h(this,n,"f").setData(uu(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",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function(){return u(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(Wr(yield this.fetchWidgetPage("create-user-modal.html")));new es((()=>{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 es((()=>{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({},au(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),f(this,n,new is((()=>{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,r,"f").call(this),this.createUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield h(this,r,"f").call(this),h(this,t,"m",o).call(this)}))}))},o=function(){const e=pu(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const o=e.find((e=>e.name===i));o?o.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),Eh=Fr((e=>{var t,n,i;return i=class extends(Ur(va,Oh,Sh)(e)){constructor(){super(...arguments),t.add(this)}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)}))}},t=new WeakSet,n=function(){var e;this.createButton=new es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},i})),xh=Fr((e=>{var t,n,i;return i=class extends(Ur(Ih,_a,va,Sh)(e)){constructor(){super(...arguments),t.add(this)}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),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(Wr(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new es((()=>{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 es((()=>{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=mu(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new ss(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Ru(this.state);i.text=`Delete ${e}?`}}))},i})),jh=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih,xh)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),this.subscribe(h(this,i,"f").bind(this),Mu)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new es(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()}))},o})),Mh=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Ih,_a,va,Va,Sh)(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",o).call(this)}))}},t=new WeakSet,n=function(){new es((()=>{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()))},i=function(){new es((()=>{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=ku(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},o=function(){var e;return u(this,void 0,void 0,(function*(){this.disableUserModal=this.createModal(),this.disableUserModal.setContent(Wr(yield this.fetchWidgetPage("disable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",i).call(this);const o=new ss(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=Ru(this.state);o.text=`Disable ${e}?`}))}))},r})),Ah=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih,Mh,Va)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),this.subscribe(h(this,i,"f").bind(this),Ou)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new es(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()}))},o})),Ph=e=>{if(!e)return e;const t=du(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},Nh=Fr((e=>{var t,n,i,o,r,s,d,a,l,p;return p=class extends(Ur(Ih,_a,va,Va,Sh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),s.set(this,(()=>u(this,void 0,void 0,(function*(){yield h(this,i,"f").setData(uu(this.state).map((({name:e})=>({value:e,label:e}))))})))),a.set(this,(()=>{var e,t;const n=null===(e=vu(this.state))||void 0===e?void 0:e[0],i=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:Ph(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},lu(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}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,i=new WeakMap,s=new WeakMap,a=new WeakMap,t=new WeakSet,o=function(){new es((()=>{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()))},r=function(){new es((()=>{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]},au(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},d=function(){const e=pu(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const o=e.find((e=>e.name===i));o?o.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(Wr(yield this.fetchWidgetPage("edit-user-modal.html"))),h(this,t,"m",o).call(this),h(this,t,"m",r).call(this),f(this,n,new ds(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),f(this,i,new is((()=>{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,a,"f").call(this),h(this,t,"m",d).call(this)}))}))},p})),Uh=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih,Nh,Va)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),this.subscribe(h(this,i,"f").bind(this),Eu)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new es(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()}))},o})),Wh=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Ih,_a,va,Va,Sh)(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",o).call(this)}))}},t=new WeakSet,n=function(){new es((()=>{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()))},i=function(){new es((()=>{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=ku(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},o=function(){var e;return u(this,void 0,void 0,(function*(){this.enableUserModal=this.createModal(),this.enableUserModal.setContent(Wr(yield this.fetchWidgetPage("enable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",i).call(this);const o=new ss(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=Ru(this.state);o.text=`Activate ${e}?`}))}))},r})),Lh=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih,Wh,Va)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),this.subscribe(h(this,i,"f").bind(this),Su)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new es(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()}))},o})),Th=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Dr((()=>{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",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new ds(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"))},o})),_h={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},Dh=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(va,Ih,Fa,ba)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Tr((e=>{e.length&&(e.forEach((({type:e,msg:o})=>{const r=h(this,t,"m",i).call(this,e);r.setContent(h(this,t,"m",n).call(this,{type:e,msg:o})),r.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,o,"f").bind(this),fu)}))}},o=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=_h[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},r})),Fh=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Ih,_a,va,Va,Sh)(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",o).call(this)}))}},t=new WeakSet,n=function(){new es((()=>{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()))},i=function(){new es((()=>{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=ku(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},o=function(){var e;return u(this,void 0,void 0,(function*(){this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(Wr(yield this.fetchWidgetPage("remove-passkey-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",i).call(this);const o=new ss(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=Ru(this.state);o.text=`Remove passkey for ${e}?`}))}))},r})),qh=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih,Fh,Va)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),this.subscribe(h(this,i,"f").bind(this),xu)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new es(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()}))},o})),Bh=Fr((e=>{var t,n,i,o,r,s,d,a;return a=class extends(Ur(Ih,va,Sh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Tr((e=>{this.usersTable.data=e}))),r.set(this,Dr(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchUsers({sort:n})}))),s.set(this,Tr((e=>{this.usersTable.filterColumns((t=>{var n;const[i,o]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===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),h(this,t,"m",i).call(this),h(this,o,"f").call(this,gu(this.state)),h(this,s,"f").call(this,pu(this.state)),this.subscribe(h(this,s,"f").bind(this),pu),this.subscribe(h(this,o,"f").bind(this),gu)}))}},o=new WeakMap,r=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:i,header:o,type:r,attrs:s})=>{const d=e(i)||t(r);if(!d)return n({path:i,header:o,type:r,attrs:s});const a=d.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:o});return Object.entries(l).forEach((([e,t])=>{a.setAttribute(e,t)})),a.outerHTML}},i=function(){var e;this.usersTable=new Qr(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",d).bind(this)),h(this,t,"m",n).call(this),h(this,t,"m",d).call(this)},d=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,r,"f").call(this,e.target,e.detail)}))}))},a})),Kh=Fr((e=>{var t,n,i;return i=class extends(Ur(Ih,_a,va,Va,Sh)(e)){constructor(){super(...arguments),t.add(this)}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),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(Wr(yield this.fetchWidgetPage("generated-password-modal.html")));new es((()=>{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()}))}))},i})),Vh=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Ih,_a,va,Va,Sh,Kh)(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",o).call(this)}))}},t=new WeakSet,n=function(){new es((()=>{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()))},i=function(){new es((()=>{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=ku(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()}))))},o=function(){var e;return u(this,void 0,void 0,(function*(){this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(Wr(yield this.fetchWidgetPage("reset-password-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",i).call(this);const o=new ss(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=Ru(this.state);o.text=`This will generate a new temporary password for ${e}?`}))}))},r})),Hh=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Sh,Ih,Vh,Va)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),this.subscribe(h(this,i,"f").bind(this),ju)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new es(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()}))},o})),zh=Fr((e=>class extends(Ur(Oa,Ba,Bh,Eh,jh,Uh,Lh,Ah,Hh,qh,Th,Dh)(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)}))}})),Gh=Ur((e=>class extends(zh(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Gh);var Jh=Object.freeze({__proto__:null,default:Gh});const Zh=e=>e.selectedRolesIds,Yh=e=>e.notifications,Xh=e=>e.tenantPermissions.data||[],Qh=Od((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"})})))),ef=Od(Zh,Qh,((e,t)=>t.filter((t=>e.includes(t.name))))),tf=Od(Zh,(e=>!!e.length)),nf=Od(Zh,(e=>1===e.length)),of=Od(ef,(e=>1===e.length?e[0].name:`${e.length} roles`)),rf=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)}))}))},sf=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}}),df=({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)})}}),af=sa("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),lf=rf(af)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},sf((e=>e.createRole)),df({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>`}})),cf={action:af,reducer:lf},uf=sa("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),hf=rf(uf)({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=[]}},sf((e=>e.deleteRole)),df({getSuccessMsg:e=>_r(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>_r(e.meta.arg.length)`Failed to delete role${["","s"]}`})),ff={action:uf,reducer:hf},pf=sa("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),gf=rf(pf)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},sf((e=>e.rolesList))),vf={action:pf,reducer:gf},mf=sa("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),$f=rf(mf)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},sf((e=>e.updateRole)),df({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>`}})),yf={action:mf,reducer:$f},bf=sa("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),wf={action:bf,reducer:rf(bf)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},sf((e=>e.tenantPermissions)))},kf={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:[]},Cf="/v1/mgmt/role/search",If="/v1/mgmt/role/delete/batch",Rf="/v1/mgmt/role/create",Sf="/v1/mgmt/role/update",Of="/v1/mgmt/permission/all",Ef=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)})),xf=({httpClient:e,tenant:t,mock:n})=>({search:({page:i,limit:o=1e4,text:r,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((i=>{const o=[];for(let e=1;e<10;e+=1)o.push({name:`Role ${e}`,description:`Role description ${e}`,permissionNames:[`Permission ${e}`],createdTime:new Date,tenantId:n});t.forEach((e=>{o.sort(((t,n)=>{var i,o;return e.desc?null===(o=n[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),i(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:o,text:r,sort:s},t);const d=yield e.post(Cf,{limit:o,page:i,text:r,sort:s},{queryParams:{tenant:t}});return yield Ef(d),(yield d.json()).roles})),deleteBatch:i=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const o=yield e.post(If,{roleNames:i},{queryParams:{tenant:t}});return yield Ef(o),o.json()})),create:({name:i,description:o,permissionNames:r})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,description:t,permissionNames:n},i)=>u(void 0,void 0,void 0,(function*(){return new Promise((o=>{o({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:i})}))})))({name:i,description:o,permissionNames:r},t);const s=yield e.post(Rf,{name:i,description:o,permissionNames:r,tenantId:t},{queryParams:{tenant:t}});return yield Ef(s),yield s.json()})),update:({name:i,newName:o,description:r,permissionNames:s})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,newName:t,description:n,permissionNames:i},o)=>u(void 0,void 0,void 0,(function*(){return new Promise((r=>{r({name:t,description:n,permissionNames:i,createdTime:new Date,oldName:e,tenantId:o})}))})))({name:i,newName:o,description:r,permissionNames:s},t);const d=yield e.post(Sf,{name:i,newName:o,description:r,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Ef(d);const a=yield d.json();return a.oldName=i,a}))}),jf=({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 i=yield e.get(Of,{queryParams:{tenant:t}});return yield Ef(i),i.json()}))}),Mf=Fr((e=>{var t,n,i,o;const r=Ur(Ca,wa,va,Ia,ka({tenant:ka.missingAttrValidator}))(e);return o=class extends r{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",i).call(this),h(this,n,"f")}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),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,i)=>{const o=si(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.1.107"}}));return{role:xf({httpClient:o.httpClient,tenant:t,mock:n}),tenant:jf({httpClient:o.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},o})),Af=Fr((e=>{const t=Ur(Ka({name:"widget",initialState:kf,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{cf.reducer(e),yf.reducer(e),ff.reducer(e),vf.reducer(e),wf.reducer(e)},asyncActions:{searchRoles:vf.action,createRole:cf.action,updateRole:yf.action,deleteRoles:ff.action,getTenantPermissions:wf.action}}),ba,va,Mf)(e);return class extends t{constructor(...e){super(...e),this.state=kf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Pf=Fr((e=>{const t=Ur(Ra,ka({"widget-id":ka.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}))}}})),Nf=Fr((e=>{var t,n,i;return i=class extends(Ur(va,ba,Na,La,Pf,Af)(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 i;return u(this,void 0,void 0,(function*(){yield null===(i=e.init)||void 0===i?void 0:i.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=Wr(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Uf=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Af,_a,Va,va,Nf)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield h(this,n,"f").setData(null===(e=Xh(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",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){return u(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(Wr(yield this.fetchWidgetPage("create-role-modal.html")));new es((()=>{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 es((()=>{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 is((()=>{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,o,"f").call(this)}))},r})),Wf=Fr((e=>{var t,n,i;return i=class extends(Ur(va,Uf,Nf)(e)){constructor(){super(...arguments),t.add(this)}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)}))}},t=new WeakSet,n=function(){var e;this.createButton=new es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},i})),Lf=Fr((e=>{var t,n,i;return i=class extends(Ur(Af,_a,va,Nf)(e)){constructor(){super(...arguments),t.add(this)}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),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(Wr(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new es((()=>{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 es((()=>{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=ef(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new ss(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=of(this.state);i.text=`Delete ${e}?`}}))},i})),Tf=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Nf,Af,Lf)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}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),this.subscribe(h(this,i,"f").bind(this),tf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new es(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()}))},o})),_f=Fr((e=>{var t,n,i,o,r,s,d,a;return a=class extends(Ur(Af,_a,va,Va,Nf)(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=Xh(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=ef(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",d).call(this)}))}},n=new WeakMap,r=new WeakMap,s=new WeakMap,t=new WeakSet,i=function(){new es((()=>{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()))},o=function(){new es((()=>{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,i=c(t,["name"]),o=null===(e=ef(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:o.name},i)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},d=function(){return u(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(Wr(yield this.fetchWidgetPage("edit-role-modal.html"))),h(this,t,"m",i).call(this),h(this,t,"m",o).call(this),f(this,n,new is((()=>{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,r,"f").call(this),h(this,s,"f").call(this)}))}))},a})),Df=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Nf,Af,_f,Va)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.editButton.enable():this.editButton.disable()})))}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),this.subscribe(h(this,i,"f").bind(this),nf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new es(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()}))},o})),Ff=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Nf,Af)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Dr((()=>{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",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new ds(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"))},o})),qf={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},Bf=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(va,Af,Fa,ba)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Tr((e=>{e.length&&(e.forEach((({type:e,msg:o})=>{const r=h(this,t,"m",i).call(this,e);r.setContent(h(this,t,"m",n).call(this,{type:e,msg:o})),r.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,o,"f").bind(this),Yh)}))}},o=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=qf[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},r})),Kf=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Af,va,Nf)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{this.rolesTable.data=e}))),o.set(this,Dr(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchRoles({sort:n})})))}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.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,o,"f").call(this,e.target,e.detail)}))})),h(this,i,"f").call(this,Qh(this.state)),this.subscribe(h(this,i,"f").bind(this),Qh)}))}},i=new WeakMap,o=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Qr(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)))}))},r})),Vf=Fr((e=>class extends(Ur(Oa,Ba,Kf,Wf,Tf,Df,Ff,Bf)(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)}))}})),Hf=Ur((e=>class extends(Vf(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Hf);var zf=Object.freeze({__proto__:null,default:Hf});const Gf=e=>e.selectedAccessKeysIds,Jf=e=>e.notifications,Zf=Od((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}))))),Yf=Od(Gf,Zf,((e,t)=>t.filter((t=>e.includes(t.id))))),Xf=Od(Gf,(e=>!!e.length)),Qf=Od(Yf,(e=>e.every((e=>e.editable)))),ep=Od(Qf,Xf,((e,t)=>e&&t));Od(Gf,(e=>1===e.length));const tp=Od(Yf,(e=>1===e.length?e[0].name:`${e.length} access keys`)),np=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)}))}))},ip=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}}),op=({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)})}}),rp=sa("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),sp=np(rp)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},ip((e=>e.createAccessKey)),op({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>`}})),dp={action:rp,reducer:sp},ap=sa("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),lp=np(ap)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},ip((e=>e.deleteAccessKey)),op({getSuccessMsg:e=>_r(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>_r(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),cp={action:ap,reducer:lp},up=sa("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),hp=np(up)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},ip((e=>e.accessKeysList))),fp={action:up,reducer:hp},pp=sa("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),gp=np(pp)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},ip((e=>e.activateAccessKey)),op({getSuccessMsg:e=>_r(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>_r(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),vp={action:pp,reducer:gp},mp=sa("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),$p=np(mp)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},ip((e=>e.deactivateAccessKey)),op({getSuccessMsg:e=>_r(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>_r(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),yp={action:mp,reducer:$p},bp=sa("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),wp={action:bp,reducer:np(bp)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},ip((e=>e.tenantRoles)))},kp={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:[]},Cp="/v1/mgmt/accesskey/search",Ip="/v1/mgmt/accesskey/delete/batch",Rp="/v1/mgmt/accesskey/create",Sp="/v1/mgmt/accesskey/deactivate/batch",Op="/v1/mgmt/accesskey/activate/batch",Ep="/v1/mgmt/role/all",xp=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)})),jp=({httpClient:e,tenant:t,mock:n})=>({search:({page:i,limit:o=1e4,text:r,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 i=[];for(let e=1;e<10;e+=1)i.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=>{i.sort(((t,n)=>{var i,o;return e.desc?null===(o=n[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:o,text:r,sort:s});const d=yield e.post(Cp,{limit:o,page:i,text:r,sort:s},{queryParams:{tenant:t}});return yield xp(d),(yield d.json()).keys})),deleteBatch:i=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const o=yield e.post(Ip,{ids:i},{queryParams:{tenant:t}});return yield xp(o),o.json()})),create:({name:i,expiration:o,roleNames:r,userId:s})=>u(void 0,void 0,void 0,(function*(){const d=new Date;d.setDate(d.getDate()+ +o);const a="0"===o[0]?0:Math.floor(d.getTime()/1e3);if(n)return(({name:e,roleNames:t,userId:n},i)=>u(void 0,void 0,void 0,(function*(){const o=Math.random().toString(10).substring(15);return new Promise((r=>{r({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${o}`,name:e||`Access Key ${o}`,createdBy:n||`User ${o}`,editable:!0,expireTime:i,createdTime:(new Date).getTime()/1e3,roleNames:t,status:"active",clientId:`Client ID ${o}`,boundUserId:n||`User ${o}`}})}))})))({name:i,expiration:o,roleNames:r,userId:s},a);const l=yield e.post(Rp,{name:i,expireTime:a,roleNames:r,userId:s},{queryParams:{tenant:t}});return yield xp(l),yield l.json()})),activate:i=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const o=yield e.post(Op,{ids:i},{queryParams:{tenant:t}});return yield xp(o),yield o.json()})),deactivate:i=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const o=yield e.post(Sp,{ids:i},{queryParams:{tenant:t}});return yield xp(o),yield o.json()}))}),Mp=({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 i=yield e.get(Ep,{queryParams:{tenant:t}});return yield xp(i),i.json()}))}),Ap=Fr((e=>{var t,n,i,o;const r=Ur(Ca,wa,va,Ia,ka({tenant:ka.missingAttrValidator}))(e);return o=class extends r{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",i).call(this),h(this,n,"f")}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),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,i)=>{const o=si(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.1.109"}}));return{accesskey:jp({httpClient:o.httpClient,tenant:t,mock:n}),tenant:Mp({httpClient:o.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},o})),Pp=Fr((e=>{const t=Ur(Ka({name:"widget",initialState:kp,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{dp.reducer(e),cp.reducer(e),fp.reducer(e),vp.reducer(e),yp.reducer(e),wp.reducer(e)},asyncActions:{searchAccessKeys:fp.action,createAccessKey:dp.action,activateAccessKeys:vp.action,deactivateAccessKeys:yp.action,deleteAccessKeys:cp.action,getTenantRoles:wp.action}}),ba,va,Ap)(e);return class extends t{constructor(...e){super(...e),this.state=kp,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Np=Fr((e=>{const t=Ur(Ra,ka({"widget-id":ka.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}))}}})),Up=Fr((e=>{var t,n,i;return i=class extends(Ur(va,ba,Na,La,Np,Pp)(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 i;return u(this,void 0,void 0,(function*(){yield null===(i=e.init)||void 0===i?void 0:i.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=Wr(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Wp=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Pp,va,Up)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{this.accessKeysTable.data=e}))),o.set(this,Dr(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchAccessKeys({sort:n})})))}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.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,o,"f").call(this,e.target,e.detail)}))})),h(this,i,"f").call(this,Zf(this.state)),this.subscribe(h(this,i,"f").bind(this),Zf)}))}},i=new WeakMap,o=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Qr(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)))}))},r})),Lp=Fr((e=>{var t,n,i;return i=class extends(Ur(Pp,_a,va,Up)(e)){constructor(){super(...arguments),t.add(this)}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),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(Wr(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new es((()=>{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 es((()=>{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=Yf(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new ss(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=tp(this.state);i.text=`Activate ${e}?`}}))},i})),Tp=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Up,Pp,Lp)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}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),this.subscribe(h(this,i,"f").bind(this),ep)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new es(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()}))},o})),_p=Fr((e=>{var t,n,i;return i=class extends(Ur(Pp,_a,Va,va,Up)(e)){constructor(){super(...arguments),t.add(this)}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)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(Wr(yield this.fetchWidgetPage("created-access-key-modal.html")));new es((()=>{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()}))}))},i})),Dp=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(Pp,_a,Va,va,Up,_p)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.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",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function e(){return u(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(Wr(yield this.fetchWidgetPage("create-access-key-modal.html")));const i=new es((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});i.onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)}));const r=new es((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});r.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 is((()=>{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,o,"f").call(this),this.createAccessKeyModal.afterClose=()=>{h(this,t,"m",e).call(this)}}))},r})),Fp=Fr((e=>{var t,n,i;return i=class extends(Ur(va,Dp,Up)(e)){constructor(){super(...arguments),t.add(this)}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)}))}},t=new WeakSet,n=function(){var e;this.createButton=new es(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()))},i})),qp=Fr((e=>{var t,n,i;return i=class extends(Ur(Pp,_a,va,Up)(e)){constructor(){super(...arguments),t.add(this)}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),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(Wr(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new es((()=>{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 es((()=>{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=Yf(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new ss(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=tp(this.state);i.text=`Deactivate ${e}?`}}))},i})),Bp=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Up,Pp,qp)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}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),this.subscribe(h(this,i,"f").bind(this),ep)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new es(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()}))},o})),Kp=Fr((e=>{var t,n,i;return i=class extends(Ur(Pp,_a,va,Up)(e)){constructor(){super(...arguments),t.add(this)}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),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(Wr(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new es((()=>{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 es((()=>{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=Yf(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new ss(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=tp(this.state);i.text=`Delete ${e}?`}}))},i})),Vp=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Up,Pp,Kp)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}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),this.subscribe(h(this,i,"f").bind(this),ep)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new es(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()}))},o})),Hp=Fr((e=>{var t,n,i,o;return o=class extends(Ur(va,Up,Pp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Dr((()=>{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",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new ds(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"))},o})),zp={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},Gp=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(va,Pp,Fa,ba)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Tr((e=>{e.length&&(e.forEach((({type:e,msg:o})=>{const r=h(this,t,"m",i).call(this,e);r.setContent(h(this,t,"m",n).call(this,{type:e,msg:o})),r.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,o,"f").bind(this),Jf)}))}},o=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=zp[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},r})),Jp=Fr((e=>class extends(Ur(Oa,Ba,Wp,Fp,Vp,Hp,Tp,Bp,Gp)(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)}))}})),Zp=Ur((e=>class extends(Jp(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Zp);var Yp=Object.freeze({__proto__:null,default:Zp});const Xp=e=>e.selectedAuditId,Qp=Od((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"})))));Od(Xp,Qp,((e,t)=>t.find((t=>e===t.id)))),Od(Xp,(e=>!!e));const eg=sa("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),tg=(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)}))}))})(eg)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(ng=e=>e.auditList,{onFulfilled:e=>{ng(e).loading=!1},onPending:e=>{ng(e).loading=!0,ng(e).error=null},onRejected:(e,t)=>{ng(e).loading=!1,ng(e).error=t.error}}));var ng;const ig={action:eg,reducer:tg},og={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},rg="/v1/mgmt/audit/search",sg=({httpClient:e,tenant:t,mock:n})=>({search:({page:i,limit:o=1e4,text:r,sort:s,from:d}={})=>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 i=[];for(let e=1;e<9;e+=1)i.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=>{i.sort(((t,n)=>{var i,o;return e.desc?null===(o=n[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.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:i,limit:o,text:r,sort:s});const a=yield e.post(rg,{limit:o,page:i,text:r,sort:s,from:d},{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)})))(a),(yield a.json()).audits}))}),dg=Fr((e=>{var t,n,i,o;const r=Ur(Ca,wa,va,Ia,ka({tenant:ka.missingAttrValidator}))(e);return o=class extends r{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",i).call(this),h(this,n,"f")}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),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,i)=>{const o=si(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.1.72"}}));return{audit:sg({httpClient:o.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},o})),ag=Fr((e=>{const t=Ur(Ka({name:"widget",initialState:og,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{ig.reducer(e)},asyncActions:{searchAudit:ig.action}}),ba,va,dg)(e);return class extends t{constructor(...e){super(...e),this.state=og,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),lg=Fr((e=>{const t=Ur(Ra,ka({"widget-id":ka.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}))}}})),cg=Fr((e=>{var t,n,i;return i=class extends(Ur(va,ba,Na,La,lg,ag)(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 i;return u(this,void 0,void 0,(function*(){yield null===(i=e.init)||void 0===i?void 0:i.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=Wr(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),ug=Fr((e=>{var t,n,i,o,r;return r=class extends(Ur(va,cg,ag)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Dr((()=>{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",i).call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new ds(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"))},o=function(){var e;this.rangeInput=new os(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"))},r})),hg=Fr((e=>{var t,n,i,o;return o=class extends(Ur(ag,va,cg)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Tr((e=>{this.auditTable.data=e})))}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),h(this,i,"f").call(this,Qp(this.state)),this.subscribe(h(this,i,"f").bind(this),Qp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Qr(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)))}))},o})),fg=Fr((e=>class extends(Ur(Oa,Ba,hg,ug)(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)}))}})),pg=Ur((e=>class extends(fg(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",pg);var gg=Object.freeze({__proto__:null,default:pg});const vg=e=>e.me.data,mg=Od(vg,(e=>e.picture)),$g=Od(vg,(e=>e.email)),yg=Od(vg,(e=>e.verifiedEmail)),bg=Od(vg,(e=>e.name)),wg=Od(vg,(e=>e.phone)),kg=Od(vg,(e=>e.verifiedPhone)),Cg=Od(vg,(e=>e.webauthn));Od(vg,(e=>e.password));const Ig=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)}))}))},Rg=sa("users/me",((e,{extra:{api:t}})=>t.user.me())),Sg=Ig(Rg)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(Og=e=>e.me,{onFulfilled:e=>{Og(e).loading=!1},onPending:e=>{Og(e).loading=!0,Og(e).error=null},onRejected:(e,t)=>{Og(e).loading=!1,Og(e).error=t.error}}));var Og;const Eg={action:Rg,reducer:Sg},xg=sa("users/logout",((e,{extra:{api:t}})=>t.user.logout())),jg={action:xg,reducer:Ig(xg)({})},Mg={me:{loading:!1,error:null,data:{}}},Ag="/v1/auth/me",Pg=({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(Ag);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()}))}),Ng=Fr((e=>{var t,n,i,o;const r=Ur(Ca,wa,va,Ia)(e);return o=class extends r{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",i).call(this),h(this,n,"f")}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),this.observeAttributes(["project-id","base-url"],(()=>{h(this,n,"f")&&h(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n)=>{const i=si(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.83"}}));return{user:Object.assign(Object.assign({},Pg({httpClient:i.httpClient,mock:t})),{logout:t?()=>u(void 0,void 0,void 0,(function*(){})):i.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},o})),Ug=Fr((e=>{const t=Ur(Ka({name:"widget",initialState:Mg,reducers:{},extraReducers:e=>{Eg.reducer(e),jg.reducer(e)},asyncActions:{getMe:Eg.action,logout:jg.action}}),ba,va,Ng)(e);return class extends t{constructor(...e){super(...e),this.state=Mg,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Wg=Fr((e=>{const t=Ur(Ra,ka({"widget-id":ka.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}))}}})),Lg=Fr((e=>{var t,n,i;return i=class extends(Ur(va,ba,Na,La,Wg,Ug)(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 i;return u(this,void 0,void 0,(function*(){yield null===(i=e.init)||void 0===i?void 0:i.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=Wr(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Tg=(e={})=>{const t=Wr("<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 _g(e){return new URLSearchParams(window.location.search).get(e)}const Dg=Fr((e=>{var t,n,i,o,r,s,d,a,l;return l=class extends(Ur(Ug,va,Lg,_a,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),d.set(this,Tr((e=>{this.avatar.image=e}))),a.set(this,Tr((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",o).call(this),h(this,d,"f").call(this,mg(this.state)),h(this,a,"f").call(this,bg(this.state)),this.subscribe(h(this,d,"f").bind(this),mg),this.subscribe(h(this,a,"f").bind(this),bg)}))}},n=new WeakMap,i=new WeakMap,d=new WeakMap,a=new WeakMap,t=new WeakSet,o=function(){f(this,n,this.createModal({"data-id":"update-pic"}),"f"),f(this,i,new us((()=>{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",r).bind(this),h(this,t,"m",r).call(this)},r=function(){h(this,n,"f").setContent(Tg({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new as((()=>{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})),Fg=Fr((e=>{var t,n,i,o,r,s,d,a,l,c,p,g,v;return v=class extends(Ur(Ug,va,Lg,_a)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),r.set(this,void 0),p.set(this,Tr((e=>{this.emailUserAttr.value=e}))),g.set(this,Tr((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",a).call(this),h(this,p,"f").call(this,$g(this.state)),h(this,g,"f").call(this,yg(this.state)),this.subscribe(h(this,p,"f").bind(this),$g),this.subscribe(h(this,g,"f").bind(this),yg)}))}},n=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-email"}),"f"),f(this,i,new us((()=>{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",d).bind(this),h(this,t,"m",d).call(this)},d=function(){h(this,n,"f").setContent(Tg({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},a=function(){f(this,o,this.createModal({"data-id":"delete-email"}),"f"),f(this,r,new us((()=>{var e;return null===(e=h(this,o,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,o,"f").afterClose=h(this,t,"m",l).bind(this),h(this,t,"m",l).call(this)},l=function(){h(this,o,"f").setContent(Tg({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,r,"f").onSuccess((()=>{h(this,o,"f").close(),this.actions.getMe()}))},c=function(){this.emailUserAttr=new ls((()=>{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,o,"f").open()}))},v})),qg=Fr((e=>{var t,n,i,o,r,s,d,a,l,c,p,g;return g=class extends(Ur(Ug,va,Lg,_a)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),r.set(this,void 0),p.set(this,Tr((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",a).call(this),h(this,p,"f").call(this,bg(this.state)),this.subscribe(h(this,p,"f").bind(this),bg)}))}},n=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-name"}),"f"),f(this,i,new us((()=>{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",d).bind(this),h(this,t,"m",d).call(this)},d=function(){h(this,n,"f").setContent(Tg({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},a=function(){f(this,o,this.createModal({"data-id":"delete-name"}),"f"),f(this,r,new us((()=>{var e;return null===(e=h(this,o,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,o,"f").afterClose=h(this,t,"m",l).bind(this),h(this,t,"m",l).call(this)},l=function(){h(this,o,"f").setContent(Tg({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,r,"f").onSuccess((()=>{h(this,o,"f").close(),this.actions.getMe()}))},c=function(){this.nameUserAttr=new ls((()=>{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,o,"f").open()}))},g})),Bg=Fr((e=>{var t,n,i,o,r,s,d,a,l,c,p,g,v;return v=class extends(Ur(Ug,va,Lg,_a)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),r.set(this,void 0),p.set(this,Tr((e=>{this.phoneUserAttr.value=e}))),g.set(this,Tr((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",a).call(this),h(this,p,"f").call(this,wg(this.state)),h(this,g,"f").call(this,kg(this.state)),this.subscribe(h(this,p,"f").bind(this),wg),this.subscribe(h(this,g,"f").bind(this),kg)}))}},n=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-phone"}),"f"),f(this,i,new us((()=>{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",d).bind(this),h(this,t,"m",d).call(this)},d=function(){h(this,n,"f").setContent(Tg({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},a=function(){f(this,o,this.createModal({"data-id":"delete-phone"}),"f"),f(this,r,new us((()=>{var e;return null===(e=h(this,o,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,o,"f").afterClose=h(this,t,"m",l).bind(this),h(this,t,"m",l).call(this)},l=function(){h(this,o,"f").setContent(Tg({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,r,"f").onSuccess((()=>{h(this,o,"f").close(),this.actions.getMe()}))},c=function(){this.phoneUserAttr=new ls((()=>{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,o,"f").open()}))},v})),Kg=Fr((e=>{var t,n,i,o,r,s,d,a;return a=class extends(Ur(Ug,va,Lg,_a)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),d.set(this,Tr((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",o).call(this),h(this,d,"f").call(this,Cg(this.state)),this.subscribe(h(this,d,"f").bind(this),Cg)}))}},n=new WeakMap,i=new WeakMap,d=new WeakMap,t=new WeakSet,o=function(){f(this,n,this.createModal({"data-id":"passkey"}),"f"),f(this,i,new us((()=>{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",r).bind(this),h(this,t,"m",r).call(this)},r=function(){h(this,n,"f").setContent(Tg({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new cs((()=>{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()}))},a})),Vg=Fr((e=>{var t,n,i,o,r,s,d;return d=class extends(Ur(Ug,va,Lg,_a)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.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",o).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(){f(this,n,this.createModal({"data-id":"password"}),"f"),f(this,i,new us((()=>{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",r).bind(this),h(this,t,"m",r).call(this)},r=function(){h(this,n,"f").setContent(Tg({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new cs((()=>{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()}))},d})),Hg=Fr((e=>{var t,n,i;return i=class extends(Ur(Ug,va,Lg,_a)(e)){constructor(){super(...arguments),t.add(this)}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)}))}},t=new WeakSet,n=function(){this.logout=new es((()=>{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"))}))))},i})),zg="widget-flow",Gg=Fr((e=>{var t,n,i;return i=class extends(Ur(ba,_a,Ug,va)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.init)||void 0===i?void 0:i.call(this);const o=_g(zg);o&&(function(e){if(window.history.replaceState&&_g(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())}}(zg),h(this,t,"m",n).call(this,o))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Tg({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));const n=new us((()=>{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()},i})),Jg=Fr((e=>class extends(Ur(Oa,Ba,Gg,Fg,Dg,qg,Bg,Kg,Vg,Hg)(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)}))}})),Zg=Ur((e=>class extends(Jg(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),Pr.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.83"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Zg);var Yg=Object.freeze({__proto__:null,default:Zg});const Xg=(e,t,n,i={})=>{var o,r,s,d;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(o=i.left)&&void 0!==o?o:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(r=i.right)&&void 0!==r?r:0)),Math.min(Math.max(n,("all"===i.top?e.offsetHeight:null!==(s=i.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===i.bottom?e.offsetHeight:null!==(d=i.bottom)&&void 0!==d?d:0))]};var Qg,ev,tv,nv,iv,ov,rv,sv,dv,av;const lv=document.createElement("template");lv.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 cv extends HTMLElement{constructor(){super(),Qg.add(this),ev.set(this,new Co({messages:[]})),tv.set(this,void 0),nv.set(this,void 0),iv.set(this,void 0),ov.set(this,{resize:h(this,Qg,"m",av).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(lv.content.cloneNode(!0)),f(this,tv,this.shadowRoot.querySelector(".debugger"),"f"),f(this,nv,h(this,tv,"f").querySelector(".content"),"f"),f(this,iv,h(this,tv,"f").querySelector(".header"),"f")}updateData(e){h(this,ev,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let i=0,o=0,r=0,s=0;function d(t){t.preventDefault(),i=r-t.clientX,o=s-t.clientY,r=t.clientX,s=t.clientY;const[d,a]=Xg(e,e.offsetLeft-i,e.offsetTop-o,n);e.style.top=`${a}px`,e.style.left=`${d}px`}function a(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),r=e.clientX,s=e.clientY,document.onmouseup=a,document.onmousemove=d}t?t.onmousedown=l:e.onmousedown=l})(h(this,tv,"f"),h(this,iv,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,ov,"f").resize),(e=h(this,tv,"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,tv,"f").onresize=h(this,Qg,"m",dv).bind(this),h(this,ev,"f").subscribe(h(this,Qg,"m",rv).bind(this))}disconnectedCallback(){h(this,ev,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,ov,"f").resize)}}ev=new WeakMap,tv=new WeakMap,nv=new WeakMap,iv=new WeakMap,ov=new WeakMap,Qg=new WeakSet,rv=function(e){h(this,Qg,"m",sv).call(this,e),h(this,Qg,"m",dv).call(this)},sv=function(e){h(this,nv,"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("")},dv=function(){h(this,nv,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,i=t.clientHeight>20;n||i?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},av=function(){const[e,t]=Xg(h(this,tv,"f"),Number.parseInt(h(this,tv,"f").style.left,10),Number.parseInt(h(this,tv,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,tv,"f").style.top=`${t}px`,h(this,tv,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",cv);var uv=Object.freeze({__proto__:null,default:cv});e.AccessKeyManagement=wi,e.AuditManagement=Ci,e.AuthProvider=({projectId:e,baseUrl:n="",baseStaticUrl:s="",sessionTokenViaCookie:a=!1,persistTokens:l=!0,storeLastAuthenticatedUser:c=!0,keepLastAuthenticatedUserAfterLogout:u=!1,children:h})=>{const[f,p]=t.useState(),[g,v]=t.useState(),[m,$]=t.useState(!1),[y,b]=t.useState(!1),w=(({projectId:e,baseUrl:n,persistTokens:i,sessionTokenViaCookie:o,storeLastAuthenticatedUser:r,keepLastAuthenticatedUserAfterLogout:s})=>t.useMemo((()=>{if(e)return ai({projectId:e,baseUrl:n,sessionTokenViaCookie:o,baseHeaders:d,persistTokens:i,storeLastAuthenticatedUser:r,keepLastAuthenticatedUserAfterLogout:s,autoRefresh:!0})}),[e,n,o]))({projectId:e,baseUrl:n,persistTokens:l,sessionTokenViaCookie:a,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u});t.useEffect((()=>{if(w){const e=w.onSessionTokenChange(v),t=w.onUserChange(p);return()=>{e(),t()}}}),[w]);const k=t.useRef(!1),C=t.useCallback((()=>{k.current||(k.current=!0,b(!0),r(null==w?void 0:w.refresh)().then((()=>{b(!1)})))}),[w]),I=t.useCallback((()=>{$(!0),r(w.me)().then((()=>{$(!1)}))}),[w]),R=t.useMemo((()=>({fetchUser:I,user:f,isUserLoading:m,fetchSession:C,session:g,isSessionLoading:y,isSessionFetched:k.current,projectId:e,baseUrl:n,baseStaticUrl:s,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,setUser:p,setSession:v,sdk:w})),[I,f,m,C,g,y,k.current,e,n,s,p,v,w]);return i.default.createElement(o.Provider,{value:R},h)},e.Descope=gi,e.RoleManagement=yi,e.SignInFlow=e=>i.default.createElement(gi,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>i.default.createElement(gi,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>i.default.createElement(gi,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=mi,e.UserProfile=Ri,e.baseHeaders=d,e.getJwtPermissions=hi,e.getJwtRoles=fi,e.getRefreshToken=ui,e.getSessionToken=ci,e.isRefreshTokenExpired=(e=ui())=>null==di?void 0:di.isJwtExpired(e),e.isSessionTokenExpired=(e=ci())=>null==di?void 0:di.isJwtExpired(e),e.refresh=(e=ui())=>null==di?void 0:di.refresh(e),e.useDescope=()=>{const{sdk:e}=Si();return t.useMemo((()=>e||new Proxy(li(),Ei)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:i,isSessionFetched:o}=Si(),r=t.useRef(n);t.useMemo((()=>{r.current=n}),[n]);const s=!e&&!n;return t.useMemo((()=>{s&&!o&&(r.current=!0)}),[o]),t.useEffect((()=>{s&&i()}),[i]),{isSessionLoading:r.current,sessionToken:e,isAuthenticated:!!e}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,session:o}=Si(),[r,s]=t.useState(!1),d=t.useRef(i),a=t.useMemo((()=>!e&&!i&&o&&!r),[n,o,r]);return t.useMemo((()=>{d.current=i}),[i]),t.useMemo((()=>{a&&(d.current=!0)}),[a]),t.useEffect((()=>{a&&(s(!0),n())}),[a]),{isUserLoading:d.current,user:e}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
3
4
|
//# sourceMappingURL=index.umd.js.map
|