@descope/react-sdk 0.0.0-alpha.0 → 0.0.0-alpha.1
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 +26 -4
- package/dist/cjs/components/AuthProvider/AuthProvider.js +1 -1
- package/dist/cjs/components/AuthProvider/AuthProvider.js.map +1 -1
- package/dist/cjs/components/AuthProvider/useSdk.js +1 -1
- package/dist/cjs/components/AuthProvider/useSdk.js.map +1 -1
- package/dist/cjs/components/Descope.js +1 -1
- package/dist/cjs/components/Descope.js.map +1 -1
- package/dist/cjs/components/UserProfile.js +1 -1
- package/dist/cjs/components/UserProfile.js.map +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/hooks/useSession.js +1 -1
- package/dist/cjs/hooks/useSession.js.map +1 -1
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/components/AuthProvider/AuthProvider.js +1 -1
- package/dist/esm/components/AuthProvider/AuthProvider.js.map +1 -1
- package/dist/esm/components/AuthProvider/useSdk.js +1 -1
- package/dist/esm/components/AuthProvider/useSdk.js.map +1 -1
- package/dist/esm/components/Descope.js +1 -1
- package/dist/esm/components/Descope.js.map +1 -1
- package/dist/esm/components/UserProfile.js +1 -1
- package/dist/esm/components/UserProfile.js.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/hooks/useSession.js +1 -1
- package/dist/esm/hooks/useSession.js.map +1 -1
- package/dist/esm/sdk.js.map +1 -1
- package/dist/index.d.ts +135 -31
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/components/AuthProvider/AuthProvider.d.ts +12 -0
- package/dist/types/components/AuthProvider/useSdk.d.ts +2 -2
- package/dist/types/sdk.d.ts +308 -46
- package/dist/types/types.d.ts +4 -1
- package/package.json +11 -10
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +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";var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(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 r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function r(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(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((i=i.apply(e,t||[])).next())}))}function o(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 s(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!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"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;class a extends Error{}function d(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return atob(t)}}function l(e,t){if("string"!=typeof e)throw new a("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,i=e.split(".")[n];if("string"!=typeof i)throw new a(`Invalid token specified: missing part #${n+1}`);let r;try{r=d(i)}catch(e){throw new a(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new a(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}a.prototype.name="InvalidTokenError";var c="/v1/auth/accesskey/exchange",u="/v1/auth/otp/verify",h="/v1/auth/otp/signin",g="/v1/auth/otp/signup",p={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},f="/v1/auth/otp/signup-in",m="/v1/auth/magiclink/verify",v="/v1/auth/magiclink/signin",y="/v1/auth/magiclink/signup",w={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},b="/v1/auth/magiclink/signup-in",$="/v1/auth/enchantedlink/verify",_="/v1/auth/enchantedlink/signin",S="/v1/auth/enchantedlink/signup",k="/v1/auth/enchantedlink/pending-session",C={email:"/v1/auth/enchantedlink/update/email"},x="/v1/auth/enchantedlink/signup-in",I="/v1/auth/oauth/authorize",R="/v1/auth/oauth/exchange",E="v1/auth/oauth/native/start",O="v1/auth/oauth/native/finish",N="/v1/auth/saml/authorize",P="/v1/auth/saml/exchange",A="/v1/auth/totp/verify",j="/v1/auth/totp/signup",T="/v1/auth/totp/update",M="/v1/auth/notp/whatsapp/signin",U="/v1/auth/notp/whatsapp/signup",W="/v1/auth/notp/whatsapp/signup-in",L="/v1/auth/notp/pending-session",D={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},F={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},q={start:"/v1/auth/webauthn/signup-in/start"},B={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},K="/v1/auth/password/signup",H="/v1/auth/password/signin",V="/v1/auth/password/reset",z="/v1/auth/password/update",G="/v1/auth/password/replace",J="/v1/auth/password/policy",Z="/v1/auth/refresh",Y="/v1/auth/tenant/select",X="/v1/auth/logout",Q="/v1/auth/logoutall",ee="/v1/auth/me",te="/v1/auth/me/tenants",ne="/v1/auth/me/history",ie="/v1/flow/start",re="/v1/flow/next";const oe="<region>",se=`https://api.${oe}descope.com`,ae=6e5,de="dct",le=()=>{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")}};let ce;const ue=()=>{if(ce)return ce;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return ce=`${t}-${n}`,ce};var he;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(he||(he={}));const ge=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(oe,r?r+".":"");let o=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,i)=>{o=`${o}${0===i?"?":""}${t}=${encodeURIComponent(n[t])}${i===e.length-1?"":"&"}`}))}return o},pe=(...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}),{})),fe={"Content-Type":"application/json"},me=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},ve=e=>{const t={"x-descope-sdk-session-id":ue(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.38.0"};return e&&(t["x-descope-refresh-cookie-name"]=e),t},ye=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},we=({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{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=>le().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 le().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(i)),i}:n})(r,a),l=async r=>{var a;const l=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:c,body:u,headers:h,queryParams:g,method:p,token:f}=l,m=(e=>void 0===e?void 0:JSON.stringify(e))(u),v={headers:pe(me(t,f),ve(i),(null==n?void 0:n.baseHeaders)||{},ye(m)?fe:{},h),method:p,body:m};null!==s&&(v.credentials=s||"include");const y=await d(ge({path:c,baseUrl:e,queryParams:g,projectId:t}),v);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==y?void 0:y.clone()),null==o?void 0:o.transformResponse){const e=await y.json(),t=((null===(a=y.headers)||void 0===a?void 0:a.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({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}return y};return{get:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:he.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:he.post,token:r}),patch:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:he.patch,token:r}),put:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:he.put,token:r}),delete:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:he.delete,token:i}),hooks:o,buildUrl:(n,i)=>ge({projectId:t,baseUrl:e,path:n,queryParams:i})}};var be=429;function $e(e,t,n){var i;let r=_e(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r[de])===t)return(null==r?void 0:r[n])||[];r=null===(i=null==r?void 0:r.tenants)||void 0===i?void 0:i[t]}const o=null==r?void 0:r[n];return Array.isArray(o)?o:[]}function _e(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return l(e)}function Se(e){const{exp:t}=_e(e);return(new Date).getTime()/1e3>t}function ke(e){let t=_e(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Ce(e,t){return $e(e,t,"permissions")}function xe(e,t){return $e(e,t,"roles")}const Ie=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Re(e,t){var n;const i=await e,r={code:i.status,ok:i.ok,response:i},o=await i.clone().json();return i.ok?r.data=o:(r.error=o,i.status===be&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function Ee(e){var t;return(null===(t=_e(e))||void 0===t?void 0:t[de])||""}const Oe=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Ne=(e,t)=>(n=t)=>t=>{const i=e.filter((e=>e(t)));return!(i.length<e.length)&&(n?n.replace("{val}",t):i.join(" OR "))},Pe=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ae=e=>t=>e.test(t),je=Ae(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Te=Ae(/^\+[1-9]{1}[0-9]{3,14}$/),Me=Oe(je,'"{val}" is not a valid email'),Ue=Oe(Te,'"{val}" is not a valid phone number'),We=Oe((e=>e.length>=1),"Minimum length is 1");const Le=Oe((e=>"string"==typeof e),"Input is not a string"),De=Oe((e=>Array.isArray(e)),"Input is not an array"),Fe=Oe((e=>"boolean"==typeof e),"Input is not a boolean"),qe=Oe((e=>void 0===e),"Input is defined"),Be=Ne([Le(),qe()],"Input is not a string or undefined"),Ke=Ne([De(),Fe()],"Input is not an array or boolean"),He=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Pe(...e).validate(n[t]))),t(...n)),Ve=e=>[Le(`"${e}" must be a string`)],ze=e=>[Le(`"${e}" must be a string`),We(`"${e}" must not be empty`)],Ge=e=>[Le(`"${e}" must be a string`),Me()],Je=e=>[Le(`"${e}" must be a string`),Ue()],Ze=He(ze("accessKey")),Ye=e=>({exchange:Ze(((t,n)=>Re(e.post(c,{loginOptions:n},{token:t}))))}),Xe=(e,t,n)=>(t.forEach((t=>{const i=t.split(".");let r=i.shift(),o=e;for(;i.length>0;){if(o=o[r],!r||!o)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=i.shift()}if("function"!=typeof o[r])throw Error(`"${t}" is not a function`);const s=o[r];o[r]=n(s)})),e),Qe=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||ae,ae)});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 rt=ze("loginId"),ot=He(ze("token")),st=He(rt),at=He(ze("pendingRef")),dt=He(rt,Ge("email")),lt=e=>({verify:ot((t=>Re(e.post($,{token:t})))),signIn:st(((t,n,i,r)=>Re(e.post(Ie(_,nt.email),{loginId:t,URI:n,loginOptions:i},{token:r})))),signUpOrIn:st(((t,n,i)=>Re(e.post(Ie(x,nt.email),{loginId:t,URI:n,loginOptions:i})))),signUp:st(((t,n,i,r)=>Re(e.post(Ie(S,nt.email),{loginId:t,URI:n,user:i,loginOptions:r})))),waitForSession:at(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=Qe(n);let s;const a=setInterval((async()=>{const n=await e.post(k,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:dt(((t,n,i,r,o)=>Re(e.post(C.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),ct=He(ze("flowId")),ut=He(ze("executionId"),ze("stepId"),ze("interactionId")),ht=e=>({start:ct(((t,n,i,r,o,s,a)=>Re(e.post(ie,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a})))),next:ut(((t,n,i,r,o,s)=>Re(e.post(re,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s}))))}),gt=ze("loginId"),pt=He(ze("token")),ft=He(gt),mt=He(gt,Je("phone")),vt=He(gt,Ge("email")),yt=Object.keys(nt).filter((e=>e!==et.voice)),wt=e=>({verify:pt((t=>Re(e.post(m,{token:t})))),signIn:yt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,i,r,o)=>Re(e.post(Ie(v,n),{loginId:t,URI:i,loginOptions:r},{token:o}))))})),{}),signUp:yt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,i,r,o)=>Re(e.post(Ie(y,n),{loginId:t,URI:i,user:r,loginOptions:o}))))})),{}),signUpOrIn:yt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,i,r)=>Re(e.post(Ie(b,n),{loginId:t,URI:i,loginOptions:r}))))})),{}),update:{email:vt(((t,n,i,r,o)=>Re(e.post(w.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(et).filter((e=>e!==et.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:mt(((t,i,r,o,s)=>Re(e.post(Ie(w.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});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 $t=He(ze("code")),_t=e=>({start:Object.assign(((t,n,i,r)=>Re(e.post(I,i||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(bt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r)=>Re(e.post(I,i||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:$t((t=>Re(e.post(R,{code:t})))),startNative:(t,n,i)=>Re(e.post(E,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>Re(e.post(O,{provider:t,stateId:n,user:i,code:r,idToken:o}))}),St=ze("loginId"),kt=He(St,ze("code")),Ct=He(St),xt=He(St,Je("phone")),It=He(St,Ge("email")),Rt=e=>({verify:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,i)=>Re(e.post(Ie(u,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,i,r)=>Re(e.post(Ie(h,n),{loginId:t,loginOptions:i},{token:r}))))})),{}),signUp:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,i,r)=>Re(e.post(Ie(g,n),{loginId:t,user:i,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(nt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,i)=>Re(e.post(Ie(f,n),{loginId:t,loginOptions:i}))))})),{}),update:{email:It(((t,n,i,r)=>Re(e.post(p.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xt(((t,i,r,o)=>Re(e.post(Ie(p.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Et=He(ze("tenant")),Ot=He(ze("code")),Nt=e=>({start:Et(((t,n,i,r,o)=>Re(e.post(N,i||{},Object.assign({queryParams:Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o})},r&&{token:r}))))),exchange:Ot((t=>Re(e.post(P,{code:t}))))}),Pt=ze("loginId"),At=He(Pt,ze("code")),jt=He(Pt),Tt=He(Pt),Mt=e=>({signUp:jt(((t,n)=>Re(e.post(j,{loginId:t,user:n})))),verify:At(((t,n,i,r)=>Re(e.post(A,{loginId:t,code:n,loginOptions:i},{token:r})))),update:Tt(((t,n)=>Re(e.post(T,{loginId:t},{token:n}))))}),Ut=ze("loginId"),Wt=ze("newPassword"),Lt=He(Ut,ze("password")),Dt=He(Ut),Ft=He(Ut,Wt),qt=He(Ut,ze("oldPassword"),Wt),Bt=e=>({signUp:Lt(((t,n,i,r)=>Re(e.post(K,{loginId:t,password:n,user:i,loginOptions:r})))),signIn:Lt(((t,n,i)=>Re(e.post(H,{loginId:t,password:n,loginOptions:i})))),sendReset:Dt(((t,n,i)=>Re(e.post(V,{loginId:t,redirectUrl:n,templateOptions:i})))),update:Ft(((t,n,i)=>Re(e.post(z,{loginId:t,newPassword:n},{token:i})))),replace:qt(((t,n,i)=>Re(e.post(G,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>Re(e.get(J))}),Kt=Ve("loginId"),Ht=ze("loginId"),Vt=ze("origin"),zt=He(Ht,Vt,ze("name")),Gt=He(Ht,Vt),Jt=He(Kt,Vt),Zt=He(Ht,Vt,ze("token")),Yt=He(ze("transactionId"),ze("response")),Xt=e=>({signUp:{start:zt(((t,n,i,r)=>Re(e.post(D.start,{user:{loginId:t,name:i},origin:n,passkeyOptions:r})))),finish:Yt(((t,n)=>Re(e.post(D.finish,{transactionId:t,response:n}))))},signIn:{start:Jt(((t,n,i,r,o)=>Re(e.post(F.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:Yt(((t,n)=>Re(e.post(F.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Gt(((t,n,i)=>Re(e.post(q.start,{loginId:t,origin:n,passkeyOptions:i}))))},update:{start:Zt(((t,n,i,r)=>Re(e.post(B.start,{loginId:t,origin:n,passkeyOptions:r},{token:i})))),finish:Yt(((t,n)=>Re(e.post(B.finish,{transactionId:t,response:n}))))}}),Qt=Ve("loginId"),en=He(Qt),tn=He(ze("pendingRef")),nn=e=>({signUpOrIn:en(((t,n)=>Re(e.post(W,{loginId:t,loginOptions:n})))),signUp:en(((t,n,i)=>Re(e.post(U,{loginId:t,user:n,loginOptions:i})))),signIn:en(((t,n,i)=>Re(e.post(M,{loginId:t,loginOptions:n},{token:i})))),waitForSession:tn(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=Qe(n);let s;const a=setInterval((async()=>{const n=await e.post(L,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),rn=He(ze("token")),on=He([Be('"token" must be string or undefined')]);var sn,an=He([(sn=ze("projectId"),Oe(((e,t)=>n=>Pe(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),i=n.length;let r=0,o=e===Object(e)?e:void 0;for(;null!=o&&r<i;)o=o[n[r++]];return r&&r===i&&void 0!==o?o:void 0})(n,e)))("projectId",sn))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a})=>{return d=we({baseUrl:n||se,projectId:e,logger:t,hooks:i,cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:Ye(d),otp:Rt(d),magicLink:wt(d),enchantedLink:lt(d),oauth:_t(d),saml:Nt(d),totp:Mt(d),notp:nn(d),webauthn:Xt(d),password:Bt(d),flow:ht(d),refresh:on(((e,t)=>Re(d.post(Z,{},{token:e,queryParams:t})))),selectTenant:He([Le("tenantId")],[Be('"token" must be string or undefined')])(((e,t)=>Re(d.post(Y,{tenant:e},{token:t})))),logout:on((e=>Re(d.post(X,{},{token:e})))),logoutAll:on((e=>Re(d.post(Q,{},{token:e})))),me:on((e=>Re(d.get(ee,{token:e})))),myTenants:He([Ke('"tenants" must a string array or a boolean')],[Be('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,Re(d.post(te,n,{token:t}))})),history:on((e=>Re(d.get(ne,{token:e})))),isJwtExpired:rn(Se),getTenants:rn(ke),getJwtPermissions:rn(Ce),getJwtRoles:rn(xe),getCurrentTenant:rn(Ee),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 r=[].concat((null===(i=e.hooks)||void 0===i?void 0:i.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}}))})),dn=Object.assign(an,{DeliveryMethods:nt});
|
|
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";const n=t.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)},r=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},o={"x-descope-sdk-name":"react","x-descope-sdk-version":"0.0.0-alpha.1"},s="undefined"!=typeof window;var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function d(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 r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function l(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(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((i=i.apply(e,t||[])).next())}))}function c(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 u(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!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"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;class h extends Error{}function f(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return atob(t)}}function p(e,t){if("string"!=typeof e)throw new h("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,i=e.split(".")[n];if("string"!=typeof i)throw new h(`Invalid token specified: missing part #${n+1}`);let r;try{r=f(i)}catch(e){throw new h(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new h(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}h.prototype.name="InvalidTokenError";var g={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const v="<region>",m=`https://api.${v}descope.com`,y=6e5,$="dct",b=()=>{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")}};let w;const C=()=>{if(w)return w;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return w=`${t}-${n}`,w};var k;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(k||(k={}));const S=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(v,r?r+".":"");let o=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,i)=>{o=`${o}${0===i?"?":""}${t}=${encodeURIComponent(n[t])}${i===e.length-1?"":"&"}`}))}return o},x=(...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}),{})),I={"Content-Type":"application/json"},R=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},O=e=>{const t={"x-descope-sdk-session-id":C(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.41.0"};return e&&(t["x-descope-refresh-cookie-name"]=e),t},E=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},N=({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{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=>b().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 b().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(i)),i}:n})(r,a),l=async r=>{var a;const l=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=l,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:x(R(t,g),O(i),(null==n?void 0:n.baseHeaders)||{},E(v)?I:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const y=await d(S({path:c,baseUrl:e,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==y?void 0:y.clone()),null==o?void 0:o.transformResponse){const e=await y.json(),t=((null===(a=y.headers)||void 0===a?void 0:a.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({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}return y};return{get:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:k.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.post,token:r}),patch:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.patch,token:r}),put:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.put,token:r}),delete:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:k.delete,token:i}),hooks:o,buildUrl:(n,i)=>S({projectId:t,baseUrl:e,path:n,queryParams:i})}};var A=429;function j(e,t,n){var i;let r=P(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r[$])===t)return(null==r?void 0:r[n])||[];r=null===(i=null==r?void 0:r.tenants)||void 0===i?void 0:i[t]}const o=null==r?void 0:r[n];return Array.isArray(o)?o:[]}function P(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return p(e)}function M(e){const{exp:t}=P(e);return(new Date).getTime()/1e3>t}function T(e){let t=P(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function U(e,t){return j(e,t,"permissions")}function _(e,t){return j(e,t,"roles")}const L=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function W(e,t){var n;const i=await e,r={code:i.status,ok:i.ok,response:i},o=await i.clone().json();return i.ok?r.data=o:(r.error=o,i.status===A&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function D(e){var t;return(null===(t=P(e))||void 0===t?void 0:t[$])||""}const F=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),q=(e,t)=>(n=t)=>t=>{const i=e.filter((e=>e(t)));return!(i.length<e.length)&&(n?n.replace("{val}",t):i.join(" OR "))},B=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),V=e=>t=>e.test(t),K=V(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),H=V(/^\+[1-9]{1}[0-9]{3,14}$/),G=F(K,'"{val}" is not a valid email'),z=F(H,'"{val}" is not a valid phone number'),J=F((e=>e.length>=1),"Minimum length is 1");const Z=F((e=>"string"==typeof e),"Input is not a string"),Y=F((e=>Array.isArray(e)),"Input is not an array"),X=F((e=>"boolean"==typeof e),"Input is not a boolean"),Q=F((e=>void 0===e),"Input is defined"),ee=q([Z(),Q()],"Input is not a string or undefined"),te=q([Y(),X()],"Input is not an array or boolean"),ne=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>B(...e).validate(n[t]))),t(...n)),ie=e=>[Z(`"${e}" must be a string`)],re=e=>[ee(`"${e}" must be string or undefined`)],oe=e=>[Z(`"${e}" must be a string`),J(`"${e}" must not be empty`)],se=e=>[Z(`"${e}" must be a string`),G()],ae=e=>[Z(`"${e}" must be a string`),z()],de=ne(oe("accessKey")),le=e=>({exchange:de(((t,n)=>W(e.post(g.accessKey.exchange,{loginOptions:n},{token:t}))))}),ce=(e,t,n)=>(t.forEach((t=>{const i=t.split(".");let r=i.shift(),o=e;for(;i.length>0;){if(o=o[r],!r||!o)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=i.shift()}if("function"!=typeof o[r])throw Error(`"${t}" is not a function`);const s=o[r];o[r]=n(s)})),e),ue=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||y,y)});var he,fe;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(he||(he={})),function(e){e.email="email"}(fe||(fe={}));const pe=Object.assign(Object.assign({},he),fe);var ge;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(ge||(ge={}));const ve=oe("loginId"),me=ne(oe("token")),ye=ne(ve),$e=ne(oe("pendingRef")),be=ne(ve,se("email")),we=e=>({verify:me((t=>W(e.post(g.enchantedLink.verify,{token:t})))),signIn:ye(((t,n,i,r)=>W(e.post(L(g.enchantedLink.signIn,pe.email),{loginId:t,URI:n,loginOptions:i},{token:r})))),signUpOrIn:ye(((t,n,i)=>W(e.post(L(g.enchantedLink.signUpOrIn,pe.email),{loginId:t,URI:n,loginOptions:i})))),signUp:ye(((t,n,i,r)=>W(e.post(L(g.enchantedLink.signUp,pe.email),{loginId:t,URI:n,user:i,loginOptions:r})))),waitForSession:$e(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ue(n);let s;const a=setInterval((async()=>{const n=await e.post(g.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(W(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:be(((t,n,i,r,o)=>W(e.post(g.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),Ce=ne(oe("flowId")),ke=ne(oe("executionId"),oe("stepId"),oe("interactionId")),Se=e=>({start:Ce(((t,n,i,r,o,s,a)=>W(e.post(g.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a})))),next:ke(((t,n,i,r,o,s)=>W(e.post(g.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s}))))}),xe=oe("loginId"),Ie=ne(oe("token")),Re=ne(xe),Oe=ne(xe,ae("phone")),Ee=ne(xe,se("email")),Ne=Object.keys(pe).filter((e=>e!==he.voice)),Ae=e=>({verify:Ie((t=>W(e.post(g.magicLink.verify,{token:t})))),signIn:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r,o)=>W(e.post(L(g.magicLink.signIn,n),{loginId:t,URI:i,loginOptions:r},{token:o}))))})),{}),signUp:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r,o)=>W(e.post(L(g.magicLink.signUp,n),{loginId:t,URI:i,user:r,loginOptions:o}))))})),{}),signUpOrIn:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r)=>W(e.post(L(g.magicLink.signUpOrIn,n),{loginId:t,URI:i,loginOptions:r}))))})),{}),update:{email:Ee(((t,n,i,r,o)=>W(e.post(g.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(he).filter((e=>e!==he.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Oe(((t,i,r,o,s)=>W(e.post(L(g.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var je;!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"}(je||(je={}));const Pe=ne(oe("code")),Me=e=>({start:Object.assign(((t,n,i,r)=>W(e.post(g.oauth.start,i||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(je).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r)=>W(e.post(g.oauth.start,i||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:Pe((t=>W(e.post(g.oauth.exchange,{code:t})))),startNative:(t,n,i)=>W(e.post(g.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>W(e.post(g.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>W(e.get(g.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>W(e.post(g.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>W(e.post(g.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),Te=oe("loginId"),Ue=ne(Te,oe("code")),_e=ne(Te),Le=ne(Te,ae("phone")),We=ne(Te,se("email")),De=e=>({verify:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ue(((t,i)=>W(e.post(L(g.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:_e(((t,i,r)=>W(e.post(L(g.otp.signIn,n),{loginId:t,loginOptions:i},{token:r}))))})),{}),signUp:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:_e(((t,i,r)=>W(e.post(L(g.otp.signUp,n),{loginId:t,user:i,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:_e(((t,i)=>W(e.post(L(g.otp.signUpOrIn,n),{loginId:t,loginOptions:i}))))})),{}),update:{email:We(((t,n,i,r)=>W(e.post(g.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(he).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Le(((t,i,r,o)=>W(e.post(L(g.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Fe=ne(oe("tenant")),qe=ne(oe("code")),Be=e=>({start:Fe(((t,n,i,r,o)=>W(e.post(g.saml.start,i||{},Object.assign({queryParams:Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o})},r&&{token:r}))))),exchange:qe((t=>W(e.post(g.saml.exchange,{code:t}))))}),Ve=oe("loginId"),Ke=ne(Ve,oe("code")),He=ne(Ve),Ge=ne(Ve),ze=e=>({signUp:He(((t,n)=>W(e.post(g.totp.signUp,{loginId:t,user:n})))),verify:Ke(((t,n,i,r)=>W(e.post(g.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:Ge(((t,n)=>W(e.post(g.totp.update,{loginId:t},{token:n}))))}),Je=oe("loginId"),Ze=oe("newPassword"),Ye=ne(Je,oe("password")),Xe=ne(Je),Qe=ne(Je,Ze),et=ne(Je,oe("oldPassword"),Ze),tt=e=>({signUp:Ye(((t,n,i,r)=>W(e.post(g.password.signUp,{loginId:t,password:n,user:i,loginOptions:r})))),signIn:Ye(((t,n,i)=>W(e.post(g.password.signIn,{loginId:t,password:n,loginOptions:i})))),sendReset:Xe(((t,n,i)=>W(e.post(g.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:Qe(((t,n,i)=>W(e.post(g.password.update,{loginId:t,newPassword:n},{token:i})))),replace:et(((t,n,i)=>W(e.post(g.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>W(e.get(g.password.policy))}),nt=ie("loginId"),it=oe("loginId"),rt=oe("origin"),ot=ne(it,rt,oe("name")),st=ne(it,rt),at=ne(nt,rt),dt=ne(it,rt,re("token")),lt=ne(oe("transactionId"),oe("response")),ct=e=>({signUp:{start:ot(((t,n,i,r)=>W(e.post(g.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,passkeyOptions:r})))),finish:lt(((t,n)=>W(e.post(g.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:at(((t,n,i,r,o)=>W(e.post(g.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:lt(((t,n)=>W(e.post(g.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:st(((t,n,i)=>W(e.post(g.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:i}))))},update:{start:dt(((t,n,i,r)=>W(e.post(g.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:i})))),finish:lt(((t,n)=>W(e.post(g.webauthn.update.finish,{transactionId:t,response:n}))))}}),ut=ie("loginId"),ht=ne(ut),ft=ne(oe("pendingRef")),pt=e=>({signUpOrIn:ht(((t,n)=>W(e.post(g.notp.signUpOrIn,{loginId:t,loginOptions:n})))),signUp:ht(((t,n,i)=>W(e.post(g.notp.signUp,{loginId:t,user:n,loginOptions:i})))),signIn:ht(((t,n,i)=>W(e.post(g.notp.signIn,{loginId:t,loginOptions:n},{token:i})))),waitForSession:ft(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ue(n);let s;const a=setInterval((async()=>{const n=await e.post(g.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(W(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),gt=ne(oe("token")),vt=ne(re("token"));var mt,yt=ne([(mt=oe("projectId"),F(((e,t)=>n=>B(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),i=n.length;let r=0,o=e===Object(e)?e:void 0;for(;null!=o&&r<i;)o=o[n[r++]];return r&&r===i&&void 0!==o?o:void 0})(n,e)))("projectId",mt))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a})=>{return d=N({baseUrl:n||m,projectId:e,logger:t,hooks:i,cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:le(d),otp:De(d),magicLink:Ae(d),enchantedLink:we(d),oauth:Me(d),saml:Be(d),totp:ze(d),notp:pt(d),webauthn:ct(d),password:tt(d),flow:Se(d),refresh:vt(((e,t,n)=>{const i={};return n&&(i.externalToken=n),W(d.post(g.refresh,i,{token:e,queryParams:t}))})),selectTenant:ne([Z("tenantId")],[ee('"token" must be string or undefined')])(((e,t)=>W(d.post(g.selectTenant,{tenant:e},{token:t})))),logout:vt((e=>W(d.post(g.logout,{},{token:e})))),logoutAll:vt((e=>W(d.post(g.logoutAll,{},{token:e})))),me:vt((e=>W(d.get(g.me,{token:e})))),myTenants:ne([te('"tenants" must a string array or a boolean')],[ee('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,W(d.post(g.myTenants,n,{token:t}))})),history:vt((e=>W(d.get(g.history,{token:e})))),isJwtExpired:gt(M),getTenants:gt(T),getJwtPermissions:gt(U),getJwtRoles:gt(_),getCurrentTenant:gt(D),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 r=[].concat((null===(i=e.hooks)||void 0===i?void 0:i.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}}))})),$t=Object.assign(yt,{DeliveryMethods:pe});
|
|
2
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,r){if("undefined"!=typeof document){"number"==typeof(r=ln({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in r)r[s]&&(o+="; "+s,!0!==r[s]&&(o+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r<n.length;r++){var o=n[r].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(i[a]=t.read(s,a),e===a)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",gn="The endpoint parameter is not a valid URL",pn="Failed to load the JS script of the agent",fn="9319";function mn(e,t){var n,i,r,o,s,a=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);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),o=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,o++))},r=new Set,[n.current(),function(e,t){var o,s=t instanceof Error?t.message:"";if(s===hn||s===gn)n.exclude(),o=0;else if(s===fn)n.exclude();else if(s===pn){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),o=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=o?o:e.getTime()+i()-Date.now()]}]),l=d[0],c=d[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var u=function(e){var n=new Date,i=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return i()}),i),r.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=c(n,e);if(!t)throw s;var i,r=t[0],o=t[1];return(i=o,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return u(r)}))}))};return u(l).then((function(e){return[e,a]}))}var vn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",yn=vn;function wn(e){var t;e.scriptUrlPattern;var r=e.token,o=e.apiKey,s=void 0===o?r:o,a=i(e,["scriptUrlPattern","token","apiKey"]),d=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,l=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]}(),c=l[0],u=l[1];return Promise.resolve().then((function(){if(!s||"string"!=typeof s)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.11.6"):e}))}(String(e),t)}))}(d,s);return mn(e,bn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===fn?new Error(pn):e}(e)})).then((function(e){var t=e[0],i=e[1];return u(),t.load(n(n({},a),{ldi:{attempts:i,visibilityStates:c}}))}))}function bn(e){return function(e,t,n){var i,r=document,o="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),r=t.blockedURI;r!==n.href&&r!==n.protocol.slice(0,-1)&&r!==n.origin||(i=t,a())};r.addEventListener(o,s);var a=function(){return r.removeEventListener(o,s)};return Promise.resolve().then(t).then((function(e){return a(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(a(),i)return n(i);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(gn);var i=document.createElement("script"),r=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},o=document.head||document.getElementsByTagName("head")[0];i.onload=function(){r(),t()},i.onerror=function(){r(),n(new Error(pn))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(hn)})).then($n)}function $n(){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(fn);return n}const _n=e=>{try{return l(e).exp}catch(e){return null}},Sn=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:_n(n)},kn=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?_n(i):void 0)},Cn=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,i)=>{var r;return n[i]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[i])||[]).concat((null==t?void 0:t[i])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},xn=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(e=>{const{access_token:t,id_token:n,refresh_token:r,refresh_expire_in:o}=e,s=i(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||r,sessionExpiration:e.sessionExpiration||kn(e),cookieExpiration:e.cookieExpiration||Sn(e)},s)})((null==t?void 0:t.authInfo)||t||{})},In=async e=>{const t=await xn(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Rn="undefined"!=typeof localStorage,En=(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)),Nn=e=>Rn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Pn=(...e)=>{console.debug(...e)},An="3.2.0",jn="undefined"!=typeof window,Tn=Math.pow(2,31)-1,Mn=`https://descopecdn.com/npm/oidc-client-ts@${An}/dist/browser/oidc-client-ts.min.js`,Un=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${An}/dist/browser/oidc-client-ts.min.js`,Wn="DS",Ln="DSR",Dn="DSI";function Fn(e=""){return On(`${e}${Ln}`)||""}function qn(e=""){return cn.get(Wn)||On(`${e}${Wn}`)||""}function Bn(e=""){return On(`${e}${Dn}`)||""}function Kn(e=""){Nn(`${e}${Ln}`),Nn(`${e}${Wn}`),Nn(`${e}${Dn}`),cn.remove(Wn)}const Hn=jn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Vn="vsid",zn="vrid",Gn="fp",Jn=(e=!1)=>{const t=localStorage.getItem(Gn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Zn=async(e,t=Hn)=>{try{if(Jn())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 r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const o=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=wn({apiKey:e,endpoint:[i.toString(),un],scriptUrlPattern:[o,yn]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[Vn]:e,[zn]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Gn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Yn=e=>{const t=Jn(!0);return t&&e.body&&(e.body.fpData=t),e},Xn="dls_last_user_login_id",Qn="dls_last_user_display_name",ei=()=>On(Xn),ti=()=>On(Qn),ni=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=ei(),o=ti();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)};function ii(){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 ri(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=ci(n.publicKey.challenge),n.publicKey.user.id=ci(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=ci(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:ui(n.rawId),type:n.type,response:{attestationObject:ui(n.response.attestationObject),clientDataJSON:ui(n.response.clientDataJSON)}});var n}async function oi(e){const t=di(e);return li(await navigator.credentials.get(t))}async function si(e,t){const n=di(e);return n.signal=t.signal,n.mediation="conditional",li(await navigator.credentials.get(n))}async function ai(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 di(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=ci(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=ci(e.id)})),n}function li(e){return JSON.stringify({id:e.id,rawId:ui(e.rawId),type:e.type,response:{authenticatorData:ui(e.response.authenticatorData),clientDataJSON:ui(e.response.clientDataJSON),signature:ui(e.response.signature),userHandle:e.response.userHandle?ui(e.response.userHandle):void 0}})}function ci(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function ui(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var hi,gi=(hi=e=>({async signUp(t,n,i){const r=await e.webauthn.signUp.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await ri(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,o)},async signIn(t,n){const i=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!i.ok)return i;const r=await oi(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,r)},async signUpOrIn(t,n){var i;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(null===(i=r.data)||void 0===i?void 0:i.create){const t=await ri(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await oi(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,t)}},async update(t,n,i){const r=await e.webauthn.update.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await ri(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:ri,get:oi,isSupported:ai,conditional:si}}),(...e)=>{const t=hi(...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 pi="/fedcm/config",fi=(e,t)=>({async oneTap(t,n,i,r,o){const s=null!=t?t:"google",a=await e.oauth.startNative(s,i,!0);if(!a.ok)return a;const{clientId:d,stateId:l,nonce:c}=a.data,u=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,a;u.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===(a=null==n?void 0:n.use_fedcm_for_prompt)||void 0===a||a,client_id:d,callback:n=>{t(e.oauth.finishNative(s,l,"","",n.credential))},nonce:c})),u.prompt((e=>{var t,n;if(o&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);null==o||o(n)}else if(r&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);null==r||r(t)}}))}))},async launch(n){var i;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+pi),clientId:t}]}},o=await(null===(i=navigator.credentials)||void 0===i?void 0:i.get(r));return e.refresh(o.token)},isSupported:()=>jn&&"IdentityCredential"in window,async isLoggedIn(n){var i;const r=e.httpClient.buildUrl(t+pi);try{const e={identity:{context:n||"signin",providers:[{configURL:r,clientId:t}]}},o=await(null===(i=navigator.credentials)||void 0===i?void 0:i.get(e));return!!o&&!!o.token}catch(e){return!1}}});var mi=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await ai(),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 vi=()=>window.location.search.includes("code")&&window.location.search.includes("state");let yi;const wi=(e,t)=>new Promise(((n,i)=>{if(!e.length)return i(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const o=e.shift(),s=document.createElement("script");s.src=o,s.id=(e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t).toString(16)})(o),s.onload=()=>{const e=t();if(e)return n(e);throw new Error("Could not get entry after loading script from URL")},s.addEventListener("error",(()=>{wi(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),bi=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{yi||(yi=(async()=>{try{return Promise.resolve().then((function(){return yo}))}catch(e){return wi([Mn,Un],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await yi;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=t,s=(null==n?void 0:n.redirectUri)||window.location.href,a=(null==n?void 0:n.scope)||"openid email roles descope.custom_claims offline_access",d=`${o}_user`;let l=e.httpClient.buildUrl(t);(null==n?void 0:n.applicationId)&&(l=`${l}/${n.applicationId}`);const c={authority:l,client_id:t,redirect_uri:s,response_type:"code",scope:a,stateStore:new r({store:window.localStorage,prefix:o}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),(null==n?void 0:n.scope)&&(c.scope=n.scope),{client:new i(c),stateUserKey:d}})(e,t,n)),{client:i,stateUserKey:r}},r=async(t="")=>{var n;const{client:r,stateUserKey:o}=await i(),s=await r.processSigninResponse(t||window.location.href);var a;return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(s)))),window.localStorage.setItem(o,JSON.stringify({id_token:(a=s).id_token,session_state:a.session_state,profile:a.profile})),(()=>{const e=new URL(window.location.href);e.searchParams.delete("code"),e.searchParams.delete("state"),window.history.replaceState({},document.title,e.toString())})(),s};return{login:async(e={},t=!1)=>{const{client:n}=await i(),r=await n.createSigninRequest(e),{url:o}=r;return t||(window.location.href=o),{ok:!0,data:r}},finishLogin:r,finishLoginIfNeed:async(e="")=>{if(vi())return await r(e)},refreshToken:async t=>{var n;const{client:r,stateUserKey:o}=await i(),s=(e=>{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null})(o);if(!s)throw new Error("User not found in storage to refresh token");let a=t;if(!a){const t={};e.httpClient.hooks.beforeRequest(t),a=t.token}const d=await r.useRefreshToken({state:{refresh_token:a,session_state:s.session_state,profile:s.profile}});return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(d)))),d},logout:async(e,t=!1)=>{const{client:n,stateUserKey:r}=await i();e||(e={}),e.id_token_hint=e.id_token_hint||Bn(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return window.localStorage.removeItem(r),t||window.location.replace(s),o}}},$i=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:r}=t,o=i(t,["fpKey","fpLoad"]);return jn?(n&&r&&Zn(n).catch((()=>null)),e(Cn(o,{beforeRequest:Yn}))):e(o)}),(e=>t=>{var{autoRefresh:n}=t,r=i(t,["autoRefresh"]);if(!n)return e(r);const{clearAllTimers:o,setTimer:s}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let a,d;jn&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&a&&new Date>a&&(Pn("Expiration time passed, refreshing session"),c.refresh(Fn()||d))}));const c=e(Cn(r,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:r}=await xn(t);if(401===(null==t?void 0:t.status))Pn("Received 401, canceling all timers"),o();else if(n||r){if(a=((e,t)=>{if(t)return new Date(1e3*t);Pn("Could not extract expiration time from session token, trying to decode the token");try{const t=l(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,r),!a)return void Pn("Could not extract expiration time from session token");d=i;const e=(e=>{let t=((n=e)?n.getTime()-(new Date).getTime():0)-2e4;var n;return t>Tn&&(Pn(`Timeout is too large (${t}ms), setting it to ${Tn}ms`),t=Tn),t})(a);if(o(),e<=2e4)return void Pn("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Pn(`Setting refresh timer for ${t}. (${e}ms)`),s((()=>{Pn("Refreshing session due to timer"),c.refresh(Fn()||i)}),e)}}}));return Xe(c,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return Pn("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.27.1"},t.baseHeaders)}))),(e=>t=>{const n=ii(),i=ii(),r=ii(),o=e(Cn(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))i.pub(null),r.pub(null),n.pub(null);else{const e=await In(t);e&&r.pub(e);const{sessionJwt:o,sessionExpiration:s}=await xn(t);o&&i.pub(o),(s||o)&&n.pub(s||42)}}})),s=Xe(o,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const o=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o}));return Object.assign(s,{onSessionTokenChange:i.sub,onUserChange:r.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:r=!1}=t,o=i(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:ei,getLastUserDisplayName:ti});const s=e(Cn(o,{afterRequest:async(e,t)=>{var n;const i=await In(t),r=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],o=null==i?void 0:i.name;r&&((e=>{En(Xn,e)})(r),(e=>{En(Qn,e)})(o))}}));let a=Xe(s,["flow.start"],ni);return a=Xe(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(Nn(Xn),Nn(Qn)),i})(r)),Object.assign(a,{getLastUserLoginId:ei,getLastUserDisplayName:ti})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:r,storagePrefix:o}=t,s=i(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!jn)return e(s);const a=e(Cn(s,{beforeRequest:(d=o,e=>Object.assign(e,{token:e.token||Fn(d)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Kn(o):((e={},t=!1,n="")=>{var i;const{sessionJwt:r,refreshJwt:o}=e;if(o&&En(`${n}${Ln}`,o),r)if(t){const n=t.sameSite||"Strict",o=null===(i=t.secure)||void 0===i||i;!function(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(i);cn.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}(Wn,r,Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:o}))}else En(`${n}${Wn}`,r);e.idToken&&En(`${n}${Dn}`,e.idToken)})(await xn(t),r,o)}}));var d;const l=Xe(a,["logout","logoutAll","oidc.logout"],(e=>t=>async(...n)=>{const i=await t(...n);return Kn(e),i})(o));return Object.assign(l,{getRefreshToken:()=>Fn(o),getSessionToken:()=>qn(o),getIdToken:()=>Bn(o)})}))((e=>{const t=dn(e),n=bi(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async i=>{if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}const r=qn(),o=Fn();return t.refresh(i,{dcs:r?"t":"f",dcr:o?"t":"f"})},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:e.toString()}})}return t.logout(i)},flow:mi(t),webauthn:gi(t),fedcm:fi(t,e.projectId),oidc:n})})),_i=t.createContext(void 0),Si=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)},ki=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},Ci={"x-descope-sdk-name":"react","x-descope-sdk-version":"0.0.0-alpha.0"},xi="undefined"!=typeof window;let Ii;const Ri=e=>{const t=$i(Object.assign({persistTokens:xi,autoRefresh:xi},e));return Ii=t,t},Ei=()=>Ri({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});Ii=Ei();const Oi=()=>xi?null==Ii?void 0:Ii.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),Ni=()=>xi?null==Ii?void 0:Ii.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),Pi=ki(((e=Oi(),t)=>null==Ii?void 0:Ii.getJwtPermissions(e,t))),Ai=ki(((e=Oi(),t)=>null==Ii?void 0:Ii.getJwtRoles(e,t))),ji=ki(((e=Oi())=>null==Ii?void 0:Ii.getCurrentTenant(e)));function Ti(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Mi=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Ui=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Wi=e=>{let t,n;return(...i)=>(t&&Ui(t,i)||(t=i,n=e(...i)),n)},Li=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Di=e=>(t,...n)=>t.reduce(((t,i,r)=>{var o;return`${t}${i}${(null===(o=null==n?void 0:n[r])||void 0===o?void 0:o[e>1?1:0])||""}`}),""),Fi=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},qi=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 Bi,Ki,Hi,Vi;function zi(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 r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!zi(o,s))return!1}else if(o!==s)return!1}return!0}let Gi=class{constructor(e={},{forceUpdate:t=!1}={}){Bi.set(this,void 0),Ki.set(this,{}),Hi.set(this,0),Vi.set(this,!0),this.update=e=>{const t="function"==typeof e?e(o(this,Bi,"f")):e,n=Object.assign(Object.assign({},o(this,Bi,"f")),t);if(o(this,Vi,"f")||!zi(o(this,Bi,"f"),n)){const e=o(this,Bi,"f");s(this,Bi,n,"f"),Object.freeze(o(this,Bi,"f")),setTimeout((()=>{Object.values(o(this,Ki,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},s(this,Bi,e,"f"),s(this,Vi,t,"f")}get current(){return Object.assign({},o(this,Bi,"f"))}subscribe(e){return s(this,Hi,o(this,Hi,"f")+1,"f"),o(this,Ki,"f")[o(this,Hi,"f")]=e,o(this,Hi,"f").toString()}unsubscribe(e){const t=!!o(this,Ki,"f")[e];return t&&delete o(this,Ki,"f")[e],t}unsubscribeAll(){return s(this,Ki,{},"f"),!0}};Bi=new WeakMap,Ki=new WeakMap,Hi=new WeakMap,Vi=new WeakMap;const Ji=e=>"string"==typeof e||null==e?e:JSON.stringify(e),Zi=e=>t.forwardRef(((n,i)=>{const{prop:r,attr:o,rest:s}=t.useMemo((()=>Object.entries(n).reduce(((e,[t,n])=>{const{trimmedKey:i,category:r}=(e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}})(t);return"prop"===r?e.prop.push([i,n]):"attr"===r?e.attr.push([Li(i),Ji(n)]):Object.assign(e.rest,{[Li(i)]:n}),e}),{attr:[],prop:[],rest:{}})),[n]),a=t.useRef(null),d=t.useCallback((e=>{a.current=e,e&&(r.forEach((([e,t])=>{a.current[e]=t})),o.forEach((([t,n])=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)})))}),[r,o,a]);return t.useImperativeHandle(i,(()=>a.current)),t.createElement(e,Object.assign({ref:d},s))})),Yi=t.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await Promise.resolve().then((function(){return ld})).then((e=>e.default))).sdkConfigOverrides={baseHeaders:Ci,persistTokens:!1,hooks:{get beforeRequest(){return Ii.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-wc",Object.assign({ref:n},e)))))}))),Xi=t.forwardRef((({flowId:e,onSuccess:n,onError:i,onReady:r,logger:o,tenant:s,theme:a,nonce:d,locale:l,debug:c,client:u,form:h,telemetryKey:g,redirectUrl:p,autoFocus:f,validateOnBlur:m,restartOnError:v,errorTransformer:y,styleId:w,onScreenUpdate:b,dismissScreenErrorOnInput:$,children:_},S)=>{const[k,C]=t.useState(null);t.useImperativeHandle(S,(()=>k));const{projectId:x,baseUrl:I,baseStaticUrl:R,baseCdnUrl:E,storeLastAuthenticatedUser:O,keepLastAuthenticatedUserAfterLogout:N,refreshCookieName:P,sdk:A}=t.useContext(_i),j=t.useCallback((async e=>{await A.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);return t.useEffect((()=>{const e=k;return null==e||e.addEventListener("success",j),i&&(null==e||e.addEventListener("error",i)),r&&(null==e||e.addEventListener("ready",r)),()=>{i&&(null==e||e.removeEventListener("error",i)),r&&(null==e||e.removeEventListener("ready",r)),null==e||e.removeEventListener("success",j)}}),[k,i,j]),t.useEffect((()=>{const e=k;return null==e||e.addEventListener("success",j),()=>{null==e||e.removeEventListener("success",j)}}),[k,j]),t.useEffect((()=>{const e=k;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[k,i]),t.useEffect((()=>{const e=k;return r&&(null==e||e.addEventListener("ready",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[k,r]),t.createElement("form",null,t.createElement(t.Suspense,{fallback:null},t.createElement(Yi,{projectId:x,flowId:e,baseUrl:I,baseStaticUrl:R,baseCdnUrl:E,ref:C,telemetryKey:g,redirectUrl:p,autoFocus:f,styleId:w,validateOnBlur:m,restartOnError:v,keepLastAuthenticatedUserAfterLogout:N,tenant:s,"theme.attr":a,"nonce.attr":d,"locale.attr":l,"form.attr":h,"client.attr":u,"debug.attr":c,"store-last-authenticated-user.attr":O,"refreshCookieName.attr":P,"dismiss-screen-error-on-input.attr":$,"errorTransformer.prop":y,"logger.prop":o,"onScreenUpdate.prop":b},_)))}));var Qi=()=>{const e=t.useContext(_i);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const er=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,tr={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],tr);if("function"==typeof e[t])return()=>{throw Error(er("function"))};throw Error(er("attribute"))}},nr=t.lazy((async()=>(await Promise.resolve().then((function(){return Pm})),{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-user-management-widget",Object.assign({ref:n},e)))))}))),ir=t.forwardRef((({logger:e,tenant:n,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,refreshCookieName:p}=t.useContext(_i);return t.createElement(t.Suspense,{fallback:null},t.createElement(nr,{projectId:c,widgetId:o,tenant:n,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,ref:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),rr=t.lazy((async()=>(await Promise.resolve().then((function(){return Ev})),{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-role-management-widget",Object.assign({ref:n},e)))))}))),or=t.forwardRef((({logger:e,tenant:n,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,refreshCookieName:p}=t.useContext(_i);return t.createElement(t.Suspense,{fallback:null},t.createElement(rr,{projectId:c,widgetId:o,tenant:n,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,innerRef:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),sr=t.lazy((async()=>(await Promise.resolve().then((function(){return Ay})),{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-access-key-management-widget",Object.assign({ref:n},e)))))}))),ar=t.forwardRef((({logger:e,tenant:n,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,refreshCookieName:p}=t.useContext(_i);return t.createElement(t.Suspense,{fallback:null},t.createElement(sr,{projectId:c,widgetId:o,tenant:n,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,innerRef:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),dr=t.lazy((async()=>(await Promise.resolve().then((function(){return Qy})),{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-audit-management-widget",Object.assign({ref:n},e)))))}))),lr=t.forwardRef((({logger:e,tenant:n,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,refreshCookieName:p}=t.useContext(_i);return t.createElement(t.Suspense,{fallback:null},t.createElement(dr,{projectId:c,widgetId:o,tenant:n,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,innerRef:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),cr=t.lazy((async()=>(await Promise.resolve().then((function(){return qw})),{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-user-profile-widget",Object.assign({ref:n},e)))))}))),ur=t.forwardRef((({logger:e,theme:n,debug:i,widgetId:r,onLogout:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,refreshCookieName:p}=t.useContext(_i);return t.useEffect((()=>{if(d&&o)return d.addEventListener("logout",o),()=>d.removeEventListener("logout",o)}),[d,o]),t.createElement(t.Suspense,{fallback:null},t.createElement(cr,{projectId:c,widgetId:r,baseUrl:u,baseStaticUrl:h,baseCdnUrl:g,styleId:s,ref:l,"theme.attr":n,"debug.attr":i,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),hr=t.lazy((async()=>(await Promise.resolve().then((function(){return ob})),{default:Zi(t.forwardRef(((e,n)=>t.createElement("descope-applications-portal-widget",Object.assign({ref:n},e)))))}))),gr=t.forwardRef((({logger:e,theme:n,debug:i,widgetId:r,styleId:o},s)=>{const[a,d]=t.useState(null);t.useImperativeHandle(s,(()=>a));const{projectId:l,baseUrl:c,baseStaticUrl:u,baseCdnUrl:h,refreshCookieName:g}=t.useContext(_i);return t.createElement(t.Suspense,{fallback:null},t.createElement(hr,{projectId:l,widgetId:r,baseUrl:c,baseStaticUrl:u,baseCdnUrl:h,innerRef:d,"theme.attr":n,"debug.attr":i,"styleId.attr":o,"refreshCookieName.attr":g,"logger.prop":e}))}));var pr,fr,mr,vr={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},yr=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(yr||{});(mr=yr||(yr={})).reset=function(){pr=3,fr=vr},mr.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");pr=e},mr.setLogger=function(e){fr=e};var wr=class e{constructor(e){this._name=e}debug(...t){pr>=4&&fr.debug(e._format(this._name,this._method),...t)}info(...t){pr>=3&&fr.info(e._format(this._name,this._method),...t)}warn(...t){pr>=2&&fr.warn(e._format(this._name,this._method),...t)}error(...t){pr>=1&&fr.error(e._format(this._name,this._method),...t)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(t,n){const i=new e(`${t}.${n}`);return i.debug("begin"),i}static _format(e,t){const n=`[${e}]`;return t?`${n} ${t}:`:n}static debug(t,...n){pr>=4&&fr.debug(e._format(t),...n)}static info(t,...n){pr>=3&&fr.info(e._format(t),...n)}static warn(t,...n){pr>=2&&fr.warn(e._format(t),...n)}static error(t,...n){pr>=1&&fr.error(e._format(t),...n)}};yr.reset();var br=class{static decode(e){try{return l(e)}catch(e){throw wr.error("JwtUtils.decode",e),e}}static async generateSignedJwt(e,t,n){const i=`${Sr.encodeBase64Url((new TextEncoder).encode(JSON.stringify(e)))}.${Sr.encodeBase64Url((new TextEncoder).encode(JSON.stringify(t)))}`,r=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,(new TextEncoder).encode(i));return`${i}.${Sr.encodeBase64Url(new Uint8Array(r))}`}},$r=e=>btoa([...new Uint8Array(e)].map((e=>String.fromCharCode(e))).join("")),_r=class e{static _randomWord(){const e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]}static generateUUIDv4(){const t="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^e._randomWord()&15>>+t/4).toString(16)));return t.replace(/-/g,"")}static generateCodeVerifier(){return e.generateUUIDv4()+e.generateUUIDv4()+e.generateUUIDv4()}static async generateCodeChallenge(e){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest("SHA-256",t);return $r(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw wr.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const n=(new TextEncoder).encode([e,t].join(":"));return $r(n)}static async hash(e,t){const n=(new TextEncoder).encode(t),i=await crypto.subtle.digest(e,n);return new Uint8Array(i)}static async customCalculateJwkThumbprint(t){let n;switch(t.kty){case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":n={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}const i=await e.hash("SHA-256",JSON.stringify(n));return e.encodeBase64Url(i)}static async generateDPoPProof({url:t,accessToken:n,httpMethod:i,keyPair:r,nonce:o}){let s,a;const d={jti:window.crypto.randomUUID(),htm:null!=i?i:"GET",htu:t,iat:Math.floor(Date.now()/1e3)};n&&(s=await e.hash("SHA-256",n),a=e.encodeBase64Url(s),d.ath=a),o&&(d.nonce=o);try{const e=await crypto.subtle.exportKey("jwk",r.publicKey),t={alg:"ES256",typ:"dpop+jwt",jwk:{crv:e.crv,kty:e.kty,x:e.x,y:e.y}};return await br.generateSignedJwt(t,d,r.privateKey)}catch(e){throw e instanceof TypeError?new Error(`Error exporting dpop public key: ${e.message}`):e}}static async generateDPoPJkt(t){try{const n=await crypto.subtle.exportKey("jwk",t.publicKey);return await e.customCalculateJwkThumbprint(n)}catch(e){throw e instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${e.message}`):e}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}};_r.encodeBase64Url=e=>$r(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var Sr=_r,kr=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new wr(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}async raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)await t(...e)}},Cr=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},xr=class e extends kr{constructor(){super(...arguments),this._logger=new wr(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const t=this._expiration-e.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=e.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){const n=this._logger.create("init");t=Math.max(Math.floor(t),1);const i=e.getEpochTime()+t;if(this.expiration===i&&this._timerHandle)return void n.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),n.debug("using duration",t),this._expiration=i;const r=Math.min(t,5);this._timerHandle=setInterval(this._callback,1e3*r)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Ir=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const n=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(n.slice(1))}},Rr=";",Er=class extends Error{constructor(e,t){var n,i,r;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw wr.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(n=e.error_description)?n:null,this.error_uri=null!=(i=e.error_uri)?i:null,this.state=e.userState,this.session_state=null!=(r=e.session_state)?r:null,this.url_state=e.url_state}},Or=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},Nr=class{constructor(e){this._logger=new wr("AccessTokenEvents"),this._expiringTimer=new xr("Access token expiring"),this._expiredTimer=new xr("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}async load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const n=e.expires_in;if(t.debug("access token present, remaining duration:",n),n>0){let e=n-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const i=n+1;t.debug("registering expired timer, raising in",i,"seconds"),this._expiredTimer.init(i)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},Pr=class{constructor(e,t,n,i,r){this._callback=e,this._client_id=t,this._intervalInSeconds=i,this._stopOnError=r,this._logger=new wr("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const o=new URL(n);this._frame_origin=o.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=o.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},Ar=class{constructor(){this._logger=new wr("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},jr=class extends Error{constructor(e,t){super(t),this.name="ErrorDPoPNonce",this.nonce=e}},Tr=class{constructor(e=[],t=null,n={}){this._jwtHandler=t,this._extraHeaders=n,this._logger=new wr("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:n,...i}=t;if(!n)return await fetch(e,i);const r=new AbortController,o=setTimeout((()=>r.abort()),1e3*n);try{return await fetch(e,{...t,signal:r.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new Or("Network timed out");throw e}finally{clearTimeout(o)}}async getJson(e,{token:t,credentials:n,timeoutInSeconds:i}={}){const r=this._logger.create("getJson"),o={Accept:this._contentTypes.join(", ")};let s;t&&(r.debug("token passed, setting Authorization header"),o.Authorization="Bearer "+t),this._appendExtraHeaders(o);try{r.debug("url:",e),s=await this.fetchWithTimeout(e,{method:"GET",headers:o,timeoutInSeconds:i,credentials:n})}catch(e){throw r.error("Network Error"),e}r.debug("HTTP response received, status",s.status);const a=s.headers.get("Content-Type");if(a&&!this._contentTypes.find((e=>a.startsWith(e)))&&r.throw(new Error(`Invalid response Content-Type: ${null!=a?a:"undefined"}, from URL: ${e}`)),s.ok&&this._jwtHandler&&(null==a?void 0:a.startsWith("application/jwt")))return await this._jwtHandler(await s.text());let d;try{d=await s.json()}catch(e){if(r.error("Error parsing JSON response",e),s.ok)throw e;throw new Error(`${s.statusText} (${s.status})`)}if(!s.ok){if(r.error("Error from server:",d),d.error)throw new Er(d);throw new Error(`${s.statusText} (${s.status}): ${JSON.stringify(d)}`)}return d}async postForm(e,{body:t,basicAuth:n,timeoutInSeconds:i,initCredentials:r,extraHeaders:o}){const s=this._logger.create("postForm"),a={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...o};let d;void 0!==n&&(a.Authorization="Basic "+n),this._appendExtraHeaders(a);try{s.debug("url:",e),d=await this.fetchWithTimeout(e,{method:"POST",headers:a,body:t,timeoutInSeconds:i,credentials:r})}catch(e){throw s.error("Network error"),e}s.debug("HTTP response received, status",d.status);const l=d.headers.get("Content-Type");if(l&&!this._contentTypes.find((e=>l.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=l?l:"undefined"}, from URL: ${e}`);const c=await d.text();let u={};if(c)try{u=JSON.parse(c)}catch(e){if(s.error("Error parsing JSON response",e),d.ok)throw e;throw new Error(`${d.statusText} (${d.status})`)}if(!d.ok){if(s.error("Error from server:",u),d.headers.has("dpop-nonce")){const e=d.headers.get("dpop-nonce");throw new jr(e,`${JSON.stringify(u)}`)}if(u.error)throw new Er(u,t);throw new Error(`${d.statusText} (${d.status}): ${JSON.stringify(u)}`)}return u}_appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),i=["accept","content-type"],r=["authorization"];0!==n.length&&n.forEach((n=>{if(i.includes(n.toLocaleLowerCase()))return void t.warn("Protected header could not be set",n,i);if(r.includes(n.toLocaleLowerCase())&&Object.keys(e).includes(n))return void t.warn("Header could not be overridden",n,r);const o="function"==typeof this._extraHeaders[n]?this._extraHeaders[n]():this._extraHeaders[n];o&&""!==o&&(e[n]=o)}))}},Mr=class{constructor(e){this._settings=e,this._logger=new wr("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new Tr(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},t,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const n=this._logger.create(`_getMetadataProperty('${e}')`),i=await this.getMetadata();if(n.debug("resolved"),void 0===i[e]){if(!0===t)return void n.warn("Metadata does not contain optional property");n.throw(new Error("Metadata does not contain property "+e))}return i[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const n=await this._jsonService.getJson(t,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(e.debug("got key set",n),!Array.isArray(n.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=n.keys,this._signingKeys}},Ur=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new wr("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let n=0;n<e;n++){const e=await this._store.key(n);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},Wr=class{constructor({authority:e,metadataUrl:t,metadata:n,signingKeys:i,metadataSeed:r,client_id:o,client_secret:s,response_type:a="code",scope:d="openid",redirect_uri:l,post_logout_redirect_uri:c,client_authentication:u="client_secret_post",prompt:h,display:g,max_age:p,ui_locales:f,acr_values:m,resource:v,response_mode:y,filterProtocolClaims:w=!0,loadUserInfo:b=!1,requestTimeoutInSeconds:$,staleStateAgeInSeconds:_=900,mergeClaimsStrategy:S={array:"replace"},disablePKCE:k=!1,stateStore:C,revokeTokenAdditionalContentTypes:x,fetchRequestCredentials:I,refreshTokenAllowedScope:R,extraQueryParams:E={},extraTokenParams:O={},extraHeaders:N={},dpop:P,omitScopeWhenRequesting:A=!1}){var j;if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=n,this.metadataSeed=r,this.signingKeys=i,this.client_id=o,this.client_secret=s,this.response_type=a,this.scope=d,this.redirect_uri=l,this.post_logout_redirect_uri=c,this.client_authentication=u,this.prompt=h,this.display=g,this.max_age=p,this.ui_locales=f,this.acr_values=m,this.resource=v,this.response_mode=y,this.filterProtocolClaims=null==w||w,this.loadUserInfo=!!b,this.staleStateAgeInSeconds=_,this.mergeClaimsStrategy=S,this.omitScopeWhenRequesting=A,this.disablePKCE=!!k,this.revokeTokenAdditionalContentTypes=x,this.fetchRequestCredentials=I||"same-origin",this.requestTimeoutInSeconds=$,C)this.stateStore=C;else{const e="undefined"!=typeof window?window.localStorage:new Ar;this.stateStore=new Ur({store:e})}if(this.refreshTokenAllowedScope=R,this.extraQueryParams=E,this.extraTokenParams=O,this.extraHeaders=N,this.dpop=P,this.dpop&&!(null==(j=this.dpop)?void 0:j.store))throw new Error("A DPoPStore is required when dpop is enabled")}},Lr=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new wr("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const n=br.decode(e);return t.debug("JWT decoding successful"),n}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new Tr(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const n=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",n);const i=await this._jsonService.getJson(n,{token:e,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("got claims",i),i}},Dr=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new wr("TokenClient"),this._jsonService=new Tr(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:n=this._settings.client_id,client_secret:i=this._settings.client_secret,extraHeaders:r,...o}){const s=this._logger.create("exchangeCode");n||s.throw(new Error("A client_id is required")),t||s.throw(new Error("A redirect_uri is required")),o.code||s.throw(new Error("A code is required"));const a=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(o))null!=t&&a.set(e,t);let d;switch(this._settings.client_authentication){case"client_secret_basic":if(null==i)throw s.throw(new Error("A client_secret is required")),null;d=Sr.generateBasicAuth(n,i);break;case"client_secret_post":a.append("client_id",n),i&&a.append("client_secret",i)}const l=await this._metadataService.getTokenEndpoint(!1);s.debug("got token endpoint");const c=await this._jsonService.postForm(l,{body:a,basicAuth:d,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return s.debug("got response"),c}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,scope:i=this._settings.scope,...r}){const o=this._logger.create("exchangeCredentials");t||o.throw(new Error("A client_id is required"));const s=new URLSearchParams({grant_type:e});this._settings.omitScopeWhenRequesting||s.set("scope",i);for(const[e,t]of Object.entries(r))null!=t&&s.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(null==n)throw o.throw(new Error("A client_secret is required")),null;a=Sr.generateBasicAuth(t,n);break;case"client_secret_post":s.append("client_id",t),n&&s.append("client_secret",n)}const d=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const l=await this._jsonService.postForm(d,{body:s,basicAuth:a,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return o.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,timeoutInSeconds:i,extraHeaders:r,...o}){const s=this._logger.create("exchangeRefreshToken");t||s.throw(new Error("A client_id is required")),o.refresh_token||s.throw(new Error("A refresh_token is required"));const a=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(o))Array.isArray(t)?t.forEach((t=>a.append(e,t))):null!=t&&a.set(e,t);let d;switch(this._settings.client_authentication){case"client_secret_basic":if(null==n)throw s.throw(new Error("A client_secret is required")),null;d=Sr.generateBasicAuth(t,n);break;case"client_secret_post":a.append("client_id",t),n&&a.append("client_secret",n)}const l=await this._metadataService.getTokenEndpoint(!1);s.debug("got token endpoint");const c=await this._jsonService.postForm(l,{body:a,basicAuth:d,timeoutInSeconds:i,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return s.debug("got response"),c}async revoke(e){var t;const n=this._logger.create("revoke");e.token||n.throw(new Error("A token is required"));const i=await this._metadataService.getRevocationEndpoint(!1);n.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const r=new URLSearchParams;for(const[t,n]of Object.entries(e))null!=n&&r.set(t,n);r.set("client_id",this._settings.client_id),this._settings.client_secret&&r.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(i,{body:r,timeoutInSeconds:this._settings.requestTimeoutInSeconds}),n.debug("got response")}},Fr=class{constructor(e,t,n){this._settings=e,this._metadataService=t,this._claimsService=n,this._logger=new wr("ResponseValidator"),this._userInfoService=new Lr(this._settings,this._metadataService),this._tokenClient=new Dr(this._settings,this._metadataService)}async validateSigninResponse(e,t,n){const i=this._logger.create("validateSigninResponse");this._processSigninState(e,t),i.debug("state processed"),await this._processCode(e,t,n),i.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),i.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),i.debug("claims processed")}async validateCredentialsResponse(e,t){const n=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),n.debug("claims processed")}async validateRefreshResponse(e,t){const n=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),n.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const i=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,i),n.debug("claims processed")}validateSignoutResponse(e,t){const n=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&n.throw(new Error("State does not match")),n.debug("state validated"),e.userState=t.data,e.error)throw n.warn("Response was error",e.error),new Er(e)}_processSigninState(e,t){const n=this._logger.create("_processSigninState");if(t.id!==e.state&&n.throw(new Error("State does not match")),t.client_id||n.throw(new Error("No client_id on state")),t.authority||n.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&n.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&n.throw(new Error("client_id mismatch on settings vs. signin state")),n.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,null!=e.scope||(e.scope=t.scope),e.error)throw n.warn("Response was error",e.error),new Er(e);t.code_verifier&&!e.code&&n.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,n=!0){const i=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void i.debug("not loading user info");i.debug("loading user info");const r=await this._userInfoService.getClaims(e.access_token);i.debug("user info claims received from user info endpoint"),n&&r.sub!==e.profile.sub&&i.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(r)),i.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t,n){const i=this._logger.create("_processCode");if(e.code){i.debug("Validating code");const r=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,extraHeaders:n,...t.extraTokenParams});Object.assign(e,r)}else i.debug("No code to process")}_validateIdTokenAttributes(e,t){var n;const i=this._logger.create("_validateIdTokenAttributes");i.debug("decoding ID Token JWT");const r=br.decode(null!=(n=e.id_token)?n:"");if(r.sub||i.throw(new Error("ID Token is missing a subject claim")),t){const e=br.decode(t);r.sub!==e.sub&&i.throw(new Error("sub in id_token does not match current sub")),r.auth_time&&r.auth_time!==e.auth_time&&i.throw(new Error("auth_time in id_token does not match original auth_time")),r.azp&&r.azp!==e.azp&&i.throw(new Error("azp in id_token does not match original azp")),!r.azp&&e.azp&&i.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=r}},qr=class e{constructor(e){this.id=e.id||Sr.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=xr.getEpochTime(),this.request_type=e.request_type,this.url_state=e.url_state}toStorageString(){return new wr("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return wr.createStatic("State","fromStorageString"),Promise.resolve(new e(JSON.parse(t)))}static async clearStaleState(t,n){const i=wr.createStatic("State","clearStaleState"),r=xr.getEpochTime()-n,o=await t.getAllKeys();i.debug("got keys",o);for(let n=0;n<o.length;n++){const s=o[n],a=await t.get(s);let d=!1;if(a)try{const t=await e.fromStorageString(a);i.debug("got item from key:",s,t.created),t.created<=r&&(d=!0)}catch(e){i.error("Error parsing state for key:",s,e),d=!0}else i.debug("no item in storage for key:",s),d=!0;d&&(i.debug("removed item for key:",s),t.remove(s))}}},Br=class e extends qr{constructor(e){super(e),this.code_verifier=e.code_verifier,this.code_challenge=e.code_challenge,this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}static async create(t){const n=!0===t.code_verifier?Sr.generateCodeVerifier():t.code_verifier||void 0,i=n?await Sr.generateCodeChallenge(n):void 0;return new e({...t,code_verifier:n,code_challenge:i})}toStorageString(){return new wr("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(t){wr.createStatic("SigninState","fromStorageString");const n=JSON.parse(t);return e.create(n)}},Kr=class e{constructor(e){this.url=e.url,this.state=e.state}static async create({url:t,authority:n,client_id:i,redirect_uri:r,response_type:o,scope:s,state_data:a,response_mode:d,request_type:l,client_secret:c,nonce:u,url_state:h,resource:g,skipUserInfo:p,extraQueryParams:f,extraTokenParams:m,disablePKCE:v,dpopJkt:y,omitScopeWhenRequesting:w,...b}){if(!t)throw this._logger.error("create: No url passed"),new Error("url");if(!i)throw this._logger.error("create: No client_id passed"),new Error("client_id");if(!r)throw this._logger.error("create: No redirect_uri passed"),new Error("redirect_uri");if(!o)throw this._logger.error("create: No response_type passed"),new Error("response_type");if(!s)throw this._logger.error("create: No scope passed"),new Error("scope");if(!n)throw this._logger.error("create: No authority passed"),new Error("authority");const $=await Br.create({data:a,request_type:l,url_state:h,code_verifier:!v,client_id:i,authority:n,redirect_uri:r,response_mode:d,client_secret:c,scope:s,extraTokenParams:m,skipUserInfo:p}),_=new URL(t);_.searchParams.append("client_id",i),_.searchParams.append("redirect_uri",r),_.searchParams.append("response_type",o),w||_.searchParams.append("scope",s),u&&_.searchParams.append("nonce",u),y&&_.searchParams.append("dpop_jkt",y);let S=$.id;if(h&&(S=`${S}${Rr}${h}`),_.searchParams.append("state",S),$.code_challenge&&(_.searchParams.append("code_challenge",$.code_challenge),_.searchParams.append("code_challenge_method","S256")),g){(Array.isArray(g)?g:[g]).forEach((e=>_.searchParams.append("resource",e)))}for(const[e,t]of Object.entries({response_mode:d,...b,...f}))null!=t&&_.searchParams.append(e,t.toString());return new e({url:_.href,state:$})}};Kr._logger=new wr("SigninRequest");var Hr=Kr,Vr=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){const e=decodeURIComponent(this.state).split(Rr);this.state=e[0],e.length>1&&(this.url_state=e.slice(1).join(Rr))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-xr.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+xr.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},zr=class{constructor({url:e,state_data:t,id_token_hint:n,post_logout_redirect_uri:i,extraQueryParams:r,request_type:o,client_id:s,url_state:a}){if(this._logger=new wr("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const d=new URL(e);if(n&&d.searchParams.append("id_token_hint",n),s&&d.searchParams.append("client_id",s),i&&(d.searchParams.append("post_logout_redirect_uri",i),t||a)){this.state=new qr({data:t,request_type:o,url_state:a});let e=this.state.id;a&&(e=`${e}${Rr}${a}`),d.searchParams.append("state",e)}for(const[e,t]of Object.entries({...r}))null!=t&&d.searchParams.append(e,t.toString());this.url=d.href}},Gr=class{constructor(e){if(this.state=e.get("state"),this.state){const e=decodeURIComponent(this.state).split(Rr);this.state=e[0],e.length>1&&(this.url_state=e.slice(1).join(Rr))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},Jr=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],Zr=["sub","iss","aud","exp","iat"],Yr=class{constructor(e){this._settings=e,this._logger=new wr("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:Jr;for(const n of e)Zr.includes(n)||delete t[n]}return t}mergeClaims(e,t){const n={...e};for(const[e,i]of Object.entries(t))if(n[e]!==i)if(Array.isArray(n[e])||Array.isArray(i))if("replace"==this._settings.mergeClaimsStrategy.array)n[e]=i;else{const t=Array.isArray(n[e])?n[e]:[n[e]];for(const e of Array.isArray(i)?i:[i])t.includes(e)||t.push(e);n[e]=t}else"object"==typeof n[e]&&"object"==typeof i?n[e]=this.mergeClaims(n[e],i):n[e]=i;return n}},Xr=class{constructor(e,t){this.keys=e,this.nonce=t}},Qr=class{constructor(e,t){this._logger=new wr("OidcClient"),this.settings=e instanceof Wr?e:new Wr(e),this.metadataService=null!=t?t:new Mr(this.settings),this._claimsService=new Yr(this.settings),this._validator=new Fr(this.settings,this.metadataService,this._claimsService),this._tokenClient=new Dr(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:i,id_token_hint:r,login_hint:o,skipUserInfo:s,nonce:a,url_state:d,response_type:l=this.settings.response_type,scope:c=this.settings.scope,redirect_uri:u=this.settings.redirect_uri,prompt:h=this.settings.prompt,display:g=this.settings.display,max_age:p=this.settings.max_age,ui_locales:f=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:v=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:w=this.settings.extraQueryParams,extraTokenParams:b=this.settings.extraTokenParams,dpopJkt:$,omitScopeWhenRequesting:_=this.settings.omitScopeWhenRequesting}){const S=this._logger.create("createSigninRequest");if("code"!==l)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const k=await this.metadataService.getAuthorizationEndpoint();S.debug("Received authorization endpoint",k);const C=await Hr.create({url:k,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:u,response_type:l,scope:c,state_data:e,url_state:d,prompt:h,display:g,max_age:p,ui_locales:f,id_token_hint:r,login_hint:o,acr_values:m,dpopJkt:$,resource:v,request:t,request_uri:n,extraQueryParams:w,extraTokenParams:b,request_type:i,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:s,nonce:a,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:_});await this.clearStaleState();const x=C.state;return await this.settings.stateStore.set(x.id,x.toStorageString()),C}async readSigninResponseState(e,t=!1){const n=this._logger.create("readSigninResponseState"),i=new Vr(Ir.readParams(e,this.settings.response_mode));if(!i.state)throw n.throw(new Error("No state in response")),null;const r=await this.settings.stateStore[t?"remove":"get"](i.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await Br.fromStorageString(r),response:i}}async processSigninResponse(e,t,n=!0){const i=this._logger.create("processSigninResponse"),{state:r,response:o}=await this.readSigninResponseState(e,n);if(i.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){const e=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:e}}try{await this._validator.validateSigninResponse(o,r,t)}catch(e){if(!(e instanceof jr&&this.settings.dpop))throw e;{const n=await this.getDpopProof(this.settings.dpop.store,e.nonce);t.DPoP=n,await this._validator.validateSigninResponse(o,r,t)}}return o}async getDpopProof(e,t){let n,i;return(await e.getAllKeys()).includes(this.settings.client_id)?(i=await e.get(this.settings.client_id),i.nonce!==t&&t&&(i.nonce=t,await e.set(this.settings.client_id,i))):(n=await Sr.generateDPoPKeys(),i=new Xr(n,t),await e.set(this.settings.client_id,i)),await Sr.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:i.keys,nonce:i.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:i={}}){const r=await this._tokenClient.exchangeCredentials({username:e,password:t,...i}),o=new Vr(new URLSearchParams);return Object.assign(o,r),await this._validator.validateCredentialsResponse(o,n),o}async useRefreshToken({state:e,redirect_uri:t,resource:n,timeoutInSeconds:i,extraHeaders:r,extraTokenParams:o}){var s;const a=this._logger.create("useRefreshToken");let d,l;if(void 0===this.settings.refreshTokenAllowedScope)d=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");d=((null==(s=e.scope)?void 0:s.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){const e=await this.getDpopProof(this.settings.dpop.store);r={...r,DPoP:e}}try{l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:d,redirect_uri:t,resource:n,timeoutInSeconds:i,extraHeaders:r,...o})}catch(s){if(!(s instanceof jr&&this.settings.dpop))throw s;r.DPoP=await this.getDpopProof(this.settings.dpop.store,s.nonce),l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:d,redirect_uri:t,resource:n,timeoutInSeconds:i,extraHeaders:r,...o})}const c=new Vr(new URLSearchParams);return Object.assign(c,l),a.debug("validating response",c),await this._validator.validateRefreshResponse(c,{...e,scope:d}),c}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:i,url_state:r,post_logout_redirect_uri:o=this.settings.post_logout_redirect_uri,extraQueryParams:s=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),d=await this.metadataService.getEndSessionEndpoint();if(!d)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",d),n||!o||t||(n=this.settings.client_id);const l=new zr({url:d,id_token_hint:t,client_id:n,post_logout_redirect_uri:o,state_data:e,extraQueryParams:s,request_type:i,url_state:r});await this.clearStaleState();const c=l.state;return c&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(c.id,c.toStorageString())),l}async readSignoutResponseState(e,t=!1){const n=this._logger.create("readSignoutResponseState"),i=new Gr(Ir.readParams(e,this.settings.response_mode));if(!i.state){if(n.debug("No state in response"),i.error)throw n.warn("Response was error:",i.error),new Er(i);return{state:void 0,response:i}}const r=await this.settings.stateStore[t?"remove":"get"](i.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await qr.fromStorageString(r),response:i}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:n,response:i}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(i,n)):t.debug("No state from storage; skipping response validation"),i}clearStaleState(){return this._logger.create("clearStaleState"),qr.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},eo=class{constructor(e){this._userManager=e,this._logger=new wr("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const n=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,n.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,n.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){n.debug("initializing check session iframe");const i=this._userManager.settings.client_id,r=this._userManager.settings.checkSessionIntervalInSeconds,o=this._userManager.settings.stopCheckSessionOnError,s=new Pr(this._callback,i,e,r,o);await s.load(),this._checkSessionIFrame=s,s.start(t)}else n.warn("no check session iframe found in the metadata")}catch(e){n.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub?{sub:e.sub}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let n=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(n=!1,this._checkSessionIFrame.start(t.session_state),e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),await this._userManager.events._raiseUserSessionChanged()):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),n?this._sub?await this._userManager.events._raiseUserSignedOut():await this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),await this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub?{sub:e.sub}:null};this._start(t)}}}},to=class e{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState,this.url_state=e.url_state}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-xr.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+xr.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new wr("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return wr.createStatic("User","fromStorageString"),new e(JSON.parse(t))}},no="oidc-client",io=class{constructor(){this._abort=new kr("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:n,keepOpen:i}=await new Promise(((n,i)=>{const r=r=>{var o;const s=r.data,a=null!=(o=e.scriptOrigin)?o:window.location.origin;if(r.origin===a&&(null==s?void 0:s.source)===no){try{const n=Ir.readParams(s.url,e.response_mode).get("state");if(n||t.warn("no state found in response url"),r.source!==this._window&&n!==e.state)return}catch{this._dispose(),i(new Error("Invalid response from window"))}n(s)}};window.addEventListener("message",r,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",r,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),i(e)})))}));return t.debug("got response from window"),this._dispose(),i||this.close(),{url:n}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,n=!1,i=window.location.origin){e.postMessage({source:no,url:t,keepOpen:n},i)}},ro={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},oo="_blank",so=60,ao=2,lo=class extends Wr{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:n=e.post_logout_redirect_uri,popupWindowFeatures:i=ro,popupWindowTarget:r=oo,redirectMethod:o="assign",redirectTarget:s="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:d=e.iframeScriptOrigin,requestTimeoutInSeconds:l,silent_redirect_uri:c=e.redirect_uri,silentRequestTimeoutInSeconds:u,automaticSilentRenew:h=!0,validateSubOnSilentRenew:g=!0,includeIdTokenInSilentRenew:p=!1,monitorSession:f=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:v=ao,query_status_response_type:y="code",stopCheckSessionOnError:w=!0,revokeTokenTypes:b=["access_token","refresh_token"],revokeTokensOnSignout:$=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:S=so,userStore:k}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=n,this.popupWindowFeatures=i,this.popupWindowTarget=r,this.redirectMethod=o,this.redirectTarget=s,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=d,this.silent_redirect_uri=c,this.silentRequestTimeoutInSeconds=u||l||10,this.automaticSilentRenew=h,this.validateSubOnSilentRenew=g,this.includeIdTokenInSilentRenew=p,this.monitorSession=f,this.monitorAnonymousSession=m,this.checkSessionIntervalInSeconds=v,this.stopCheckSessionOnError=w,this.query_status_response_type=y,this.revokeTokenTypes=b,this.revokeTokensOnSignout=$,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=S,k)this.userStore=k;else{const e="undefined"!=typeof window?window.sessionStorage:new Ar;this.userStore=new Ur({store:e})}}},co=class e extends io{constructor({silentRequestTimeoutInSeconds:t=10}){super(),this._logger=new wr("IFrameWindow"),this._timeoutInSeconds=t,this._frame=e.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>{this._abort.raise(new Or("IFrame timed out without a response"))}),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const n=e.target;null==(t=n.parentNode)||t.removeChild(n),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},uo=class{constructor(e){this._settings=e,this._logger=new wr("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new co({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),co.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},ho=class extends io{constructor({popupWindowTarget:e=oo,popupWindowFeatures:t={},popupSignal:n}){super(),this._logger=new wr("PopupWindow");const i=Cr.center({...ro,...t});this._window=window.open(void 0,e,Cr.serialize(i)),n&&n.addEventListener("abort",(()=>{var e;this._abort.raise(new Error(null!=(e=n.reason)?e:"Popup aborted"))})),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout((()=>{this._window&&"boolean"==typeof this._window.closed&&!this._window.closed?this.close():this._abort.raise(new Error("Popup blocked by user"))}),1e3*t.closePopupWindowAfterInSeconds)}async navigate(e){var t;null==(t=this._window)||t.focus();const n=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(n))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},go=class{constructor(e){this._settings=e,this._logger=new wr("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget,popupSignal:n}){return new ho({popupWindowFeatures:e,popupWindowTarget:t,popupSignal:n})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),ho.notifyOpener(e,t)}},po=class{constructor(e){this._settings=e,this._logger=new wr("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var n;this._logger.create("prepare");let i=window.self;"top"===t&&(i=null!=(n=window.top)?n:window.self);const r=i.location[e].bind(i.location);let o;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{o=t}));return r(e.url),await t},close:()=>{this._logger.create("close"),null==o||o(new Error("Redirect aborted")),i.stop()}}}async callback(){}},fo=class extends Nr{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new wr("UserManagerEvents"),this._userLoaded=new kr("User loaded"),this._userUnloaded=new kr("User unloaded"),this._silentRenewError=new kr("Silent renew error"),this._userSignedIn=new kr("User signed in"),this._userSignedOut=new kr("User signed out"),this._userSessionChanged=new kr("User session changed")}async load(e,t=!0){await super.load(e),t&&await this._userLoaded.raise(e)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}async _raiseSilentRenewError(e){await this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},mo=class{constructor(e){this._userManager=e,this._logger=new wr("SilentRenewService"),this._isStarted=!1,this._retryTimer=new xr("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof Or)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),await this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},vo=class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}},yo=Object.freeze({__proto__:null,AccessTokenEvents:Nr,CheckSessionIFrame:Pr,DPoPState:Xr,ErrorResponse:Er,ErrorTimeout:Or,InMemoryWebStorage:Ar,IndexedDbDPoPStore:class{constructor(){this._dbName="oidc",this._storeName="dpop"}async set(e,t){const n=await this.createStore(this._dbName,this._storeName);await n("readwrite",(n=>(n.put(t,e),this.promisifyRequest(n.transaction))))}async get(e){const t=await this.createStore(this._dbName,this._storeName);return await t("readonly",(t=>this.promisifyRequest(t.get(e))))}async remove(e){const t=await this.get(e),n=await this.createStore(this._dbName,this._storeName);return await n("readwrite",(t=>this.promisifyRequest(t.delete(e)))),t}async getAllKeys(){const e=await this.createStore(this._dbName,this._storeName);return await e("readonly",(e=>this.promisifyRequest(e.getAllKeys())))}promisifyRequest(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}async createStore(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const i=await this.promisifyRequest(n);return async(e,n)=>{const r=i.transaction(t,e).objectStore(t);return await n(r)}}},get Log(){return yr},Logger:wr,MetadataService:Mr,OidcClient:Qr,OidcClientSettingsStore:Wr,SessionMonitor:eo,SigninResponse:Vr,SigninState:Br,SignoutResponse:Gr,State:qr,User:to,UserManager:class{constructor(e,t,n,i){this._logger=new wr("UserManager"),this.settings=new lo(e),this._client=new Qr(e),this._redirectNavigator=null!=t?t:new po(this.settings),this._popupNavigator=null!=n?n:new go(this.settings),this._iframeNavigator=null!=i?i:new uo(this.settings),this._events=new fo(this.settings),this._silentRenewService=new mo(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new eo(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(e=!1){const t=this._logger.create("getUser"),n=await this._loadUser();return n?(t.info("user loaded"),await this._events.load(n,e),n):(t.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),await this._events.unload()}async signinRedirect(e={}){var t;this._logger.create("signinRedirect");const{redirectMethod:n,...i}=e;let r;(null==(t=this.settings.dpop)?void 0:t.bind_authorization_code)&&(r=await this.generateDPoPJkt(this.settings.dpop));const o=await this._redirectNavigator.prepare({redirectMethod:n});await this._signinStart({request_type:"si:r",dpopJkt:r,...i},o)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),n=await this._signinEnd(e);return n.profile&&n.profile.sub?t.info("success, signed in subject",n.profile.sub):t.info("no subject"),n}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:n=!1}){const i=this._logger.create("signinResourceOwnerCredential"),r=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n,extraTokenParams:this.settings.extraTokenParams});i.debug("got signin response");const o=await this._buildUser(r);return o.profile&&o.profile.sub?i.info("success, signed in subject",o.profile.sub):i.info("no subject"),o}async signinPopup(e={}){var t;const n=this._logger.create("signinPopup");let i;(null==(t=this.settings.dpop)?void 0:t.bind_authorization_code)&&(i=await this.generateDPoPJkt(this.settings.dpop));const{popupWindowFeatures:r,popupWindowTarget:o,popupSignal:s,...a}=e,d=this.settings.popup_redirect_uri;d||n.throw(new Error("No popup_redirect_uri configured"));const l=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:o,popupSignal:s}),c=await this._signin({request_type:"si:p",redirect_uri:d,display:"popup",dpopJkt:i,...a},l);return c&&(c.profile&&c.profile.sub?n.info("success, signed in subject",c.profile.sub):n.info("no subject")),c}async signinPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async signinSilent(e={}){var t,n;const i=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:r,...o}=e;let s,a=await this._loadUser();if(null==a?void 0:a.refresh_token){i.debug("using refresh token");const e=new vo(a);return await this._useRefreshToken({state:e,redirect_uri:o.redirect_uri,resource:o.resource,extraTokenParams:o.extraTokenParams,timeoutInSeconds:r})}(null==(t=this.settings.dpop)?void 0:t.bind_authorization_code)&&(s=await this.generateDPoPJkt(this.settings.dpop));const d=this.settings.silent_redirect_uri;let l;d||i.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(i.debug("subject prior to silent renew:",a.profile.sub),l=a.profile.sub);const c=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r});return a=await this._signin({request_type:"si:s",redirect_uri:d,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,dpopJkt:s,...o},c,l),a&&((null==(n=a.profile)?void 0:n.sub)?i.info("success, signed in subject",a.profile.sub):i.info("no subject")),a}async _useRefreshToken(e){const t=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...e}),n=new to({...e.state,...t});return await this.storeUser(n),await this._events.load(n),n}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":await this.signinPopupCallback(e);break;case"si:s":await this.signinSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:n}=await this._client.readSignoutResponseState(e);if(n)switch(n.request_type){case"so:r":return await this.signoutRedirectCallback(e);case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:n,...i}=e,r=this.settings.silent_redirect_uri;r||t.throw(new Error("No silent_redirect_uri configured"));const o=await this._loadUser(),s=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n}),a=await this._signinStart({request_type:"si:s",redirect_uri:r,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...i},s);try{const e={},n=await this._client.processSigninResponse(a.url,e);return t.debug("got signin response"),n.session_state&&n.profile.sub?(t.info("success for subject",n.profile.sub),{session_state:n.session_state,sub:n.profile.sub}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof Er)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,n){const i=await this._signinStart(e,t);return await this._signinEnd(i.url,n)}async _signinStart(e,t){const n=this._logger.create("_signinStart");try{const i=await this._client.createSigninRequest(e);return n.debug("got signin request"),await t.navigate({url:i.url,state:i.state.id,response_mode:i.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const n=this._logger.create("_signinEnd"),i=await this._client.processSigninResponse(e,{});n.debug("got signin response");return await this._buildUser(i,t)}async _buildUser(e,t){const n=this._logger.create("_buildUser"),i=new to(e);if(t){if(t!==i.profile.sub)throw n.debug("current user does not match user returned from signin. sub from signin:",i.profile.sub),new Er({...e,error:"login_required"});n.debug("current user matches user returned from signin")}return await this.storeUser(i),n.debug("user stored"),await this._events.load(i),i}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:n,...i}=e,r=await this._redirectNavigator.prepare({redirectMethod:n});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...i},r),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),n=await this._signoutEnd(e);return t.info("success"),n}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:n,popupWindowTarget:i,popupSignal:r,...o}=e,s=this.settings.popup_post_logout_redirect_uri,a=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:i,popupSignal:r});await this._signout({request_type:"so:p",post_logout_redirect_uri:s,state:null==s?void 0:{},...o},a),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async _signout(e,t){const n=await this._signoutStart(e,t);return await this._signoutEnd(n.url)}async _signoutStart(e={},t){var n;const i=this._logger.create("_signoutStart");try{const r=await this._loadUser();i.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(r);const o=e.id_token_hint||r&&r.id_token;o&&(i.debug("setting id_token_hint in signout request"),e.id_token_hint=o),await this.removeUser(),i.debug("user removed, creating signout request");const s=await this._client.createSignoutRequest(e);return i.debug("got signout request"),await t.navigate({url:s.url,state:null==(n=s.state)?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw i.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),n=await this._client.processSignoutResponse(e);return t.debug("got signout response"),n}async signoutSilent(e={}){var t;const n=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:i,...r}=e,o=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,s=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});await this._signout({request_type:"so:s",post_logout_redirect_uri:s,id_token_hint:o,...r},a),n.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const n=this._logger.create("_revokeInternal");if(!e)return;const i=t.filter((t=>"string"==typeof e[t]));if(i.length){for(const t of i)await this._client.revokeToken(e[t],t),n.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),n.debug("user stored"),await this._events.load(e)}else n.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),to.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const n=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,n)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey),this.settings.dpop&&await this.settings.dpop.store.remove(this.settings.client_id)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(e,t,n,i){var r,o;const s=await(null==(o=null==(r=this.settings.dpop)?void 0:r.store)?void 0:o.get(this.settings.client_id));if(s)return await Sr.generateDPoPProof({url:e,accessToken:null==t?void 0:t.access_token,httpMethod:n,keyPair:s.keys,nonce:i})}async generateDPoPJkt(e){let t=await e.store.get(this.settings.client_id);if(!t){const n=await Sr.generateDPoPKeys();t=new Xr(n),await e.store.set(this.settings.client_id,t)}return await Sr.generateDPoPJkt(t.keys)}},UserManagerSettingsStore:lo,Version:"3.2.0",WebStorageStateStore:Ur});const wo="undefined"!=typeof localStorage,bo="J151000",$o=wo&&localStorage.getItem("base.content.url")||"",_o="base.ui.components.url";wo&&localStorage.getItem(_o),wo&&localStorage.getItem(_o);const So="descope-login-flow",ko="code",Co="data-exclude-field",xo="data-exclude-next",Io="dls_last_auth",Ro="state_id",Eo="saml_idp_state_id",Oo="saml_idp_username",No="descope_idp_initiated",Po="sso_app_id",Ao="third_party_app_id",jo="third_party_app_state_id",To="oidc_login_hint",Mo="oidc_prompt",Uo="oidc_error_redirect_uri",Wo="application_scopes",Lo="data-type",Do="redirect",Fo="poll",qo="webauthnCreate",Bo="webauthnGet",Ko="nativeBridge",Ho="loadForm",Vo="submit",zo="polling",Go=["descope-multi-select-combo-box","descope-text-area"],Jo=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var Zo;!function(e){e.backward="backward",e.forward="forward"}(Zo||(Zo={}));const Yo=["descope-enriched-text"];function Xo(e){return new URLSearchParams(window.location.search).get(e)}function Qo(e){if(window.history.replaceState&&Xo(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 es(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?Zo.forward:n<i?Zo.backward:void 0}const ts=e=>{let[t="",n=""]=(Xo(So)||"").split("_");const i=(e=>{var t;return(null===(t=/(.*)\|#\|.*/.exec(e))||void 0===t?void 0:t[1])||""})(t);return(!e||i&&i!==e)&&(t="",n=""),{executionId:t,stepId:n,executionFlowId:i}};function ns(){Qo(So)}const is=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),rs=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=ts(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&ns();const o=Xo("t")||void 0;o&&Qo("t");const s=Xo(ko)||void 0;s&&Qo(ko);const a=Xo("err")||void 0;a&&Qo("err");const{redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u}={redirectAuthCodeChallenge:Xo("ra-challenge"),redirectAuthCallbackUrl:Xo("ra-callback"),redirectAuthBackupCallbackUri:Xo("ra-backup-callback"),redirectAuthInitiator:Xo("ra-initiator")},h=Xo(Ro);h&&Qo(Ro);const g=Xo(Eo);g&&Qo(Eo);const p=Xo(Oo);g&&Qo(Oo);const f=Xo(No);f&&Qo(No);const m=Xo(Po);m&&Qo(Po);const v=Xo(Ao);v&&Qo(Ao);const y=Xo(jo);y&&Qo(jo);const w=Xo(Wo);w&&Qo(Wo);const b=Xo(To);b&&Qo(To);const $=Xo(Mo);$&&Qo(Mo);const _=Xo(Uo);return _&&Qo(Uo),{executionId:n,stepId:i,token:o,code:s,exchangeError:a,redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u,ssoQueryParams:{oidcIdpStateId:h,samlIdpStateId:g,samlIdpUsername:p,descopeIdpInitiated:"true"===f,ssoAppId:m,oidcLoginHint:b,oidcPrompt:$,oidcErrorRedirectUri:_,thirdPartyAppId:v,thirdPartyAppStateId:y,applicationScopes:w}}},os=e=>{let t,n;return Object.assign(((...i)=>{return t&&(o=i,(r=t).length===o.length&&r.every(((e,t)=>e===o[t])))||(t=i,n=e(...i)),n;var r,o}),{reset:()=>{t=void 0,n=void 0}})};function ss(e,t,n){return new Promise(((i,r)=>{let o=!1;const s=setTimeout((()=>{o=!0,void 0!==n?i(n):r(new Error(`Promise timed out after ${e} ms`))}),e);t.then((e=>{o||(clearTimeout(s),i(e))})).catch((e=>{o||(clearTimeout(s),r(e))}))}))}const as=(e,{oidcIdpStateId:t,samlIdpStateId:n,samlIdpUsername:i,ssoAppId:r,oidcLoginHint:o,oidcPrompt:s,oidcErrorRedirectUri:a,thirdPartyAppId:d,thirdPartyAppStateId:l,applicationScopes:c})=>!(!e||t||n||i||r||o||s||a||d||l||c),ds=e=>null==e?void 0:e.submit(),ls=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},cs=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function us(e){if(e)return{locale:e.toLowerCase(),fallback:e.toLowerCase()};const t=navigator.language;return t?t.includes("-")?{locale:t.toLowerCase(),fallback:t.split("-")[0].toLowerCase()}:{locale:t.toLowerCase(),fallback:t.toLowerCase()}:{locale:"",fallback:""}}var hs,gs,ps,fs;function ms(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 r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!ms(o,s))return!1}else if(o!==s)return!1}return!0}let vs=class{constructor(e={},{forceUpdate:t=!1}={}){hs.set(this,void 0),gs.set(this,{}),ps.set(this,0),fs.set(this,!0),this.update=e=>{const t="function"==typeof e?e(o(this,hs,"f")):e,n=Object.assign(Object.assign({},o(this,hs,"f")),t),i=o(this,hs,"f");s(this,hs,n,"f"),Object.freeze(o(this,hs,"f")),setTimeout((()=>{Object.values(o(this,gs,"f")).forEach((({cb:e,selector:t})=>{const r=t(i),s=t(n);!o(this,fs,"f")&&(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(s)?ms(r,s):r===s)||e(s,r,((e,t)=>n=>e[n]!==t[n])(s,r))}))}),0)},s(this,hs,e,"f"),s(this,fs,t,"f")}get current(){return Object.assign({},o(this,hs,"f"))}set forceUpdate(e){s(this,fs,e,"f")}subscribe(e,t=e=>e){return s(this,ps,o(this,ps,"f")+1,"f"),o(this,gs,"f")[o(this,ps,"f")]={cb:e,selector:t},o(this,ps,"f").toString()}unsubscribe(e){const t=!!o(this,gs,"f")[e];return t&&delete o(this,gs,"f")[e],t}unsubscribeAll(){return s(this,gs,{},"f"),!0}};hs=new WeakMap,gs=new WeakMap,ps=new WeakMap,fs=new WeakMap;const ys=["*","#","/","(",")","[","]","_","<",">","`"],ws=e=>"string"!=typeof e?e:e.replace((e=>{const t=ys.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),bs=["disabled"],$s=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Co}])`)).forEach((e=>{e.value=n}))}))},_s=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),Ss=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?ws(_s(t,i)):_s(t,i))),ks=(e,t,n)=>{e.querySelectorAll(`[${Lo}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Cs=(e,t,n)=>{var i,r;const o=null===(i=customElements.get(t))||void 0===i?void 0:i.cssVarList.url;n&&o&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(o,`url(data:image/jpg;base64,${n})`))},xs=(e,t,n,r,o)=>{var s,a;ks(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),ks(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=>{const n=(e=>Yo.includes(e))(e.localName);e.textContent=Ss(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",Ss(i,t))}))})(e,t),((e,t,n)=>{if(!t)return;const{componentsDynamicAttrs:r}=t,o=i(t,["componentsDynamicAttrs"]),s=Object.keys(o).reduce(((e,t)=>(e[`[name=${t}]`]=o[t],e)),{});r&&Object.keys(r).forEach((e=>{const t=r[e];if(t){const{attributes:n}=t;n&&Object.keys(n).length&&(s[e]=n)}})),Object.keys(s).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const i=s[t];Object.keys(i).forEach((t=>{let r=i[t];if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){n.error(`Could not stringify value "${r}" for "${t}"`,e.message),r=""}e.setAttribute(t,r)}))}))}))})(e,n,o),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Ss(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])=>{bs.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,r)},Is=os((()=>r(void 0,void 0,void 0,(function*(){var e,t;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const n=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 ss(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}})))),Rs="dls_ab_testing_id",Es={"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 Os(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Io)))}catch(e){}return t}const Ns=["error","warn","info","debug"],Ps=qi((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,o(this,t,"m",i).call(this,console))}set logger(e){s(this,n,o(this,t,"m",i).call(this,e||console),"f")}get logger(){return o(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return Ns.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},r})),As="undefined"!=typeof localStorage,js=As&&localStorage.getItem("base.content.url")||"",Ts=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Ms=qi((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)&&o(this,t,"f")&&(s(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Us=qi((e=>{var t,n;const i=Ti(Ps,Ms)(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=o(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){o(this,t,"f")[e]||(o(this,t,"f")[e]=[]);const i=o(this,t,"f")[e].push(n);return()=>o(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})),Ws=e=>t=>{var n,i,r;const s=Ti(Ps,Ms,Us)(t),a=Object.keys(e);return r=class extends s{constructor(...e){super(...e),n.add(this),this.observeAttributes(a,o(this,n,"m",i).bind(this))}async init(){var e;a.forEach((e=>o(this,n,"m",i).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,i=function(t,n){const i=e[t],r="function"==typeof i?i(t,n):i;r&&this.logger.error(r)},r};Ws.missingAttrValidator=Ts;const Ls=qi((e=>{const t=Ti(Ws({"project-id":Ts}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Ds=qi((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),Fs="Trying the next fallback URL...";function qs({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i="https://static.descope.com/pages"}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}const Bs=qi((e=>{var t,n,i,r,a;const d=Ti(Ps,Ls,Ds)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}async fetchStaticResource(e,n){const a=o(this,t,"m",r).call(this,e),d=Array.isArray(a)?e=>{if(e!==a.length-1){const{baseUrl:t}=a[e];s(this,i,t,"f")}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:i})=>{const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=r[e],s=e===r.length-1;try{const r=await fetch(o.toString(),t);if(r.ok)return null==i||i(e),r;const a=`Error fetching URL ${o} [${r.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${Fs}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${Fs}`)}}})(a,{cache:"default"},{logger:this.logger,onSuccess:d});return{body:await e[n](),headers:Object.fromEntries(e.headers.entries())}}catch(e){this.logger.error(e.message)}}get baseStaticUrl(){return this.getAttribute("base-static-url")}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(e){const t=js||this.baseStaticUrl;if(t)return qs({projectId:this.projectId,filename:e,baseUrl:t});const r=o(this,n,"f")!==this.baseUrl,a=r&&!!this.baseUrl;r&&(s(this,n,this.baseUrl,"f"),s(this,i,void 0,"f"));const d=qs({projectId:this.projectId,filename:e,baseUrl:o(this,i,"f")});if(!a)return d;return[qs({projectId:this.projectId,filename:e,baseUrl:this.baseUrl+"/pages"}),d]},a})),Ks=qi((e=>{var t,n;const i=Ti(Ws({"project-id":Ts}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(o(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return o(this,t,"f").set(e,n),()=>{o(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(o(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!o(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=o(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),Hs=qi((e=>{var t,n,i,r,a;const d=Ti(Bs,Ks,Ms)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),i.set(this,void 0),r.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")}}))}async init(){await super.init(),this.onReset("config",o(this,t,"m",n).bind(this))}get config(){return o(this,i,"f")||s(this,i,o(this,r,"f").call(this),"f"),o(this,i,"f")}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){s(this,i,void 0,"f")},a})),Vs="load-descope-ui",zs="base.ui.components.url",Gs=As&&localStorage.getItem(zs)||"https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Js=As&&localStorage.getItem(zs)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Zs=As&&localStorage.getItem(zs)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Ys=e=>{const t=document.createElement("script");return t.id=e,t},Xs=(e,t)=>e.replace("<version>",t),Qs=qi((e=>{var t,n,i,r,a,d,l,c,u,h,g,p;const f=Ti(Ps,Hs)(e);return p=class extends f{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),i.set(this,Symbol("loadCbs")),u.set(this,void 0)}get descopeUi(){return o(this,u,"f")||s(this,u,o(this,t,"m",g).call(this),"f"),o(this,u,"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=>o(this,t,"m",h).call(this,e))))}get baseCdnUrl(){return this.getAttribute("base-cdn-url")}},n=new WeakMap,i=new WeakMap,u=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},a=function(e){const t=o(this,n,"f"),r=o(this,i,"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)}})},d=async function(e,n,i,s){this.logger.debug("Trying to load DescopeUI from a fallback URL");const a=Ys(i);document.body.append(a),a.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${a.src}"`)))})),a.addEventListener("load",(()=>{n.forEach((e=>e()))})),a.src=Xs(s,await o(this,t,"m",r).call(this))},l=function(e){e.addEventListener("error",(()=>{e[o(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}"`))),o(this,t,"m",d).call(this,[o(this,t,"m",d).bind(this,e[o(this,n,"f")],e[o(this,i,"f")],"load-descope-ui-fallback-script-2",Zs),...e[o(this,n,"f")]],e[o(this,i,"f")],"load-descope-ui-fallback-script",Js)})),e.addEventListener("load",(()=>{e[o(this,i,"f")].forEach((e=>e()))}))},c=async function(){if(document.querySelector(`script#${Vs}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Ys(Vs);document.body.append(e),o(this,t,"m",a).call(this,e),o(this,t,"m",l).call(this,e),e.src=Xs(this.baseCdnUrl||Gs,await o(this,t,"m",r).call(this))}return document.getElementById(Vs)},h=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(", ")}"`)},g=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),o(this,t,"m",c).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})),ea="content-root",ta="root",na=qi((e=>class extends e{constructor(...e){var t,n,i,r;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${ta}">\n <div id="${ea}"></div>\n </div>\n `;const o=new CSSStyleSheet;o.replaceSync(`\n #${ta}, #${ea} {\n height: 100%;\n }\n #${ta} {\n position: relative;\n height: fit-content;\n }\n `),null!==(t=(r=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(r.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,o],this.contentRootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(ea),this.rootElement=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById(ta)}})),ia=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',ra=qi((e=>{var t,n,i,r,a,d,l,c,u,h,g,p,f,m;const v=Ti(Ws({theme:ia}),Bs,Ms,Qs,Hs,na,Us)(e);return m=class extends v{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),g.set(this,(()=>{o(this,t,"m",p).call(this),o(this,f,"f").call(this,"os"===this.getAttribute("theme"))})),f.set(this,(e=>{var n,i,r;const s=e?"addEventListener":"removeEventListener";null===(r=null===(i=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===i?void 0:i[s])||void 0===r||r.call(i,"change",(()=>o(this,t,"m",p).call(this)))}))}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"}get styleId(){return this.getAttribute("style-id")||"theme"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),o(this,t,"m",d).call(this),o(this,t,"m",l).call(this),o(this,g,"f").call(this),this.observeAttributes(["theme"],o(this,g,"f")),this.observeAttributes(["style-id"],(()=>{s(this,i,null,"f"),o(this,t,"m",u).call(this),o(this,t,"m",d).call(this),o(this,t,"m",l).call(this)}))}},n=new WeakMap,i=new WeakMap,g=new WeakMap,f=new WeakMap,t=new WeakSet,r=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(zs)))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(zs),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({},e.light.components),t.light.components),e.dark.components=Object.assign(Object.assign({},e.dark.components),t.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")}},a=function(){return o(this,i,"f")||(s(this,i,o(this,t,"m",r).call(this),"f"),o(this,i,"f").then((e=>this.logger.debug("Fetched theme",e)))),o(this,i,"f")},d=async function(){var e,i,r,d;const l=await o(this,t,"a",a);l&&(o(this,n,"f")||(s(this,n,new CSSStyleSheet,"f"),null!==(e=(d=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(d.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,o(this,n,"f")]),o(this,n,"f").replaceSync(((null===(i=null==l?void 0:l.light)||void 0===i?void 0:i.globals)||"")+((null===(r=null==l?void 0:l.dark)||void 0===r?void 0:r.globals)||"")))},l=async function(){var e,n;const i=Object.assign({},await o(this,t,"a",a));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})},c=async function(){var e,t;const{projectConfig:n}=await this.config||{},i=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],r=null==n?void 0:n.cssTemplate,o=i||r;return null===(t=null==o?void 0:o[this.theme])||void 0===t?void 0:t.fonts},u=async function(){const e=await o(this,t,"m",c).call(this);e?Object.values(e).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))})):this.logger.debug("No fonts to load")},h=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)},p=function(){o(this,t,"m",u).call(this),o(this,t,"m",h).call(this)},m})),oa=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if("object"==typeof e[i]&&null!==e[i]&&!(null===(r=e[i])||void 0===r?void 0:r.value))return Object.assign(Object.assign({},n),oa(e[i],`${t+i}.`));const o="object"==typeof e[i]?e[i]:{value:e[i]},s=Object.assign(Object.assign({},n),{[t+i]:o,[`form.${t}${i}`]:o});return"displayName"===i?Object.assign(Object.assign({},s),{[`${t}fullName`]:o,[`form.${t}fullName`]:o}):s}),[]),sa=qi((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;o(this,t,"m",n).call(this)&&o(this,t,"m",i).call(this),null===(e=super.connectedCallback)||void 0===e||e.call(this)}},t=new WeakSet,n=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},i=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)},r}));var aa,da,la,ca,ua,ha,ga,pa,fa,ma,va,ya,wa,ba,$a,_a,Sa,ka,Ca,xa,Ia,Ra,Ea;const Oa=Ti(ra,Bs,sa)(HTMLElement);let Na=class extends Oa{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id","nonce"]}constructor(e){super(),aa.add(this),la.set(this,!1),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),o(this,aa,"m",Ia).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)}},ca.set(this,new vs),ua.set(this,new vs),ha.set(this,{}),this.getComponentsContext=()=>o(this,ha,"f"),this.nextRequestStatus=new vs({isLoading:!1}),ga.set(this,void 0),pa.set(this,{popstate:o(this,aa,"m",wa).bind(this),componentsContext:o(this,aa,"m",ka).bind(this)}),fa.set(this,void 0),this.getConfig=()=>r(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),s(this,fa,e,"f"),o(this,aa,"m",va).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get tenantId(){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 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 refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}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 oa(JSON.parse(e))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return((e,t)=>Object.fromEntries(Object.entries(e).map((([e,n])=>[e,n[t]]))))(this.formConfig,"value")}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return r(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return r(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return r(this,void 0,void 0,(function*(){var e,t;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 r(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}getComponentsVersion(){return r(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig();return("projectConfig"in t?null===(e=t.projectConfig)||void 0===e?void 0:e.componentsVersion:{})||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;if(this.flowStatus="loading",["ready","error","success"].forEach((e=>this.addEventListener(e,(()=>{this.flowStatus=e})))),yield null===(t=e.init)||void 0===t?void 0:t.call(this),o(this,ua,"f").subscribe(o(this,aa,"m",xa).bind(this)),o(this,ua,"f").update({isDebug:this.debug}),o(this,aa,"m",ya).call(this),o(this,aa,"m",Ea).call(this),yield o(this,aa,"m",_a).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");const n=yield this.getConfig();if("isMissingConfig"in n&&n.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");o(this,aa,"m",Ra).call(this);const{executionId:i,stepId:r,token:a,code:d,exchangeError:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthCodeChallenge:h,redirectAuthInitiator:g,ssoQueryParams:p}=rs(this.flowId,this.loggerWrapper);window.addEventListener("popstate",o(this,pa,"f").popstate),window.addEventListener("components-context",o(this,pa,"f").componentsContext),o(this,ca,"f").subscribe(o(this,aa,"m",$a).bind(this)),o(this,ca,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:r,executionId:i,token:a,code:d,exchangeError:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthCodeChallenge:h,redirectAuthInitiator:g},p)),s(this,la,!0,"f")}))}disconnectedCallback(){o(this,ca,"f").unsubscribeAll(),o(this,ua,"f").unsubscribeAll(),o(this,aa,"m",Ca).call(this),window.removeEventListener("popstate",o(this,pa,"f").popstate),window.removeEventListener("components-context",o(this,pa,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&o(this,la,"f")&&t!==n&&da.observedAttributes.includes(e)){o(this,aa,"m",ya).call(this);const i=null===t;"nonce"===e&&o(this,aa,"m",Ea).call(this),o(this,ca,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,ns()),{[is(e)]:n,stepId:o,executionId:s}})),o(this,ua,"f").update({isDebug:this.debug})}}};function Pa(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var Aa,ja,Ta,Ma,Ua,Wa,La,Da,Fa,qa,Ba,Ka,Ha,Va,za,Ga,Ja,Za,Ya,Xa,Qa,ed,td,nd,id,rd,od,sd,ad;da=Na,la=new WeakMap,ca=new WeakMap,ua=new WeakMap,ha=new WeakMap,ga=new WeakMap,pa=new WeakMap,fa=new WeakMap,aa=new WeakSet,ma=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync("\n :host {\n all: initial;\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n transition: opacity 300ms ease-in-out;\n }\n\n\t\t#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 .hidden {\n display: none;\n }\n "),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n]},va=function(){o(this,aa,"m",ma).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},ya=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","nonce"];da.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[is(t)])throw Error(`${t} cannot be empty`)}))},wa=function(){const{stepId:e,executionId:t}=ts(this.flowId);o(this,ca,"f").update({stepId:e,executionId:t})},ba=function(e,t){this.sdk=$i(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},da.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>r(this,void 0,void 0,(function*(){try{return yield t(...e)}catch(e){return{error:{errorCode:bo,errorDescription:e.toString()}}}}))}))},$a=function(e,t,n){return r(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;o(this,aa,"m",ba).call(this,t,i)}o(this,fa,"f").call(this,e)}))},_a=function(){return r(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield o(this,aa,"m",Sa).call(this))}))},Sa=function(){return r(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL($o||i||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:"config.json",assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield function(e,t){return r(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](),headers:Object.fromEntries(n.headers.entries())}}))}(e,"json"),!0}catch(e){return!1}}))},ka=function(e){s(this,ha,Object.assign(Object.assign({},o(this,ha,"f")),e.detail),"f")},Ca=function(){var e;null===(e=o(this,ga,"f"))||void 0===e||e.remove(),s(this,ga,null,"f")},xa=function(e){return r(this,arguments,void 0,(function*({isDebug:e}){e?(s(this,ga,document.createElement("descope-debugger"),"f"),Object.assign(o(this,ga,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return bb})),document.body.appendChild(o(this,ga,"f"))):o(this,aa,"m",Ca).call(this)}))},Ia=function(e,t){var n;e&&this.debug&&(null===(n=o(this,ga,"f"))||void 0===n||n.updateData({title:e,description:t}))},Ra=function(){this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Go.includes(null!==(i=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==i?i:"");if("Enter"!==e.key||r||o)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()}}},Ea=function(){this.getAttribute("nonce")&&(window.DESCOPE_NONCE=this.getAttribute("nonce"))},Na.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.39.3"}};let dd=class extends Na{static set sdkConfigOverrides(e){Na.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Na.sdkConfigOverrides}constructor(){const e=new vs({deferredRedirect:!1});super(e.update.bind(e)),Aa.add(this),this.stepState=new vs({}),ja.set(this,void 0),Ta.set(this,null),Ma.set(this,null),Ua.set(this,{visibilitychange:o(this,Aa,"m",Wa).bind(this)}),this.bridgeVersion=1,this.nativeResume=(e,t)=>{var n;const i=JSON.parse(t);if(this.logger.info(`nativeResume received payload of type '${e}'`),"oauthWeb"===e||"sso"===e){let{exchangeCode:e}=i;e||(e=null===(n=new URL(i.url).searchParams)||void 0===n?void 0:n.get(ko)),this.nativeComplete({exchangeCode:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(i.url),t=e.searchParams.get("t"),n=e.searchParams.get(So).split("_").pop();o(this,Ha,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else this.nativeComplete(i)},Ba.set(this,(e=>{this.contentRootElement.classList.toggle("hidden",e),this.slotElement.classList.toggle("hidden",!e)})),Ka.set(this,((e,t,n,i,a=!1)=>{if(this.flowState.current.action===Fo){this.logger.debug("polling - Scheduling polling request");const d=Date.now(),l=a?500:2e3;s(this,ja,setTimeout((()=>r(this,void 0,void 0,(function*(){var r;this.logger.debug("polling - Calling next");const s=this.sdk.flow.next(e,t,zo,n,i,{}),c=document.hidden&&!a&&Date.now()-d>l+500;let u;c&&this.logger.debug("polling - The polling seems to be throttled");try{const e=c?1e3:6e3;u=yield ss(e,s)}catch(r){return this.logger.warn(`polling - The ${c?"throttled fetch":"fetch"} call timed out or was aborted`),void o(this,Ka,"f").call(this,e,t,n,i,c)}if((null===(r=null==u?void 0:u.error)||void 0===r?void 0:r.errorCode)===bo)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void o(this,Ka,"f").call(this,e,t,n,i);this.logger.debug("polling - Got a response"),(null==u?void 0:u.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(u.error,null,4)),o(this,Ka,"f").call(this,e,t,n,i),o(this,Va,"f").call(this,u)}))),l),"f")}})),Ha.set(this,(()=>{clearTimeout(o(this,ja,"f")),s(this,ja,null,"f")})),Va.set(this,(e=>{var t,n,i,r,a,d,l,c,u,h,g,p,f;if(!(null==e?void 0:e.ok)){const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,l=`${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}`;o(this,Aa,"m",ad).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:l,errorMessage:s}),this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(a=null==e?void 0:e.error)||void 0===a?void 0:a.errorMessage)||l);const c=null===(d=null==e?void 0:e.error)||void 0===d?void 0:d.errorCode;return void("E102004"!==c&&"E103205"!==c||!this.isRestartOnError||o(this,Aa,"m",Fa).call(this))}null===(c=null===(l=e.data)||void 0===l?void 0:l.runnerLogs)||void 0===c||c.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 m=null===(g=null===(h=null===(u=e.data)||void 0===u?void 0:u.screen)||void 0===h?void 0:h.state)||void 0===g?void 0:g.errorText;(null===(p=e.data)||void 0===p?void 0:p.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${m?`${m} - `:""}${e.data.error.message}`):m&&this.loggerWrapper.error(m);const{status:v,authInfo:y,lastAuth:w,action:b}=e.data;if(b!==Fo&&o(this,Ha,"f").call(this),"completed"===v)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&wo&&localStorage.setItem(Io,JSON.stringify(e))}(w),void o(this,Aa,"m",ad).call(this,"success",y);const{executionId:$,stepId:_,stepName:S,screen:k,redirect:C,openInNewTabUrl:x,webauthn:I,error:R,samlIdpResponse:E,nativeResponse:O}=e.data,N=Date.now();b!==Fo?(this.loggerWrapper.info(`Step "${S||`#${_}`}" is ${v}`,"",{screen:k,status:v,stepId:_,stepName:S,action:b,error:R}),(null===(f=k.state)||void 0===f?void 0:f.clientScripts)&&s(this,Ma,this.loadSdkScripts(k.state.clientScripts),"f"),this.flowState.update({stepId:_,stepName:S,executionId:$,action:b,redirectTo:null==C?void 0:C.url,openInNewTabUrl:x,screenId:null==k?void 0:k.id,screenState:null==k?void 0:k.state,webauthnTransactionId:null==I?void 0:I.transactionId,webauthnOptions:null==I?void 0:I.options,samlIdpResponseUrl:null==E?void 0:E.url,samlIdpResponseSamlResponse:null==E?void 0:E.samlResponse,samlIdpResponseRelayState:null==E?void 0:E.relayState,nativeResponseType:null==O?void 0:O.type,nativePayload:null==O?void 0:O.payload,reqTimestamp:N})):this.flowState.update({action:b,reqTimestamp:N})})),za.set(this,os((()=>r(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)}}))))),id.set(this,cs(((e,t)=>r(this,void 0,void 0,(function*(){var n;if("true"===e.getAttribute("formnovalidate")||o(this,Aa,"m",Ya).call(this)){const i=null==e?void 0:e.getAttribute("id");o(this,Aa,"m",Qa).call(this,e);const r=yield o(this,Aa,"m",Xa).call(this),s=(e=>Array.from((null==e?void 0:e.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}),{}))(e);if(this.nextRequestStatus.update({isLoading:!0}),o(this,Ma,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield o(this,Ma,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const a=this.getComponentsContext(),d=Object.assign(Object.assign(Object.assign(Object.assign({},a),s),r),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin});yield t(i,d),this.nextRequestStatus.update({isLoading:!1}),o(this,Aa,"m",ed).call(this,r)}}))))),this.flowState=e}loadSdkScripts(e){if(!(null==e?void 0:e.length))return null;const t=(e,t)=>n=>{this.dispatchEvent(new CustomEvent("components-context",{detail:{[Pa(e.id,e.resultKey)]:n},bubbles:!0,composed:!0})),t(e.id)};this.loggerWrapper.debug(`Preparing to load scripts: ${e.map((e=>e.id)).join(", ")}`);const n=Promise.all(null==e?void 0:e.map((e=>r(this,void 0,void 0,(function*(){var n;const i=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(i){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=i;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}const o=yield function(e){return r(this,void 0,void 0,(function*(){let t;switch(e){case"forter":return t=yield Promise.resolve().then((function(){return $b})),t.default;case"fingerprint":return t=yield Promise.resolve().then((function(){return Sb})),t.default;case"fingerprintDescope":return t=yield Promise.resolve().then((function(){return Cb})),t.default;case"grecaptcha":return t=yield Promise.resolve().then((function(){return Ib})),t.default;default:throw new Error(`Unknown script id: ${e}`)}}))}(e.id);return new Promise(((n,i)=>{try{const i=o(e.initArgs,{baseUrl:this.baseUrl},t(e,n));if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t),this.nextRequestStatus.subscribe((()=>{var t;this.loggerWrapper.debug("Unloading script",e.id),null===(t=i.stop)||void 0===t||t.call(i)}))}}catch(e){i(e)}}))}))))),i=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([n,i])}get isDismissScreenErrorOnInput(){return"true"===this.getAttribute("dismiss-screen-error-on-input")}init(){if(!window.isDescopeBridge)return this._init();this.lazyInit=this._init}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t,n;this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),o(this,Aa,"m",Da).call(this),window.addEventListener("visibilitychange",o(this,Ua,"f").visibilitychange)),yield null===(n=e.init)||void 0===n?void 0:n.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=o(this,Ta,"f"))||void 0===e||e.abort(),s(this,Ta,null,"f"),window.removeEventListener("visibilitychange",o(this,Ua,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return r(this,void 0,void 0,(function*(){let n;const i=us(e),r=yield this.getTargetLocales();return r.includes(i.locale)?n=`${t}-${i.locale}.html`:r.includes(i.fallback)&&(n=`${t}-${i.fallback}.html`),n}))}getPageContent(e,t){return r(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield this.fetchStaticResource(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 this.fetchStaticResource(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){return r(this,void 0,void 0,(function*(){var a,d;const{projectId:l,flowId:c,tenant:u,stepId:h,executionId:g,action:p,screenId:f,screenState:m,redirectTo:v,openInNewTabUrl:y,redirectUrl:w,token:b,code:$,exchangeError:_,webauthnTransactionId:S,webauthnOptions:k,redirectAuthCodeChallenge:C,redirectAuthCallbackUrl:x,redirectAuthBackupCallbackUri:I,redirectAuthInitiator:R,locale:E,samlIdpResponseUrl:O,samlIdpResponseSamlResponse:N,samlIdpResponseRelayState:P,nativeResponseType:A,nativePayload:j,reqTimestamp:T}=e,M=i(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","openInNewTabUrl","redirectUrl","token","code","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","nativeResponseType","nativePayload","reqTimestamp"]);let U,W,L;const D=(()=>{const e=localStorage.getItem(Rs);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Rs,e.toString()),e}return Number(e)})(),F=this.sdk.getLastUserLoginId(),q=yield this.getFlowConfig(),B=yield this.getProjectConfig(),K=Object.entries(B.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),H=x&&C?{callbackUrl:x,codeChallenge:C,backupCallbackUri:I}:void 0,V=this.nativeOptions?{platform:this.nativeOptions.platform,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect}:void 0;let z={};if(!g){const e=[...q.clientScripts||[],...q.sdkScripts||[]];if(q.conditions){let t=[];({startScreenId:U,conditionInteractionId:L,startScreenName:W,clientScripts:t,componentsConfig:z}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:i})=>{var r;if("ELSE"===t)return!0;const o=null===(r=Es[t])||void 0===r?void 0:r[n];return!!(null==o?void 0:o(e,i))}));return n?{startScreenId:n.met.screenId,startScreenName:n.met.screenName,conditionInteractionId:n.met.interactionId,clientScripts:n.met.clientScripts,componentsConfig:n.met.componentsConfig}:{}})({loginId:F,code:$,token:b,abTestingKey:D},q.conditions)),e.push(...t||[])}else q.condition?({startScreenId:U,conditionInteractionId:L}=((e,t)=>{var n;const i=null===(n=Es[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!i)return{};const r=i(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,startScreenName:null==r?void 0:r.screenName,conditionInteractionId:null==r?void 0:r.interactionId}})(q.condition,{loginId:F,code:$,token:b,abTestingKey:D})):(W=q.startScreenName,U=q.startScreenId);if(s(this,Ma,this.loadSdkScripts(e),"f"),q.fingerprintEnabled&&q.fingerprintKey?yield Zn(q.fingerprintKey,this.baseUrl):localStorage.removeItem(Gn),!as(U,M)){const e=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:H},M),{client:this.client}),w&&{redirectUrl:w}),{lastAuth:Os(F),abTestingKey:D,locale:us(E).locale,nativeOptions:V}),L,"",B.componentsVersion,K,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),$?{exchangeCode:$,idpInitiated:!0}:{}),M.descopeIdpInitiated&&{idpInitiated:!0}),b?{token:b}:{}),M.oidcLoginHint?{externalId:M.oidcLoginHint}:{}));return o(this,Va,"f").call(this,e),void("completed"!==(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.status)&&this.flowState.update({code:void 0,token:void 0}))}}if(g&&(n("token")&&b||n("code")&&$||n("exchangeError")&&_)){const e=yield this.sdk.flow.next(g,h,Vo,q.version,B.componentsVersion,{token:b,exchangeCode:$,exchangeError:_});return o(this,Va,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Ho&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!O||!N)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,i)=>{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),i(r)})(O,N,P||"",ds)}if(p===Do&&(n("redirectTo")||n("deferredRedirect")))return v?"android"===R&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(v):void this.loggerWrapper.error("Did not get redirect url");if(p===qo||p===Bo){if(!S||!k)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(d=o(this,Ta,"f"))||void 0===d||d.abort(),s(this,Ta,null,"f");try{e=p===qo?yield this.sdk.webauthn.helpers.create(k):yield this.sdk.webauthn.helpers.get(k)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name}const n=yield this.sdk.flow.next(g,h,Vo,q.version,B.componentsVersion,{transactionId:S,response:e,failure:t});o(this,Va,"f").call(this,n)}if(p===Ko)return this.nativeComplete=e=>r(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(g,h,Vo,q.version,B.componentsVersion,e);o(this,Va,"f").call(this,t)})),void o(this,Aa,"m",ad).call(this,"bridge",{type:A,payload:j});if(n("action")&&o(this,Ka,"f").call(this,g,h,q.version,B.componentsVersion),!f&&!U)return void this.loggerWrapper.warn("No screen was found to show");const G=U||f,J=yield this.getHtmlFilenameWithLocale(E,G),{oidcLoginHint:Z,oidcPrompt:Y,oidcErrorRedirectUri:X,samlIdpUsername:Q}=M,ee={direction:es(h,t.stepId),screenState:Object.assign(Object.assign({},m),{form:Object.assign(Object.assign({},this.formConfigValues),null==m?void 0:m.form),lastAuth:{loginId:F,name:this.sdk.getLastUserDisplayName()||F},componentsConfig:Object.assign(Object.assign(Object.assign({},q.componentsConfig),z),null==m?void 0:m.componentsConfig)}),htmlFilename:`${G}.html`,htmlLocaleFilename:J,screenId:G,stepName:e.stepName||W,samlIdpUsername:Q,oidcLoginHint:Z,oidcPrompt:Y,oidcErrorRedirectUri:X,openInNewTabUrl:y},te=Os(F);as(U,M)?ee.next=(e,t)=>r(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:H},M),{lastAuth:te,preview:this.preview,abTestingKey:D,client:this.client}),w&&{redirectUrl:w}),{locale:us(E).locale,nativeOptions:V}),L,e,B.componentsVersion,K,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),t),$&&{exchangeCode:$,idpInitiated:!0}),M.descopeIdpInitiated&&{idpInitiated:!0}),b&&{token:b}));return o(this,Va,"f").call(this,n),n})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(ee.next=(e,t)=>r(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.next(g,h,e,q.version,B.componentsVersion,t);return o(this,Va,"f").call(this,n),n}))),this.loggerWrapper.debug("Got a screen with id",ee.screenId),yield o(this,Aa,"m",qa).call(this,ee),this.stepState.update(ee)}))}onStepChange(e,t){return r(this,void 0,void 0,(function*(){var n,i;const{htmlFilename:s,htmlLocaleFilename:a,direction:d,next:l,screenState:c,openInNewTabUrl:u}=e;this.loggerWrapper.debug("Rendering a flow screen");const h=document.createElement("template");h.innerHTML=yield this.getPageContent(s,a);const g=h.content.cloneNode(!0),p=this.loadDescopeUiComponents(h);this.sdk.webauthn.helpers.isSupported()?yield o(this,Aa,"m",Ja).call(this,g,l):(e=>{e.querySelectorAll(`descope-button[${Lo}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(g),!e.samlIdpUsername||(null===(n=c.form)||void 0===n?void 0:n.loginId)||(null===(i=c.form)||void 0===i?void 0:i.email)||(c.form||(c.form={}),c.form.loginId=e.samlIdpUsername,c.form.email=e.samlIdpUsername),xs(g,c,c.componentsConfig,this.formConfig,this.loggerWrapper);const{geo:f}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(g,f);const m=()=>r(this,void 0,void 0,(function*(){var n,i;yield p;const r=this.contentRootElement;((e,t)=>{Cs(e,"descope-totp-image",t)})(r,null===(n=null==c?void 0:c.totp)||void 0===n?void 0:n.image),((e,t)=>{Cs(e,"descope-notp-image",t)})(r,null===(i=null==c?void 0:c.notp)||void 0===i?void 0:i.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{t.querySelector(r)||i.debug(`Skipping css vars for component "${r}}"`,`Got css vars for component ${r} but Could not find it on next page`);const o=customElements.get(r);o?Object.keys(n[r]).forEach((t=>{var s;const a=n[r],d=null===(s=null==o?void 0:o.cssVarList)||void 0===s?void 0:s[t];if(!d)return void i.info(`Could not find css variable name for ${t} in ${r}`,"Check if the css variable is defined in the component");const l=a[t];e.style.setProperty(d,l)})):i.info(`Could not find component class for ${r}`,"Check if the component is registered")}))})(r,g,c.cssVars,this.loggerWrapper),r.replaceChildren(g);const s=!t.htmlFilename;setTimeout((()=>{o(this,Aa,"m",td).call(this),this.validateOnBlur&&(e=>{e.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}))}))}))})(r),((e,t)=>{$s(e,null==t?void 0:t.inputs),$s(e,null==t?void 0:t.form)})(r,c),o(this,Aa,"m",Za).call(this,{isFirstScreen:s,stepName:e.stepName}),((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(r,this.autoFocus,s)})),o(this,Aa,"m",od).call(this,l),r.querySelector(`[${Lo}="polling"]`)&&l(zo,{}),u&&!t.openInNewTabUrl&&window.open(u,"_blank")}));d?o(this,Aa,"m",sd).call(this,m,d):m()}))}};ja=new WeakMap,Ta=new WeakMap,Ma=new WeakMap,Ua=new WeakMap,Ba=new WeakMap,Ka=new WeakMap,Ha=new WeakMap,Va=new WeakMap,za=new WeakMap,id=new WeakMap,Aa=new WeakSet,Wa=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1})}),300)},La=function({errorText:e,errorType:t}){const n=()=>{var n;let i=e;try{i=(null===(n=this.errorTransformer)||void 0===n?void 0:n.call(this,{text:e,type:t}))||e}catch(e){this.loggerWrapper.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Lo}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(this.contentRootElement,"error-message",i)};this.addEventListener("screen-updated",n,{once:!0}),n()},Da=function(){var e,t;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var t=e.screenState,n=i(void 0===t?{}:t,["errorText","errorType"]),r=i(e,["screenState"]);return Object.assign(Object.assign({},r),{screenState:n})})),null===(t=this.stepState)||void 0===t||t.subscribe(o(this,Aa,"m",La).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}))},Fa=function(){return r(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Trying to restart the flow");const e=yield this.getComponentsVersion();this.reset(),e===(yield this.getComponentsVersion())?(this.loggerWrapper.debug("Components version was not changed, restarting flow"),this.flowState.update({stepId:null,executionId:null})):this.loggerWrapper.error("Components version mismatch, please reload the page")}))},qa=function(e){return r(this,void 0,void 0,(function*(){var t;const n=Object.assign(Object.assign({},this.stepState.current),e),{next:r,stepName:s}=n,a=i(n,["next","stepName"]),d=Boolean(yield null===(t=this.onScreenUpdate)||void 0===t?void 0:t.call(this,s,(e=>{const t=(n=e.screenState,i=(e,t)=>Jo.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([e,t])=>!i(0,e)))));var n,i;const{screenState:{errorText:r,errorType:o}}=e;return(r||o)&&(t.error={text:r,type:o}),t})(a),r,this));if(d){this.loggerWrapper.debug("Rendering a custom screen"),this.contentRootElement.innerHTML="",o(this,Aa,"m",Za).call(this,{isFirstScreen:!this.stepState.current.htmlFilename,stepName:e.stepName}),this.stepState.unsubscribeAll();const t=this.stepState.subscribe((()=>{this.stepState.unsubscribe(t),o(this,Aa,"m",Da).call(this)}))}this.stepState.forceUpdate=d,o(this,Ba,"f").call(this,d)}))},Ga=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)}))}},Ja=function(e,t){return r(this,void 0,void 0,(function*(){var n;null===(n=o(this,Ta,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield Is())){const{options:e,transactionId:n}=(yield o(this,za,"f").call(this))||{};e&&n&&(o(this,Aa,"m",Ga).call(this,i),s(this,Ta,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,o(this,Ta,"f")).then((e=>r(this,void 0,void 0,(function*(){t(i.id,{transactionId:n,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},Za=function({isFirstScreen:e,stepName:t}){e&&o(this,Aa,"m",ad).call(this,"ready",{}),o(this,Aa,"m",ad).call(this,"page-updated",{screenName:t}),o(this,Aa,"m",ad).call(this,"screen-updated",{screenName:t})},Ya=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},Xa=function(){return r(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Co}])`));return(yield Promise.all(e.map((e=>r(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})),{})}))},Qa=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},ed=function(e={}){var t,n;const i=ls(e,["externalId","email","phone"]),r=ls(e,["newPassword","password"]);if(i&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:i,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)}},td=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>o(this,Aa,"m",nd).call(this,e)))},nd=function(e){e&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),i=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",i),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",i),this.appendChild(t)}))},rd=function(e){this.contentRootElement.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))&&o(this,id,"f").call(this,t,e)}))}))},od=function(e){this.contentRootElement.querySelectorAll(`descope-button:not([${xo}]), [data-type="button"]:not([${xo}]`).forEach((t=>{t.onclick=()=>{o(this,id,"f").call(this,t,e)}})),o(this,Aa,"m",rd).call(this,e),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Co}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},sd=function(e,t){this.contentRootElement.addEventListener("transitionend",(()=>{this.contentRootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===Zo.forward?"slide-forward":"slide-backward";Array.from(this.contentRootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.contentRootElement.classList.add("fade-out")},ad=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",dd);var ld=Object.freeze({__proto__:null,default:dd});const cd=qi((e=>{var t,n,i,r,a,d,l;return l=class extends(Ti(Ms,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,i),"debug"===e&&o(this,t,"m",a).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&&o(this,t,"m",d).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),o(this,t,"m",a).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=o(this,n,"f"))||void 0===e||e.remove(),s(this,n,null,"f")},r=async function(){s(this,n,document.createElement("descope-debugger"),"f"),Object.assign(o(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Fb})),document.body.appendChild(o(this,n,"f"))},a=function(){this.debug?o(this,t,"m",r).call(this):o(this,t,"m",i).call(this)},d=function(e,t){var i;e&&(null===(i=o(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},l})),ud="descope-modal";var hd,gd;let pd=class{constructor(e,t){hd.set(this,void 0),this.nodeName="",s(this,hd,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>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)})))(o(this,hd,"f"))}get ele(){var e,t;const n="function"==typeof o(this,hd,"f")?o(this,hd,"f").call(this):o(this,hd,"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(`Driver element is not available for ${this.nodeName}`,new Error),null)}};hd=new WeakMap;const fd=/^descope-grid-([^-]+)-column$/,md={text:class extends pd{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 pd{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)}}}};let vd=class extends pd{constructor(){super(...arguments),this.nodeName="descope-grid",gd.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=fd.exec(t.localName))||void 0===n?void 0:n[1],r=md[i];return r?(e.push(new r(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);Ui(i,this.ele.columns)||(this.ele.columns=i,null===(n=o(this,gd,"f"))||void 0===n||n.call(this,i))}onColumnsChange(e){s(this,gd,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};gd=new WeakMap;class yd extends pd{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 wd;class bd extends pd{constructor(){super(...arguments),wd.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=""),o(this,wd,"f")&&(null===(e=this.ele)||void 0===e||e.append(o(this,wd,"f").content.cloneNode(!0)))}setContent(e){s(this,wd,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}wd=new WeakMap;let $d=class extends pd{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()))}},_d=class extends pd{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()))}},Sd=class extends pd{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()}},kd=class extends pd{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)}},Cd=class extends pd{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")}},xd=class extends pd{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)}}},Id=class extends pd{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)}}},Rd=class extends pd{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")}},Ed=class extends pd{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)}set theme(e){var t,n;e?null===(n=this.ele)||void 0===n||n.setAttribute("theme",e):null===(t=this.ele)||void 0===t||t.removeAttribute("theme")}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)}}},Od=class extends pd{constructor(){super(...arguments),this.nodeName="descope-apps-list"}set data(e){this.ele&&(this.ele.data=e)}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}get ele(){return super.ele}};const Nd=qi((e=>{var t,n;const i=Ti(Ms,na,Qs)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends bd{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(ud);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(o(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([ud]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Pd="descope-notification",Ad=qi((e=>{var t,n;const i=Ti(Ms,na,Qs)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Sd{setContent(t){const n="string"==typeof t?Mi(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Pd);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(o(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([Pd])}},t=new WeakMap,n}));function jd(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 Td=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Md=()=>Math.random().toString(36).substring(7).split("").join("."),Ud={INIT:`@@redux/INIT${Md()}`,REPLACE:`@@redux/REPLACE${Md()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Md()}`};function Wd(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 Ld(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 Dd(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Ld(e)),t}function Fd(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?jd(2):`Expected the root reducer to be a function. Instead, received: '${Dd(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?jd(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?jd(1):`Expected the enhancer to be a function. Instead, received: '${Dd(n)}'`);return n(Fd)(e,t)}let i=e,r=t,o=new Map,s=o,a=0,d=!1;function l(){s===o&&(s=new Map,o.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("production"===process.env.NODE_ENV?jd(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?jd(4):`Expected the listener to be a function. Instead, received: '${Dd(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?jd(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?jd(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),o=null}}}function h(e){if(!Wd(e))throw new Error("production"===process.env.NODE_ENV?jd(7):`Actions must be plain objects. Instead, the actual type was: '${Dd(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?jd(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?jd(17):`Action "type" property must be a string. Instead, the actual type was: '${Dd(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?jd(9):"Reducers may not dispatch actions.");try{d=!0,r=i(r,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Ud.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?jd(10):`Expected the nextReducer to be a function. Instead, received: '${Dd(e)}`);i=e,h({type:Ud.REPLACE})},[Td]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?jd(11):`Expected the observer to be an object. Instead, received: '${Dd(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Td](){return this}}}}}function qd(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Bd(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];"production"!==process.env.NODE_ENV&&void 0===e[r]&&qd(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r,o;"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:Ud.INIT}))throw new Error("production"===process.env.NODE_ENV?jd(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:Ud.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?jd(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Ud.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){o=e}return function(e={},t){if(o)throw o;if("production"!==process.env.NODE_ENV){const i=function(e,t,n,i){const r=Object.keys(t),o=n&&n.type===Ud.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(!Wd(e))return`The ${o} has unexpected type of "${Dd(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!i[e]));return s.forEach((e=>{i[e]=!0})),n&&n.type===Ud.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${o}. Expected to find one of the known reducer keys instead: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);i&&qd(i)}let s=!1;const a={};for(let r=0;r<i.length;r++){const o=i[r],d=n[o],l=e[o],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?jd(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${o}" 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[o]=c,s=s||c!==l}return s=s||i.length!==Object.keys(e).length,s?a:e}}function Kd(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Hd(e){return Wd(e)&&"type"in e&&"string"==typeof e.type}var Vd=Symbol.for("immer-nothing"),zd=Symbol.for("immer-draftable"),Gd=Symbol.for("immer-state"),Jd="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 Zd(e,...t){if("production"!==process.env.NODE_ENV){const n=Jd[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 Yd=Object.getPrototypeOf;function Xd(e){return!!e&&!!e[Gd]}function Qd(e){return!!e&&(tl(e)||Array.isArray(e)||!!e[zd]||!!e.constructor?.[zd]||sl(e)||al(e))}var el=Object.prototype.constructor.toString();function tl(e){if(!e||"object"!=typeof e)return!1;const t=Yd(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)===el}function nl(e,t){0===il(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function il(e){const t=e[Gd];return t?t.type_:Array.isArray(e)?1:sl(e)?2:al(e)?3:0}function rl(e,t){return 2===il(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ol(e,t,n){const i=il(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function sl(e){return e instanceof Map}function al(e){return e instanceof Set}function dl(e){return e.copy_||e.base_}function ll(e,t){if(sl(e))return new Map(e);if(al(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&tl(e)){if(!Yd(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Gd];let i=Reflect.ownKeys(n);for(let t=0;t<i.length;t++){const r=i[t],o=n[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(n[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[r]})}return Object.create(Yd(e),n)}function cl(e,t=!1){return hl(e)||Xd(e)||!Qd(e)||(il(e)>1&&(e.set=e.add=e.clear=e.delete=ul),Object.freeze(e),t&&nl(e,((e,t)=>cl(t,!0)))),e}function ul(){Zd(2)}function hl(e){return Object.isFrozen(e)}var gl,pl={};function fl(e){const t=pl[e];return t||Zd(0,e),t}function ml(){return gl}function vl(e,t){t&&(fl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function yl(e){wl(e),e.drafts_.forEach($l),e.drafts_=null}function wl(e){e===gl&&(gl=e.parent_)}function bl(e){return gl={drafts_:[],parent_:gl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $l(e){const t=e[Gd];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function _l(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Gd].modified_&&(yl(t),Zd(4)),Qd(e)&&(e=Sl(t,e),t.parent_||Cl(t,e)),t.patches_&&fl("Patches").generateReplacementPatches_(n[Gd].base_,e,t.patches_,t.inversePatches_)):e=Sl(t,n,[]),yl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Vd?e:void 0}function Sl(e,t,n){if(hl(t))return t;const i=t[Gd];if(!i)return nl(t,((r,o)=>kl(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return Cl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let r=t,o=!1;3===i.type_&&(r=new Set(t),t.clear(),o=!0),nl(r,((r,s)=>kl(e,i,t,r,s,n,o))),Cl(e,t,!1),n&&e.patches_&&fl("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function kl(e,t,n,i,r,o,s){if("production"!==process.env.NODE_ENV&&r===n&&Zd(5),Xd(r)){const s=Sl(e,r,o&&t&&3!==t.type_&&!rl(t.assigned_,i)?o.concat(i):void 0);if(ol(n,i,s),!Xd(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(Qd(r)&&!hl(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Sl(e,r),t&&t.scope_.parent_||Cl(e,r)}}function Cl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&cl(t,n)}var xl={get(e,t){if(t===Gd)return e;const n=dl(e);if(!rl(n,t))return function(e,t,n){const i=El(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_||!Qd(i)?i:i===Rl(e.base_,t)?(Nl(e),e.copy_[t]=Pl(i,e)):i},has:(e,t)=>t in dl(e),ownKeys:e=>Reflect.ownKeys(dl(e)),set(e,t,n){const i=El(dl(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=Rl(dl(e),t),r=i?.[Gd];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,i)&&(void 0!==n||rl(e.base_,t)))return!0;Nl(e),Ol(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!==Rl(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Nl(e),Ol(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=dl(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){Zd(11)},getPrototypeOf:e=>Yd(e.base_),setPrototypeOf(){Zd(12)}},Il={};function Rl(e,t){const n=e[Gd];return(n?dl(n):e)[t]}function El(e,t){if(!(t in e))return;let n=Yd(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Yd(n)}}function Ol(e){e.modified_||(e.modified_=!0,e.parent_&&Ol(e.parent_))}function Nl(e){e.copy_||(e.copy_=ll(e.base_,e.scope_.immer_.useStrictShallowCopy_))}nl(xl,((e,t)=>{Il[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Il.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Zd(13),Il.set.call(this,e,t,void 0)},Il.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Zd(14),xl.set.call(this,e[0],t,n,e[0])};function Pl(e,t){const n=sl(e)?fl("MapSet").proxyMap_(e,t):al(e)?fl("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:ml(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=xl;n&&(r=[i],o=Il);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:ml()).drafts_.push(n),n}function Al(e){return Xd(e)||Zd(10,e),jl(e)}function jl(e){if(!Qd(e)||hl(e))return e;const t=e[Gd];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ll(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ll(e,!0);return nl(n,((e,t)=>{ol(n,e,jl(t))})),t&&(t.finalized_=!1),n}var Tl=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,...r){return i.produce(e,(e=>t.call(this,e,...r)))}}let i;if("function"!=typeof t&&Zd(6),void 0!==n&&"function"!=typeof n&&Zd(7),Qd(e)){const r=bl(this),o=Pl(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?yl(r):wl(r)}return vl(r,n),_l(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===Vd&&(i=void 0),this.autoFreeze_&&cl(i,!0),n){const t=[],r=[];fl("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}Zd(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,i;const r=this.produce(e,t,((e,t)=>{n=e,i=t}));return[r,n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Qd(e)||Zd(8),Xd(e)&&(e=Al(e));const t=bl(this),n=Pl(e,void 0);return n[Gd].isManual_=!0,wl(t),n}finishDraft(e,t){const n=e&&e[Gd];n&&n.isManual_||Zd(9);const{scope_:i}=n;return vl(i,t),_l(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=fl("Patches").applyPatches_;return Xd(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},Ml=Tl.produce;Tl.produceWithPatches.bind(Tl),Tl.setAutoFreeze.bind(Tl),Tl.setUseStrictShallowCopy.bind(Tl),Tl.applyPatches.bind(Tl),Tl.createDraft.bind(Tl),Tl.finishDraft.bind(Tl);var Ul=(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})}}},Wl=(e,t,n)=>{const{memoize:i,memoizeOptions:r}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=i((()=>({})),...r);if(!(a.apply(null,o)===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:o,secondInputs:s,stack:e})}},Ll={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Dl=e=>Array.isArray(e)?e:[e];function Fl(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 ql(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var Bl="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},Kl=0,Hl=1;function Vl(){return{s:Kl,v:void 0,o:null,p:null}}function zl(e,t={}){let n=Vl();const{resultEqualityCheck:i}=t;let r,o=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=Vl(),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=Vl(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===Hl)d=t.v;else if(d=e.apply(null,arguments),o++,i){const e=r?.deref?.()??r;null!=e&&i(e,d)&&(d=e,0!==o&&o--);r="object"==typeof d&&null!==d||"function"==typeof d?new Bl(d):d}return a.s=Hl,a.v=d,d}return s.clearCache=()=>{n=Vl(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function Gl(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,i=(...e)=>{let t,i=0,r=0,o={},s=e.pop();"object"==typeof s&&(o=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,...o},{memoize:d,memoizeOptions:l=[],argsMemoize:c=zl,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,g=Dl(l),p=Dl(u),f=Fl(e),m=d((function(){return i++,s.apply(null,arguments)}),...g);let v=!0;const y=c((function(){r++;const e=ql(f,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:i}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:i}={...Ll,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Ul},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Wl}}})(v,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=ql(f,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:g},arguments)}v&&(v=!1)}return t}),...p);return Object.assign(y,{resultFunc:s,memoizedResultFunc:m,dependencies:f,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:d,argsMemoize:c})};return Object.assign(i,{withTypes:()=>i}),i}var Jl=Gl(zl),Zl=Object.assign(((e,t=Jl)=>{!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:()=>Zl});function Yl(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var Xl=Yl(),Ql=Yl;((...e)=>{const t=Gl(...e)})(zl);var ec="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Kd:Kd.apply(null,arguments)},tc=e=>e&&"function"==typeof e.match;function nc(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?Mc(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=>Hd(t)&&t.type===e,n}function ic(e){return"function"==typeof e&&"type"in e&&tc(e)}function rc(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 oc=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 sc(e){return Qd(e)?Ml(e,(()=>{})):e}function ac(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?Mc(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function dc(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function lc(e,t,n){const i=cc(e,t,n);return{detectMutations:()=>uc(e,t,i,n)}}function cc(e,t=[],n,i="",r=new Set){const o={value:n};if(!e(n)&&!r.has(n)){r.add(n),o.children={};for(const r in n){const s=i?i+"."+r:r;t.length&&-1!==t.indexOf(s)||(o.children[r]=cc(e,t,n[r],s))}}return o}function uc(e,t=[],n,i,r=!1,o=""){const s=n?n.value:void 0,a=s===i;if(r&&!a&&!Number.isNaN(i))return{wasMutated:!0,path:o};if(e(s)||e(i))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in i)d[e]=!0;const l=t.length>0;for(let r in d){const s=o?o+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=uc(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function hc(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Wd(e)}function gc(e,t="",n=hc,i,r=[],o){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(o?.has(e))return!1;const a=null!=i?i(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=gc(l,a,n,i,r,o),s))return s}return o&&pc(e)&&o.add(e),!1}function pc(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!pc(t))return!1;return!0}function fc(e){return"boolean"==typeof e}var mc=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new oc;if(t&&(fc(t)?o.push(Xl):o.push(Ql(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};fc(n)||(e=n),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,i,r){return JSON.stringify(e,n(t,r),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(r,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,r):i.push(r),~n.indexOf(o)&&(o=t.call(this,r,o))}else n.push(o);return null==e?o:e.call(this,r,o)}},{isImmutable:i=dc,ignoredPaths:r,warnAfter:o=32}=e;const s=lc.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=rc(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Mc(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(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Mc(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(i){let e={};fc(i)||(e=i),o.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=hc,getEntries:n,ignoredActions:i=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:o=[],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(!Hd(u))return l(u);const h=l(u),g=rc(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||g.measureTime((()=>{const e=gc(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||(g.measureTime((()=>{const i=gc(e.getState(),"",t,n,o,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)`)}})),g.warnIfExceeded()),h}}}(e))}if(r){let e={};fc(r)||(e=r),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ic}=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 o},vc=e=>t=>{setTimeout(t,e)},yc="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:vc(10),wc=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new oc(e);return n&&i.push(((e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let r=!0,o=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?yc:"callback"===e.type?e.queueNotification:vc(e.timeout),l=()=>{s=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},i,{subscribe(e){const t=i.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,o=!r,o&&(s||(s=!0,d(l))),i.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),i},bc="production"===process.env.NODE_ENV;function $c(e){const t=mc(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Wd(n))throw new Error("production"===process.env.NODE_ENV?Mc(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Bd(n)}if(!bc&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?Mc(2):"`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!bc&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Mc(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!bc&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Mc(4):"each middleware provided to configureStore must be a function");let l=Kd;r&&(l=ec({trace:!bc,..."object"==typeof r&&r}));const c=function(...e){return t=>(n,i)=>{const r=t(n,i);let o=()=>{throw new Error("production"===process.env.NODE_ENV?jd(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)=>o(e,...t)},a=e.map((e=>e(s)));return o=Kd(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=wc(c);if(!bc&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Mc(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!bc&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Mc(6):"`enhancers` callback must return an array");if(!bc&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Mc(7):"each enhancer provided to configureStore must be a function");bc||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return Fd(a,o,l(...h))}function _c(e){const t={},n=[];let i;const r={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Mc(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?Mc(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?Mc(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Mc(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?Mc(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&&i)throw new Error("production"===process.env.NODE_ENV?Mc(31):"`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function Sc(...e){return t=>e.some((e=>((e,t)=>tc(e)?e.match(t):e(t))(e,t)))}var kc=["name","message","stack","code"],Cc=class{constructor(e,t){this.payload=e,this.meta=t}_type},xc=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ic=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of kc)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Rc=(()=>{function e(e,t,n){const i=nc(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=nc(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=nc(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||Ic)(e||"Rejected"),meta:{...o||{},arg:i,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):((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 g=async function(){let g;try{let o=n?.condition?.(e,{getState:a,extra:d});if(null!==(p=o)&&"object"==typeof p&&"function"==typeof p.then&&(o=await o),!1===o||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const f=new Promise(((e,t)=>c.signal.addEventListener("abort",(()=>t({name:"AbortError",message:u||"Aborted"})))));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),g=await Promise.race([f,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:h,rejectWithValue:(e,t)=>new Cc(e,t),fulfillWithValue:(e,t)=>new xc(e,t)})).then((t=>{if(t instanceof Cc)throw t;return t instanceof xc?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){g=t instanceof Cc?o(null,l,e,t.payload,t.meta):o(t,l,e)}var p;return n&&!n.dispatchConditionRejection&&o.match(g)&&g.meta.condition||s(g),g}();return Object.assign(g,{abort:h,requestId:l,arg:e,unwrap:()=>g.then(Ec)})}}),{pending:r,rejected:o,fulfilled:i,settled:Sc(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function Ec(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Oc=Symbol.for("rtk-slice-createasyncthunk");function Nc(e,t){return`${e}/${t}`}function Pc(e,t,n,i){function r(r,...o){let s=n.call(e,r);if(void 0===s)if(i)s=e.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Mc(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...o)}return r.unwrapped=t,r}var Ac=function({creators:e}={}){const t=e?.asyncThunk?.[Oc];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Mc(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)||{},o=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?Mc(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Mc(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?Mc(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?_c(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?Mc(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,r,o]=_c(t);if(function(e){return"function"==typeof e}(e))n=()=>sc(e());else{const t=sc(e);n=()=>t}function s(e=n(),t){let s=[i[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[o]),s.reduce(((e,n)=>{if(n){if(Xd(e)){const i=n(e,t);return void 0===i?e:i}if(Qd(e))return Ml(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?Mc(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 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);i&&e.addDefaultCase(i)}))}o.forEach((i=>{const o=r[i],s={reducerName:i,type:Nc(n,i),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},i,r){let o,s;if("reducer"in i){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(i))throw new Error("production"===process.env.NODE_ENV?Mc(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=i.reducer,s=i.prepare}else o=i;r.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?nc(e,s):nc(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Mc(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:o,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,o,c);i.exposeAction(t,u),s&&i.addCase(u.fulfilled,s);a&&i.addCase(u.pending,a);d&&i.addCase(u.rejected,d);l&&i.addMatcher(u.settled,l);i.exposeCaseReducer(t,{fulfilled:s||jc,pending:a||jc,rejected:d||jc,settled:l||jc})}(s,o,a,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:i,reducer:(e,t)=>(u||(u=d()),u(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(u||(u=d()),u.getInitialState()),getSelectors(t=l){const n=ac(c,this,{insert:()=>new WeakMap});return ac(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Pc(this,r,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?Mc(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 jc(){}var Tc="listenerMiddleware";function Mc(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. `}nc(`${Tc}/add`),nc(`${Tc}/removeAll`),nc(`${Tc}/remove`);const Uc=e=>qi((t=>{const n=Ac(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ti(Ps)(t)){constructor(...e){super(...e);const t=$c({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const i=await t.dispatch(e(...n));try{Ec(i)}catch(e){this.logger.error(e.message,i.type,e.stack)}return i},o=Object.keys(i).reduce(((e,t)=>(e[t]=r(i[t]),e)),{});this.actions=o,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}})),Wc=qi((e=>class extends(Ps(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()}})),Lc=qi((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}}));var Dc={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]|2[23]"],"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","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?: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))|7090[0-4])\\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)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|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-9]\\d{9}|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])|9(?:0[25]|42))[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(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[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]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\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{2})(\\d{4})","$1 $2 $3",["2"],"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"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"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,12],[["(\\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[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|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(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"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])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($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,10,11,12],[["(\\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",["(?:19|[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|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|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|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"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))|7090[0-4])\\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]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\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,12],[["(\\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}",[6,7,8,9,10,11]],["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]],["3[2-8]\\d{9,10}",[11,12]],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}|[25-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",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"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",["[25-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",["[36]0|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[0135-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|7090)\\d{5}|(?: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))|7090[0-4])\\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",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"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|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"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","38\\d{6}|[78]\\d{9,13}|(?:20|9\\d)\\d{8}",[8,10,11,12,13,14],[["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["3"],"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|8\\d\\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","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"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]))|7092[0-3])\\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]","(?:[2489]\\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,12],[["(\\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-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"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|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],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(?:[1245]|3[12])"]],["(\\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]))\\d{4}|(?:305[3-9]|472[24]|505[2-57-9]|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[0135-79]|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[0-247]|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-9]\\d)\\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,12],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|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\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","7093\\d{5}|(?: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])|7093[5-7])\\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}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],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,["348[57]\\d{7}",[11]],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 Fc(e){return Fc="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},Fc(e)}function qc(e){var t=Vc();return function(){var n,i=Gc(e);if(t){var r=Gc(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Fc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Bc(e)}(this,n)}}function Bc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kc(e){var t="function"==typeof Map?new Map:void 0;return Kc=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 Hc(e,arguments,Gc(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),zc(i,e)},Kc(e)}function Hc(e,t,n){return Hc=Vc()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&zc(r,n.prototype),r},Hc.apply(null,arguments)}function Vc(){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 zc(e,t){return zc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},zc(e,t)}function Gc(e){return Gc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gc(e)}var Jc=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&&zc(e,t)}(i,e);var t,n=qc(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=n.call(this,e),Object.setPrototypeOf(Bc(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(Kc(Error)),Zc=2,Yc=17,Xc=3,Qc="0-90-9٠-٩۰-۹",eu="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),tu="++";function nu(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),i=t[0].split("."),r=0;r<3;r++){var o=Number(n[r]),s=Number(i[r]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!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 iu={}.constructor;function ru(e){return null!=e&&e.constructor===iu}function ou(e){return ou="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},ou(e)}function su(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function au(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var du=" ext. ",lu=/^\d+$/,cu=function(){function e(t){su(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!ru(e)||!ru(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(ru(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+mu(e)+": "+e,"."))}(t),this.metadata=t,wu.call(this,t)}return au(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&&lu.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new uu(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new uu(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}(),uu=function(){function e(t,n){su(this,e),this.globalMetadataObject=n,this.metadata=t,wu.call(this,n.metadata)}return au(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 hu(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()&&fu(this.types(),e))return new pu(fu(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?du:this.metadata[13]||du}}]),e}(),hu=function(){function e(t,n){su(this,e),this._format=t,this.metadata=n}return au(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()||gu.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),gu=/^\(?\$1\)?$/,pu=function(){function e(t,n){su(this,e),this.type=t,this.metadata=n}return au(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 fu(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 mu=function(e){return ou(e)};function vu(e,t){if((t=new cu(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function yu(e,t){return t.countries.hasOwnProperty(e)}function wu(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===nu(t,"1.2.0")?this.v2=!0:-1===nu(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var bu=function(e){return"([".concat(Qc,"]{1,").concat(e,"})")};function $u(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+bu("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+bu("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+bu("9")+i)+"|"+("[- ]+"+bu("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+bu("15")+i)+"|"+(r+"(?:,)+"+n+bu("9")+i)}var _u="["+Qc+"]{"+Zc+"}",Su="[++]{0,1}(?:["+eu+"]*["+Qc+"]){3,}["+eu+Qc+"]*",ku=new RegExp("^[++]{0,1}(?:["+eu+"]*["+Qc+"]){1,2}$","i"),Cu=Su+"(?:"+$u()+")?",xu=new RegExp("^"+_u+"$|^"+Cu+"$","i");var Iu=new RegExp("(?:"+$u()+")$","i");function Ru(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 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){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 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}var Ou={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 Nu(e){return Ou[e]}function Pu(e){for(var t,n="",i=Ru(e.split(""));!(t=i()).done;){var r=Nu(t.value);r&&(n+=r)}return n}function Au(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 ju(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 ju(e,t)}(e))||t){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 ju(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){for(var t,n="",i=Au(e.split(""));!(t=i()).done;){n+=Mu(t.value,n)||""}return n}function Mu(e,t,n){if("+"===e){if(t)return;return"+"}return Nu(e)}function Uu(e,t){return function(e,t,n){var i=n.type(t),r=i&&i.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";var o=e.length,s=r[0];if(s===o)return"IS_POSSIBLE";if(s>o)return"TOO_SHORT";if(r[r.length-1]<o)return"TOO_LONG";return r.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Wu(e,t){return"IS_POSSIBLE"===Uu(e,t)}function Lu(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Du(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 Fu(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 Fu(e,t)}(e))||t){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 Fu(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 qu=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Bu(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new cu(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(Lu(i,n.nationalNumberPattern())){if(Ku(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Ku(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=Du(qu);!(r=o()).done;){var s=r.value;if(Ku(i,s,n))return s}}}}function Ku(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Lu(e,t.pattern()))}function Hu(e,t,n){var i=new cu(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new cu(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function Vu(e){return e.replace(new RegExp("[".concat(eu,"]+"),"g")," ").trim()}var zu=/(\$\d)/;function Gu(e,t,n){var i=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var o=e.replace(new RegExp(t.pattern()),i?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(zu,t.nationalPrefixFormattingRule()):t.format());return i?Vu(o):o}var Ju=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Zu(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 Yu(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 Yu(e,t)}(e))||t){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 Yu(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 Xu(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 Qu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xu(Object(n),!0).forEach((function(t){eh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function eh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var th={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function nh(e,t,n,i){if(n=n?Qu(Qu({},th),n):th,i=new cu(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 r,o=i.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?oh(r=ih(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=ih(s,null,"INTERNATIONAL",i,n),oh(r="+".concat(o," ").concat(r),e.ext,i,n.formatExtension)):"+".concat(o);case"E.164":return"+".concat(o).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(o).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,i,r){var o=vu(i,r.metadata);if(o===n){var s=ih(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new cu(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():Ju.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(ih(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return oh(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function ih(e,t,n,i,r){var o=rh(i.formats(),e);return o?Gu(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function rh(e,t){for(var n,i=Zu(e);!(n=i()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var o=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(Lu(t,r.pattern()))return r}}function oh(e,t,n,i){return t?i(e,t,n):e}function sh(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 ah(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sh(Object(n),!0).forEach((function(t){dh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function dh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ch=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 r=function(e,t){var n,i,r=new cu(t);uh(e)?(n=e,r.selectNumberingPlan(n),i=r.countryCallingCode()):i=e;return{country:n,countryCallingCode:i}}(t,i),o=r.country,s=r.countryCallingCode;this.country=o,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return i}}return lh(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Hu(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new cu(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 Wu(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 cu(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Bu(e,t,n.metadata):Lu(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new cu(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Bu(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return nh(this,e,t?ah(ah({},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)}}]),e}(),uh=function(e){return/^[A-Z]{2}$/.test(e)};var hh=new RegExp("(["+Qc+"])");function gh(e,t,n,i){if(t){var r=new cu(i);r.selectNumberingPlan(t,n);var o=new RegExp(r.IDDPrefix());if(0===e.search(o)){var s=(e=e.slice(e.match(o)[0].length)).match(hh);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function ph(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),i=n.exec(e);if(i){var r,o,s,a=i.length-1,d=a>0&&i[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(o=i[1]);else{var l=i[0];r=e.slice(l.length),d&&(o=i[1])}if(d){var c=e.indexOf(i[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=i[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:o}}}return{nationalNumber:e}}function fh(e,t){var n=ph(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Lu(e,n.nationalNumberPattern())&&!Lu(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Uu(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function mh(e,t,n,i){var r=t?vu(t,i):n;if(0===e.indexOf(r)){(i=new cu(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=fh(o,i).nationalNumber,a=fh(e,i).nationalNumber;if(!Lu(a,i.nationalNumberPattern())&&Lu(s,i.nationalNumberPattern())||"TOO_LONG"===Uu(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function vh(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=gh(e,t,n,i);if(!o||o===e){if(t||n){var s=mh(e,t,n,i),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="+"+o}if("0"===e[1])return{};i=new cu(i);for(var l=2;l-1<=Xc&&l<=e.length;){var c=e.slice(1,l);if(i.hasCallingCode(c))return i.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function yh(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 wh(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 wh(e,t)}(e))||t){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 wh(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 bh(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new cu(i);for(var r,o=yh(n);!(r=o()).done;){var s=r.value;if(i.country(s),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return s}else if(Bu({phone:e,country:s},void 0,i.metadata))return s}}function $h(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:bh(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var _h="+",Sh="(["+Qc+"]|[\\-\\.\\(\\)]?)",kh=new RegExp("^\\"+_h+Sh+"*["+Qc+"]"+Sh+"*$","g"),Ch=new RegExp("^("+("["+Qc+"]+((\\-)*["+Qc+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Qc+"])*")+"\\.?$","g"),xh="tel:",Ih=";phone-context=",Rh=";isub=";function Eh(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Ih);if(t<0)return null;var n=t+Ih.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&&(kh.test(e)||Ch.test(e))}(r))throw new Jc("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===_h&&(n+=r);var o,s=e.indexOf(xh);o=s>=0?s+xh.length:0;var a=e.indexOf(Ih);n+=e.substring(o,a)}var d=n.indexOf(Rh);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Oh=250,Nh=new RegExp("[++"+Qc+"]"),Ph=new RegExp("[^"+Qc+"#]+$");function Ah(e,t,n){if(t=t||{},n=new cu(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Jc("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=Eh(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>Oh){if(n)throw new Jc("TOO_LONG");return}if(!1===t)return e;var i=e.search(Nh);if(i<0)return;return e.slice(i).replace(Ph,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=Zc&&xu.test(e)}(i))return function(e){return ku.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Iu);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(Iu),r=1;r<i.length;){if(i[r])return{number:n,ext:i[r]};r++}}(i);if(r.ext)return r;return{number:i}}(e,t.v2,t.extract),r=i.number,o=i.ext,s=i.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new Jc("TOO_SHORT");throw new Jc("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=vh(Tu(e),t,n,i.metadata),s=o.countryCallingCodeSource,a=o.countryCallingCode,d=o.number;if(a)i.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};i.selectNumberingPlan(t,n),t&&(r=t),a=n||vu(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=fh(Tu(d),i),c=l.nationalNumber,u=l.carrierCode,h=$h(a,{nationalNumber:c,defaultCountry:t,metadata:i});h&&(r=h,"001"===h||i.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 Jc("INVALID_COUNTRY");return{}}if(!l||l.length<Zc){if(t.v2)throw new Jc("TOO_SHORT");return{}}if(l.length>Yc){if(t.v2)throw new Jc("TOO_LONG");return{}}if(t.v2){var g=new ch(c,l,n.metadata);return d&&(g.country=d),h&&(g.carrierCode=h),o&&(g.ext=o),g.__countryCallingCodeSource=u,g}var p=!!(t.extended?n.hasSelectedNumberingPlan():d)&&Lu(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!Wu(l,n)),phone:l,ext:o}:p?function(e,t,n){var i={country:e,phone:t};n&&(i.ext=n);return i}(d,l,o):{}}function jh(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 Th(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jh(Object(n),!0).forEach((function(t){Mh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uh(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 Wh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lh(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,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Dh(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 Dh(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 Dh(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 Fh(e){var t,n,i,r=Lh(Array.prototype.slice.call(e),4),o=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,s&&"string"!=typeof s){if(!ru(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,i=a):i=s}else d?(n=a,i=d):(n=void 0,i=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uh(Object(n),!0).forEach((function(t){Wh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uh(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 qh(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 Bh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qh(Object(n),!0).forEach((function(t){Kh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hh(e,t,n){t&&t.defaultCountry&&!yu(t.defaultCountry,n)&&(t=Bh(Bh({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Ah(e,Th(Th({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Jc))throw e}}function Vh(){var e=Fh(arguments);return Hh(e.text,e.options,e.metadata)}function zh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Jh=zh((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Gh(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),Zh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Gh(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return zh(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Jh(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Jh(e,t);this.cache[e]=this.head,this.size++}},{key:"get",value:function(e){if(this.cache[e]){var t=this.cache[e].value;return this.remove(e),this.put(e,t),t}console.log("Item not available in cache for key ".concat(e))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(e){var t=this.cache[e];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[e],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),e}();function Yh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Xh=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new Zh(t)}return Yh(e,[{key:"getPatternForRegExp",value:function(e){var t=this.cache.get(e);return t||(t=new RegExp("^"+e),this.cache.put(e,t)),t}}]),e}();function Qh(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function eg(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var tg=" - \u2028\u2029 ",ng="[".concat(tg,"]"),ig="[^".concat(tg,"]"),rg="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),og="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",sg="[".concat(og,"]"),ag=new RegExp(sg),dg="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),lg=new RegExp(dg),cg="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),ug=new RegExp(cg),hg=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function gg(e){return!(!ag.test(e)&&!ug.test(e))&&hg.test(e)}function pg(e){return"%"===e||lg.test(e)}function fg(e,t,n){var i=!0,r=Vh(e,n);if(r||(i=!1,r=Vh(e,{defaultCallingCode:t.countryCallingCode},n)),!r)return"INVALID_NUMBER";if(t.ext){if(r.ext!==t.ext)return"NO_MATCH"}else if(r.ext)return"NO_MATCH";return i&&t.countryCallingCode!==r.countryCallingCode?"NO_MATCH":t.number===r.number?i?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(r.nationalNumber)||0===r.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var mg={POSSIBLE:function(e,t){return t.candidate,t.metadata,!0},VALID:function(e,t){var n=t.candidate;t.defaultCountry;var i=t.metadata;return!(!e.isValid()||!vg(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!vg(e,n,r)||wg(e,n)||!yg(e,{defaultCountry:i,metadata:r}))&&bg()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!vg(e,n,r)||wg(e,n)||!yg(e,{defaultCountry:i,metadata:r}))&&bg()}};function vg(e,t,n){for(var i=0;i<t.length-1;i++){var r=t.charAt(i);if("x"===r||"X"===r){var o=t.charAt(i+1);if("x"===o||"X"===o){if(i++,"NSN_MATCH"!==fg(t.substring(i),e,n))return!1}else{var s=Pu(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function yg(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new cu(i);r.selectNumberingPlan(e.countryCallingCode),e.country||$h(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=rh(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function wg(e,t){var n=t.indexOf("/");if(n<0)return!1;var i=t.indexOf("/",n+1);return!(i<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===e.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===e.__countryCallingCodeSource)||Pu(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function bg(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var $g=/[\\/] *x/;function _g(e){return eg($g,e)}var Sg=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,kg=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Cg=/^:[0-5]\d/;function xg(e,t,n){if(Sg.test(e))return!1;if(kg.test(e)){var i=n.slice(t+e.length);if(Cg.test(i))return!1}return!0}var Ig="(\\[([",Rg=")\\])]",Eg="[^".concat(Ig).concat(Rg,"]"),Og="[".concat(Ig).concat(tu,"]"),Ng=new RegExp("^"+Og),Pg=Qh(0,3),Ag=new RegExp("^(?:[(\\[([])?(?:"+Eg+"+["+Rg+"])?"+Eg+"+(?:["+Ig+"]"+Eg+"+["+Rg+"])"+Pg+Eg+"*$"),jg=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function Tg(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 Mg(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 Mg(e,t)}(e))||t){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 Mg(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 Ug(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Wg=$u(),Lg=["\\/+(.*)/","(\\([^(]*)","(?:".concat(ng,"-|-").concat(ng,")").concat(ng,"*(.+)"),"[‒-―-]".concat(ng,"*(.+)"),"\\.+".concat(ng,"*([^.]+)"),"".concat(ng,"+(").concat(ig,"+)")],Dg=Qh(0,2),Fg=Qh(0,4),qg=Yc+Xc,Bg=Qh(0,qg),Kg="[".concat(eu,"]")+Fg,Hg=rg+Qh(1,qg),Vg="(?:"+Og+Kg+")"+Dg+Hg+"(?:"+Kg+Hg+")"+Bg+"(?:"+Wg+")?",zg=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(og,"#]+$")),Gg=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Jg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(n={v2:n.v2,defaultCallingCode:n.defaultCallingCode,defaultCountry:n.defaultCountry&&yu(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Gg}).leniency)throw new TypeError("`leniency` is required");if("POSSIBLE"!==n.leniency&&"VALID"!==n.leniency)throw new TypeError('Invalid `leniency`: "'.concat(n.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(n.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");if(this.text=t,this.options=n,this.metadata=i,this.leniency=mg[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(Vg,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new Xh(32)}return Ug(e,[{key:"find",value:function(){for(var e;this.maxTries>0&&null!==(e=this.PATTERN.exec(this.text));){var t=e[0],n=e.index;if(xg(t=_g(t),n,this.text)){var i=this.parseAndVerify(t,n,this.text)||this.extractInnerMatch(t,n,this.text);if(i){if(this.options.v2)return{startsAt:i.startsAt,endsAt:i.endsAt,number:i.phoneNumber};var r=i.phoneNumber,o={startsAt:i.startsAt,endsAt:i.endsAt,phone:r.nationalNumber};return r.country?o.country=r.country:o.countryCallingCode=r.countryCallingCode,r.ext&&(o.ext=r.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,n){for(var i,r=Tg(Lg);!(i=r()).done;)for(var o=i.value,s=!0,a=void 0,d=new RegExp(o,"g");this.maxTries>0&&null!==(a=d.exec(e));){if(s){var l=eg(zg,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=eg(zg,a[1]),h=e.indexOf(u,a.index),g=this.parseAndVerify(u,t+h,n);if(g)return g;this.maxTries--}}},{key:"parseAndVerify",value:function(e,t,n){if(function(e,t,n,i){if(Ag.test(e)&&!jg.test(e)){if("POSSIBLE"!==i){if(t>0&&!Ng.test(e)){var r=n[t-1];if(pg(r)||gg(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(pg(s)||gg(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=Vh(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(i&&i.isPossible())return this.leniency(i,{candidate:e,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+e.length,phoneNumber:i}:void 0}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var e=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",e}}]),e}();function Zg(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Yg=function(){function e(t){var n=t.onCountryChange,i=t.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.onCountryChange=n,this.onCallingCodeChange=i}return Zg(e,[{key:"reset",value:function(e){var t=e.country,n=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];this[i]=e[i]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}]),e}();function Xg(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 Qg(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 Qg(e,t)}(e))||t){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 Qg(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 ep="x",tp=new RegExp(ep);function np(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function ip(e,t){return")"===e[t]&&t++,function(e){var t=[],n=0;for(;n<e.length;)"("===e[n]?t.push(n):")"===e[n]&&t.pop(),n++;var i=0,r="";t.push(e.length);for(var o=0,s=t;o<s.length;o++){var a=s[o];r+=e.slice(i,a),i=a+1}return r}(e.slice(0,t))}function rp(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,r(t)){var s=op(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return op(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function op(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Gu(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:r,metadata:i});if(r||(e.nationalPrefix?s=e.nationalPrefix+o(t)+s:e.complexPrefixBeforeNationalSignificantNumber&&(s=e.complexPrefixBeforeNationalSignificantNumber+" "+s)),function(e,t){return Pu(e)===t.getNationalDigits()}(s,e))return s}function sp(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ap=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return sp(e,[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],n=t.branches,i=t.instructions;if(n)return{op:"|",args:n.concat([up(i)])};if(0===i.length)throw new Error("Pattern is required");return 1===i.length?i[0]:i}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw new Error("Pattern is required");var t=e.match(cp);if(t){var n=t[1],i=e.slice(0,t.index),r=e.slice(t.index+n.length);switch(n){case"(?:":i&&this.parsePattern(i),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(i&&this.parsePattern(i),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(up(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:o});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(i&&this.parsePattern(i),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(up(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":i&&this.parsePattern(i),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:dp(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(lp.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function dp(e){for(var t=[],n=0;n<e.length;){if("-"===e[n]){if(0===n||n===e.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(e));for(var i=e[n-1].charCodeAt(0)+1,r=e[n+1].charCodeAt(0)-1,o=i;o<=r;)t.push(String.fromCharCode(o)),o++}else t.push(e[n]);n++}return t}var lp=/[\(\)\[\]\?\:\|]/,cp=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function up(e){return 1===e.length?e[0]:e}function hp(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 gp(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 gp(e,t)}(e))||t){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 gp(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 pp(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var fp=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matchTree=(new ap).parse(t)}return pp(e,[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw new Error("String is required");var n=mp(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function mp(e,t,n){if("string"==typeof t){var i=e.join("");return 0===t.indexOf(i)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===i.indexOf(t)?n&&e.length>t.length?{overflow:!0}:{match:!0,matchedChars:e.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var r=e.slice(),o=0;o<t.length;){var s=mp(r,t[o],n&&o===t.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(r=r.slice(s.matchedChars.length)).length)return o===t.length-1?{match:!0,matchedChars:e}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:e.slice(0,e.length-r.length)}}switch(t.op){case"|":for(var a,d,l=hp(t.args);!(d=l()).done;){var c=mp(e,d.value,n);if(c){if(c.overflow)return c;if(c.match)return{match:!0,matchedChars:c.matchedChars};if(!c.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)));a=!0}}return a?{partialMatch:!0}:void 0;case"[]":for(var u,h=hp(t.args);!(u=h()).done;){var g=u.value;if(e[0]===g)return 1===e.length?{match:!0,matchedChars:e}:n?{overflow:!0}:{match:!0,matchedChars:[g]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function vp(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 yp(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 yp(e,t)}(e))||t){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 yp(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 wp(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var bp=np("9",15),$p=/[- ]/,_p=new RegExp("["+eu+"]*\\$1["+eu+"]*(\\$\\d["+eu+"]*)*$"),Sp=function(){function e(t){t.state;var n=t.metadata;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=n,this.resetFormat()}return wp(e,[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var n=this;if(function(e,t){return"IS_POSSIBLE"===Uu(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=vp(this.matchingFormats);!(i=r()).done;){var o=i.value,s=rp(t,o,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return n.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return n.getSeparatorAfterNationalPrefix(e)}});if(s)return this.resetFormat(),this.chosenFormat=o,this.setNationalNumberTemplate(s.replace(/\d/g,ep),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(ep),s}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var n=this.chosenFormat,i=this.chooseFormat(t);if(i)return i===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,n=e.nationalSignificantNumber,i=e.nationalPrefix,r=e.international,o=n,s=o.length-3;s<0&&(s=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,r,i)&&t.formatMatches(e,o,s)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,n){return!(n&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat())&&!(!t&&!n&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,n){var i=e.leadingDigitsPatterns().length;if(0===i)return!0;n=Math.min(n,i-1);var r=e.leadingDigitsPatterns()[n];if(t.length<3)try{return void 0!==new fp(r).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(r,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,n=this,i=function(){var i=t.value;return n.chosenFormat===i?"break":_p.test(n.getFormatFormat(i,e.international))?n.createTemplateForFormat(i,e)?(n.chosenFormat=i,"break"):(n.matchingFormats=n.matchingFormats.filter((function(e){return e!==i})),"continue"):"continue"},r=vp(this.matchingFormats.slice());!(t=r()).done;){var o=i();if("break"===o)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var n=this.getTemplateForFormat(e,t);return n?(this.setNationalNumberTemplate(n,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&$p.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var n=e.IDDPrefix,i=e.missingPlus;return n?t&&!1===t.spacing?n:n+" ":i?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,n=0,i=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";n<i.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(ep,t+1),n++;return ip(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,ep)+np(ep,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var n=t.nationalSignificantNumber,i=t.international,r=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,s=e.pattern();s=s.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var a=bp.match(s)[0];if(!(n.length>a.length)){var d=new RegExp("^"+s+"$"),l=n.replace(/\d/g,"9");d.test(l)&&(a=l);var c,u=this.getFormatFormat(e,i);if(this.shouldTryNationalPrefixFormattingRule(e,{international:i,nationalPrefix:r})){var h=u.replace(zu,e.nationalPrefixFormattingRule());if(Pu(e.nationalPrefixFormattingRule())===(r||"")+Pu("$1")&&(u=h,c=!0,r))for(var g=r.length;g>0;)u=u.replace(/\d/,ep),g--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),ep);return c||(o?p=np(ep,o.length)+" "+p:r&&(p=np(ep,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=Vu(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=Xg(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(tp)<0)return;t=e.search(tp),e=e.replace(tp,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],ip(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var n=t.international,i=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var r=e.usesNationalPrefix();if(r&&i||!r&&!n)return!0}}}]),e}();function kp(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,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Cp(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 Cp(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 Cp(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 xp(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ip=new RegExp("^"+("["+eu+Qc+"]+")+"$","i"),Rp="(?:[++]["+eu+Qc+"]*|["+eu+Qc+"]+)",Ep=new RegExp("[^"+eu+Qc+"]+.*$"),Op=/[^\d\[\]]/,Np=function(){function e(t){var n=t.defaultCountry,i=t.defaultCallingCode,r=t.metadata,o=t.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaultCountry=n,this.defaultCallingCode=i,this.metadata=r,this.onNationalSignificantNumberChange=o}return xp(e,[{key:"input",value:function(e,t){var n,i=function(e){var t=function(e){var t=function(e){var t,n=e.search(Rp);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(Ep,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=kp(t,2),i=n[0],r=n[1];Ip.test(i)||(i="");return[i,r]}(e),r=kp(i,2),o=r[0],s=r[1],a=Pu(o);return s&&(t.digits||(t.startInternationalNumber(),a||(n=!0))),a&&this.inputDigits(a,t),{digits:a,justLeadingPlus:n}}},{key:"inputDigits",value:function(e,t){var n=t.digits,i=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),i&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,n=e.callingCode;return t&&!n}},{key:"extractCountryCallingCode",value:function(e){var t=vh("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode,i=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:i}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Op.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=ph(e,this.metadata),i=n.nationalPrefix,r=n.nationalNumber,o=n.carrierCode;if(r!==e)return this.onExtractedNationalNumber(i,o,r,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var i=ph(e,this.metadata),r=i.nationalPrefix,o=i.nationalNumber,s=i.carrierCode;if(o!==t)return this.onExtractedNationalNumber(r,s,o,e,n),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,n,i,r){var o,s,a=i.lastIndexOf(n);if(a>=0&&a===i.length-n.length){s=!0;var d=i.slice(0,a);d!==e&&(o=d)}r({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:n,nationalSignificantNumberMatchesInput:s,complexPrefixBeforeNationalSignificantNumber:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,n=e.IDDPrefix,i=e.digits;if(e.nationalSignificantNumber,!t&&!n){var r=gh(i,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==i?(e.update({IDDPrefix:i.slice(0,i.length-r.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=mh(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode;if(t.number,n)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:n}),!0}}},{key:"startInternationalNumber",value:function(e,t){var n=t.country,i=t.callingCode;e.startInternationalNumber(n,i),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}]),e}();function Pp(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,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||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)||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 Ap(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 jp(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Tp,Mp=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new cu(n);var i=Pp(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return jp(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(ru(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,n]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput="+";else if(n){var i;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(i=this.formatter.format(n,this.state)),void 0===i&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(i=this.formatter.format(r,this.state))}this.formattedOutput=i?this.getFullNumber(i):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Yg({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new Sp({state:this.state,metadata:this.metadata}),this.parser=new Np({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},i=this.state.callingCode;return n(i?e?"".concat(i," ").concat(e):i:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.complexPrefixBeforeNationalSignificantNumber,i=e.nationalPrefix,r=t,o=n||i;return o&&(r=o+r),r}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,ep)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry($h(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,n=e.callingCode,i=e.country,r=e.nationalSignificantNumber;if(t)return this.isInternational()?n?"+"+n+r:"+"+t:i||n?"+"+(i?this.metadata.countryCallingCode():n)+r:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,i=e.callingCode,r=this._getCountry();if(t&&(r||i)){if(r&&r===this.defaultCountry){var o=new cu(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=bh(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new ch(r||i,t,this.metadata.metadata);return n&&(l.carrierCode=n),l}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function Up(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Dc),e.apply(this,n)}(Vh,arguments)}function Wp(e,t){return Jg.call(this,e,t,Dc)}function Lp(e){return Mp.call(this,e,Dc)}function Dp(){return cu.call(this,Dc)}Wp.prototype=Object.create(Jg.prototype,{}),Wp.prototype.constructor=Wp,Lp.prototype=Object.create(Mp.prototype,{}),Lp.prototype.constructor=Lp,Dp.prototype=Object.create(cu.prototype,{}),Dp.prototype.constructor=Dp,function(e){e[e.text=1]="text",e[e.numeric=2]="numeric",e[e.bool=3]="bool",e[e.singleSelect=4]="singleSelect",e[e.array=5]="array",e[e.date=6]="date"}(Tp||(Tp={}));const Fp=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>{const[r,...o]=n.split(".");return t!==r?Object.assign(e,{[n]:i}):(e[r]||(e[r]={}),e[r][o.join(".")]=i,e)}),{}),qp=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Bp=(e,t)=>e===Tp.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t,Kp={enabled:"active",disabled:"disabled",invited:"invited"},Hp=e=>e.tenantRoles.data,Vp=e=>e.selectedUsersLoginIds,zp=e=>e.notifications,Gp=e=>e.customAttributes.data,Jp=Jl(Gp,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),Zp=Jl((e=>e.usersList.data),Jp,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes).map((([e,n])=>[e,Bp(t[e],n)])))}))))),Yp=Jl(Zp,(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),qp(null==e?void 0:e.customAttributes,"customAttributes")),{status:Kp[e.status]||e.status,roles:e.roleNames}))))),Xp=Jl(Vp,Yp,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Qp=Jl(Xp,(e=>e.map((e=>e.userId)))),ef=Jl(Xp,(e=>e.map((e=>e.status)))),tf=Jl(Xp,(e=>e.every((e=>e.editable)))),nf=Jl(Vp,(e=>!!e.length)),rf=Jl(Vp,(e=>1===e.length)),of=Jl(Vp,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),sf=Jl(rf,ef,((e,t)=>e&&t.every((e=>e===Kp.enabled)))),af=Jl(ef,(e=>e.every((e=>e===Kp.disabled)))),df=Jl(Xp,(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`})),lf=Jl(rf,af,tf,((e,t,n)=>e&&t&&n)),cf=Jl(rf,sf,tf,((e,t,n)=>e&&t&&n)),uf=Jl(rf,tf,((e,t)=>e&&t)),hf=Jl(rf,tf,((e,t)=>e&&t)),gf=Jl(rf,tf,((e,t)=>e&&t)),pf=nf,ff=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)}))}))},mf=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}}),vf=({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)})}}),yf=Rc("users/create",((e,{extra:{api:t}})=>t.user.create(e))),wf=ff(yf)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},mf((e=>e.createUser)),vf({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>`}})),bf={action:yf,reducer:wf},$f=Rc("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),_f=ff($f)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},mf((e=>e.deleteUser)),vf({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Sf={action:$f,reducer:_f},kf=Rc("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Cf=ff(kf)(mf((e=>e.setTempUserPassword)),vf({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>`}})),xf={action:kf,reducer:Cf},If=Rc("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Rf=ff(If)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},mf((e=>e.customAttributes))),Ef={action:If,reducer:Rf},Of=Rc("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),Nf=ff(Of)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},mf((e=>e.usersList))),Pf={action:Of,reducer:Nf},Af=Rc("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),jf=ff(Af)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},mf((e=>e.tenantRoles))),Tf={action:Af,reducer:jf},Mf=Rc("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Uf=ff(Mf)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Ui(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},mf((e=>e.updateUser)),vf({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>`}})),Wf={action:Mf,reducer:Uf},Lf=Rc("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Df=ff(Lf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Ui(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)}},mf((e=>e.enableUser)),vf({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>`}})),Ff={action:Lf,reducer:Df},qf=Rc("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Bf=ff(qf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Ui(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)}},mf((e=>e.disableUser)),vf({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>`}})),Kf={action:qf,reducer:Bf},Hf=Rc("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Vf={action:Hf,reducer:ff(Hf)(mf((e=>e.removePasskey)),vf({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>`}}))},zf={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:[]},Gf="/v1/mgmt/user/search",Jf="/v1/mgmt/user/delete/batch",Zf="/v1/mgmt/user/create",Yf="/v1/mgmt/user/update",Xf="/v1/mgmt/user/update/status",Qf="/v1/mgmt/user/password/set/temporary",em="/v1/mgmt/user/passkeys/delete",tm="/v1/mgmt/user/customattributes",nm="/v1/mgmt/role/all",im=e=>r(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)})),rm=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>r(void 0,[...i],void 0,(function*({page:i,limit:o=1e4,customAttributes:s,statuses:a,emails:d,phones:l,text:c,sort:u}={}){if(n)return(e=>r(void 0,[e],void 0,(function*({text:e,sort:t}){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,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.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:s,statuses:a,emails:d,phones:l,text:c,sort:u});const h=yield e.post(Gf,{limit:o,page:i,withTestUser:!1,customAttributes:s,statuses:a,emails:d,phones:l,text:c,sort:u},{queryParams:{tenant:t}});return yield im(h),(yield h.json()).users})),deleteBatch:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){}));const o=yield e.post(Jf,{userIds:i},{queryParams:{tenant:t}});return yield im(o),o.json()})),create:i=>r(void 0,[i],void 0,(function*({loginId:i,email:o,phone:s,displayName:a,roles:d,customAttributes:l,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:g,middleName:p,familyName:f,additionalLoginIds:m,sendSMS:v,sendMail:y,inviteUrl:w,invite:b}){if(n)return(e=>r(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{const g=Math.random().toString(10).substring(15);h({loginIds:[e],externalIds:[e],userId:`user-${g}`,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:o,phone:s,displayName:a,roles:d,customAttributes:l,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:g,middleName:p,familyName:f,additionalLoginIds:m,sendSMS:v,sendMail:y,inviteUrl:w,invite:b});const $=yield e.post(Zf,{loginId:i,email:o,phone:s,displayName:a,givenName:g,middleName:p,familyName:f,roleNames:d,userTenants:[{tenantId:t}],customAttributes:l,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:m,sendSMS:v,sendMail:y,inviteUrl:w,invite:b},{queryParams:{tenant:t}});return yield im($),(yield $.json()).user})),update:i=>r(void 0,[i],void 0,(function*({loginId:i,email:o,phone:s,displayName:a,roles:d,customAttributes:l,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:g,middleName:p,familyName:f,additionalLoginIds:m}){if(n)return(e=>r(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{h({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:o,phone:s,displayName:a,roles:d,customAttributes:l,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:g,middleName:p,familyName:f,additionalLoginIds:m});const v=yield e.post(Yf,{loginId:i,email:o,phone:s,displayName:a,givenName:g,middleName:p,familyName:f,roleNames:d,customAttributes:l,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:m},{queryParams:{tenant:t}});return yield im(v),(yield v.json()).user})),enable:i=>r(void 0,void 0,void 0,(function*(){if(n)return(e=>r(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(i);const o=yield e.post(Xf,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield im(o),o.json()})),disable:i=>r(void 0,void 0,void 0,(function*(){if(n)return(e=>r(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(i);const o=yield e.post(Xf,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield im(o),o.json()})),removePasskey:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){}));const o=yield e.post(em,{loginId:i},{queryParams:{tenant:t}});return yield im(o),o.json()})),setTempPassword:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const o=yield e.post(Qf,{loginId:i},{queryParams:{tenant:t}});return yield im(o),o.json()})),getCustomAttributes:()=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const i=yield e.get(tm,{queryParams:{tenant:t}});return yield im(i),(yield i.json()).data}))}),om=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>r(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(nm,{queryParams:{tenant:t}});return yield im(i),i.json()}))}),sm=qi((e=>{var t,n,i,a;const d=Ti(Ls,Us,Ps,Ds,Lc,Ws({tenant:Ws.missingAttrValidator}))(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return o(this,n,"f")||o(this,t,"m",i).call(this),o(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{o(this,n,"f")&&o(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),s(this,n,((e,t,n,i)=>{const r=$i(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.7.7"}}));return{user:rm({httpClient:r.httpClient,tenant:t,mock:n}),tenant:om({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},a})),am=qi((e=>{const t=Ti(Uc({name:"widget",initialState:zf,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{bf.reducer(e),Wf.reducer(e),Ff.reducer(e),Kf.reducer(e),Sf.reducer(e),Pf.reducer(e),xf.reducer(e),Vf.reducer(e),Ef.reducer(e),Tf.reducer(e)},asyncActions:{searchUsers:Pf.action,createUser:bf.action,updateUser:Wf.action,enableUser:Ff.action,disableUser:Kf.action,deleteUsers:Sf.action,removePasskey:Vf.action,getCustomAttributes:Ef.action,getTenantRoles:Tf.action,setTempUserPassword:xf.action}}),Ms,Ps,sm)(e);return class extends t{constructor(...e){super(...e),this.state=zf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),dm=qi((e=>{const t=Ti(Bs,Ws({"widget-id":Ws.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),lm=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,Ms,Qs,na,dm,am)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([o(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){const e=Mi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),cm=qi((e=>{var t,n,i,a,d,l;return l=class extends(Ti(am,Nd,Wc,Ps,lm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),d.set(this,(()=>r(this,void 0,void 0,(function*(){yield o(this,n,"f").setData(Hp(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this)}))}},n=new WeakMap,d=new WeakMap,t=new WeakSet,i=function(){return r(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(Mi(yield this.fetchWidgetPage("create-user-modal.html"))),new yd((()=>{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)})),new yd((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>r(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({},Fp(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),s(this,n,new $d((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),o(this,d,"f").call(this),this.createUserModal.beforeOpen=()=>r(this,void 0,void 0,(function*(){yield o(this,d,"f").call(this),o(this,t,"m",a).call(this)}))}))},a=function(){const e=Gp(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},l})),um=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,cm,lm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new yd(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})),hm=qi((e=>{var t,n,i;return i=class extends(Ti(am,Nd,Ps,lm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(Mi(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new yd((()=>{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 yd((()=>{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=Qp(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new kd(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=df(this.state);i.text=`Delete ${e}?`}}))},i})),gm=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am,hm)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;o(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(o(this,i,"f").bind(this),pf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new yd(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()}))},s})),pm=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(am,Nd,Ps,Wc,lm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield o(this,t,"m",s).call(this)}))}},t=new WeakSet,n=function(){new yd((()=>{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 yd((()=>{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=of(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},s=function(){return r(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(Mi(yield this.fetchWidgetPage("disable-user-modal.html"))),o(this,t,"m",n).call(this),o(this,t,"m",i).call(this);const s=new kd(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>r(this,void 0,void 0,(function*(){const e=df(this.state);s.text=`Disable ${e}?`}))}))},a})),fm=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am,pm,Wc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;o(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(o(this,i,"f").bind(this),cf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new yd(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()}))},s})),mm=e=>{if(!e)return e;const t=Up(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},vm=qi((e=>{var t,n,a,d,l,c,u,h,g,p;return p=class extends(Ti(am,Nd,Ps,Wc,lm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),a.set(this,void 0),c.set(this,(()=>r(this,void 0,void 0,(function*(){yield o(this,a,"f").setData(Hp(this.state).map((({name:e})=>({value:e,label:e}))))})))),h.set(this,(()=>{var e,t;const n=null===(e=Xp(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:mm(null==n?void 0:n.phone),roles:null==n?void 0:n.roles,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},qp(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield o(this,t,"m",g).call(this)}))}},n=new WeakMap,a=new WeakMap,c=new WeakMap,h=new WeakMap,t=new WeakSet,d=function(){new yd((()=>{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()))},l=function(){new yd((()=>{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=i(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Fp(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},u=function(){const e=Gp(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},g=function(){return r(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(Mi(yield this.fetchWidgetPage("edit-user-modal.html"))),o(this,t,"m",d).call(this),o(this,t,"m",l).call(this),s(this,n,new Cd(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),s(this,a,new $d((()=>{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=()=>r(this,void 0,void 0,(function*(){yield o(this,c,"f").call(this),o(this,n,"f").disable(),o(this,h,"f").call(this),o(this,t,"m",u).call(this)}))}))},p})),ym=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am,vm,Wc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;o(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(o(this,i,"f").bind(this),uf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new yd(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()}))},s})),wm=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(am,Nd,Ps,Wc,lm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield o(this,t,"m",s).call(this)}))}},t=new WeakSet,n=function(){new yd((()=>{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 yd((()=>{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=of(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},s=function(){return r(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(Mi(yield this.fetchWidgetPage("enable-user-modal.html"))),o(this,t,"m",n).call(this),o(this,t,"m",i).call(this);const s=new kd(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>r(this,void 0,void 0,(function*(){const e=df(this.state);s.text=`Activate ${e}?`}))}))},a})),bm=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am,wm,Wc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;o(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(o(this,i,"f").bind(this),lf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new yd(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()}))},s})),$m=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Fi((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Cd(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(o(this,n,"f"))},s})),_m={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},Sm=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(Ps,am,Ad,Ms)(e)){constructor(){super(...arguments),t.add(this),s.set(this,Wi((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const s=o(this,t,"m",i).call(this,e);s.setContent(o(this,t,"m",n).call(this,{type:e,msg:r})),s.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(o(this,s,"f").bind(this),zp)}))}},s=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=_m[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"})},a})),km=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(am,Nd,Ps,Wc,lm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield o(this,t,"m",s).call(this)}))}},t=new WeakSet,n=function(){new yd((()=>{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 yd((()=>{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=of(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},s=function(){return r(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(Mi(yield this.fetchWidgetPage("remove-passkey-modal.html"))),o(this,t,"m",n).call(this),o(this,t,"m",i).call(this);const s=new kd(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>r(this,void 0,void 0,(function*(){const e=df(this.state);s.text=`Remove passkey for ${e}?`}))}))},a})),Cm=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am,km,Wc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;o(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(o(this,i,"f").bind(this),hf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new yd(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()}))},s})),xm=qi((e=>{var t,n,i,s,a,d,l,c;return c=class extends(Ti(am,Ps,lm)(e)){constructor(){super(...arguments),t.add(this),s.set(this,Wi((e=>{this.usersTable.data=e}))),a.set(this,Fi(((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})}))),d.set(this,Wi((e=>{this.usersTable.filterColumns((t=>{var n;const[i,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this),o(this,s,"f").call(this,Yp(this.state)),o(this,d,"f").call(this,Gp(this.state)),this.subscribe(o(this,d,"f").bind(this),Gp),this.subscribe(o(this,s,"f").bind(this),Yp)}))}},s=new WeakMap,a=new WeakMap,d=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:r,type:o,attrs:s})=>{const a=e(i)||t(o);if(!a)return n({path:i,header:r,type:o,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}},i=function(){var e;this.usersTable=new vd(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(o(this,t,"m",l).bind(this)),o(this,t,"m",n).call(this),o(this,t,"m",l).call(this)},l=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{o(this,a,"f").call(this,e.target,e.detail)}))}))},c})),Im=qi((e=>{var t,n,i;return i=class extends(Ti(am,Nd,Ps,Wc,lm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(Mi(yield this.fetchWidgetPage("generated-password-modal.html"))),new yd((()=>{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})),Rm=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(am,Nd,Ps,Wc,lm,Im)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield o(this,t,"m",s).call(this)}))}},t=new WeakSet,n=function(){new yd((()=>{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 yd((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>r(this,void 0,void 0,(function*(){var e;const t=of(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()}))))},s=function(){return r(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(Mi(yield this.fetchWidgetPage("reset-password-modal.html"))),o(this,t,"m",n).call(this),o(this,t,"m",i).call(this);const s=new kd(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>r(this,void 0,void 0,(function*(){const e=df(this.state);s.text=`This will generate a new temporary password for ${e}?`}))}))},a})),Em=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,lm,am,Rm,Wc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;o(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(o(this,i,"f").bind(this),gf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new yd(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()}))},s})),Om=qi((e=>class extends(Ti(cd,ra,xm,um,gm,ym,bm,fm,Em,Cm,$m,Sm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Nm=Ti((e=>class extends(Om(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Nm);var Pm=Object.freeze({__proto__:null,default:Nm});const Am=e=>e.selectedRolesIds,jm=e=>e.notifications,Tm=e=>e.tenantPermissions.data||[],Mm=Jl((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"})})))),Um=Jl(Am,Mm,((e,t)=>t.filter((t=>e.includes(t.name))))),Wm=Jl(Am,(e=>!!e.length)),Lm=Jl(Am,(e=>1===e.length)),Dm=Jl(Um,(e=>1===e.length?e[0].name:`${e.length} roles`)),Fm=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)}))}))},qm=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}}),Bm=({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)})}}),Km=Rc("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),Hm=Fm(Km)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},qm((e=>e.createRole)),Bm({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>`}})),Vm={action:Km,reducer:Hm},zm=Rc("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Gm=Fm(zm)({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=[]}},qm((e=>e.deleteRole)),Bm({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete role${["","s"]}`})),Jm={action:zm,reducer:Gm},Zm=Rc("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),Ym=Fm(Zm)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},qm((e=>e.rolesList))),Xm={action:Zm,reducer:Ym},Qm=Rc("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),ev=Fm(Qm)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},qm((e=>e.updateRole)),Bm({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>`}})),tv={action:Qm,reducer:ev},nv=Rc("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),iv={action:nv,reducer:Fm(nv)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},qm((e=>e.tenantPermissions)))},rv={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:[]},ov="/v1/mgmt/role/search",sv="/v1/mgmt/role/delete/batch",av="/v1/mgmt/role/create",dv="/v1/mgmt/role/update",lv="/v1/mgmt/permission/all",cv=e=>r(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)})),uv=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>r(void 0,[...i],void 0,(function*({page:i,limit:o=1e4,text:s,sort:a}={}){if(n)return((e,t)=>r(void 0,[e,t],void 0,(function*({text:e,sort:t},n){return new Promise((i=>{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 i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),i(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:o,text:s,sort:a},t);const d=yield e.post(ov,{limit:o,page:i,text:s,sort:a},{queryParams:{tenant:t}});return yield cv(d),(yield d.json()).roles})),deleteBatch:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){}));const o=yield e.post(sv,{roleNames:i},{queryParams:{tenant:t}});return yield cv(o),o.json()})),create:i=>r(void 0,[i],void 0,(function*({name:i,description:o,permissionNames:s}){if(n)return((e,t)=>r(void 0,[e,t],void 0,(function*({name:e,description:t,permissionNames:n},i){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:i})}))})))({name:i,description:o,permissionNames:s},t);const a=yield e.post(av,{name:i,description:o,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});return yield cv(a),yield a.json()})),update:i=>r(void 0,[i],void 0,(function*({name:i,newName:o,description:s,permissionNames:a}){if(n)return((e,t)=>r(void 0,[e,t],void 0,(function*({name:e,newName:t,description:n,permissionNames:i},r){return new Promise((o=>{o({name:t,description:n,permissionNames:i,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:i,newName:o,description:s,permissionNames:a},t);const d=yield e.post(dv,{name:i,newName:o,description:s,permissionNames:a,tenantId:t},{queryParams:{tenant:t}});yield cv(d);const l=yield d.json();return l.oldName=i,l}))}),hv=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>r(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(lv,{queryParams:{tenant:t}});return yield cv(i),i.json()}))}),gv=qi((e=>{var t,n,i,a;const d=Ti(Ls,Us,Ps,Ds,Lc,Ws({tenant:Ws.missingAttrValidator}))(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return o(this,n,"f")||o(this,t,"m",i).call(this),o(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{o(this,n,"f")&&o(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),s(this,n,((e,t,n,i)=>{const r=$i(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.3.7"}}));return{role:uv({httpClient:r.httpClient,tenant:t,mock:n}),tenant:hv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},a})),pv=qi((e=>{const t=Ti(Uc({name:"widget",initialState:rv,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Vm.reducer(e),tv.reducer(e),Jm.reducer(e),Xm.reducer(e),iv.reducer(e)},asyncActions:{searchRoles:Xm.action,createRole:Vm.action,updateRole:tv.action,deleteRoles:Jm.action,getTenantPermissions:iv.action}}),Ms,Ps,gv)(e);return class extends t{constructor(...e){super(...e),this.state=rv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),fv=qi((e=>{const t=Ti(Bs,Ws({"widget-id":Ws.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),mv=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,Ms,Qs,na,fv,pv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([o(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){const e=Mi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),vv=qi((e=>{var t,n,i,a,d;return d=class extends(Ti(pv,Nd,Wc,Ps,mv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),a.set(this,(()=>r(this,void 0,void 0,(function*(){var e;yield o(this,n,"f").setData(null===(e=Tm(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}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this)}))}},n=new WeakMap,a=new WeakMap,t=new WeakSet,i=function(){return r(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(Mi(yield this.fetchWidgetPage("create-role-modal.html"))),new yd((()=>{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)})),new yd((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>r(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))})))),s(this,n,new $d((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),o(this,a,"f").call(this)}))},d})),yv=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,vv,mv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new yd(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})),wv=qi((e=>{var t,n,i;return i=class extends(Ti(pv,Nd,Ps,mv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){var e;this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(Mi(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new yd((()=>{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 yd((()=>{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=Um(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new kd(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Dm(this.state);i.text=`Delete ${e}?`}}))},i})),bv=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,mv,pv,wv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.subscribe(o(this,i,"f").bind(this),Wm)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new yd(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()}))},s})),$v=qi((e=>{var t,n,a,d,l,c,u,h;return h=class extends(Ti(pv,Nd,Ps,Wc,mv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),l.set(this,(()=>r(this,void 0,void 0,(function*(){var e;yield o(this,n,"f").setData(null===(e=Tm(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),c.set(this,(()=>{var e;const t=null===(e=Um(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}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield o(this,t,"m",u).call(this)}))}},n=new WeakMap,l=new WeakMap,c=new WeakMap,t=new WeakSet,a=function(){new yd((()=>{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()))},d=function(){new yd((()=>{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,r=i(t,["name"]),o=null===(e=Um(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:o.name},r)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},u=function(){return r(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(Mi(yield this.fetchWidgetPage("edit-role-modal.html"))),o(this,t,"m",a).call(this),o(this,t,"m",d).call(this),s(this,n,new $d((()=>{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=()=>r(this,void 0,void 0,(function*(){yield o(this,l,"f").call(this),o(this,c,"f").call(this)}))}))},h})),_v=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,mv,pv,$v,Wc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.subscribe(o(this,i,"f").bind(this),Lm)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new yd(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()}))},s})),Sv=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,mv,pv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Fi((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Cd(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(o(this,n,"f"))},s})),kv={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},Cv=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(Ps,pv,Ad,Ms)(e)){constructor(){super(...arguments),t.add(this),s.set(this,Wi((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const s=o(this,t,"m",i).call(this,e);s.setContent(o(this,t,"m",n).call(this,{type:e,msg:r})),s.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(o(this,s,"f").bind(this),jm)}))}},s=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=kv[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"})},a})),xv=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(pv,Ps,mv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{this.rolesTable.data=e}))),s.set(this,Fi(((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}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{o(this,s,"f").call(this,e.target,e.detail)}))})),o(this,i,"f").call(this,Mm(this.state)),this.subscribe(o(this,i,"f").bind(this),Mm)}))}},i=new WeakMap,s=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new vd(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)))}))},a})),Iv=qi((e=>class extends(Ti(cd,ra,xv,yv,bv,_v,Sv,Cv)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Rv=Ti((e=>class extends(Iv(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Rv);var Ev=Object.freeze({__proto__:null,default:Rv});const Ov=e=>e.selectedAccessKeysIds,Nv=e=>e.notifications,Pv=Jl((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}))))),Av=Jl(Ov,Pv,((e,t)=>t.filter((t=>e.includes(t.id))))),jv=Jl(Ov,(e=>!!e.length)),Tv=Jl(Av,(e=>e.every((e=>e.editable)))),Mv=Jl(Tv,jv,((e,t)=>e&&t));Jl(Ov,(e=>1===e.length));const Uv=Jl(Av,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Wv=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)}))}))},Lv=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}}),Dv=({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)})}}),Fv=Rc("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),qv=Wv(Fv)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},Lv((e=>e.createAccessKey)),Dv({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>`}})),Bv={action:Fv,reducer:qv},Kv=Rc("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),Hv=Wv(Kv)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},Lv((e=>e.deleteAccessKey)),Dv({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),Vv={action:Kv,reducer:Hv},zv=Rc("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),Gv=Wv(zv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},Lv((e=>e.accessKeysList))),Jv={action:zv,reducer:Gv},Zv=Rc("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),Yv=Wv(Zv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},Lv((e=>e.activateAccessKey)),Dv({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),Xv={action:Zv,reducer:Yv},Qv=Rc("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),ey=Wv(Qv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},Lv((e=>e.deactivateAccessKey)),Dv({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),ty={action:Qv,reducer:ey},ny=Rc("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),iy={action:ny,reducer:Wv(ny)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Lv((e=>e.tenantRoles)))},ry={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:[]},oy="/v1/mgmt/accesskey/search",sy="/v1/mgmt/accesskey/delete/batch",ay="/v1/mgmt/accesskey/create",dy="/v1/mgmt/accesskey/deactivate/batch",ly="/v1/mgmt/accesskey/activate/batch",cy="/v1/mgmt/role/all",uy=e=>r(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)})),hy=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>r(void 0,[...i],void 0,(function*({page:i,limit:o=1e4,text:s,sort:a}={}){if(n)return((...e)=>r(void 0,[...e],void 0,(function*({text:e,sort:t}={}){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}`],permittedIps:["127.1.2.3"],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.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:s,sort:a});const d=yield e.post(oy,{limit:o,page:i,text:s,sort:a},{queryParams:{tenant:t}});return yield uy(d),(yield d.json()).keys})),deleteBatch:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){}));const o=yield e.post(sy,{ids:i},{queryParams:{tenant:t}});return yield uy(o),o.json()})),create:i=>r(void 0,[i],void 0,(function*({name:i,expiration:o,roleNames:s,userId:a,permittedIps:d}){const l=new Date;l.setDate(l.getDate()+ +o);const c="0"===o[0]?0:Math.floor(l.getTime()/1e3);if(n)return((e,t)=>r(void 0,[e,t],void 0,(function*({name:e,roleNames:t,userId:n,permittedIps:i},r){const o=Math.random().toString(10).substring(15);return new Promise((s=>{s({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:r,createdTime:(new Date).getTime()/1e3,roleNames:t,permittedIps:i,status:"active",clientId:`Client ID ${o}`,boundUserId:n||`User ${o}`}})}))})))({name:i,expiration:o,roleNames:s,userId:a,permittedIps:d},c);const u=yield e.post(ay,{name:i,expireTime:c,roleNames:s,userId:a,permittedIps:d},{queryParams:{tenant:t}});return yield uy(u),yield u.json()})),activate:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){}));const o=yield e.post(ly,{ids:i},{queryParams:{tenant:t}});return yield uy(o),yield o.json()})),deactivate:i=>r(void 0,void 0,void 0,(function*(){if(n)return r(void 0,void 0,void 0,(function*(){}));const o=yield e.post(dy,{ids:i},{queryParams:{tenant:t}});return yield uy(o),yield o.json()}))}),gy=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>r(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(cy,{queryParams:{tenant:t}});return yield uy(i),i.json()}))}),py=qi((e=>{var t,n,i,a;const d=Ti(Ls,Us,Ps,Ds,Lc,Ws({tenant:Ws.missingAttrValidator}))(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return o(this,n,"f")||o(this,t,"m",i).call(this),o(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{o(this,n,"f")&&o(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),s(this,n,((e,t,n,i)=>{const r=$i(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.4.7"}}));return{accesskey:hy({httpClient:r.httpClient,tenant:t,mock:n}),tenant:gy({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},a})),fy=qi((e=>{const t=Ti(Uc({name:"widget",initialState:ry,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Bv.reducer(e),Vv.reducer(e),Jv.reducer(e),Xv.reducer(e),ty.reducer(e),iy.reducer(e)},asyncActions:{searchAccessKeys:Jv.action,createAccessKey:Bv.action,activateAccessKeys:Xv.action,deactivateAccessKeys:ty.action,deleteAccessKeys:Vv.action,getTenantRoles:iy.action}}),Ms,Ps,py)(e);return class extends t{constructor(...e){super(...e),this.state=ry,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),my=qi((e=>{const t=Ti(Bs,Ws({"widget-id":Ws.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),vy=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,Ms,Qs,na,my,fy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([o(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){const e=Mi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),yy=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(fy,Ps,vy)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{this.accessKeysTable.data=e}))),s.set(this,Fi(((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}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{o(this,s,"f").call(this,e.target,e.detail)}))})),o(this,i,"f").call(this,Pv(this.state)),this.subscribe(o(this,i,"f").bind(this),Pv)}))}},i=new WeakMap,s=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new vd(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)))}))},a})),wy=qi((e=>{var t,n,i;return i=class extends(Ti(fy,Nd,Ps,vy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){var e;this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(Mi(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new yd((()=>{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 yd((()=>{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=Av(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new kd(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Uv(this.state);i.text=`Activate ${e}?`}}))},i})),by=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,vy,fy,wy)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.subscribe(o(this,i,"f").bind(this),Mv)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new yd(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()}))},s})),$y=qi((e=>{var t,n,i;return i=class extends(Ti(fy,Nd,Wc,Ps,vy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(Mi(yield this.fetchWidgetPage("created-access-key-modal.html"))),new yd((()=>{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})),_y=qi((e=>{var t,n,i,a,d;return d=class extends(Ti(fy,Nd,Wc,Ps,vy,$y)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),a.set(this,(()=>r(this,void 0,void 0,(function*(){var e,t;yield o(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}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this)}))}},n=new WeakMap,a=new WeakMap,t=new WeakSet,i=function e(){return r(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(Mi(yield this.fetchWidgetPage("create-access-key-modal.html"))),new yd((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)})),new yd((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>r(this,void 0,void 0,(function*(){var e,t;if(this.validateForm(this.createAccessKeyModal.ele)){const n=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),(null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext)&&(this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(t=null==n?void 0:n.payload)||void 0===t?void 0:t.cleartext}),this.createdAccessKeyModal.open())}})))),s(this,n,new $d((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),o(this,a,"f").call(this),this.createAccessKeyModal.afterClose=()=>{o(this,t,"m",e).call(this)}}))},d})),Sy=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,_y,vy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new yd(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})),ky=qi((e=>{var t,n,i;return i=class extends(Ti(fy,Nd,Ps,vy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){var e;this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(Mi(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new yd((()=>{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 yd((()=>{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=Av(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new kd(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Uv(this.state);i.text=`Deactivate ${e}?`}}))},i})),Cy=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,vy,fy,ky)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.subscribe(o(this,i,"f").bind(this),Mv)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new yd(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()}))},s})),xy=qi((e=>{var t,n,i;return i=class extends(Ti(fy,Nd,Ps,vy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){var e;this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(Mi(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new yd((()=>{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 yd((()=>{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=Av(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new kd(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Uv(this.state);i.text=`Delete ${e}?`}}))},i})),Iy=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,vy,fy,xy)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),this.subscribe(o(this,i,"f").bind(this),Mv)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new yd(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()}))},s})),Ry=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,vy,fy)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Fi((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Cd(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(o(this,n,"f"))},s})),Ey={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},Oy=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(Ps,fy,Ad,Ms)(e)){constructor(){super(...arguments),t.add(this),s.set(this,Wi((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const s=o(this,t,"m",i).call(this,e);s.setContent(o(this,t,"m",n).call(this,{type:e,msg:r})),s.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(o(this,s,"f").bind(this),Nv)}))}},s=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Ey[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"})},a})),Ny=qi((e=>class extends(Ti(cd,ra,yy,Sy,Iy,Ry,by,Cy,Oy)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Py=Ti((e=>class extends(Ny(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Py);var Ay=Object.freeze({__proto__:null,default:Py});const jy=(e,t)=>t?{[e]:t}:{},Ty=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},My=e=>e.selectedAuditId,Uy=Jl((e=>e.auditList.data),(e=>e.map((e=>{const t=e||{},{occurred:n,ID:r,type:o}=t,s=t.data,a=void 0===s?{saml_request:"",saml_response:"",saml_generated_user:"",saml_generated_roles:"",oidc_response:"",oidc_generated_user:""}:s,{saml_request:d,saml_response:l,saml_generated_user:c,saml_generated_roles:u,oidc_response:h,oidc_generated_user:g}=a,p=i(a,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user"]),f=i(t,["occurred","ID","type","data"]);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},f),{data:p}),jy("type",(m=o)&&m[0].toUpperCase()+m.slice(1))),jy("saml_request",d)),jy("saml_response",l)),jy("saml_generated_user",Ty(c))),jy("saml_generated_roles",Ty(u))),jy("oidc_response",Ty(h))),jy("oidc_generated_user",Ty(g))),{occurredFormatted:n?new Date(Number(n)||0).toLocaleString():"N/A"});var m}))));Jl(My,Uy,((e,t)=>t.find((t=>e===t.id)))),Jl(My,(e=>!!e));const Wy=Rc("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),Ly=(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)}))}))})(Wy)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Dy=e=>e.auditList,{onFulfilled:e=>{Dy(e).loading=!1},onPending:e=>{Dy(e).loading=!0,Dy(e).error=null},onRejected:(e,t)=>{Dy(e).loading=!1,Dy(e).error=t.error}}));var Dy;const Fy={action:Wy,reducer:Ly},qy={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},By="/v1/mgmt/audit/search",Ky=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>r(void 0,[...i],void 0,(function*({page:i,limit:o=1e4,text:s,sort:a,from:d}={}){if(n)return(e=>r(void 0,[e],void 0,(function*({text:e,sort:t}){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,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.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:s,sort:a});const l=yield e.post(By,{limit:o,page:i,text:s,sort:a,from:d},{queryParams:{tenant:t}});return yield(e=>r(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)})))(l),(yield l.json()).audits}))}),Hy=qi((e=>{var t,n,i,a;const d=Ti(Ls,Us,Ps,Ds,Lc,Ws({tenant:Ws.missingAttrValidator}))(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return o(this,n,"f")||o(this,t,"m",i).call(this),o(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{o(this,n,"f")&&o(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),s(this,n,((e,t,n,i)=>{const r=$i(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.4.7"}}));return{audit:Ky({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},a})),Vy=qi((e=>{const t=Ti(Uc({name:"widget",initialState:qy,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Fy.reducer(e)},asyncActions:{searchAudit:Fy.action}}),Ms,Ps,Hy)(e);return class extends t{constructor(...e){super(...e),this.state=qy,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),zy=qi((e=>{const t=Ti(Bs,Ws({"widget-id":Ws.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Gy=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,Ms,Qs,na,zy,Vy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([o(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){const e=Mi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Jy=qi((e=>{var t,n,i,s,a;return a=class extends(Ti(Ps,Gy,Vy)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Fi((()=>{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}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",i).call(this),o(this,t,"m",s).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Cd(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(o(this,n,"f")),o(this,n,"f").call(this)},s=function(){var e;this.rangeInput=new _d(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(o(this,n,"f"))},a})),Zy=qi((e=>{var t,n,i,s;return s=class extends(Ti(Vy,Ps,Gy)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Wi((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),o(this,t,"m",n).call(this),o(this,i,"f").call(this,Uy(this.state)),this.subscribe(o(this,i,"f").bind(this),Uy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new vd(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)))}))},s})),Yy=qi((e=>class extends(Ti(cd,ra,Zy,Jy)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Xy=Ti((e=>class extends(Yy(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Xy);var Qy=Object.freeze({__proto__:null,default:Xy});const ew=(e={})=>{const t=Mi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(Li(e),n)})),t};function tw(e){return new URLSearchParams(window.location.search).get(e)}const nw=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)}))}))},iw=Rc("users/me",((e,{extra:{api:t}})=>t.user.me())),rw=nw(iw)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(ow=e=>e.me,{onFulfilled:e=>{ow(e).loading=!1},onPending:e=>{ow(e).loading=!0,ow(e).error=null},onRejected:(e,t)=>{ow(e).loading=!1,ow(e).error=t.error}}));var ow;const sw={action:iw,reducer:rw},aw=Rc("users/logout",((e,{extra:{api:t}})=>t.user.logout())),dw={action:aw,reducer:nw(aw)({})},lw={me:{loading:!1,error:null,data:{}}},cw="/v1/auth/me",uw=({httpClient:e,mock:t})=>({me:()=>r(void 0,void 0,void 0,(function*(){if(t)return r(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(cw);return yield(e=>r(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()}))}),hw=qi((e=>{var t,n,i,a;const d=Ti(Ls,Us,Ps,Ds,Lc)(e);return a=class extends d{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 o(this,n,"f")||o(this,t,"m",i).call(this),o(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{o(this,n,"f")&&o(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),s(this,n,((e,t,n)=>{const i=$i(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.4.3"}}));return{user:Object.assign(Object.assign({},uw({httpClient:i.httpClient,mock:t})),{logout:t?()=>r(void 0,void 0,void 0,(function*(){})):i.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},a})),gw=qi((e=>{const t=Ti(Uc({name:"widget",initialState:lw,reducers:{},extraReducers:e=>{sw.reducer(e),dw.reducer(e)},asyncActions:{getMe:sw.action,logout:dw.action}}),Ms,Ps,hw)(e);return class extends t{constructor(...e){super(...e),this.state=lw,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),pw="widget-flow",fw=qi((e=>{var t,n,i;return i=class extends(Ti(Ms,Nd,gw,Lc,Ps)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=tw(pw);r&&(function(e){if(window.history.replaceState&&tw(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())}}(pw),o(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(ew({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),new Ed((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},i})),mw=e=>e.me.data,vw=Jl(mw,(e=>e.picture)),yw=Jl(mw,(e=>e.email)),ww=Jl(mw,(e=>e.verifiedEmail)),bw=Jl(mw,(e=>e.name)),$w=Jl(mw,(e=>e.phone)),_w=Jl(mw,(e=>e.verifiedPhone)),Sw=Jl(mw,(e=>e.webauthn));Jl(mw,(e=>e.password));const kw=Jl(mw,(e=>e.TOTP)),Cw=Jl(mw,(e=>e.customAttributes)),xw=qi((e=>{const t=Ti(Bs,Ws({"widget-id":Ws.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Iw=qi((e=>{var t,n,i;return i=class extends(Ti(Ps,Ms,Qs,na,xw,gw)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),o(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){const e=Mi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Rw=qi((e=>class extends(Ti(ra,Us)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),Ew=qi((e=>{var t,n,i,a,d,l,c,u,h;return h=class extends(Ti(Rw,ra,gw,Ps,Lc,Iw,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),c.set(this,Wi((e=>{this.avatar.image=e}))),u.set(this,Wi((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",l).call(this),o(this,t,"m",a).call(this),o(this,c,"f").call(this,vw(this.state)),o(this,u,"f").call(this,bw(this.state)),this.subscribe(o(this,c,"f").bind(this),vw),this.subscribe(o(this,u,"f").bind(this),bw)}))}},n=new WeakMap,i=new WeakMap,c=new WeakMap,u=new WeakMap,t=new WeakSet,a=function(){this.avatar.flowId&&(s(this,n,this.createModal({"data-id":"update-pic"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",d).bind(this),o(this,t,"m",d).call(this),this.syncFlowTheme(o(this,i,"f")))},d=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close(),this.actions.getMe()}))},l=function(){this.avatar=new xd((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()}))},h})),Ow=qi((e=>{var t,n,i,a,d,l,c,u,h,g,p,f,m;return m=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,void 0),d.set(this,void 0),p.set(this,Wi((e=>{this.emailUserAttr.value=e}))),f.set(this,Wi((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",g).call(this),o(this,t,"m",l).call(this),o(this,t,"m",u).call(this),o(this,p,"f").call(this,yw(this.state)),o(this,f,"f").call(this,ww(this.state)),this.subscribe(o(this,p,"f").bind(this),yw),this.subscribe(o(this,f,"f").bind(this),ww)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakMap,t=new WeakSet,l=function(){this.emailUserAttr.editFlowId&&(s(this,n,this.createModal({"data-id":"edit-email"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",c).bind(this),o(this,t,"m",c).call(this),this.syncFlowTheme(o(this,i,"f")))},c=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.emailUserAttr.deleteFlowId&&(s(this,a,this.createModal({"data-id":"delete-email"}),"f"),s(this,d,new Ed((()=>{var e;return null===(e=o(this,a,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,a,"f").afterClose=o(this,t,"m",h).bind(this),o(this,t,"m",h).call(this),this.syncFlowTheme(o(this,d,"f")))},h=function(){o(this,a,"f").setContent(ew({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),o(this,d,"f").onSuccess((()=>{o(this,a,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr=new Id((()=>{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((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=o(this,a,"f"))||void 0===e||e.open()}))},m})),Nw=qi((e=>{var t,n,i;return i=class extends(Ti(gw,Ps,Iw,Nd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),o(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new yd((()=>{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((()=>r(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},i})),Pw=qi((e=>{var t,n,i,a,d,l,c,u,h,g,p,f;return f=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,void 0),d.set(this,void 0),p.set(this,Wi((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",g).call(this),o(this,t,"m",l).call(this),o(this,t,"m",u).call(this),o(this,p,"f").call(this,bw(this.state)),this.subscribe(o(this,p,"f").bind(this),bw)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,p=new WeakMap,t=new WeakSet,l=function(){this.nameUserAttr.editFlowId&&(s(this,n,this.createModal({"data-id":"edit-name"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",c).bind(this),o(this,t,"m",c).call(this),this.syncFlowTheme(o(this,i,"f")))},c=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.nameUserAttr.deleteFlowId&&(s(this,a,this.createModal({"data-id":"delete-name"}),"f"),s(this,d,new Ed((()=>{var e;return null===(e=o(this,a,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,a,"f").afterClose=o(this,t,"m",h).bind(this),o(this,t,"m",h).call(this),this.syncFlowTheme(o(this,d,"f")))},h=function(){o(this,a,"f").setContent(ew({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,d,"f").onSuccess((()=>{o(this,a,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr=new Id((()=>{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((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=o(this,a,"f"))||void 0===e||e.open()}))},f})),Aw=qi((e=>{var t,n,i,a,d,l,c,u;return u=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),c.set(this,Wi((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",l).call(this),o(this,t,"m",a).call(this),o(this,c,"f").call(this,Sw(this.state)),this.subscribe(o(this,c,"f").bind(this),Sw)}))}},n=new WeakMap,i=new WeakMap,c=new WeakMap,t=new WeakSet,a=function(){this.passkeyUserAuthMethod.flowId&&(s(this,n,this.createModal({"data-id":"passkey"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",d).bind(this),o(this,t,"m",d).call(this),this.syncFlowTheme(o(this,i,"f")))},d=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close(),this.actions.getMe()}))},l=function(){this.passkeyUserAuthMethod=new Rd((()=>{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((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()}))},u})),jw=qi((e=>{var t,n,i,a,d,l;return l=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new Rd((()=>{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((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.initPasswordAuthMethod(),o(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,a=function(){this.passwordUserAuthMethod.flowId&&(s(this,n,this.createModal({"data-id":"password"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",d).bind(this),o(this,t,"m",d).call(this),this.syncFlowTheme(o(this,i,"f")))},d=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close()}))},l})),Tw=qi((e=>{var t,n,i,a,d,l,c,u,h,g,p,f,m;return m=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,void 0),d.set(this,void 0),p.set(this,Wi((e=>{this.phoneUserAttr.value=e}))),f.set(this,Wi((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",g).call(this),o(this,t,"m",l).call(this),o(this,t,"m",u).call(this),o(this,p,"f").call(this,$w(this.state)),o(this,f,"f").call(this,_w(this.state)),this.subscribe(o(this,p,"f").bind(this),$w),this.subscribe(o(this,f,"f").bind(this),_w)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakMap,t=new WeakSet,l=function(){this.phoneUserAttr.editFlowId&&(s(this,n,this.createModal({"data-id":"edit-phone"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",c).bind(this),o(this,t,"m",c).call(this),this.syncFlowTheme(o(this,i,"f")))},c=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.phoneUserAttr.deleteFlowId&&(s(this,a,this.createModal({"data-id":"delete-phone"}),"f"),s(this,d,new Ed((()=>{var e;return null===(e=o(this,a,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,a,"f").afterClose=o(this,t,"m",h).bind(this),o(this,t,"m",h).call(this),this.syncFlowTheme(o(this,d,"f")))},h=function(){o(this,a,"f").setContent(ew({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,d,"f").onSuccess((()=>{o(this,a,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr=new Id((()=>{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((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=o(this,a,"f"))||void 0===e||e.open()}))},m}));var Mw;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(Mw||(Mw={}));const Uw=qi((e=>{var t,n,i,s,a,d,l,c,u,h,g;return n=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,{}),s.set(this,{}),a.set(this,{}),d.set(this,{}),u.set(this,Wi((e=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),s=i.getAttribute("data-type")||Mw.TEXT,a=e[r],d=new Id(i,{logger:this.logger});d.value=n.getFormattedValue(s,a),o(this,t,"m",h).call(this,i,r,d),o(this,t,"m",g).call(this,i,r,d)}))})))}static getFormattedValue(e,t){return e===Mw.DATE&&t?new Date(t).toLocaleString():e===Mw.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),o(this,u,"f").call(this,Cw(this.state)),this.subscribe(o(this,u,"f").bind(this),Cw)}))}},i=new WeakMap,s=new WeakMap,a=new WeakMap,d=new WeakMap,u=new WeakMap,t=new WeakSet,l=function(e){var t,n;null===(t=o(this,i,"f")[e])||void 0===t||t.setContent(ew({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),null===(n=o(this,s,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=o(this,i,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},c=function(e){var t,n;null===(t=o(this,a,"f")[e])||void 0===t||t.setContent(ew({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),null===(n=o(this,d,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=o(this,a,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},h=function(e,n,r){const a=e.getAttribute("edit-flow-id");a&&(o(this,i,"f")[a]=this.createModal({"data-id":`edit-${n}`}),o(this,s,"f")[a]=new Ed((()=>{var e,t;return null===(t=null===(e=o(this,i,"f")[a])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),o(this,i,"f")[a].afterClose=o(this,t,"m",l).bind(this,a),r.onEditClick((()=>{var e,t;null===(t=null===(e=o(this,i,"f"))||void 0===e?void 0:e[a])||void 0===t||t.open()})),o(this,t,"m",l).call(this,a),this.syncFlowTheme(o(this,s,"f")[a]))},g=function(e,n,i){const r=e.getAttribute("delete-flow-id");r&&(o(this,a,"f")[r]=this.createModal({"data-id":`delete-${n}`}),o(this,d,"f")[r]=new Ed((()=>{var e,t;return null===(t=null===(e=o(this,a,"f")[r])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),o(this,a,"f")[r].afterClose=o(this,t,"m",c).bind(this,r),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=o(this,a,"f"))||void 0===e?void 0:e[r])||void 0===t||t.open()})),o(this,t,"m",c).call(this,r),this.syncFlowTheme(o(this,d,"f")[r]))},n})),Ww=qi((e=>{var t,n,i,a,d,l,c,u;return u=class extends(Ti(Rw,gw,Ps,Iw,Lc,Nd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),c.set(this,Wi((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),o(this,t,"m",l).call(this),o(this,t,"m",a).call(this),o(this,c,"f").call(this,kw(this.state)),this.subscribe(o(this,c,"f").bind(this),kw)}))}},n=new WeakMap,i=new WeakMap,c=new WeakMap,t=new WeakSet,a=function(){this.totpUserAuthMethod.flowId&&(s(this,n,this.createModal({"data-id":"totp"}),"f"),s(this,i,new Ed((()=>{var e;return null===(e=o(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),o(this,n,"f").afterClose=o(this,t,"m",d).bind(this),o(this,t,"m",d).call(this),this.syncFlowTheme(o(this,i,"f")))},d=function(){o(this,n,"f").setContent(ew({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName})),o(this,i,"f").onSuccess((()=>{o(this,n,"f").close(),this.actions.getMe()}))},l=function(){this.totpUserAuthMethod=new Rd((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onButtonClick((()=>{var e;null===(e=o(this,n,"f"))||void 0===e||e.open()}))},u})),Lw=qi((e=>class extends(Ti(cd,ra,fw,Uw,Ow,Ew,Pw,Tw,Aw,jw,jw,Ww,Nw)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Dw=Ti((e=>class extends(Lw(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),(customElements.get("descope-wc")||(yield Promise.resolve().then((function(){return ld})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.4.3"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Dw);var Fw,qw=Object.freeze({__proto__:null,default:Dw});!function(e){e.oidc="oidc",e.saml="saml"}(Fw||(Fw={}));const Bw=Jl((e=>e.ssoAppsList.data),(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===Fw.saml))})),Kw=Jl(Bw,(e=>e.map((e=>({name:e.name,icon:e.logo,url:e.samlSettings.idpInitiatedUrl}))))),Hw=Rc("ssoApps/load",((e,{extra:{api:t}})=>t.ssoApps.load())),Vw=(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)}))}))})(Hw)({onFulfilled:(e,t)=>{var n;e.ssoAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},(zw=e=>e.ssoAppsList,{onFulfilled:e=>{zw(e).loading=!1},onPending:e=>{zw(e).loading=!0,zw(e).error=null},onRejected:(e,t)=>{zw(e).loading=!1,zw(e).error=t.error}}));var zw;const Gw={action:Hw,reducer:Vw},Jw={ssoAppsList:{data:[],loading:!1,error:null}},Zw="/v1/mgmt/sso/idp/apps/load",Yw=({httpClient:e,mock:t})=>({load:()=>r(void 0,void 0,void 0,(function*(){if(t)return r(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:[{id:"ssoapp1",name:"App 1",description:"This is the first SAML app",enabled:!0,appType:Fw.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:Fw.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:Fw.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}}]})}))}));const n=yield e.get(Zw);return yield(e=>r(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()}))}),Xw=qi((e=>{var t,n,i,a;const d=Ti(Ls,Us,Ps,Lc,Ds)(e);return a=class extends d{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 o(this,n,"f")||o(this,t,"m",i).call(this),o(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{o(this,n,"f")&&o(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),s(this,n,((e,t,n)=>{const i=$i(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"applications-portal-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.3.7"}}));return{ssoApps:Yw({httpClient:i.httpClient,mock:t})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},a})),Qw=qi((e=>{const t=Ti(Uc({name:"widget",initialState:Jw,reducers:{},extraReducers:e=>{Gw.reducer(e)},asyncActions:{loadSSOApps:Gw.action}}),Ms,Ps,Xw)(e);return class extends t{constructor(...e){super(...e),this.state=Jw,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),eb=qi((e=>{const t=Ti(Bs,Ws({"widget-id":Ws.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${e}`,"text")).body}))}}})),tb=qi((e=>{var t,n,i,s;return s=class extends(Ti(Ps,Ms,Qs,na,eb,Qw)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this);const[s]=yield Promise.all([o(this,t,"m",n).call(this),this.actions.loadSSOApps()]);o(this,t,"m",i).call(this,s),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return r(this,void 0,void 0,(function*(){const e=Mi(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},s})),nb=qi((e=>{var t,n,i;return i=class extends(Ti(Qw,Ps,tb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return r(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),o(this,t,"m",n).call(this,Kw(this.state))}))}},t=new WeakSet,n=function(e){this.appsList=new Od((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=e},i})),ib=qi((e=>class extends(Ti(cd,ra,nb)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return r(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),rb=Ti((e=>class extends(ib(e)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",rb);var ob=Object.freeze({__proto__:null,default:rb});const sb=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o: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!==(a=i.bottom)&&void 0!==a?a:0))]};var ab,db,lb,cb,ub,hb,gb,pb,fb,mb,vb;const yb=document.createElement("template");yb.innerHTML='\n<div 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 wb extends HTMLElement{constructor(){super(),ab.add(this),db.set(this,new vs({messages:[]})),lb.set(this,void 0),cb.set(this,void 0),ub.set(this,void 0),hb.set(this,{resize:o(this,ab,"m",vb).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(yb.content.cloneNode(!0)),s(this,lb,this.shadowRoot.querySelector(".debugger"),"f"),s(this,cb,o(this,lb,"f").querySelector(".content"),"f"),s(this,ub,o(this,lb,"f").querySelector(".header"),"f"),o(this,ab,"m",gb).call(this)}updateData(e){o(this,db,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=sb(e,e.offsetLeft-i,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(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(o(this,lb,"f"),o(this,ub,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",o(this,hb,"f").resize),(e=>{e.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}})(o(this,lb,"f")),o(this,lb,"f").onresize=o(this,ab,"m",mb).bind(this),o(this,db,"f").subscribe(o(this,ab,"m",pb).bind(this))}disconnectedCallback(){o(this,db,"f").unsubscribeAll(),window.removeEventListener("resize",o(this,hb,"f").resize)}}db=new WeakMap,lb=new WeakMap,cb=new WeakMap,ub=new WeakMap,hb=new WeakMap,ab=new WeakSet,gb=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync('\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'),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n],o(this,lb,"f").style.top="32px",o(this,lb,"f").style.left=window.innerWidth-300-32+"px"},pb=function(e){o(this,ab,"m",fb).call(this,e),o(this,ab,"m",mb).call(this)},fb=function(e){o(this,cb,"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("")},mb=function(){o(this,cb,"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)}))},vb=function(){const[e,t]=sb(o(this,lb,"f"),Number.parseInt(o(this,lb,"f").style.left,10),Number.parseInt(o(this,lb,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});o(this,lb,"f").style.top=`${t}px`,o(this,lb,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",wb);var bb=Object.freeze({__proto__:null,default:wb});var $b=Object.freeze({__proto__:null,default:(e,t,n)=>r(void 0,void 0,void 0,(function*(){const{siteId:t}=e,i='\n(function () {\nvar merchantConfig = {\n csp: false\n};\n\nvar siteId = "{{SITE_ID}}";\nfunction t(t,n){for(var e=t.split(""),r=0;r<e.length;++r)e[r]=String.fromCharCode(e[r].charCodeAt(0)+n);return e.join("")}function n(n){return t(n,-L).replace(/%SN%/g,siteId)}function e(){var t="no"+"op"+"fn",n="g"+"a",e="n"+"ame";return window[n]&&window[n][e]===t}function r(){return!(!navigator.brave||"function"!=typeof navigator.brave.isBrave)}function o(){return document.currentScript&&document.currentScript.src}function i(t){try{if("number"==typeof t&&window.location&&window.location.pathname){for(var n=window.location.pathname.split("/"),e=[],r=0;r<=Math.min(n.length-1,Math.abs(t));r++)e.push(n[r]);return e.join("/")||"/"}}catch(t){}return"/"}function c(t){try{G.ex=t,e()&&-1===G.ex.indexOf(B.uB)&&(G.ex+=B.uB),r()&&-1===G.ex.indexOf(B.uBr)&&(G.ex+=B.uBr),o()&&-1===G.ex.indexOf(B.nIL)&&(G.ex+=B.nIL),window.ftr__snp_cwc||(G.ex+=B.s),M(G)}catch(t){}}function a(t,n){function e(o){try{o.blockedURI===t&&(n(),document.removeEventListener(r,e))}catch(t){document.removeEventListener(r,e)}}var r="securitypolicyviolation";document.addEventListener(r,e),setTimeout(function(){document.removeEventListener(r,e)},2*60*1e3)}function u(t,n,e,r){var o=!1;t="https://"+t,a(t,function(){r(!0),o=!0});var i=document.createElement("script");i.onerror=function(){if(!o)try{r(!1),o=!0}catch(t){}},i.onload=e,i.type="text/javascript",i.id="ftr__script",i.async=!0,i.src=t;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(i,c)}function f(){J(B.uDF),setTimeout(h,I,B.uDF)}function d(t,n,e,r){var o=!1,i=new XMLHttpRequest;if(a("https:"+t,function(){e(new Error("CSP Violation"),!0),o=!0}),"//"===t.slice(0,2)&&(t="https:"+t),"withCredentials"in i)i.open("GET",t,!0);else{if("undefined"==typeof XDomainRequest)return;i=new XDomainRequest,i.open("GET",t)}Object.keys(r).forEach(function(t){i.setRequestHeader(t,r[t])}),i.onload=function(){"function"==typeof n&&n(i)},i.onerror=function(t){if("function"==typeof e&&!o)try{e(t,!1),o=!0}catch(t){}},i.onprogress=function(){},i.ontimeout=function(){"function"==typeof e&&e("tim"+"eo"+"ut",!1)},setTimeout(function(){i.send()},0)}function s(t,siteId,n){function e(t){var n=t.toString(16);return n.length%2?"0"+n:n}function r(t){if(t<=0)return"";for(var n="0123456789abcdef",e="",r=0;r<t;r++)e+=n[Math.floor(Math.random()*n.length)];return e}function o(t){for(var n="",r=0;r<t.length;r++)n+=e(t.charCodeAt(r));return n}function i(t){for(var n=t.split(""),e=0;e<n.length;++e)n[e]=String.fromCharCode(255^n[e].charCodeAt(0));return n.join("")}n=n?"1":"0";var c=[];return c.push(t),c.push(siteId),c.push(n),function(t){var n=40,e="";return t.length<n/2&&(e=","+r(n/2-t.length-1)),o(i(t+e))}(c.join(","))}function w(){function t(){D&&(J(B.dUAL),setTimeout(h,I,B.dUAL))}function n(t,n){c(n?B.uAS+B.uF+B.cP:B.uAS+B.uF)}window.ftr__fdad(t,n)}function h(t){try{var n;switch(t){case B.uFP:n=q;break;case B.uDF:n=E;break;default:n=D}if(!n)return;u(n,void 0,function(){try{K(),c(t+B.uS)}catch(t){}},function(n){try{K(),G.td=1*new Date-G.ts,c(n?t+B.uF+B.cP:t+B.uF),t===B.uFP&&f(),t===B.uDF&&w()}catch(t){c(B.eUoe)}})}catch(n){c(t+B.eTlu)}}var m="22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv",v="fort",l="erTo",p="ken";window.ftr__config={m:merchantConfig,s:"23",si:siteId};var g=!1,_=v+l+p,y=400*24*60,T=10,k={write:function(t,n,e,r){void 0===r&&(r=!0);var o=0;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.ckDepth&&(o=window.ftr__config.m.ckDepth);var c,a,u=i(o);if(e?(c=new Date,c.setTime(c.getTime()+60*e*1e3),a="; expires="+c.toGMTString()):a="",!r)return void(document.cookie=escape(t)+"="+escape(n)+a+"; path="+u);for(var f=1,d=document.domain.split("."),s=T,w=!0;w&&d.length>=f&&s>0;){var h=d.slice(-f).join(".");document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h;var m=k.read(t);null!=m&&m==n||(h="."+h,document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h),w=-1===document.cookie.indexOf(t+"="+n),f++,s--}},read:function(t){var n=null;try{for(var e=escape(t)+"=",r=document.cookie.split(";"),o=32,i=0;i<r.length;i++){for(var c=r[i];c.charCodeAt(0)===o;)c=c.substring(1,c.length);0===c.indexOf(e)&&(n=unescape(c.substring(e.length,c.length)))}}finally{return n}}},S=window.ftr__config.s;S+="ck";var x=function(t){var n=!1,e=null,r=function(){try{if(!e||!n)return;e.remove&&"function"==typeof e.remove?e.remove():document.head.removeChild(e),n=!1}catch(t){}};document.head&&(!function(){e=document.createElement("link"),e.setAttribute("rel","pre"+"con"+"nect"),e.setAttribute("cros"+"sori"+"gin","anonymous"),e.onload=r,e.onerror=r,e.setAttribute("href",t),document.head.appendChild(e),n=!0}(),setTimeout(r,3e3))},L=3,A=n(m||"22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv"),F=t("[0Uhtxhvw0LG",-L),U=t("[0Fruuhodwlrq0LG",-L),b=t("Li0Qrqh0Pdwfk",-L),D,C="fgq71iruwhu1frp",E=n("(VQ(1"+C+"2vq2(VQ(2vfulsw1mv"),V=n("(VQ(1"+C+"2vqV2(VQ(2vfulsw1mv"),q;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.fpi&&(q=window.ftr__config.m.fpi+n("2vq2(VQ(2vfulsw1mv"));var I=10;window.ftr__startScriptLoad=1*new Date;var R=function(t){var n="ft"+"r:tok"+"enR"+"eady";window.ftr__tt&&clearTimeout(window.ftr__tt),window.ftr__tt=setTimeout(function(){try{delete window.ftr__tt,t+="_tt";var e=document.createEvent("Event");e.initEvent(n,!1,!1),e.detail=t,document.dispatchEvent(e)}catch(t){}},1e3)},M=function(t){var n=function(t){return t||""},e=n(t.id)+"_"+n(t.ts)+"_"+n(t.td)+"_"+n(t.ex)+"_"+n(S),r=y;!isNaN(window.ftr__config.m.ckTTL)&&window.ftr__config.m.ckTTL&&(r=window.ftr__config.m.ckTTL),k.write(_,e,r,!0),R(e),window.ftr__gt=e},P=function(){var t=k.read(_)||"",n=t.split("_"),e=function(t){return n[t]||void 0};return{id:e(0),ts:e(1),td:e(2),ex:e(3),vr:e(4)}},j=function(){for(var t={},n="fgu",e=[],r=0;r<256;r++)e[r]=(r<16?"0":"")+r.toString(16);var o=function(t,n,r,o,i){var c=i?"-":"";return e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+c+e[255&n]+e[n>>8&255]+c+e[n>>16&15|64]+e[n>>24&255]+c+e[63&r|128]+e[r>>8&255]+c+e[r>>16&255]+e[r>>24&255]+e[255&o]+e[o>>8&255]+e[o>>16&255]+e[o>>24&255]},i=function(){if(window.Uint32Array&&window.crypto&&window.crypto.getRandomValues){var t=new window.Uint32Array(4);return window.crypto.getRandomValues(t),{d0:t[0],d1:t[1],d2:t[2],d3:t[3]}}return{d0:4294967296*Math.random()>>>0,d1:4294967296*Math.random()>>>0,d2:4294967296*Math.random()>>>0,d3:4294967296*Math.random()>>>0}},c=function(){var t="",n=function(t,n){for(var e="",r=t;r>0;--r)e+=n.charAt(1e3*Math.random()%n.length);return e};return t+=n(2,"0123456789"),t+=n(1,"123456789"),t+=n(8,"0123456789")};return t.safeGenerateNoDash=function(){try{var t=i();return o(t.d0,t.d1,t.d2,t.d3,!1)}catch(t){try{return n+c()}catch(t){}}},t.isValidNumericalToken=function(t){return t&&t.toString().length<=11&&t.length>=9&&parseInt(t,10).toString().length<=11&&parseInt(t,10).toString().length>=9},t.isValidUUIDToken=function(t){return t&&32===t.toString().length&&/^[a-z0-9]+$/.test(t)},t.isValidFGUToken=function(t){return 0==t.indexOf(n)&&t.length>=12},t}(),B={uDF:"UDF",dUAL:"dUAL",uAS:"UAS",uFP:"UFP",mLd:"1",eTlu:"2",eUoe:"3",uS:"4",uF:"9",tmos:["T5","T10","T15","T30","T60"],tmosSecs:[5,10,15,30,60],bIR:"43",uB:"u",uBr:"b",cP:"c",nIL:"i",s:"s"};try{var G=P();try{G.id&&(j.isValidNumericalToken(G.id)||j.isValidUUIDToken(G.id)||j.isValidFGUToken(G.id))?window.ftr__ncd=!1:(G.id=j.safeGenerateNoDash(),window.ftr__ncd=!0),G.ts=window.ftr__startScriptLoad,M(G),window.ftr__snp_cwc=!!k.read(_),window.ftr__snp_cwc||(E=V);for(var N="for"+"ter"+".co"+"m",O="ht"+"tps://c"+"dn9."+N,Q="ht"+"tps://"+G.id+"-"+siteId+".cd"+"n."+N,H="http"+"s://cd"+"n3."+N,X=[O,Q,H],z=0;z<X.length;z++)x(X[z]);var $=new Array(B.tmosSecs.length),J=function(t){for(var n=0;n<B.tmosSecs.length;n++)$[n]=setTimeout(c,1e3*B.tmosSecs[n],t+B.tmos[n])},K=function(){for(var t=0;t<B.tmosSecs.length;t++)clearTimeout($[t])};window.ftr__fdad=function(n,e){if(!g){g=!0;var r={};r[b]=s(window.ftr__config.s,siteId,window.ftr__config.m.csp),d(A,function(e){try{var r=e.getAllResponseHeaders().toLowerCase();if(r.indexOf(U.toLowerCase())>=0){var o=e.getResponseHeader(U);window.ftr__altd2=t(atob(o),-L-1)}if(r.indexOf(F.toLowerCase())<0)return;var i=e.getResponseHeader(F),c=t(atob(i),-L-1);if(c){var a=c.split(":");if(a&&2===a.length){for(var u=a[0],f=a[1],d="",s=0,w=0;s<20;++s)d+=s%3>0&&w<12?siteId.charAt(w++):G.id.charAt(s);var h=f.split(",");if(h.length>1){var m=h[0],v=h[1];D=u+"/"+m+"."+d+"."+v}}}n()}catch(t){}},function(t,n){e&&e(t,n)},r)}};var W=q?B.uFP:B.uDF;J(W),setTimeout(h,I,W)}catch(t){c(B.mLd)}}catch(t){}})();\n'.replace(/{{SITE_ID}}/g,t),r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("id",t),r.text=i,document.body.appendChild(r),document.addEventListener("ftr:tokenReady",(e=>{n(e.detail)}))}))});const _b=(e,t,n)=>r(void 0,void 0,void 0,(function*(){try{const{publicApiKey:t,useCloudflareIntegration:i,cloudflareScriptUrl:r,cloudflareEndpointUrl:o}=e;let s=[];s=i&&o?[o,un]:[un];let a=[];if(i&&r){a=[`${new URL(r).toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,yn]}else a=[yn];const d=wn({apiKey:t,endpoint:s,scriptUrlPattern:a}),l=yield d,{requestId:c}=yield l.get();n(c)}catch(e){console.warn("Could not load fingerprint",e)}}));var Sb=Object.freeze({__proto__:null,default:_b,loadFingerprint:_b});const kb=(e,t,n)=>r(void 0,void 0,void 0,(function*(){try{const{customDomain:i,publicApiKey:r,cloudflareEndpointPath:o,cloudflareScriptPath:s}=e,{baseUrl:a}=t;let d;d=i?`https://${i}`:a||"https://api.descope.com";const l=new URL(d);l.pathname=o;const c=new URL(d);c.pathname=s;const u=`${c.toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,h=wn({apiKey:r,endpoint:[l.toString(),un],scriptUrlPattern:[u,yn]}),g=yield h,{requestId:p}=yield g.get();n(p)}catch(e){console.warn("Could not load descope fingerprint",e)}}));var Cb=Object.freeze({__proto__:null,default:kb,loadFingerprint:kb});const xb=(e,t,n)=>{const i=()=>{var t;return e.enterprise?null===(t=window.grecaptcha)||void 0===t?void 0:t.enterprise:window.grecaptcha};let r,o;const s=(t,i)=>{t.ready((()=>{e.siteKey&&(null==t||t.execute(o,{action:"load"}).then(((e,i)=>{i?console.warn("could not execute recaptcha",i):(n(e),r=setTimeout((()=>{s(t)}),11e4))})))}))},a=(()=>{const e=document.createElement("div");return e.style.display="none",e.id="recaptcha",document.body.appendChild(e)})();return window.onRecaptchaLoadCallback=()=>{const t=a;if(t.hasChildNodes())return;const n=i();n&&setTimeout((()=>{o=n.render(t,{sitekey:e.siteKey,badge:"inline",size:"invisible"}),s(n)}),0)},(()=>{const t=document.createElement("script");t.src=(()=>{const t=new URL("https://www.google.com/recaptcha/");return t.pathname+=(e.enterprise?"enterprise":"api")+".js",t.searchParams.append("onload","onRecaptchaLoadCallback"),t.searchParams.append("render","explicit"),t.toString()})(),t.async=!0,t.id="recaptcha-script",t.defer=!0,document.body.appendChild(t)})(),{stop:()=>{clearTimeout(r)},start:()=>{const e=i();e&&s(e)}}};var Ib=Object.freeze({__proto__:null,default:xb,loadGRecaptcha:xb});const Rb=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o: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!==(a=i.bottom)&&void 0!==a?a:0))]};var Eb,Ob,Nb,Pb,Ab,jb,Tb,Mb,Ub,Wb;const Lb=document.createElement("template");Lb.innerHTML=`\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 Db extends HTMLElement{constructor(){var e,t,n;super(),Eb.add(this),Ob.set(this,new Gi({messages:[]})),Nb.set(this,void 0),Pb.set(this,void 0),Ab.set(this,void 0),jb.set(this,{resize:o(this,Eb,"m",Wb).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Lb.content.cloneNode(!0));const i=new CSSStyleSheet;i.replaceSync('\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'),null!==(t=(n=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(n.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,i],s(this,Nb,this.shadowRoot.querySelector(".debugger"),"f"),s(this,Pb,o(this,Nb,"f").querySelector(".content"),"f"),s(this,Ab,o(this,Nb,"f").querySelector(".header"),"f")}updateData(e){o(this,Ob,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=Rb(e,e.offsetLeft-i,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(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(o(this,Nb,"f"),o(this,Ab,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",o(this,jb,"f").resize),(e=o(this,Nb,"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},o(this,Nb,"f").onresize=o(this,Eb,"m",Ub).bind(this),o(this,Ob,"f").subscribe(o(this,Eb,"m",Tb).bind(this))}disconnectedCallback(){o(this,Ob,"f").unsubscribeAll(),window.removeEventListener("resize",o(this,jb,"f").resize)}}Ob=new WeakMap,Nb=new WeakMap,Pb=new WeakMap,Ab=new WeakMap,jb=new WeakMap,Eb=new WeakSet,Tb=function(e){o(this,Eb,"m",Mb).call(this,e),o(this,Eb,"m",Ub).call(this)},Mb=function(e){o(this,Pb,"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("")},Ub=function(){o(this,Pb,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),i=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;i||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)}))},Wb=function(){const[e,t]=Rb(o(this,Nb,"f"),Number.parseInt(o(this,Nb,"f").style.left,10),Number.parseInt(o(this,Nb,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});o(this,Nb,"f").style.top=`${t}px`,o(this,Nb,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Db);var Fb=Object.freeze({__proto__:null,default:Db});e.AccessKeyManagement=ar,e.ApplicationsPortal=gr,e.AuditManagement=lr,e.AuthProvider=({projectId:e,baseUrl:n="",baseStaticUrl:i="",sessionTokenViaCookie:r=!1,persistTokens:o=!0,oidcConfig:s,storeLastAuthenticatedUser:a=!0,keepLastAuthenticatedUserAfterLogout:d=!1,refreshCookieName:l="",children:c})=>{const[u,h]=t.useState(),[g,p]=t.useState(),[f,m]=t.useState(!1),[v,y]=t.useState(!1),[w,b]=t.useState(!1),[$,_]=t.useState(!1),S=t.useRef(!1),k=(({projectId:e,baseUrl:n,persistTokens:i,sessionTokenViaCookie:r,refreshCookieName:o,oidcConfig:s,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d})=>t.useMemo((()=>{if(e)return Ri({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:Ci,persistTokens:i,refreshCookieName:o,oidcConfig:s,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,oidcConfig:s,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,refreshCookieName:l});t.useEffect((()=>{if(k){const e=k.onSessionTokenChange(p),t=k.onUserChange(h),n=k.onIsAuthenticatedChange(m);return()=>{e(),t(),n()}}}),[k]);const C=t.useRef(!1),x=t.useRef(!1);t.useEffect((()=>{k&&s&&vi()&&!S.current&&(S.current=!0,_(!0),k.oidc.finishLoginIfNeed().finally((()=>{_(!1),C.current=!0})))}),[]);const I=t.useCallback((()=>{C.current||(C.current=!0,b(!0),Si(null==k?void 0:k.refresh)().then((()=>{b(!1)})))}),[k]),R=t.useCallback((()=>{x.current||(x.current=!0,y(!0),Si(k.me)().then((()=>{y(!1)})))}),[k]),E=t.useMemo((()=>({fetchUser:R,user:u,isUserLoading:v,isUserFetched:x.current,fetchSession:I,session:g,isAuthenticated:f,isSessionLoading:w,isOidcFinishLogin:$,isSessionFetched:C.current,projectId:e,baseUrl:n,baseStaticUrl:i,storeLastAuthenticatedUser:a,keepLastAuthenticatedUserAfterLogout:d,refreshCookieName:l,setUser:h,setSession:p,sdk:k})),[R,u,v,x.current,I,g,f,w,$,C.current,e,n,i,d,l,h,p,k]);return t.createElement(_i.Provider,{value:E},c)},e.Descope=Xi,e.RoleManagement=or,e.SignInFlow=e=>t.createElement(Xi,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>t.createElement(Xi,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>t.createElement(Xi,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=ir,e.UserProfile=ur,e.baseHeaders=Ci,e.getCurrentTenant=ji,e.getJwtPermissions=Pi,e.getJwtRoles=Ai,e.getRefreshToken=Ni,e.getSessionToken=Oi,e.isRefreshTokenExpired=(e=Ni())=>null==Ii?void 0:Ii.isJwtExpired(e),e.isSessionTokenExpired=(e=Oi())=>null==Ii?void 0:Ii.isJwtExpired(e),e.refresh=(e=Ni())=>null==Ii?void 0:Ii.refresh(e),e.useDescope=()=>{const{sdk:e}=Qi();return t.useMemo((()=>e||new Proxy(Ei(),tr)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,isOidcFinishLogin:i,fetchSession:r,isSessionFetched:o,isAuthenticated:s}=Qi(),a=t.useRef(n||i);t.useMemo((()=>{a.current=n||i}),[n,i]);const d=!s&&!n;return t.useMemo((()=>{d&&!o&&(a.current=!0)}),[o]),t.useEffect((()=>{d&&r()}),[r]),{isSessionLoading:a.current,sessionToken:e,isAuthenticated:s}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,isAuthenticated:r,isUserFetched:o}=Qi(),[s,a]=t.useState(!1),d=t.useRef(i),l=t.useMemo((()=>!e&&!i&&r&&!s),[n,r,s]);return t.useMemo((()=>{d.current=i}),[i]),t.useMemo((()=>{l&&!o&&(d.current=!0)}),[l,o]),t.useEffect((()=>{l&&(a(!0),n())}),[l]),{isUserLoading:d.current,user:e}}}));
|
|
3
|
+
function bt(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 wt=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=bt({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in r)r[s]&&(o+="; "+s,!0!==r[s]&&(o+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r<n.length;r++){var o=n[r].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(i[a]=t.read(s,a),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",bt({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,bt({},this.attributes,t))},withConverter:function(t){return e(bt({},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 Ct={default:"endpoint"},kt="Blocked by CSP",St="The endpoint parameter is not a valid URL",xt="Failed to load the JS script of the agent",It="9319";function Rt(e,t){var n,i,r,o,s,a=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);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),o=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,o++))},r=new Set,[n.current(),function(e,t){var o,s=t instanceof Error?t.message:"";if(s===kt||s===St)n.exclude(),o=0;else if(s===It)n.exclude();else if(s===xt){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),o=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=o?o:e.getTime()+i()-Date.now()]}]),l=d[0],c=d[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var u=function(e){var n=new Date,i=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return i()}),i),r.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=c(n,e);if(!t)throw s;var i,r=t[0],o=t[1];return(i=o,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return u(r)}))}))};return u(l).then((function(e){return[e,a]}))}var Ot="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Et=Ot;function Nt(e){var t;e.scriptUrlPattern;var n=e.token,i=e.apiKey,r=void 0===i?n:i,o=d(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:Ot,l=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]}(),c=l[0],u=l[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.11.6"):e}))}(String(e),t)}))}(s,r);return Rt(e,At)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===It?new Error(xt):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(a(a({},o),{ldi:{attempts:n,visibilityStates:c}}))}))}function At(e){return function(e,t,n){var i,r=document,o="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),r=t.blockedURI;r!==n.href&&r!==n.protocol.slice(0,-1)&&r!==n.origin||(i=t,a())};r.addEventListener(o,s);var a=function(){return r.removeEventListener(o,s)};return Promise.resolve().then(t).then((function(e){return a(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(a(),i)return n(i);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(St);var i=document.createElement("script"),r=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},o=document.head||document.getElementsByTagName("head")[0];i.onload=function(){r(),t()},i.onerror=function(){r(),n(new Error(xt))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(kt)})).then(jt)}function jt(){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(It);return n}const Pt=e=>{try{return p(e).exp}catch(e){return null}},Mt=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Pt(n)},Tt=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Pt(i):void 0)},Ut=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,i)=>{var r;return n[i]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[i])||[]).concat((null==t?void 0:t[i])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},_t=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(e=>{const{access_token:t,id_token:n,refresh_token:i,refresh_expire_in:r}=e,o=d(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||i,sessionExpiration:e.sessionExpiration||Tt(e),cookieExpiration:e.cookieExpiration||Mt(e)},o)})((null==t?void 0:t.authInfo)||t||{})},Lt=async e=>{const t=await _t(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Wt="undefined"!=typeof localStorage,Dt=(e,t)=>Wt&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Ft=e=>Wt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),qt=e=>Wt&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Bt=(...e)=>{console.debug(...e)},Vt="3.2.0",Kt="undefined"!=typeof window,Ht=Math.pow(2,31)-1,Gt=`https://descopecdn.com/npm/oidc-client-ts@${Vt}/dist/browser/oidc-client-ts.min.js`,zt=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Vt}/dist/browser/oidc-client-ts.min.js`,Jt="DS",Zt="DSR",Yt="DSI";function Xt(e=""){return Ft(`${e}${Zt}`)||""}function Qt(e=""){return wt.get(Jt)||Ft(`${e}${Jt}`)||""}function en(e=""){return Ft(`${e}${Yt}`)||""}function tn(e=""){qt(`${e}${Zt}`),qt(`${e}${Jt}`),qt(`${e}${Yt}`),wt.remove(Jt)}const nn=Kt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",rn="vsid",on="vrid",sn="fp",an=(e=!1)=>{const t=localStorage.getItem(sn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},dn=async(e,t=nn)=>{try{if(an())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 r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const o=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Nt({apiKey:e,endpoint:[i.toString(),Ct],scriptUrlPattern:[o,Et]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[rn]:e,[on]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(sn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},ln=e=>{const t=an(!0);return t&&e.body&&(e.body.fpData=t),e},cn="dls_last_user_login_id",un="dls_last_user_display_name",hn=()=>Ft(cn),fn=()=>Ft(un),pn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=hn(),o=fn();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)};function gn(){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 vn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Cn(n.publicKey.challenge),n.publicKey.user.id=Cn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Cn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:kn(n.rawId),type:n.type,response:{attestationObject:kn(n.response.attestationObject),clientDataJSON:kn(n.response.clientDataJSON)}});var n}async function mn(e){const t=bn(e);return wn(await navigator.credentials.get(t))}async function yn(e,t){const n=bn(e);return n.signal=t.signal,n.mediation="conditional",wn(await navigator.credentials.get(n))}async function $n(e=!1){if(!Kt)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 bn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Cn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Cn(e.id)})),n}function wn(e){return JSON.stringify({id:e.id,rawId:kn(e.rawId),type:e.type,response:{authenticatorData:kn(e.response.authenticatorData),clientDataJSON:kn(e.response.clientDataJSON),signature:kn(e.response.signature),userHandle:e.response.userHandle?kn(e.response.userHandle):void 0}})}function Cn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function kn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Sn,xn=(Sn=e=>({async signUp(t,n,i){const r=await e.webauthn.signUp.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await vn(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,o)},async signIn(t,n){const i=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!i.ok)return i;const r=await mn(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,r)},async signUpOrIn(t,n){var i;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(null===(i=r.data)||void 0===i?void 0:i.create){const t=await vn(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await mn(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,t)}},async update(t,n,i){const r=await e.webauthn.update.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await vn(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:vn,get:mn,isSupported:$n,conditional:yn}}),(...e)=>{const t=Sn(...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 In="/fedcm/config";async function Rn(e,t){var n,i,r;try{const r=await async function(e,t="google",n,i,r){const o=(()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("")}return Math.random().toString(36).substring(2)})(),s=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")}}))}(),a=await e.oauth.getOneTapClientId(t);if(!a.ok)throw new Error("Failed to get OneTap client ID for provider "+t);const d=a.data.clientId;return new Promise((e=>{var a,l;const c=n=>{e({provider:t,nonce:o,credential:null==n?void 0:n.credential})};s.initialize(Object.assign(Object.assign({},n),{itp_support:null===(a=null==n?void 0:n.itp_support)||void 0===a||a,use_fedcm_for_prompt:null===(l=null==n?void 0:n.use_fedcm_for_prompt)||void 0===l||l,client_id:d,callback:c,nonce:o})),s.prompt((e=>{var t,n;if(r&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);return null==r||r(n),void c()}if(i&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);return null==i||i(t),void c()}}))}))}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(null==t?void 0:t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,null==t?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);null===(n=null==t?void 0:t.onCodeReceived)||void 0===n||n.call(t,i.data.code)}else{const n=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,null==t?void 0:t.loginOptions);if(!n.ok||!n.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);null===(i=null==t?void 0:t.onAuthenticated)||void 0===i||i.call(t,n.data)}}catch(e){null===(r=null==t?void 0:t.onFailed)||void 0===r||r.call(t,e)}}var On=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await $n(),i=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=i,e.flow.start(...t)}});let En;const Nn=(e,t)=>new Promise(((n,i)=>{if(!e.length)return i(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const o=e.shift(),s=document.createElement("script");s.src=o,s.id=(e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t).toString(16)})(o),s.onload=()=>{const e=t();if(e)return n(e);throw new Error("Could not get entry after loading script from URL")},s.addEventListener("error",(()=>{Nn(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),An=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{En||(En=(async()=>{try{return require("oidc-client-ts")}catch(e){return Nn([Gt,zt],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await En;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=t,s=(null==n?void 0:n.redirectUri)||window.location.href,a=(null==n?void 0:n.scope)||"openid email roles descope.custom_claims offline_access",d=`${o}_user`;let l=e.httpClient.buildUrl(t);(null==n?void 0:n.applicationId)&&(l=`${l}/${n.applicationId}`);const c={authority:l,client_id:t,redirect_uri:s,response_type:"code",scope:a,stateStore:new r({store:window.localStorage,prefix:o}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),(null==n?void 0:n.scope)&&(c.scope=n.scope),{client:new i(c),stateUserKey:d}})(e,t,n)),{client:i,stateUserKey:r}},r=async(t="")=>{var n;const{client:r,stateUserKey:o}=await i(),s=await r.processSigninResponse(t||window.location.href);var a;return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(s)))),window.localStorage.setItem(o,JSON.stringify({id_token:(a=s).id_token,session_state:a.session_state,profile:a.profile})),(()=>{const e=new URL(window.location.href);e.searchParams.delete("code"),e.searchParams.delete("state"),window.history.replaceState({},document.title,e.toString())})(),s};return{loginWithRedirect:async(e={},t=!1)=>{const{client:n}=await i(),r=await n.createSigninRequest(e),{url:o}=r;return t||(window.location.href=o),{ok:!0,data:r}},finishLogin:r,finishLoginIfNeed:async(e="")=>{if(window.location.search.includes("code")&&window.location.search.includes("state"))return await r(e)},refreshToken:async t=>{var n;const{client:r,stateUserKey:o}=await i(),s=(e=>{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null})(o);if(!s)throw new Error("User not found in storage to refresh token");let a=t;if(!a){const t={};e.httpClient.hooks.beforeRequest(t),a=t.token}const d=await r.useRefreshToken({state:{refresh_token:a,session_state:s.session_state,profile:s.profile}});return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(d)))),d},logout:async(e,t=!1)=>{const{client:n,stateUserKey:r}=await i();e||(e={}),e.id_token_hint=e.id_token_hint||en(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return window.localStorage.removeItem(r),t||window.location.replace(s),o}}},jn=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:i}=t,r=d(t,["fpKey","fpLoad"]);return Kt?(n&&i&&dn(n).catch((()=>null)),e(Ut(r,{beforeRequest:ln}))):e(r)}),(e=>t=>{var{autoRefresh:n}=t,i=d(t,["autoRefresh"]);if(!n)return e(i);const{clearAllTimers:r,setTimer:o}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;Kt&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&s&&new Date>s&&(Bt("Expiration time passed, refreshing session"),l.refresh(Xt()||a))}));const l=e(Ut(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:d}=await _t(t);if(401===(null==t?void 0:t.status))Bt("Received 401, canceling all timers"),r();else if(n||d){if(s=((e,t)=>{if(t)return new Date(1e3*t);Bt("Could not extract expiration time from session token, trying to decode the token");try{const t=p(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,d),!s)return void Bt("Could not extract expiration time from session token");a=i;const e=(e=>{let t=((n=e)?n.getTime()-(new Date).getTime():0)-2e4;var n;return t>Ht&&(Bt(`Timeout is too large (${t}ms), setting it to ${Ht}ms`),t=Ht),t})(s);if(r(),e<=2e4)return void Bt("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Bt(`Setting refresh timer for ${t}. (${e}ms)`),o((()=>{Bt("Refreshing session due to timer"),l.refresh(Xt()||i)}),e)}}}));return ce(l,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return Bt("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.30.0"},t.baseHeaders)}))),(e=>t=>{const n=gn(),i=gn(),r=gn(),o=e(Ut(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))i.pub(null),r.pub(null),n.pub(null);else{const e=await Lt(t);e&&r.pub(e);const{sessionJwt:o,sessionExpiration:s}=await _t(t);o&&i.pub(o),(s||o)&&n.pub(s||42)}}})),s=ce(o,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const o=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o}));return Object.assign(s,{onSessionTokenChange:i.sub,onUserChange:r.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=t,r=d(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:hn,getLastUserDisplayName:fn});const o=e(Ut(r,{afterRequest:async(e,t)=>{var n;const i=await Lt(t),r=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],o=null==i?void 0:i.name;r&&((e=>{Dt(cn,e)})(r),(e=>{Dt(un,e)})(o))}}));let s=ce(o,["flow.start"],pn);return s=ce(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(qt(cn),qt(un)),i})(i)),Object.assign(s,{getLastUserLoginId:hn,getLastUserDisplayName:fn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:i,storagePrefix:r}=t,o=d(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!Kt)return e(o);const s=e(Ut(o,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Xt(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=!1,n="",i)=>{var r;const{sessionJwt:o,refreshJwt:s}=e;if(s&&Dt(`${n}${Zt}`,s),o)if(t){const n=t.sameSite||"Strict",s=null===(r=t.secure)||void 0===r||r;!function(e,t,n,i){var r,o;if(t){const{cookieDomain:s,cookiePath:a,cookieSameSite:d,cookieExpiration:l,cookieSecure:c}=n,u=new Date(1e3*l),h=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(s);null===(r=null==i?void 0:i.debug)||void 0===r||r.call(i,"Setting session cookie",{authInfo:n,domainMatches:h,expires:u}),wt.set(e,t,{path:a,domain:h?s:void 0,expires:u,sameSite:d,secure:c});const f=wt.get(e);f!==t&&(null===(o=null==i?void 0:i.warn)||void 0===o||o.call(i,"Failed to set cookie",{currentSessionSuffix:null==f?void 0:f.slice(-10),requestSessionSuffix:t.slice(-10)}))}}(Jt,o,Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:s}),i)}else Dt(`${n}${Jt}`,o);e.idToken&&Dt(`${n}${Yt}`,e.idToken)})(await _t(t),i,r,o.logger)}}));var a;const l=ce(s,["logout","logoutAll","oidc.logout"],(e=>t=>async(...n)=>{const i=await t(...n);return tn(e),i})(r));return Object.assign(l,{getRefreshToken:()=>Xt(r),getSessionToken:()=>Qt(r),getIdToken:()=>en(r)})}))((e=>{const t=$t(e),n=An(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async i=>{var r;if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}const o=Qt(),s=Xt();let a="";if(e.getExternalToken)try{a=await(null===(r=e.getExternalToken)||void 0===r?void 0:r.call(e))}catch(e){Bt("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:o?"t":"f",dcr:s?"t":"f"},a)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:e.toString()}})}return t.logout(i)},flow:On(t),webauthn:xn(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){Rn(i,e)},requestAuthentication(e){Rn(i,e)}},oneTap(e,t,n,r,o){Rn(i,{provider:e,oneTapConfig:t,loginOptions:n,onSkipped:r,onDismissed:o})},async launch(e){var t;const n={identity:{context:e||"signin",providers:[{configURL:i.httpClient.buildUrl(r+In),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>Kt&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+In);try{const i={identity:{context:e||"signin",providers:[{configURL:n,clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(i));return!!o&&!!o.token}catch(e){return!1}}}),oidc:n});var i,r}));let Pn;const Mn=e=>{const t=jn(Object.assign({persistTokens:s,autoRefresh:s},e));return Pn=t,t},Tn=()=>Mn({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});Pn=Tn();const Un=()=>s?null==Pn?void 0:Pn.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),_n=()=>s?null==Pn?void 0:Pn.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),Ln=r(((e=Un(),t)=>null==Pn?void 0:Pn.getJwtPermissions(e,t))),Wn=r(((e=Un(),t)=>null==Pn?void 0:Pn.getJwtRoles(e,t))),Dn=r(((e=Un())=>null==Pn?void 0:Pn.getCurrentTenant(e)));function Fn(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const qn=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Bn=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Vn=e=>{let t,n;return(...i)=>(t&&Bn(t,i)||(t=i,n=e(...i)),n)},Kn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Hn=e=>(t,...n)=>t.reduce(((t,i,r)=>{var o;return`${t}${i}${(null===(o=null==n?void 0:n[r])||void 0===o?void 0:o[e>1?1:0])||""}`}),""),Gn=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},zn=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 Jn,Zn,Yn,Xn;function Qn(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 r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!Qn(o,s))return!1}else if(o!==s)return!1}return!0}let ei=class{constructor(e={},{forceUpdate:t=!1}={}){Jn.set(this,void 0),Zn.set(this,{}),Yn.set(this,0),Xn.set(this,!0),this.update=e=>{const t="function"==typeof e?e(c(this,Jn,"f")):e,n=Object.assign(Object.assign({},c(this,Jn,"f")),t);if(c(this,Xn,"f")||!Qn(c(this,Jn,"f"),n)){const e=c(this,Jn,"f");u(this,Jn,n,"f"),Object.freeze(c(this,Jn,"f")),setTimeout((()=>{Object.values(c(this,Zn,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},u(this,Jn,e,"f"),u(this,Xn,t,"f")}get current(){return Object.assign({},c(this,Jn,"f"))}subscribe(e){return u(this,Yn,c(this,Yn,"f")+1,"f"),c(this,Zn,"f")[c(this,Yn,"f")]=e,c(this,Yn,"f").toString()}unsubscribe(e){const t=!!c(this,Zn,"f")[e];return t&&delete c(this,Zn,"f")[e],t}unsubscribeAll(){return u(this,Zn,{},"f"),!0}};Jn=new WeakMap,Zn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap;const ti=e=>"string"==typeof e||null==e?e:JSON.stringify(e),ni=e=>t.forwardRef(((n,i)=>{const{prop:r,attr:o,rest:s}=t.useMemo((()=>Object.entries(n).reduce(((e,[t,n])=>{const{trimmedKey:i,category:r}=(e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}})(t);return"prop"===r?e.prop.push([i,n]):"attr"===r?e.attr.push([Kn(i),ti(n)]):Object.assign(e.rest,{[Kn(i)]:n}),e}),{attr:[],prop:[],rest:{}})),[n]),a=t.useRef(null),d=t.useCallback((e=>{a.current=e,e&&(r.forEach((([e,t])=>{a.current[e]=t})),o.forEach((([t,n])=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)})))}),[r,o,a]);return t.useImperativeHandle(i,(()=>a.current)),t.createElement(e,Object.assign({ref:d},s))})),ii=t.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await Promise.resolve().then((function(){return us})).then((e=>e.default))).sdkConfigOverrides={baseHeaders:o,persistTokens:!1,hooks:{get beforeRequest(){return Pn.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-wc",Object.assign({ref:n},e)))))}))),ri=t.forwardRef((({flowId:e,onSuccess:i,onError:r,onReady:o,logger:s,tenant:a,theme:d,nonce:l,locale:c,debug:u,client:h,form:f,telemetryKey:p,redirectUrl:g,autoFocus:v,validateOnBlur:m,restartOnError:y,errorTransformer:$,styleId:b,onScreenUpdate:w,dismissScreenErrorOnInput:C,outboundAppId:k,outboundAppScopes:S,children:x},I)=>{const[R,O]=t.useState(null);t.useImperativeHandle(I,(()=>R));const{projectId:E,baseUrl:N,baseStaticUrl:A,baseCdnUrl:j,storeLastAuthenticatedUser:P,keepLastAuthenticatedUserAfterLogout:M,refreshCookieName:T,sdk:U}=t.useContext(n),_=t.useCallback((async e=>{await U.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),i&&i(e)}),[i]);return t.useEffect((()=>{const e=R;return null==e||e.addEventListener("success",_),r&&(null==e||e.addEventListener("error",r)),o&&(null==e||e.addEventListener("ready",o)),()=>{r&&(null==e||e.removeEventListener("error",r)),o&&(null==e||e.removeEventListener("ready",o)),null==e||e.removeEventListener("success",_)}}),[R,r,_]),t.useEffect((()=>{const e=R;return null==e||e.addEventListener("success",_),()=>{null==e||e.removeEventListener("success",_)}}),[R,_]),t.useEffect((()=>{const e=R;return r&&(null==e||e.addEventListener("error",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[R,r]),t.useEffect((()=>{const e=R;return o&&(null==e||e.addEventListener("ready",o)),()=>{o&&(null==e||e.removeEventListener("error",o))}}),[R,o]),t.createElement("form",null,t.createElement(t.Suspense,{fallback:null},t.createElement(ii,{projectId:E,flowId:e,baseUrl:N,baseStaticUrl:A,baseCdnUrl:j,ref:O,telemetryKey:p,redirectUrl:g,autoFocus:v,styleId:b,validateOnBlur:m,restartOnError:y,keepLastAuthenticatedUserAfterLogout:M,tenant:a,"theme.attr":d,"nonce.attr":l,"locale.attr":c,"form.attr":f,"client.attr":h,"debug.attr":u,"outbound-app-id.attr":k,"outbound-app-scopes.attr":S,"store-last-authenticated-user.attr":P,"refreshCookieName.attr":T,"dismiss-screen-error-on-input.attr":C,"errorTransformer.prop":$,"logger.prop":s,"onScreenUpdate.prop":w},x)))}));var oi=()=>{const e=t.useContext(n);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const si=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,ai={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],ai);if("function"==typeof e[t])return()=>{throw Error(si("function"))};throw Error(si("attribute"))}},di=t.lazy((async()=>(await Promise.resolve().then((function(){return Mp})),{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-user-management-widget",Object.assign({ref:n},e)))))}))),li=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(di,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,ref:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),ci=t.lazy((async()=>(await Promise.resolve().then((function(){return jg})),{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-role-management-widget",Object.assign({ref:n},e)))))}))),ui=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(ci,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),hi=t.lazy((async()=>(await Promise.resolve().then((function(){return Uv})),{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-access-key-management-widget",Object.assign({ref:n},e)))))}))),fi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(hi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),pi=t.lazy((async()=>(await Promise.resolve().then((function(){return nm})),{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-audit-management-widget",Object.assign({ref:n},e)))))}))),gi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(pi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),vi=t.lazy((async()=>(await Promise.resolve().then((function(){return Km})),{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-user-profile-widget",Object.assign({ref:n},e)))))}))),mi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,onLogout:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g,setSession:v,setUser:m,setIsAuthenticated:y}=t.useContext(n),$=t.useCallback((e=>{s&&s(e),y(!1),v(""),m(null)}),[s,v,y,m]);return t.useEffect((()=>{if(l)return l.addEventListener("logout",$),()=>l.removeEventListener("logout",$)}),[l,$]),t.createElement(t.Suspense,{fallback:null},t.createElement(vi,{projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,styleId:a,ref:c,"theme.attr":i,"debug.attr":r,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),yi=t.lazy((async()=>(await Promise.resolve().then((function(){return dy})),{default:ni(t.forwardRef(((e,n)=>t.createElement("descope-applications-portal-widget",Object.assign({ref:n},e)))))}))),$i=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:f,refreshCookieName:p}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(yi,{projectId:c,widgetId:o,baseUrl:u,baseStaticUrl:h,baseCdnUrl:f,innerRef:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),bi="undefined"!=typeof localStorage,wi="J151000",Ci=bi&&localStorage.getItem("base.content.url")||"",ki="base.ui.components.url";bi&&localStorage.getItem(ki),bi&&localStorage.getItem(ki);const Si="descope-login-flow",xi="code",Ii="data-exclude-field",Ri="data-exclude-next",Oi="dls_last_auth",Ei="state_id",Ni="saml_idp_state_id",Ai="saml_idp_username",ji="descope_idp_initiated",Pi="sso_app_id",Mi="third_party_app_id",Ti="third_party_app_state_id",Ui="oidc_login_hint",_i="oidc_prompt",Li="oidc_error_redirect_uri",Wi="application_scopes",Di="data-type",Fi="redirect",qi="poll",Bi="webauthnCreate",Vi="webauthnGet",Ki="nativeBridge",Hi="loadForm",Gi="submit",zi="polling",Ji=["descope-multi-select-combo-box","descope-text-area"],Zi=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var Yi;!function(e){e.backward="backward",e.forward="forward"}(Yi||(Yi={}));const Xi=["descope-enriched-text"];function Qi(e){return new URLSearchParams(window.location.search).get(e)}function er(e){if(window.history.replaceState&&Qi(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 tr(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?Yi.forward:n<i?Yi.backward:void 0}const nr=e=>{let[t="",n=""]=(Qi(Si)||"").split("_");const i=(e=>{var t;return(null===(t=/(.*)\|#\|.*/.exec(e))||void 0===t?void 0:t[1])||""})(t);return(!e||i&&i!==e)&&(t="",n=""),{executionId:t,stepId:n,executionFlowId:i}};function ir(){er(Si)}const rr=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),or=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=nr(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&ir();const o=Qi("t")||void 0;o&&er("t");const s=Qi(xi)||void 0;s&&er(xi);const a=Qi("err")||void 0;a&&er("err");const{redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u}={redirectAuthCodeChallenge:Qi("ra-challenge"),redirectAuthCallbackUrl:Qi("ra-callback"),redirectAuthBackupCallbackUri:Qi("ra-backup-callback"),redirectAuthInitiator:Qi("ra-initiator")},h=Qi(Ei);h&&er(Ei);const f=Qi(Ni);f&&er(Ni);const p=Qi(Ai);f&&er(Ai);const g=Qi(ji);g&&er(ji);const v=Qi(Pi);v&&er(Pi);const m=Qi(Mi);m&&er(Mi);const y=Qi(Ti);y&&er(Ti);const $=Qi(Wi);$&&er(Wi);const b=Qi(Ui);b&&er(Ui);const w=Qi(_i);w&&er(_i);const C=Qi(Li);return C&&er(Li),{executionId:n,stepId:i,token:o,code:s,exchangeError:a,redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u,ssoQueryParams:{oidcIdpStateId:h,samlIdpStateId:f,samlIdpUsername:p,descopeIdpInitiated:"true"===g,ssoAppId:v,oidcLoginHint:b,oidcPrompt:w,oidcErrorRedirectUri:C,thirdPartyAppId:m,thirdPartyAppStateId:y,applicationScopes:$}}},sr=e=>{let t,n;return Object.assign(((...i)=>{return t&&(o=i,(r=t).length===o.length&&r.every(((e,t)=>e===o[t])))||(t=i,n=e(...i)),n;var r,o}),{reset:()=>{t=void 0,n=void 0}})};function ar(e,t,n){return new Promise(((i,r)=>{let o=!1;const s=setTimeout((()=>{o=!0,void 0!==n?i(n):r(new Error(`Promise timed out after ${e} ms`))}),e);t.then((e=>{o||(clearTimeout(s),i(e))})).catch((e=>{o||(clearTimeout(s),r(e))}))}))}const dr=(e,{oidcIdpStateId:t,samlIdpStateId:n,samlIdpUsername:i,ssoAppId:r,oidcLoginHint:o,oidcPrompt:s,oidcErrorRedirectUri:a,thirdPartyAppId:d,thirdPartyAppStateId:l,applicationScopes:c})=>!(!e||t||n||i||r||o||s||a||d||l||c),lr=e=>null==e?void 0:e.submit(),cr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},ur=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function hr(e){if(e)return{locale:e.toLowerCase(),fallback:e.toLowerCase()};const t=navigator.language;return t?t.includes("-")?{locale:t.toLowerCase(),fallback:t.split("-")[0].toLowerCase()}:{locale:t.toLowerCase(),fallback:t.toLowerCase()}:{locale:"",fallback:""}}var fr,pr,gr,vr;function mr(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 r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!mr(o,s))return!1}else if(o!==s)return!1}return!0}let yr=class{constructor(e={},{forceUpdate:t=!1}={}){fr.set(this,void 0),pr.set(this,{}),gr.set(this,0),vr.set(this,!0),this.update=e=>{const t="function"==typeof e?e(c(this,fr,"f")):e,n=Object.assign(Object.assign({},c(this,fr,"f")),t),i=c(this,fr,"f");u(this,fr,n,"f"),Object.freeze(c(this,fr,"f")),setTimeout((()=>{Object.values(c(this,pr,"f")).forEach((({cb:e,selector:t})=>{const r=t(i),o=t(n);!c(this,vr,"f")&&(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(o)?mr(r,o):r===o)||e(o,r,((e,t)=>n=>e[n]!==t[n])(o,r))}))}),0)},u(this,fr,e,"f"),u(this,vr,t,"f")}get current(){return Object.assign({},c(this,fr,"f"))}set forceUpdate(e){u(this,vr,e,"f")}subscribe(e,t=e=>e){return u(this,gr,c(this,gr,"f")+1,"f"),c(this,pr,"f")[c(this,gr,"f")]={cb:e,selector:t},c(this,gr,"f").toString()}unsubscribe(e){const t=!!c(this,pr,"f")[e];return t&&delete c(this,pr,"f")[e],t}unsubscribeAll(){return u(this,pr,{},"f"),!0}};fr=new WeakMap,pr=new WeakMap,gr=new WeakMap,vr=new WeakMap;const $r=["*","#","/","(",")","[","]","_","<",">","`"],br=e=>"string"!=typeof e?e:e.replace((e=>{const t=$r.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),wr=["disabled"],Cr=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Ii}])`)).forEach((e=>{e.value=n}))}))},kr=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),Sr=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?br(kr(t,i)):kr(t,i))),xr=(e,t,n)=>{e.querySelectorAll(`[${Di}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Ir=(e,t,n)=>{var i,r;const o=null===(i=customElements.get(t))||void 0===i?void 0:i.cssVarList.url;n&&o&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(o,`url(data:image/jpg;base64,${n})`))},Rr=(e,t,n,i,r)=>{var o,s;xr(e,"totp-link",null===(o=null==t?void 0:t.totp)||void 0===o?void 0:o.provisionUrl),xr(e,"notp-link",null===(s=null==t?void 0:t.notp)||void 0===s?void 0:s.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{const n=(e=>Xi.includes(e))(e.localName);e.textContent=Sr(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",Sr(i,t))}))})(e,t),((e,t,n)=>{if(!t)return;const{componentsDynamicAttrs:i}=t,r=d(t,["componentsDynamicAttrs"]),o=Object.keys(r).reduce(((e,t)=>(e[`[name=${t}]`]=r[t],e)),{});i&&Object.keys(i).forEach((e=>{const t=i[e];if(t){const{attributes:n}=t;n&&Object.keys(n).length&&(o[e]=n)}})),Object.keys(o).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const i=o[t];Object.keys(i).forEach((t=>{let r=i[t];if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){n.error(`Could not stringify value "${r}" for "${t}"`,e.message),r=""}e.setAttribute(t,r)}))}))}))})(e,n,r),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Sr(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])=>{wr.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,i)},Or=sr((()=>l(void 0,void 0,void 0,(function*(){var e,t;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const n=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 ar(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}})))),Er="dls_ab_testing_id",Nr={"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 Ar(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Oi)))}catch(e){}return t}const jr=["error","warn","info","debug"],Pr=zn((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,c(this,t,"m",i).call(this,console))}set logger(e){u(this,n,c(this,t,"m",i).call(this,e||console),"f")}get logger(){return c(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return jr.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},r})),Mr="undefined"!=typeof localStorage,Tr=Mr&&localStorage.getItem("base.content.url")||"",Ur=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,_r=zn((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)&&c(this,t,"f")&&(u(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Lr=zn((e=>{var t,n;const i=Fn(Pr,_r)(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=c(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){c(this,t,"f")[e]||(c(this,t,"f")[e]=[]);const i=c(this,t,"f")[e].push(n);return()=>c(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})),Wr=e=>t=>{var n,i,r;const o=Fn(Pr,_r,Lr)(t),s=Object.keys(e);return r=class extends o{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,c(this,n,"m",i).bind(this))}async init(){var e;s.forEach((e=>c(this,n,"m",i).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,i=function(t,n){const i=e[t],r="function"==typeof i?i(t,n):i;r&&this.logger.error(r)},r};Wr.missingAttrValidator=Ur;const Dr=zn((e=>{const t=Fn(Wr({"project-id":Ur}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Fr=zn((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),qr="Trying the next fallback URL...";function Br({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i="https://static.descope.com/pages"}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}const Vr=zn((e=>{var t,n,i,r,o;const s=Fn(Pr,Dr,Fr)(e);return o=class extends s{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}async fetchStaticResource(e,n){const o=c(this,t,"m",r).call(this,e),s=Array.isArray(o)?e=>{if(e!==o.length-1){const{baseUrl:t}=o[e];u(this,i,t,"f")}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:i})=>{const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=r[e],s=e===r.length-1;try{const r=await fetch(o.toString(),t);if(r.ok)return null==i||i(e),r;const a=`Error fetching URL ${o} [${r.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${qr}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${qr}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:s});return{body:await e[n](),headers:Object.fromEntries(e.headers.entries())}}catch(e){this.logger.error(e.message)}}get baseStaticUrl(){return this.getAttribute("base-static-url")}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(e){const t=Tr||this.baseStaticUrl;if(t)return Br({projectId:this.projectId,filename:e,baseUrl:t});const r=c(this,n,"f")!==this.baseUrl,o=r&&!!this.baseUrl;r&&(u(this,n,this.baseUrl,"f"),u(this,i,void 0,"f"));const s=Br({projectId:this.projectId,filename:e,baseUrl:c(this,i,"f")});if(!o)return s;return[Br({projectId:this.projectId,filename:e,baseUrl:this.baseUrl+"/pages"}),s]},o})),Kr=zn((e=>{var t,n;const i=Fn(Wr({"project-id":Ur}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(c(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return c(this,t,"f").set(e,n),()=>{c(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(c(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!c(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=c(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),Hr=zn((e=>{var t,n,i,r,o;const s=Fn(Vr,Kr,_r)(e);return o=class extends s{constructor(){super(...arguments),t.add(this),i.set(this,void 0),r.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")}}))}async init(){await super.init(),this.onReset("config",c(this,t,"m",n).bind(this))}get config(){return c(this,i,"f")||u(this,i,c(this,r,"f").call(this),"f"),c(this,i,"f")}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){u(this,i,void 0,"f")},o})),Gr="load-descope-ui",zr="base.ui.components.url",Jr=Mr&&localStorage.getItem(zr)||"https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Zr=Mr&&localStorage.getItem(zr)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Yr=Mr&&localStorage.getItem(zr)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Xr=e=>{const t=document.createElement("script");return t.id=e,t},Qr=(e,t)=>e.replace("<version>",t),eo=zn((e=>{var t,n,i,r,o,s,a,d,l,h,f,p;const g=Fn(Pr,Hr)(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 c(this,l,"f")||u(this,l,c(this,t,"m",f).call(this),"f"),c(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=>c(this,t,"m",h).call(this,e))))}get baseCdnUrl(){return this.getAttribute("base-cdn-url")}},n=new WeakMap,i=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},o=function(e){const t=c(this,n,"f"),r=c(this,i,"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,i,o){this.logger.debug("Trying to load DescopeUI from a fallback URL");const s=Xr(i);document.body.append(s),s.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${s.src}"`)))})),s.addEventListener("load",(()=>{n.forEach((e=>e()))})),s.src=Qr(o,await c(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[c(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}"`))),c(this,t,"m",s).call(this,[c(this,t,"m",s).bind(this,e[c(this,n,"f")],e[c(this,i,"f")],"load-descope-ui-fallback-script-2",Yr),...e[c(this,n,"f")]],e[c(this,i,"f")],"load-descope-ui-fallback-script",Zr)})),e.addEventListener("load",(()=>{e[c(this,i,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Gr}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Xr(Gr);document.body.append(e),c(this,t,"m",o).call(this,e),c(this,t,"m",a).call(this,e),e.src=Qr(this.baseCdnUrl||Jr,await c(this,t,"m",r).call(this))}return document.getElementById(Gr)},h=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(", ")}"`)},f=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),c(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)}))}))}))},p})),to="content-root",no="root",io=zn((e=>class extends e{constructor(...e){var t,n,i,r;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${no}">\n <div id="${to}"></div>\n </div>\n `;const o=new CSSStyleSheet;o.replaceSync(`\n #${no}, #${to} {\n height: 100%;\n }\n #${no} {\n position: relative;\n height: fit-content;\n }\n `),null!==(t=(r=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(r.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,o],this.contentRootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(to),this.rootElement=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById(no)}})),ro=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',oo=zn((e=>{var t,n,i,r,o,s,a,d,l,h,f,p,g,v;const m=Fn(Wr({theme:ro}),Vr,_r,eo,Hr,io,Lr)(e);return v=class extends m{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),f.set(this,(()=>{c(this,t,"m",p).call(this),c(this,g,"f").call(this,"os"===this.getAttribute("theme"))})),g.set(this,(e=>{var n,i,r;const o=e?"addEventListener":"removeEventListener";null===(r=null===(i=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===i?void 0:i[o])||void 0===r||r.call(i,"change",(()=>c(this,t,"m",p).call(this)))}))}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"}get styleId(){return this.getAttribute("style-id")||"theme"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),c(this,t,"m",s).call(this),c(this,t,"m",a).call(this),c(this,f,"f").call(this),this.observeAttributes(["theme"],c(this,f,"f")),this.observeAttributes(["style-id"],(()=>{u(this,i,null,"f"),c(this,t,"m",l).call(this),c(this,t,"m",s).call(this),c(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,r=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(zr)))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(zr),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({},e.light.components),t.light.components),e.dark.components=Object.assign(Object.assign({},e.dark.components),t.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 c(this,i,"f")||(u(this,i,c(this,t,"m",r).call(this),"f"),c(this,i,"f").then((e=>this.logger.debug("Fetched theme",e)))),c(this,i,"f")},s=async function(){var e,i,r,s;const a=await c(this,t,"a",o);a&&(c(this,n,"f")||(u(this,n,new CSSStyleSheet,"f"),null!==(e=(s=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(s.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,c(this,n,"f")]),c(this,n,"f").replaceSync(((null===(i=null==a?void 0:a.light)||void 0===i?void 0:i.globals)||"")+((null===(r=null==a?void 0:a.dark)||void 0===r?void 0:r.globals)||"")))},a=async function(){var e,n;const i=Object.assign({},await c(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===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],r=null==n?void 0:n.cssTemplate,o=i||r;return null===(t=null==o?void 0:o[this.theme])||void 0===t?void 0:t.fonts},l=async function(){const e=await c(this,t,"m",d).call(this);e?Object.values(e).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))})):this.logger.debug("No fonts to load")},h=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)},p=function(){c(this,t,"m",l).call(this),c(this,t,"m",h).call(this)},v})),so=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if("object"==typeof e[i]&&null!==e[i]&&!(null===(r=e[i])||void 0===r?void 0:r.value))return Object.assign(Object.assign({},n),so(e[i],`${t+i}.`));const o="object"==typeof e[i]?e[i]:{value:e[i]},s=Object.assign(Object.assign({},n),{[t+i]:o,[`form.${t}${i}`]:o});return"displayName"===i?Object.assign(Object.assign({},s),{[`${t}fullName`]:o,[`form.${t}fullName`]:o}):s}),[]),ao=zn((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;c(this,t,"m",n).call(this)&&c(this,t,"m",i).call(this),null===(e=super.connectedCallback)||void 0===e||e.call(this)}},t=new WeakSet,n=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},i=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)},r}));var lo,co,uo,ho,fo,po,go,vo,mo,yo,$o,bo,wo,Co,ko,So,xo,Io,Ro,Oo,Eo,No,Ao;const jo=Fn(oo,Vr,ao)(HTMLElement);let Po=class extends jo{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id","nonce"]}constructor(e){super(),lo.add(this),uo.set(this,!1),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),c(this,lo,"m",Eo).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)}},ho.set(this,new yr),fo.set(this,new yr),po.set(this,{}),this.getComponentsContext=()=>c(this,po,"f"),this.nextRequestStatus=new yr({isLoading:!1}),go.set(this,void 0),vo.set(this,{popstate:c(this,lo,"m",wo).bind(this),componentsContext:c(this,lo,"m",Io).bind(this)}),mo.set(this,void 0),this.getConfig=()=>l(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),u(this,mo,e,"f"),c(this,lo,"m",$o).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get tenantId(){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 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 refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}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 so(JSON.parse(e))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return((e,t)=>Object.fromEntries(Object.entries(e).map((([e,n])=>[e,n[t]]))))(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{return JSON.parse(this.getAttribute("outbound-app-scopes"))||null}catch(e){return null}}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return l(this,void 0,void 0,(function*(){var e,t;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 l(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}getComponentsVersion(){return l(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig();return("projectConfig"in t?null===(e=t.projectConfig)||void 0===e?void 0:e.componentsVersion:{})||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;if(this.flowStatus="loading",["ready","error","success"].forEach((e=>this.addEventListener(e,(()=>{this.flowStatus=e})))),yield null===(t=e.init)||void 0===t?void 0:t.call(this),c(this,fo,"f").subscribe(c(this,lo,"m",Oo).bind(this)),c(this,fo,"f").update({isDebug:this.debug}),c(this,lo,"m",bo).call(this),c(this,lo,"m",Ao).call(this),yield c(this,lo,"m",So).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");const n=yield this.getConfig();if("isMissingConfig"in n&&n.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");c(this,lo,"m",No).call(this);const{executionId:i,stepId:r,token:o,code:s,exchangeError:a,redirectAuthCallbackUrl:d,redirectAuthBackupCallbackUri:l,redirectAuthCodeChallenge:h,redirectAuthInitiator:f,ssoQueryParams:p}=or(this.flowId,this.loggerWrapper);window.addEventListener("popstate",c(this,vo,"f").popstate),window.addEventListener("components-context",c(this,vo,"f").componentsContext),c(this,ho,"f").subscribe(c(this,lo,"m",ko).bind(this)),c(this,ho,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:r,executionId:i,token:o,code:s,exchangeError:a,redirectAuthCallbackUrl:d,redirectAuthBackupCallbackUri:l,redirectAuthCodeChallenge:h,redirectAuthInitiator:f},p)),u(this,uo,!0,"f")}))}disconnectedCallback(){c(this,ho,"f").unsubscribeAll(),c(this,fo,"f").unsubscribeAll(),c(this,lo,"m",Ro).call(this),window.removeEventListener("popstate",c(this,vo,"f").popstate),window.removeEventListener("components-context",c(this,vo,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&c(this,uo,"f")&&t!==n&&co.observedAttributes.includes(e)){c(this,lo,"m",bo).call(this);const i=null===t;"nonce"===e&&c(this,lo,"m",Ao).call(this),c(this,ho,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,ir()),{[rr(e)]:n,stepId:o,executionId:s}})),c(this,fo,"f").update({isDebug:this.debug})}}};function Mo(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var To,Uo,_o,Lo,Wo,Do,Fo,qo,Bo,Vo,Ko,Ho,Go,zo,Jo,Zo,Yo,Xo,Qo,es,ts,ns,is,rs,os,ss,as,ds,ls;co=Po,uo=new WeakMap,ho=new WeakMap,fo=new WeakMap,po=new WeakMap,go=new WeakMap,vo=new WeakMap,mo=new WeakMap,lo=new WeakSet,yo=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n "),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n]},$o=function(){c(this,lo,"m",yo).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},bo=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","nonce","outbound-app-id","outbound-app-scopes"];co.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[rr(t)])throw Error(`${t} cannot be empty`)}))},wo=function(){const{stepId:e,executionId:t}=nr(this.flowId);c(this,ho,"f").update({stepId:e,executionId:t})},Co=function(e,t){this.sdk=jn(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},co.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>l(this,void 0,void 0,(function*(){try{return yield t(...e)}catch(e){return{error:{errorCode:wi,errorDescription:e.toString()}}}}))}))},ko=function(e,t,n){return l(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;c(this,lo,"m",Co).call(this,t,i)}c(this,mo,"f").call(this,e)}))},So=function(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield c(this,lo,"m",xo).call(this))}))},xo=function(){return l(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(Ci||i||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:"config.json",assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield function(e,t){return l(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](),headers:Object.fromEntries(n.headers.entries())}}))}(e,"json"),!0}catch(e){return!1}}))},Io=function(e){u(this,po,Object.assign(Object.assign({},c(this,po,"f")),e.detail),"f")},Ro=function(){var e;null===(e=c(this,go,"f"))||void 0===e||e.remove(),u(this,go,null,"f")},Oo=function(e){return l(this,arguments,void 0,(function*({isDebug:e}){e?(u(this,go,document.createElement("descope-debugger"),"f"),Object.assign(c(this,go,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return ky})),document.body.appendChild(c(this,go,"f"))):c(this,lo,"m",Ro).call(this)}))},Eo=function(e,t){var n;e&&this.debug&&(null===(n=c(this,go,"f"))||void 0===n||n.updateData({title:e,description:t}))},No=function(){this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Ji.includes(null!==(i=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==i?i:"");if("Enter"!==e.key||r||o)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()}}},Ao=function(){this.getAttribute("nonce")&&(window.DESCOPE_NONCE=this.getAttribute("nonce"))},Po.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.40.9"}};let cs=class extends Po{static set sdkConfigOverrides(e){Po.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Po.sdkConfigOverrides}constructor(){const e=new yr({deferredRedirect:!1});super(e.update.bind(e)),To.add(this),this.stepState=new yr({}),Uo.set(this,void 0),_o.set(this,null),Lo.set(this,null),Wo.set(this,{visibilitychange:c(this,To,"m",Do).bind(this)}),this.bridgeVersion=1,this.nativeResume=(e,t)=>{var n;const i=JSON.parse(t);if(this.logger.info(`nativeResume received payload of type '${e}'`),"oauthWeb"===e||"sso"===e){let{exchangeCode:e}=i;e||(e=null===(n=new URL(i.url).searchParams)||void 0===n?void 0:n.get(xi)),this.nativeComplete({exchangeCode:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(i.url),t=e.searchParams.get("t"),n=e.searchParams.get(Si).split("_").pop();c(this,zo,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else this.nativeComplete(i)},Ko.set(this,(e=>{const t=()=>{this.contentRootElement.classList.toggle("hidden",e),this.slotElement.classList.toggle("hidden",!e),e&&(this.contentRootElement.innerHTML="")};e&&this.contentRootElement.hasChildNodes()?c(this,To,"m",Ho).call(this,t):t()})),Go.set(this,((e,t,n,i,r=!1)=>{if(this.flowState.current.action===qi){this.logger.debug("polling - Scheduling polling request");const o=Date.now(),s=r?500:2e3;u(this,Uo,setTimeout((()=>l(this,void 0,void 0,(function*(){var a;this.logger.debug("polling - Calling next");const d=this.sdk.flow.next(e,t,zi,n,i,{}),l=document.hidden&&!r&&Date.now()-o>s+500;let u;l&&this.logger.debug("polling - The polling seems to be throttled");try{const e=l?1e3:6e3;u=yield ar(e,d)}catch(a){return this.logger.warn(`polling - The ${l?"throttled fetch":"fetch"} call timed out or was aborted`),void c(this,Go,"f").call(this,e,t,n,i,l)}if((null===(a=null==u?void 0:u.error)||void 0===a?void 0:a.errorCode)===wi)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void c(this,Go,"f").call(this,e,t,n,i);this.logger.debug("polling - Got a response"),(null==u?void 0:u.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(u.error,null,4)),c(this,Go,"f").call(this,e,t,n,i),c(this,Jo,"f").call(this,u)}))),s),"f")}})),zo.set(this,(()=>{clearTimeout(c(this,Uo,"f")),u(this,Uo,null,"f")})),Jo.set(this,(e=>{var t,n,i,r,o,s,a,d,l,h,f,p,g;if(!(null==e?void 0:e.ok)){const a=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}`;c(this,To,"m",ls).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:d,errorMessage:a}),this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||a,(null===(o=null==e?void 0:e.error)||void 0===o?void 0:o.errorMessage)||d);const l=null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorCode;return void("E102004"!==l&&"E103205"!==l||!this.isRestartOnError||c(this,To,"m",Bo).call(this))}null===(d=null===(a=e.data)||void 0===a?void 0:a.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 v=null===(f=null===(h=null===(l=e.data)||void 0===l?void 0:l.screen)||void 0===h?void 0:h.state)||void 0===f?void 0:f.errorText;(null===(p=e.data)||void 0===p?void 0:p.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${v?`${v} - `:""}${e.data.error.message}`):v&&this.loggerWrapper.error(v);const{status:m,authInfo:y,lastAuth:$,action:b,openInNewTabUrl:w}=e.data;if(b!==qi&&c(this,zo,"f").call(this),"completed"===m)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&bi&&localStorage.setItem(Oi,JSON.stringify(e))}($),void c(this,To,"m",ls).call(this,"success",y);w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:x,redirect:I,webauthn:R,error:O,samlIdpResponse:E,nativeResponse:N}=e.data,A=Date.now();b!==qi?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:x,status:m,stepId:k,stepName:S,action:b,error:O}),(null===(g=x.state)||void 0===g?void 0:g.clientScripts)&&u(this,Lo,this.loadSdkScripts(x.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==I?void 0:I.url,screenId:null==x?void 0:x.id,screenState:null==x?void 0:x.state,webauthnTransactionId:null==R?void 0:R.transactionId,webauthnOptions:null==R?void 0:R.options,samlIdpResponseUrl:null==E?void 0:E.url,samlIdpResponseSamlResponse:null==E?void 0:E.samlResponse,samlIdpResponseRelayState:null==E?void 0:E.relayState,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:A})):this.flowState.update({action:b,reqTimestamp:A})})),Zo.set(this,sr((()=>l(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)}}))))),ss.set(this,ur(((e,t)=>l(this,void 0,void 0,(function*(){var n;if("true"===e.getAttribute("formnovalidate")||c(this,To,"m",es).call(this)){const i=null==e?void 0:e.getAttribute("id");c(this,To,"m",ns).call(this,e);const r=yield c(this,To,"m",ts).call(this),o=(e=>Array.from((null==e?void 0:e.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}),{}))(e);if(this.nextRequestStatus.update({isLoading:!0}),c(this,Lo,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield c(this,Lo,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const s=this.loadSdkScriptsModules();if(s.length>0){const e=s.filter((e=>"function"==typeof e.refresh)).map((e=>e.refresh()));e.length>0&&(yield ar(5e3,Promise.all(e),null))}const a=this.getComponentsContext(),d=Object.assign(Object.assign(Object.assign(Object.assign({},a),o),r),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin});yield t(i,d),this.nextRequestStatus.update({isLoading:!1}),c(this,To,"m",is).call(this,r)}}))))),this.flowState=e}loadSdkScriptsModules(){const e=this.shadowRoot.querySelectorAll("div[data-script-id]");return Array.from(e).map((e=>e.moduleRes)).filter((e=>!!e))}loadSdkScripts(e){if(!(null==e?void 0:e.length))return null;const t=(e,t)=>n=>{this.dispatchEvent(new CustomEvent("components-context",{detail:{[Mo(e.id,e.resultKey)]:n},bubbles:!0,composed:!0})),t(e.id)};this.loggerWrapper.debug(`Preparing to load scripts: ${e.map((e=>e.id)).join(", ")}`);const n=Promise.all(null==e?void 0:e.map((e=>l(this,void 0,void 0,(function*(){var n;const i=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(i){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=i;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}const r=yield function(e){return l(this,void 0,void 0,(function*(){let t;switch(e){case"forter":return t=yield Promise.resolve().then((function(){return Sy})),t.default;case"fingerprint":return t=yield Promise.resolve().then((function(){return Iy})),t.default;case"fingerprintDescope":return t=yield Promise.resolve().then((function(){return Oy})),t.default;case"grecaptcha":return t=yield Promise.resolve().then((function(){return Ay})),t.default;default:throw new Error(`Unknown script id: ${e}`)}}))}(e.id);return new Promise(((n,i)=>{try{const i=r(e.initArgs,{baseUrl:this.baseUrl},t(e,n));if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t),this.nextRequestStatus.subscribe((()=>{var t;this.loggerWrapper.debug("Unloading script",e.id),null===(t=i.stop)||void 0===t||t.call(i)}))}}catch(e){i(e)}}))}))))),i=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([n,i])}get isDismissScreenErrorOnInput(){return"true"===this.getAttribute("dismiss-screen-error-on-input")}init(){if(!window.isDescopeBridge)return this._init();this.lazyInit=this._init}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t,n;this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),c(this,To,"m",qo).call(this),window.addEventListener("visibilitychange",c(this,Wo,"f").visibilitychange)),yield null===(n=e.init)||void 0===n?void 0:n.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=c(this,_o,"f"))||void 0===e||e.abort(),u(this,_o,null,"f"),window.removeEventListener("visibilitychange",c(this,Wo,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return l(this,void 0,void 0,(function*(){let n;const i=hr(e),r=yield this.getTargetLocales();return r.includes(i.locale)?n=`${t}-${i.locale}.html`:r.includes(i.fallback)&&(n=`${t}-${i.fallback}.html`),n}))}getPageContent(e,t){return l(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield this.fetchStaticResource(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 this.fetchStaticResource(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){return l(this,void 0,void 0,(function*(){var i,r;const{projectId:o,flowId:s,tenant:a,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectUrl:y,token:$,code:b,exchangeError:w,webauthnTransactionId:C,webauthnOptions:k,redirectAuthCodeChallenge:S,redirectAuthCallbackUrl:x,redirectAuthBackupCallbackUri:I,redirectAuthInitiator:R,locale:O,samlIdpResponseUrl:E,samlIdpResponseSamlResponse:N,samlIdpResponseRelayState:A,nativeResponseType:j,nativePayload:P,reqTimestamp:M}=e,T=d(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectUrl","token","code","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","nativeResponseType","nativePayload","reqTimestamp"]);let U,_,L;const W=(()=>{const e=localStorage.getItem(Er);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Er,e.toString()),e}return Number(e)})(),D=this.outboundAppId,F=this.outboundAppScopes,q=this.sdk.getLastUserLoginId(),B=yield this.getFlowConfig(),V=yield this.getProjectConfig(),K=Object.entries(V.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),H=x&&S?{callbackUrl:x,codeChallenge:S,backupCallbackUri:I}:void 0,G=this.nativeOptions?{platform:this.nativeOptions.platform,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect}:void 0;let z={};if(!f){const e=[...B.clientScripts||[],...B.sdkScripts||[]];if(B.conditions){let t=[];({startScreenId:U,conditionInteractionId:L,startScreenName:_,clientScripts:t,componentsConfig:z}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:i})=>{var r;if("ELSE"===t)return!0;const o=null===(r=Nr[t])||void 0===r?void 0:r[n];return!!(null==o?void 0:o(e,i))}));return n?{startScreenId:n.met.screenId,startScreenName:n.met.screenName,conditionInteractionId:n.met.interactionId,clientScripts:n.met.clientScripts,componentsConfig:n.met.componentsConfig}:{}})({loginId:q,code:b,token:$,abTestingKey:W},B.conditions)),e.push(...t||[])}else B.condition?({startScreenId:U,conditionInteractionId:L}=((e,t)=>{var n;const i=null===(n=Nr[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!i)return{};const r=i(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,startScreenName:null==r?void 0:r.screenName,conditionInteractionId:null==r?void 0:r.interactionId}})(B.condition,{loginId:q,code:b,token:$,abTestingKey:W})):(_=B.startScreenName,U=B.startScreenId);if(u(this,Lo,this.loadSdkScripts(e),"f"),B.fingerprintEnabled&&B.fingerprintKey?yield dn(B.fingerprintKey,this.baseUrl):localStorage.removeItem(sn),!dr(U,T)){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:H},T),{client:this.client}),y&&{redirectUrl:y}),{lastAuth:Ar(q),abTestingKey:W,locale:hr(O).locale,nativeOptions:G,outboundAppId:D,outboundAppScopes:F}),L,"",V.componentsVersion,K,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),b?{exchangeCode:b,idpInitiated:!0}:{}),T.descopeIdpInitiated&&{idpInitiated:!0}),$?{token:$}:{}),T.oidcLoginHint?{externalId:T.oidcLoginHint}:{}));return c(this,Jo,"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(f&&(n("token")&&$||n("code")&&b||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(f,h,Gi,B.version,V.componentsVersion,{token:$,exchangeCode:b,exchangeError:w});return c(this,Jo,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Hi&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!E||!N)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,i)=>{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),i(r)})(E,N,A||"",lr)}if(p===Fi&&(n("redirectTo")||n("deferredRedirect")))return m?"android"===R&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(m):void this.loggerWrapper.error("Did not get redirect url");if(p===Bi||p===Vi){if(!C||!k)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=c(this,_o,"f"))||void 0===r||r.abort(),u(this,_o,null,"f");try{e=p===Bi?yield this.sdk.webauthn.helpers.create(k):yield this.sdk.webauthn.helpers.get(k)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name}const n=yield this.sdk.flow.next(f,h,Gi,B.version,V.componentsVersion,{transactionId:C,response:e,failure:t});c(this,Jo,"f").call(this,n)}if(p===Ki)return this.nativeComplete=e=>l(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,Gi,B.version,V.componentsVersion,e);c(this,Jo,"f").call(this,t)})),void c(this,To,"m",ls).call(this,"bridge",{type:j,payload:P});if(n("action")&&c(this,Go,"f").call(this,f,h,B.version,V.componentsVersion),!g&&!U)return void this.loggerWrapper.warn("No screen was found to show");const J=U||g,Z=yield this.getHtmlFilenameWithLocale(O,J),{oidcLoginHint:Y,oidcPrompt:X,oidcErrorRedirectUri:Q,samlIdpUsername:ee}=T,te={direction:tr(h,t.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:q,name:this.sdk.getLastUserDisplayName()||q},componentsConfig:Object.assign(Object.assign(Object.assign({},B.componentsConfig),z),null==v?void 0:v.componentsConfig)}),htmlFilename:`${J}.html`,htmlLocaleFilename:Z,screenId:J,stepName:e.stepName||_,samlIdpUsername:ee,oidcLoginHint:Y,oidcPrompt:X,oidcErrorRedirectUri:Q},ne=Ar(q);dr(U,T)?te.next=(e,t)=>l(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:H},T),{lastAuth:ne,preview:this.preview,abTestingKey:W,client:this.client}),y&&{redirectUrl:y}),{locale:hr(O).locale,nativeOptions:G,outboundAppId:D,outboundAppScopes:F}),L,e,V.componentsVersion,K,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),t),b&&{exchangeCode:b,idpInitiated:!0}),T.descopeIdpInitiated&&{idpInitiated:!0}),$&&{token:$}));return c(this,Jo,"f").call(this,n),n})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(te.next=(e,t)=>l(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.next(f,h,e,B.version,V.componentsVersion,t);return c(this,Jo,"f").call(this,n),n}))),this.loggerWrapper.debug("Got a screen with id",te.screenId),yield c(this,To,"m",Vo).call(this,te),this.stepState.update(te)}))}onStepChange(e,t){return l(this,void 0,void 0,(function*(){var n,i;const{htmlFilename:r,htmlLocaleFilename:o,direction:s,next:a,screenState:d}=e;this.loggerWrapper.debug("Rendering a flow screen");const u=document.createElement("template");u.innerHTML=yield this.getPageContent(r,o);const h=u.content.cloneNode(!0),f=this.loadDescopeUiComponents(u);this.sdk.webauthn.helpers.isSupported()?yield c(this,To,"m",Xo).call(this,h,a):(e=>{e.querySelectorAll(`descope-button[${Di}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(h),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(i=d.form)||void 0===i?void 0:i.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),Rr(h,d,d.componentsConfig,this.formConfig,this.loggerWrapper);const{geo:p}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,p);const g=()=>l(this,void 0,void 0,(function*(){var n,i;yield f;const r=this.contentRootElement;((e,t)=>{Ir(e,"descope-totp-image",t)})(r,null===(n=null==d?void 0:d.totp)||void 0===n?void 0:n.image),((e,t)=>{Ir(e,"descope-notp-image",t)})(r,null===(i=null==d?void 0:d.notp)||void 0===i?void 0:i.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{t.querySelector(r)||i.debug(`Skipping css vars for component "${r}}"`,`Got css vars for component ${r} but Could not find it on next page`);const o=customElements.get(r);o?Object.keys(n[r]).forEach((t=>{var s;const a=n[r],d=null===(s=null==o?void 0:o.cssVarList)||void 0===s?void 0:s[t];if(!d)return void i.info(`Could not find css variable name for ${t} in ${r}`,"Check if the css variable is defined in the component");const l=a[t];e.style.setProperty(d,l)})):i.info(`Could not find component class for ${r}`,"Check if the component is registered")}))})(r,h,d.cssVars,this.loggerWrapper),r.replaceChildren(h);const o=!t.htmlFilename;setTimeout((()=>{c(this,To,"m",rs).call(this),this.validateOnBlur&&(e=>{e.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}))}))}))})(r),((e,t)=>{Cr(e,null==t?void 0:t.inputs),Cr(e,null==t?void 0:t.form)})(r,d),c(this,To,"m",Qo).call(this,{isFirstScreen:o,stepName:e.stepName}),((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(r,this.autoFocus,o)})),c(this,To,"m",ds).call(this,a),r.querySelector(`[${Di}="polling"]`)&&a(zi,{})}));s?c(this,To,"m",Ho).call(this,g):g()}))}};Uo=new WeakMap,_o=new WeakMap,Lo=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,Go=new WeakMap,zo=new WeakMap,Jo=new WeakMap,Zo=new WeakMap,ss=new WeakMap,To=new WeakSet,Do=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1})}),300)},Fo=function({errorText:e,errorType:t}){const n=()=>{var n;let i=e;try{i=(null===(n=this.errorTransformer)||void 0===n?void 0:n.call(this,{text:e,type:t}))||e}catch(e){this.loggerWrapper.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Di}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(this.contentRootElement,"error-message",i)};this.addEventListener("screen-updated",n,{once:!0}),n()},qo=function(){var e,t;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var t=e.screenState,n=d(void 0===t?{}:t,["errorText","errorType"]),i=d(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:n})})),null===(t=this.stepState)||void 0===t||t.subscribe(c(this,To,"m",Fo).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}))},Bo=function(){return l(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Trying to restart the flow");const e=yield this.getComponentsVersion();this.reset(),e===(yield this.getComponentsVersion())?(this.loggerWrapper.debug("Components version was not changed, restarting flow"),this.flowState.update({stepId:null,executionId:null})):this.loggerWrapper.error("Components version mismatch, please reload the page")}))},Vo=function(e){return l(this,void 0,void 0,(function*(){var t;const n=Object.assign(Object.assign({},this.stepState.current),e),{next:i,stepName:r}=n,o=d(n,["next","stepName"]),s=Boolean(yield null===(t=this.onScreenUpdate)||void 0===t?void 0:t.call(this,r,(e=>{const t=(n=e.screenState,i=(e,t)=>Zi.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([e,t])=>!i(0,e)))));var n,i;const{screenState:{errorText:r,errorType:o}}=e;return(r||o)&&(t.error={text:r,type:o}),t})(o),i,this)),a=!this.stepState.current.htmlFilename;if(c(this,Ko,"f").call(this,s),s){this.loggerWrapper.debug("Rendering a custom screen"),c(this,To,"m",Qo).call(this,{isFirstScreen:a,stepName:e.stepName}),this.stepState.unsubscribeAll();const t=this.stepState.subscribe((()=>{this.stepState.unsubscribe(t),c(this,To,"m",qo).call(this)}))}this.stepState.forceUpdate=s}))},Ho=function(e){this.contentRootElement.addEventListener("transitionend",(()=>{this.loggerWrapper.debug("page switch transition end"),this.contentRootElement.classList.remove("fade-out"),e()}),{once:!0}),this.loggerWrapper.debug("page switch transition start"),this.contentRootElement.classList.add("fade-out")},Yo=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)}))}},Xo=function(e,t){return l(this,void 0,void 0,(function*(){var n;null===(n=c(this,_o,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield Or())){const{options:e,transactionId:n}=(yield c(this,Zo,"f").call(this))||{};e&&n&&(c(this,To,"m",Yo).call(this,i),u(this,_o,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,c(this,_o,"f")).then((e=>l(this,void 0,void 0,(function*(){t(i.id,{transactionId:n,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},Qo=function({isFirstScreen:e,stepName:t}){e&&c(this,To,"m",ls).call(this,"ready",{}),c(this,To,"m",ls).call(this,"page-updated",{screenName:t}),c(this,To,"m",ls).call(this,"screen-updated",{screenName:t})},es=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},ts=function(){return l(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Ii}])`));return(yield Promise.all(e.map((e=>l(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})),{})}))},ns=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},is=function(e={}){var t,n;const i=cr(e,["externalId","email","phone"]),r=cr(e,["newPassword","password"]);if(i&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:i,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)}},rs=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>c(this,To,"m",os).call(this,e)))},os=function(e){e&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),i=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",i),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",i),this.appendChild(t)}))},as=function(e){this.contentRootElement.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))&&c(this,ss,"f").call(this,t,e)}))}))},ds=function(e){this.contentRootElement.querySelectorAll(`descope-button:not([${Ri}]), [data-type="button"]:not([${Ri}]`).forEach((t=>{t.onclick=()=>{c(this,ss,"f").call(this,t,e)}})),c(this,To,"m",as).call(this,e),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Ii}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},ls=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",cs);var us=Object.freeze({__proto__:null,default:cs});const hs=zn((e=>{var t,n,i,r,o,s,a;return a=class extends(Fn(_r,Pr)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,i),"debug"===e&&c(this,t,"m",o).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&&c(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)),c(this,t,"m",o).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=c(this,n,"f"))||void 0===e||e.remove(),u(this,n,null,"f")},r=async function(){u(this,n,document.createElement("descope-debugger"),"f"),Object.assign(c(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Ky})),document.body.appendChild(c(this,n,"f"))},o=function(){this.debug?c(this,t,"m",r).call(this):c(this,t,"m",i).call(this)},s=function(e,t){var i;e&&(null===(i=c(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},a})),fs="descope-modal";var ps,gs;let vs=class{constructor(e,t){ps.set(this,void 0),this.nodeName="",u(this,ps,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>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)})))(c(this,ps,"f"))}get ele(){var e,t;const n="function"==typeof c(this,ps,"f")?c(this,ps,"f").call(this):c(this,ps,"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(`Driver element is not available for ${this.nodeName}`,new Error),null)}};ps=new WeakMap;const ms=/^descope-grid-([^-]+)-column$/,ys={text:class extends vs{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 vs{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)}}}};let $s=class extends vs{constructor(){super(...arguments),this.nodeName="descope-grid",gs.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=ms.exec(t.localName))||void 0===n?void 0:n[1],r=ys[i];return r?(e.push(new r(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);Bn(i,this.ele.columns)||(this.ele.columns=i,null===(n=c(this,gs,"f"))||void 0===n||n.call(this,i))}onColumnsChange(e){u(this,gs,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};gs=new WeakMap;class bs extends vs{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 ws;class Cs extends vs{constructor(){super(...arguments),ws.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=""),c(this,ws,"f")&&(null===(e=this.ele)||void 0===e||e.append(c(this,ws,"f").content.cloneNode(!0)))}setContent(e){u(this,ws,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}ws=new WeakMap;let ks=class extends vs{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()))}},Ss=class extends vs{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()))}},xs=class extends vs{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()}},Is=class extends vs{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)}},Rs=class extends vs{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")}},Os=class extends vs{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)}}},Es=class extends vs{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)}}},Ns=class extends vs{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")}},As=class extends vs{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)}set theme(e){var t,n;e?null===(n=this.ele)||void 0===n||n.setAttribute("theme",e):null===(t=this.ele)||void 0===t||t.removeAttribute("theme")}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)}}},js=class extends vs{constructor(){super(...arguments),this.nodeName="descope-apps-list"}set data(e){this.ele&&(this.ele.data=e)}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}get ele(){return super.ele}};const Ps=zn((e=>{var t,n;const i=Fn(_r,io,eo)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Cs{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(fs);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(c(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([fs]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Ms="descope-notification",Ts=zn((e=>{var t,n;const i=Fn(_r,io,eo)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends xs{setContent(t){const n="string"==typeof t?qn(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Ms);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(c(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([Ms])}},t=new WeakMap,n}));function Us(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 _s=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Ls=()=>Math.random().toString(36).substring(7).split("").join("."),Ws={INIT:`@@redux/INIT${Ls()}`,REPLACE:`@@redux/REPLACE${Ls()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ls()}`};function Ds(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 Fs(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 qs(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Fs(e)),t}function Bs(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Us(2):`Expected the root reducer to be a function. Instead, received: '${qs(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Us(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?Us(1):`Expected the enhancer to be a function. Instead, received: '${qs(n)}'`);return n(Bs)(e,t)}let i=e,r=t,o=new Map,s=o,a=0,d=!1;function l(){s===o&&(s=new Map,o.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("production"===process.env.NODE_ENV?Us(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?Us(4):`Expected the listener to be a function. Instead, received: '${qs(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Us(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?Us(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),o=null}}}function h(e){if(!Ds(e))throw new Error("production"===process.env.NODE_ENV?Us(7):`Actions must be plain objects. Instead, the actual type was: '${qs(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?Us(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?Us(17):`Action "type" property must be a string. Instead, the actual type was: '${qs(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Us(9):"Reducers may not dispatch actions.");try{d=!0,r=i(r,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Ws.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Us(10):`Expected the nextReducer to be a function. Instead, received: '${qs(e)}`);i=e,h({type:Ws.REPLACE})},[_s]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Us(11):`Expected the observer to be an object. Instead, received: '${qs(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[_s](){return this}}}}}function Vs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Ks(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];"production"!==process.env.NODE_ENV&&void 0===e[r]&&Vs(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r,o;"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:Ws.INIT}))throw new Error("production"===process.env.NODE_ENV?Us(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:Ws.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Us(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Ws.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){o=e}return function(e={},t){if(o)throw o;if("production"!==process.env.NODE_ENV){const i=function(e,t,n,i){const r=Object.keys(t),o=n&&n.type===Ws.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(!Ds(e))return`The ${o} has unexpected type of "${qs(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!i[e]));return s.forEach((e=>{i[e]=!0})),n&&n.type===Ws.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${o}. Expected to find one of the known reducer keys instead: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);i&&Vs(i)}let s=!1;const a={};for(let r=0;r<i.length;r++){const o=i[r],d=n[o],l=e[o],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?Us(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${o}" 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[o]=c,s=s||c!==l}return s=s||i.length!==Object.keys(e).length,s?a:e}}function Hs(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Gs(e){return Ds(e)&&"type"in e&&"string"==typeof e.type}var zs=Symbol.for("immer-nothing"),Js=Symbol.for("immer-draftable"),Zs=Symbol.for("immer-state"),Ys="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 Xs(e,...t){if("production"!==process.env.NODE_ENV){const n=Ys[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 Qs=Object.getPrototypeOf;function ea(e){return!!e&&!!e[Zs]}function ta(e){return!!e&&(ia(e)||Array.isArray(e)||!!e[Js]||!!e.constructor?.[Js]||da(e)||la(e))}var na=Object.prototype.constructor.toString();function ia(e){if(!e||"object"!=typeof e)return!1;const t=Qs(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)===na}function ra(e,t){0===oa(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function oa(e){const t=e[Zs];return t?t.type_:Array.isArray(e)?1:da(e)?2:la(e)?3:0}function sa(e,t){return 2===oa(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function aa(e,t,n){const i=oa(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function da(e){return e instanceof Map}function la(e){return e instanceof Set}function ca(e){return e.copy_||e.base_}function ua(e,t){if(da(e))return new Map(e);if(la(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&ia(e)){if(!Qs(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Zs];let i=Reflect.ownKeys(n);for(let t=0;t<i.length;t++){const r=i[t],o=n[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(n[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[r]})}return Object.create(Qs(e),n)}function ha(e,t=!1){return pa(e)||ea(e)||!ta(e)||(oa(e)>1&&(e.set=e.add=e.clear=e.delete=fa),Object.freeze(e),t&&ra(e,((e,t)=>ha(t,!0)))),e}function fa(){Xs(2)}function pa(e){return Object.isFrozen(e)}var ga,va={};function ma(e){const t=va[e];return t||Xs(0,e),t}function ya(){return ga}function $a(e,t){t&&(ma("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ba(e){wa(e),e.drafts_.forEach(ka),e.drafts_=null}function wa(e){e===ga&&(ga=e.parent_)}function Ca(e){return ga={drafts_:[],parent_:ga,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ka(e){const t=e[Zs];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Sa(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Zs].modified_&&(ba(t),Xs(4)),ta(e)&&(e=xa(t,e),t.parent_||Ra(t,e)),t.patches_&&ma("Patches").generateReplacementPatches_(n[Zs].base_,e,t.patches_,t.inversePatches_)):e=xa(t,n,[]),ba(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==zs?e:void 0}function xa(e,t,n){if(pa(t))return t;const i=t[Zs];if(!i)return ra(t,((r,o)=>Ia(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return Ra(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let r=t,o=!1;3===i.type_&&(r=new Set(t),t.clear(),o=!0),ra(r,((r,s)=>Ia(e,i,t,r,s,n,o))),Ra(e,t,!1),n&&e.patches_&&ma("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Ia(e,t,n,i,r,o,s){if("production"!==process.env.NODE_ENV&&r===n&&Xs(5),ea(r)){const s=xa(e,r,o&&t&&3!==t.type_&&!sa(t.assigned_,i)?o.concat(i):void 0);if(aa(n,i,s),!ea(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(ta(r)&&!pa(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;xa(e,r),t&&t.scope_.parent_||Ra(e,r)}}function Ra(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ha(t,n)}var Oa={get(e,t){if(t===Zs)return e;const n=ca(e);if(!sa(n,t))return function(e,t,n){const i=Aa(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_||!ta(i)?i:i===Na(e.base_,t)?(Pa(e),e.copy_[t]=Ma(i,e)):i},has:(e,t)=>t in ca(e),ownKeys:e=>Reflect.ownKeys(ca(e)),set(e,t,n){const i=Aa(ca(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=Na(ca(e),t),r=i?.[Zs];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,i)&&(void 0!==n||sa(e.base_,t)))return!0;Pa(e),ja(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!==Na(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Pa(e),ja(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ca(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){Xs(11)},getPrototypeOf:e=>Qs(e.base_),setPrototypeOf(){Xs(12)}},Ea={};function Na(e,t){const n=e[Zs];return(n?ca(n):e)[t]}function Aa(e,t){if(!(t in e))return;let n=Qs(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Qs(n)}}function ja(e){e.modified_||(e.modified_=!0,e.parent_&&ja(e.parent_))}function Pa(e){e.copy_||(e.copy_=ua(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ra(Oa,((e,t)=>{Ea[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ea.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Xs(13),Ea.set.call(this,e,t,void 0)},Ea.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Xs(14),Oa.set.call(this,e[0],t,n,e[0])};function Ma(e,t){const n=da(e)?ma("MapSet").proxyMap_(e,t):la(e)?ma("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:ya(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=Oa;n&&(r=[i],o=Ea);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:ya()).drafts_.push(n),n}function Ta(e){return ea(e)||Xs(10,e),Ua(e)}function Ua(e){if(!ta(e)||pa(e))return e;const t=e[Zs];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ua(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ua(e,!0);return ra(n,((e,t)=>{aa(n,e,Ua(t))})),t&&(t.finalized_=!1),n}var _a=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,...r){return i.produce(e,(e=>t.call(this,e,...r)))}}let i;if("function"!=typeof t&&Xs(6),void 0!==n&&"function"!=typeof n&&Xs(7),ta(e)){const r=Ca(this),o=Ma(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?ba(r):wa(r)}return $a(r,n),Sa(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===zs&&(i=void 0),this.autoFreeze_&&ha(i,!0),n){const t=[],r=[];ma("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}Xs(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,i;const r=this.produce(e,t,((e,t)=>{n=e,i=t}));return[r,n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ta(e)||Xs(8),ea(e)&&(e=Ta(e));const t=Ca(this),n=Ma(e,void 0);return n[Zs].isManual_=!0,wa(t),n}finishDraft(e,t){const n=e&&e[Zs];n&&n.isManual_||Xs(9);const{scope_:i}=n;return $a(i,t),Sa(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=ma("Patches").applyPatches_;return ea(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},La=_a.produce;_a.produceWithPatches.bind(_a),_a.setAutoFreeze.bind(_a),_a.setUseStrictShallowCopy.bind(_a),_a.applyPatches.bind(_a),_a.createDraft.bind(_a),_a.finishDraft.bind(_a);var Wa=(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})}}},Da=(e,t,n)=>{const{memoize:i,memoizeOptions:r}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=i((()=>({})),...r);if(!(a.apply(null,o)===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:o,secondInputs:s,stack:e})}},Fa={inputStabilityCheck:"once",identityFunctionCheck:"once"};var qa=e=>Array.isArray(e)?e:[e];function Ba(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 Va(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var Ka="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},Ha=0,Ga=1;function za(){return{s:Ha,v:void 0,o:null,p:null}}function Ja(e,t={}){let n=za();const{resultEqualityCheck:i}=t;let r,o=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=za(),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=za(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===Ga)d=t.v;else if(d=e.apply(null,arguments),o++,i){const e=r?.deref?.()??r;null!=e&&i(e,d)&&(d=e,0!==o&&o--);r="object"==typeof d&&null!==d||"function"==typeof d?new Ka(d):d}return a.s=Ga,a.v=d,d}return s.clearCache=()=>{n=za(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function Za(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,i=(...e)=>{let t,i=0,r=0,o={},s=e.pop();"object"==typeof s&&(o=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,...o},{memoize:d,memoizeOptions:l=[],argsMemoize:c=Ja,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=qa(l),p=qa(u),g=Ba(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const y=c((function(){r++;const e=Va(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}={...Fa,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Wa},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Da}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=Va(g,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign(y,{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:d,argsMemoize:c})};return Object.assign(i,{withTypes:()=>i}),i}var Ya=Za(Ja),Xa=Object.assign(((e,t=Ya)=>{!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:()=>Xa});function Qa(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var ed=Qa(),td=Qa;((...e)=>{const t=Za(...e)})(Ja);var nd="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Hs:Hs.apply(null,arguments)},id=e=>e&&"function"==typeof e.match;function rd(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?Ld(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=>Gs(t)&&t.type===e,n}function od(e){return"function"==typeof e&&"type"in e&&id(e)}function sd(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 ad=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 dd(e){return ta(e)?La(e,(()=>{})):e}function ld(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?Ld(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function cd(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function ud(e,t,n){const i=hd(e,t,n);return{detectMutations:()=>fd(e,t,i,n)}}function hd(e,t=[],n,i="",r=new Set){const o={value:n};if(!e(n)&&!r.has(n)){r.add(n),o.children={};for(const r in n){const s=i?i+"."+r:r;t.length&&-1!==t.indexOf(s)||(o.children[r]=hd(e,t,n[r],s))}}return o}function fd(e,t=[],n,i,r=!1,o=""){const s=n?n.value:void 0,a=s===i;if(r&&!a&&!Number.isNaN(i))return{wasMutated:!0,path:o};if(e(s)||e(i))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in i)d[e]=!0;const l=t.length>0;for(let r in d){const s=o?o+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=fd(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function pd(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ds(e)}function gd(e,t="",n=pd,i,r=[],o){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(o?.has(e))return!1;const a=null!=i?i(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=gd(l,a,n,i,r,o),s))return s}return o&&vd(e)&&o.add(e),!1}function vd(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!vd(t))return!1;return!0}function md(e){return"boolean"==typeof e}var yd=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new ad;if(t&&(md(t)?o.push(ed):o.push(td(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};md(n)||(e=n),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,i,r){return JSON.stringify(e,n(t,r),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(r,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,r):i.push(r),~n.indexOf(o)&&(o=t.call(this,r,o))}else n.push(o);return null==e?o:e.call(this,r,o)}},{isImmutable:i=cd,ignoredPaths:r,warnAfter:o=32}=e;const s=ud.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=sd(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ld(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(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ld(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(i){let e={};md(i)||(e=i),o.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=pd,getEntries:n,ignoredActions:i=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:o=[],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(!Gs(u))return l(u);const h=l(u),f=sd(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=gd(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||(f.measureTime((()=>{const i=gd(e.getState(),"",t,n,o,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(r){let e={};md(r)||(e=r),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=od}=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 o},$d=e=>t=>{setTimeout(t,e)},bd="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:$d(10),wd=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new ad(e);return n&&i.push(((e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let r=!0,o=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?bd:"callback"===e.type?e.queueNotification:$d(e.timeout),l=()=>{s=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},i,{subscribe(e){const t=i.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,o=!r,o&&(s||(s=!0,d(l))),i.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),i},Cd="production"===process.env.NODE_ENV;function kd(e){const t=yd(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ds(n))throw new Error("production"===process.env.NODE_ENV?Ld(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Ks(n)}if(!Cd&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?Ld(2):"`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!Cd&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Ld(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Cd&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ld(4):"each middleware provided to configureStore must be a function");let l=Hs;r&&(l=nd({trace:!Cd,..."object"==typeof r&&r}));const c=function(...e){return t=>(n,i)=>{const r=t(n,i);let o=()=>{throw new Error("production"===process.env.NODE_ENV?Us(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)=>o(e,...t)},a=e.map((e=>e(s)));return o=Hs(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=wd(c);if(!Cd&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Ld(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Cd&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Ld(6):"`enhancers` callback must return an array");if(!Cd&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ld(7):"each enhancer provided to configureStore must be a function");Cd||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return Bs(a,o,l(...h))}function Sd(e){const t={},n=[];let i;const r={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Ld(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?Ld(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?Ld(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Ld(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?Ld(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&&i)throw new Error("production"===process.env.NODE_ENV?Ld(31):"`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function xd(...e){return t=>e.some((e=>((e,t)=>id(e)?e.match(t):e(t))(e,t)))}var Id=["name","message","stack","code"],Rd=class{constructor(e,t){this.payload=e,this.meta=t}_type},Od=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ed=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Id)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Nd=(()=>{function e(e,t,n){const i=rd(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=rd(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=rd(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||Ed)(e||"Rejected"),meta:{...o||{},arg:i,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):((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 o=n?.condition?.(e,{getState:a,extra:d});if(null!==(p=o)&&"object"==typeof p&&"function"==typeof p.then&&(o=await o),!1===o||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(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([g,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:h,rejectWithValue:(e,t)=>new Rd(e,t),fulfillWithValue:(e,t)=>new Od(e,t)})).then((t=>{if(t instanceof Rd)throw t;return t instanceof Od?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof Rd?o(null,l,e,t.payload,t.meta):o(t,l,e)}var p;return n&&!n.dispatchConditionRejection&&o.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(Ad)})}}),{pending:r,rejected:o,fulfilled:i,settled:xd(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function Ad(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var jd=Symbol.for("rtk-slice-createasyncthunk");function Pd(e,t){return`${e}/${t}`}function Md(e,t,n,i){function r(r,...o){let s=n.call(e,r);if(void 0===s)if(i)s=e.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Ld(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...o)}return r.unwrapped=t,r}var Td=function({creators:e}={}){const t=e?.asyncThunk?.[jd];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Ld(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)||{},o=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?Ld(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Ld(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?Ld(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?Sd(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?Ld(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,r,o]=Sd(t);if(function(e){return"function"==typeof e}(e))n=()=>dd(e());else{const t=dd(e);n=()=>t}function s(e=n(),t){let s=[i[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[o]),s.reduce(((e,n)=>{if(n){if(ea(e)){const i=n(e,t);return void 0===i?e:i}if(ta(e))return La(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?Ld(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 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);i&&e.addDefaultCase(i)}))}o.forEach((i=>{const o=r[i],s={reducerName:i,type:Pd(n,i),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},i,r){let o,s;if("reducer"in i){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(i))throw new Error("production"===process.env.NODE_ENV?Ld(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=i.reducer,s=i.prepare}else o=i;r.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?rd(e,s):rd(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Ld(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:o,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,o,c);i.exposeAction(t,u),s&&i.addCase(u.fulfilled,s);a&&i.addCase(u.pending,a);d&&i.addCase(u.rejected,d);l&&i.addMatcher(u.settled,l);i.exposeCaseReducer(t,{fulfilled:s||Ud,pending:a||Ud,rejected:d||Ud,settled:l||Ud})}(s,o,a,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:i,reducer:(e,t)=>(u||(u=d()),u(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(u||(u=d()),u.getInitialState()),getSelectors(t=l){const n=ld(c,this,{insert:()=>new WeakMap});return ld(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Md(this,r,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?Ld(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 Ud(){}var _d="listenerMiddleware";function Ld(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. `}rd(`${_d}/add`),rd(`${_d}/removeAll`),rd(`${_d}/remove`);const Wd=e=>zn((t=>{const n=Td(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Fn(Pr)(t)){constructor(...e){super(...e);const t=kd({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const i=await t.dispatch(e(...n));try{Ad(i)}catch(e){this.logger.error(e.message,i.type,e.stack)}return i},o=Object.keys(i).reduce(((e,t)=>(e[t]=r(i[t]),e)),{});this.actions=o,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}})),Dd=zn((e=>class extends(Pr(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()}})),Fd=zn((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}}));var qd={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]|2[23]"],"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","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?: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))|7090[0-4])\\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)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|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-9]\\d{9}|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])|9(?:0[25]|42))[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(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[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]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\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{2})(\\d{4})","$1 $2 $3",["2"],"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"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"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,12],[["(\\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[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|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(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|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(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"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])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($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,10,11,12],[["(\\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",["(?:19|[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|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|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|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"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))|7090[0-4])\\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]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\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,12],[["(\\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}",[6,7,8,9,10,11]],["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]],["3[2-8]\\d{9,10}",[11,12]],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}|[25-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",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"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",["[25-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",["[36]0|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[0135-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|7090)\\d{5}|(?: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))|7090[0-4])\\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",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"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|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"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","38\\d{6}|[78]\\d{9,13}|(?:20|9\\d)\\d{8}",[8,10,11,12,13,14],[["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["3"],"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|8\\d\\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","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"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]))|7092[0-3])\\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]","(?:[2489]\\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,12],[["(\\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-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"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|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],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(?:[1245]|3[12])"]],["(\\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]))\\d{4}|(?:305[3-9]|472[24]|505[2-57-9]|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[0135-79]|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[0-247]|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-9]\\d)\\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,12],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|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\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","7093\\d{5}|(?: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])|7093[5-7])\\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}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],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,["348[57]\\d{7}",[11]],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 Bd(e){return Bd="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},Bd(e)}function Vd(e){var t=zd();return function(){var n,i=Zd(e);if(t){var r=Zd(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Bd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Kd(e)}(this,n)}}function Kd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hd(e){var t="function"==typeof Map?new Map:void 0;return Hd=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 Gd(e,arguments,Zd(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Jd(i,e)},Hd(e)}function Gd(e,t,n){return Gd=zd()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&Jd(r,n.prototype),r},Gd.apply(null,arguments)}function zd(){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 Jd(e,t){return Jd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Jd(e,t)}function Zd(e){return Zd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Zd(e)}var Yd=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&&Jd(e,t)}(i,e);var t,n=Vd(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=n.call(this,e),Object.setPrototypeOf(Kd(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(Hd(Error)),Xd=2,Qd=17,el=3,tl="0-90-9٠-٩۰-۹",nl="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),il="++";function rl(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),i=t[0].split("."),r=0;r<3;r++){var o=Number(n[r]),s=Number(i[r]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!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 ol={}.constructor;function sl(e){return null!=e&&e.constructor===ol}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 dl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ll(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var cl=" ext. ",ul=/^\d+$/,hl=function(){function e(t){dl(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!sl(e)||!sl(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(sl(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+yl(e)+": "+e,"."))}(t),this.metadata=t,wl.call(this,t)}return ll(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&&ul.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new fl(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new fl(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}(),fl=function(){function e(t,n){dl(this,e),this.globalMetadataObject=n,this.metadata=t,wl.call(this,n.metadata)}return ll(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 pl(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()&&ml(this.types(),e))return new vl(ml(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?cl:this.metadata[13]||cl}}]),e}(),pl=function(){function e(t,n){dl(this,e),this._format=t,this.metadata=n}return ll(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()||gl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),gl=/^\(?\$1\)?$/,vl=function(){function e(t,n){dl(this,e),this.type=t,this.metadata=n}return ll(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 ml(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 yl=function(e){return al(e)};function $l(e,t){if((t=new hl(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function bl(e,t){return t.countries.hasOwnProperty(e)}function wl(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===rl(t,"1.2.0")?this.v2=!0:-1===rl(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Cl=function(e){return"([".concat(tl,"]{1,").concat(e,"})")};function kl(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+Cl("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+Cl("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+Cl("9")+i)+"|"+("[- ]+"+Cl("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+Cl("15")+i)+"|"+(r+"(?:,)+"+n+Cl("9")+i)}var Sl="["+tl+"]{"+Xd+"}",xl="[++]{0,1}(?:["+nl+"]*["+tl+"]){3,}["+nl+tl+"]*",Il=new RegExp("^[++]{0,1}(?:["+nl+"]*["+tl+"]){1,2}$","i"),Rl=xl+"(?:"+kl()+")?",Ol=new RegExp("^"+Sl+"$|^"+Rl+"$","i");var El=new RegExp("(?:"+kl()+")$","i");function Nl(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 Al(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 Al(e,t)}(e))||t){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 Al(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 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 Pl(e){return jl[e]}function Ml(e){for(var t,n="",i=Nl(e.split(""));!(t=i()).done;){var r=Pl(t.value);r&&(n+=r)}return n}function Tl(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 Ul(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 Ul(e,t)}(e))||t){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 Ul(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 _l(e){for(var t,n="",i=Tl(e.split(""));!(t=i()).done;){n+=Ll(t.value,n)||""}return n}function Ll(e,t,n){if("+"===e){if(t)return;return"+"}return Pl(e)}function Wl(e,t){return function(e,t,n){var i=n.type(t),r=i&&i.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";var o=e.length,s=r[0];if(s===o)return"IS_POSSIBLE";if(s>o)return"TOO_SHORT";if(r[r.length-1]<o)return"TOO_LONG";return r.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Dl(e,t){return"IS_POSSIBLE"===Wl(e,t)}function Fl(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function ql(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 Bl(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 Bl(e,t)}(e))||t){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 Bl(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 Vl=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Kl(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new hl(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(Fl(i,n.nationalNumberPattern())){if(Hl(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Hl(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=ql(Vl);!(r=o()).done;){var s=r.value;if(Hl(i,s,n))return s}}}}function Hl(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Fl(e,t.pattern()))}function Gl(e,t,n){var i=new hl(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new hl(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function zl(e){return e.replace(new RegExp("[".concat(nl,"]+"),"g")," ").trim()}var Jl=/(\$\d)/;function Zl(e,t,n){var i=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var o=e.replace(new RegExp(t.pattern()),i?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(Jl,t.nationalPrefixFormattingRule()):t.format());return i?zl(o):o}var Yl=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Xl(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 Ql(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 Ql(e,t)}(e))||t){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 Ql(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 ec(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 tc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ec(Object(n),!0).forEach((function(t){nc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ic={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function rc(e,t,n,i){if(n=n?tc(tc({},ic),n):ic,i=new hl(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 r,o=i.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?ac(r=oc(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=oc(s,null,"INTERNATIONAL",i,n),ac(r="+".concat(o," ").concat(r),e.ext,i,n.formatExtension)):"+".concat(o);case"E.164":return"+".concat(o).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(o).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,i,r){var o=$l(i,r.metadata);if(o===n){var s=oc(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new hl(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():Yl.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(oc(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return ac(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function oc(e,t,n,i,r){var o=sc(i.formats(),e);return o?Zl(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function sc(e,t){for(var n,i=Xl(e);!(n=i()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var o=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(Fl(t,r.pattern()))return r}}function ac(e,t,n,i){return t?i(e,t,n):e}function dc(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 lc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dc(Object(n),!0).forEach((function(t){cc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uc(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var hc=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 r=function(e,t){var n,i,r=new hl(t);fc(e)?(n=e,r.selectNumberingPlan(n),i=r.countryCallingCode()):i=e;return{country:n,countryCallingCode:i}}(t,i),o=r.country,s=r.countryCallingCode;this.country=o,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return i}}return uc(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Gl(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new hl(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 Dl(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 hl(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Kl(e,t,n.metadata):Fl(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new hl(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Kl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return rc(this,e,t?lc(lc({},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)}}]),e}(),fc=function(e){return/^[A-Z]{2}$/.test(e)};var pc=new RegExp("(["+tl+"])");function gc(e,t,n,i){if(t){var r=new hl(i);r.selectNumberingPlan(t,n);var o=new RegExp(r.IDDPrefix());if(0===e.search(o)){var s=(e=e.slice(e.match(o)[0].length)).match(pc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function vc(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),i=n.exec(e);if(i){var r,o,s,a=i.length-1,d=a>0&&i[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(o=i[1]);else{var l=i[0];r=e.slice(l.length),d&&(o=i[1])}if(d){var c=e.indexOf(i[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=i[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:o}}}return{nationalNumber:e}}function mc(e,t){var n=vc(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Fl(e,n.nationalNumberPattern())&&!Fl(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Wl(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function yc(e,t,n,i){var r=t?$l(t,i):n;if(0===e.indexOf(r)){(i=new hl(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=mc(o,i).nationalNumber,a=mc(e,i).nationalNumber;if(!Fl(a,i.nationalNumberPattern())&&Fl(s,i.nationalNumberPattern())||"TOO_LONG"===Wl(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function $c(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=gc(e,t,n,i);if(!o||o===e){if(t||n){var s=yc(e,t,n,i),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="+"+o}if("0"===e[1])return{};i=new hl(i);for(var l=2;l-1<=el&&l<=e.length;){var c=e.slice(1,l);if(i.hasCallingCode(c))return i.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function bc(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 wc(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 wc(e,t)}(e))||t){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 wc(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 Cc(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new hl(i);for(var r,o=bc(n);!(r=o()).done;){var s=r.value;if(i.country(s),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return s}else if(Kl({phone:e,country:s},void 0,i.metadata))return s}}function kc(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:Cc(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var Sc="+",xc="(["+tl+"]|[\\-\\.\\(\\)]?)",Ic=new RegExp("^\\"+Sc+xc+"*["+tl+"]"+xc+"*$","g"),Rc=new RegExp("^("+("["+tl+"]+((\\-)*["+tl+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+tl+"])*")+"\\.?$","g"),Oc="tel:",Ec=";phone-context=",Nc=";isub=";function Ac(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Ec);if(t<0)return null;var n=t+Ec.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&&(Ic.test(e)||Rc.test(e))}(r))throw new Yd("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===Sc&&(n+=r);var o,s=e.indexOf(Oc);o=s>=0?s+Oc.length:0;var a=e.indexOf(Ec);n+=e.substring(o,a)}var d=n.indexOf(Nc);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var jc=250,Pc=new RegExp("[++"+tl+"]"),Mc=new RegExp("[^"+tl+"#]+$");function Tc(e,t,n){if(t=t||{},n=new hl(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Yd("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=Ac(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>jc){if(n)throw new Yd("TOO_LONG");return}if(!1===t)return e;var i=e.search(Pc);if(i<0)return;return e.slice(i).replace(Mc,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=Xd&&Ol.test(e)}(i))return function(e){return Il.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(El);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(El),r=1;r<i.length;){if(i[r])return{number:n,ext:i[r]};r++}}(i);if(r.ext)return r;return{number:i}}(e,t.v2,t.extract),r=i.number,o=i.ext,s=i.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new Yd("TOO_SHORT");throw new Yd("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=$c(_l(e),t,n,i.metadata),s=o.countryCallingCodeSource,a=o.countryCallingCode,d=o.number;if(a)i.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};i.selectNumberingPlan(t,n),t&&(r=t),a=n||$l(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=mc(_l(d),i),c=l.nationalNumber,u=l.carrierCode,h=kc(a,{nationalNumber:c,defaultCountry:t,metadata:i});h&&(r=h,"001"===h||i.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 Yd("INVALID_COUNTRY");return{}}if(!l||l.length<Xd){if(t.v2)throw new Yd("TOO_SHORT");return{}}if(l.length>Qd){if(t.v2)throw new Yd("TOO_LONG");return{}}if(t.v2){var f=new hc(c,l,n.metadata);return d&&(f.country=d),h&&(f.carrierCode=h),o&&(f.ext=o),f.__countryCallingCodeSource=u,f}var p=!!(t.extended?n.hasSelectedNumberingPlan():d)&&Fl(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!Dl(l,n)),phone:l,ext:o}:p?function(e,t,n){var i={country:e,phone:t};n&&(i.ext=n);return i}(d,l,o):{}}function Uc(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?Uc(Object(n),!0).forEach((function(t){Lc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wc(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 Dc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fc(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,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qc(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 qc(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 qc(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 Bc(e){var t,n,i,r=Fc(Array.prototype.slice.call(e),4),o=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,s&&"string"!=typeof s){if(!sl(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,i=a):i=s}else d?(n=a,i=d):(n=void 0,i=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wc(Object(n),!0).forEach((function(t){Dc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wc(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 Vc(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 Kc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vc(Object(n),!0).forEach((function(t){Hc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gc(e,t,n){t&&t.defaultCountry&&!bl(t.defaultCountry,n)&&(t=Kc(Kc({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Tc(e,_c(_c({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Yd))throw e}}function zc(){var e=Bc(arguments);return Gc(e.text,e.options,e.metadata)}function Jc(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yc=Jc((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Zc(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),Xc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Zc(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return Jc(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Yc(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Yc(e,t);this.cache[e]=this.head,this.size++}},{key:"get",value:function(e){if(this.cache[e]){var t=this.cache[e].value;return this.remove(e),this.put(e,t),t}console.log("Item not available in cache for key ".concat(e))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(e){var t=this.cache[e];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[e],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),e}();function Qc(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var eu=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new Xc(t)}return Qc(e,[{key:"getPatternForRegExp",value:function(e){var t=this.cache.get(e);return t||(t=new RegExp("^"+e),this.cache.put(e,t)),t}}]),e}();function tu(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function nu(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var iu=" - \u2028\u2029 ",ru="[".concat(iu,"]"),ou="[^".concat(iu,"]"),su="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),au="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",du="[".concat(au,"]"),lu=new RegExp(du),cu="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),uu=new RegExp(cu),hu="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),fu=new RegExp(hu),pu=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function gu(e){return!(!lu.test(e)&&!fu.test(e))&&pu.test(e)}function vu(e){return"%"===e||uu.test(e)}function mu(e,t,n){var i=!0,r=zc(e,n);if(r||(i=!1,r=zc(e,{defaultCallingCode:t.countryCallingCode},n)),!r)return"INVALID_NUMBER";if(t.ext){if(r.ext!==t.ext)return"NO_MATCH"}else if(r.ext)return"NO_MATCH";return i&&t.countryCallingCode!==r.countryCallingCode?"NO_MATCH":t.number===r.number?i?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(r.nationalNumber)||0===r.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var yu={POSSIBLE:function(e,t){return t.candidate,t.metadata,!0},VALID:function(e,t){var n=t.candidate;t.defaultCountry;var i=t.metadata;return!(!e.isValid()||!$u(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!$u(e,n,r)||wu(e,n)||!bu(e,{defaultCountry:i,metadata:r}))&&Cu()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!$u(e,n,r)||wu(e,n)||!bu(e,{defaultCountry:i,metadata:r}))&&Cu()}};function $u(e,t,n){for(var i=0;i<t.length-1;i++){var r=t.charAt(i);if("x"===r||"X"===r){var o=t.charAt(i+1);if("x"===o||"X"===o){if(i++,"NSN_MATCH"!==mu(t.substring(i),e,n))return!1}else{var s=Ml(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function bu(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new hl(i);r.selectNumberingPlan(e.countryCallingCode),e.country||kc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=sc(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function wu(e,t){var n=t.indexOf("/");if(n<0)return!1;var i=t.indexOf("/",n+1);return!(i<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===e.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===e.__countryCallingCodeSource)||Ml(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function Cu(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var ku=/[\\/] *x/;function Su(e){return nu(ku,e)}var xu=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,Iu=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Ru=/^:[0-5]\d/;function Ou(e,t,n){if(xu.test(e))return!1;if(Iu.test(e)){var i=n.slice(t+e.length);if(Ru.test(i))return!1}return!0}var Eu="(\\[([",Nu=")\\])]",Au="[^".concat(Eu).concat(Nu,"]"),ju="[".concat(Eu).concat(il,"]"),Pu=new RegExp("^"+ju),Mu=tu(0,3),Tu=new RegExp("^(?:[(\\[([])?(?:"+Au+"+["+Nu+"])?"+Au+"+(?:["+Eu+"]"+Au+"+["+Nu+"])"+Mu+Au+"*$"),Uu=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function _u(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 Lu(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 Lu(e,t)}(e))||t){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 Lu(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 Wu(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Du=kl(),Fu=["\\/+(.*)/","(\\([^(]*)","(?:".concat(ru,"-|-").concat(ru,")").concat(ru,"*(.+)"),"[‒-―-]".concat(ru,"*(.+)"),"\\.+".concat(ru,"*([^.]+)"),"".concat(ru,"+(").concat(ou,"+)")],qu=tu(0,2),Bu=tu(0,4),Vu=Qd+el,Ku=tu(0,Vu),Hu="[".concat(nl,"]")+Bu,Gu=su+tu(1,Vu),zu="(?:"+ju+Hu+")"+qu+Gu+"(?:"+Hu+Gu+")"+Ku+"(?:"+Du+")?",Ju=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(au,"#]+$")),Zu=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Yu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(n={v2:n.v2,defaultCallingCode:n.defaultCallingCode,defaultCountry:n.defaultCountry&&bl(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Zu}).leniency)throw new TypeError("`leniency` is required");if("POSSIBLE"!==n.leniency&&"VALID"!==n.leniency)throw new TypeError('Invalid `leniency`: "'.concat(n.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(n.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");if(this.text=t,this.options=n,this.metadata=i,this.leniency=yu[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(zu,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new eu(32)}return Wu(e,[{key:"find",value:function(){for(var e;this.maxTries>0&&null!==(e=this.PATTERN.exec(this.text));){var t=e[0],n=e.index;if(Ou(t=Su(t),n,this.text)){var i=this.parseAndVerify(t,n,this.text)||this.extractInnerMatch(t,n,this.text);if(i){if(this.options.v2)return{startsAt:i.startsAt,endsAt:i.endsAt,number:i.phoneNumber};var r=i.phoneNumber,o={startsAt:i.startsAt,endsAt:i.endsAt,phone:r.nationalNumber};return r.country?o.country=r.country:o.countryCallingCode=r.countryCallingCode,r.ext&&(o.ext=r.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,n){for(var i,r=_u(Fu);!(i=r()).done;)for(var o=i.value,s=!0,a=void 0,d=new RegExp(o,"g");this.maxTries>0&&null!==(a=d.exec(e));){if(s){var l=nu(Ju,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=nu(Ju,a[1]),h=e.indexOf(u,a.index),f=this.parseAndVerify(u,t+h,n);if(f)return f;this.maxTries--}}},{key:"parseAndVerify",value:function(e,t,n){if(function(e,t,n,i){if(Tu.test(e)&&!Uu.test(e)){if("POSSIBLE"!==i){if(t>0&&!Pu.test(e)){var r=n[t-1];if(vu(r)||gu(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(vu(s)||gu(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=zc(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(i&&i.isPossible())return this.leniency(i,{candidate:e,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+e.length,phoneNumber:i}:void 0}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var e=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",e}}]),e}();function Xu(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Qu=function(){function e(t){var n=t.onCountryChange,i=t.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.onCountryChange=n,this.onCallingCodeChange=i}return Xu(e,[{key:"reset",value:function(e){var t=e.country,n=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];this[i]=e[i]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}]),e}();function eh(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 th(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 th(e,t)}(e))||t){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 th(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 nh="x",ih=new RegExp(nh);function rh(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function oh(e,t){return")"===e[t]&&t++,function(e){var t=[],n=0;for(;n<e.length;)"("===e[n]?t.push(n):")"===e[n]&&t.pop(),n++;var i=0,r="";t.push(e.length);for(var o=0,s=t;o<s.length;o++){var a=s[o];r+=e.slice(i,a),i=a+1}return r}(e.slice(0,t))}function sh(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,r(t)){var s=ah(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return ah(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function ah(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Zl(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:r,metadata:i});if(r||(e.nationalPrefix?s=e.nationalPrefix+o(t)+s:e.complexPrefixBeforeNationalSignificantNumber&&(s=e.complexPrefixBeforeNationalSignificantNumber+" "+s)),function(e,t){return Ml(e)===t.getNationalDigits()}(s,e))return s}function dh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var lh=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return dh(e,[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],n=t.branches,i=t.instructions;if(n)return{op:"|",args:n.concat([fh(i)])};if(0===i.length)throw new Error("Pattern is required");return 1===i.length?i[0]:i}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw new Error("Pattern is required");var t=e.match(hh);if(t){var n=t[1],i=e.slice(0,t.index),r=e.slice(t.index+n.length);switch(n){case"(?:":i&&this.parsePattern(i),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(i&&this.parsePattern(i),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(fh(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:o});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(i&&this.parsePattern(i),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(fh(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":i&&this.parsePattern(i),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:ch(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(uh.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function ch(e){for(var t=[],n=0;n<e.length;){if("-"===e[n]){if(0===n||n===e.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(e));for(var i=e[n-1].charCodeAt(0)+1,r=e[n+1].charCodeAt(0)-1,o=i;o<=r;)t.push(String.fromCharCode(o)),o++}else t.push(e[n]);n++}return t}var uh=/[\(\)\[\]\?\:\|]/,hh=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function fh(e){return 1===e.length?e[0]:e}function ph(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 gh(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 gh(e,t)}(e))||t){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 gh(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 vh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var mh=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matchTree=(new lh).parse(t)}return vh(e,[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw new Error("String is required");var n=yh(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function yh(e,t,n){if("string"==typeof t){var i=e.join("");return 0===t.indexOf(i)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===i.indexOf(t)?n&&e.length>t.length?{overflow:!0}:{match:!0,matchedChars:e.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var r=e.slice(),o=0;o<t.length;){var s=yh(r,t[o],n&&o===t.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(r=r.slice(s.matchedChars.length)).length)return o===t.length-1?{match:!0,matchedChars:e}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:e.slice(0,e.length-r.length)}}switch(t.op){case"|":for(var a,d,l=ph(t.args);!(d=l()).done;){var c=yh(e,d.value,n);if(c){if(c.overflow)return c;if(c.match)return{match:!0,matchedChars:c.matchedChars};if(!c.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)));a=!0}}return a?{partialMatch:!0}:void 0;case"[]":for(var u,h=ph(t.args);!(u=h()).done;){var f=u.value;if(e[0]===f)return 1===e.length?{match:!0,matchedChars:e}:n?{overflow:!0}:{match:!0,matchedChars:[f]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function $h(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 bh(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 bh(e,t)}(e))||t){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 bh(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 wh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ch=rh("9",15),kh=/[- ]/,Sh=new RegExp("["+nl+"]*\\$1["+nl+"]*(\\$\\d["+nl+"]*)*$"),xh=function(){function e(t){t.state;var n=t.metadata;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=n,this.resetFormat()}return wh(e,[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var n=this;if(function(e,t){return"IS_POSSIBLE"===Wl(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=$h(this.matchingFormats);!(i=r()).done;){var o=i.value,s=sh(t,o,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return n.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return n.getSeparatorAfterNationalPrefix(e)}});if(s)return this.resetFormat(),this.chosenFormat=o,this.setNationalNumberTemplate(s.replace(/\d/g,nh),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(nh),s}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var n=this.chosenFormat,i=this.chooseFormat(t);if(i)return i===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,n=e.nationalSignificantNumber,i=e.nationalPrefix,r=e.international,o=n,s=o.length-3;s<0&&(s=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,r,i)&&t.formatMatches(e,o,s)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,n){return!(n&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat())&&!(!t&&!n&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,n){var i=e.leadingDigitsPatterns().length;if(0===i)return!0;n=Math.min(n,i-1);var r=e.leadingDigitsPatterns()[n];if(t.length<3)try{return void 0!==new mh(r).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(r,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,n=this,i=function(){var i=t.value;return n.chosenFormat===i?"break":Sh.test(n.getFormatFormat(i,e.international))?n.createTemplateForFormat(i,e)?(n.chosenFormat=i,"break"):(n.matchingFormats=n.matchingFormats.filter((function(e){return e!==i})),"continue"):"continue"},r=$h(this.matchingFormats.slice());!(t=r()).done;){var o=i();if("break"===o)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var n=this.getTemplateForFormat(e,t);return n?(this.setNationalNumberTemplate(n,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&kh.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var n=e.IDDPrefix,i=e.missingPlus;return n?t&&!1===t.spacing?n:n+" ":i?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,n=0,i=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";n<i.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(nh,t+1),n++;return oh(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,nh)+rh(nh,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var n=t.nationalSignificantNumber,i=t.international,r=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,s=e.pattern();s=s.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var a=Ch.match(s)[0];if(!(n.length>a.length)){var d=new RegExp("^"+s+"$"),l=n.replace(/\d/g,"9");d.test(l)&&(a=l);var c,u=this.getFormatFormat(e,i);if(this.shouldTryNationalPrefixFormattingRule(e,{international:i,nationalPrefix:r})){var h=u.replace(Jl,e.nationalPrefixFormattingRule());if(Ml(e.nationalPrefixFormattingRule())===(r||"")+Ml("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,nh),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),nh);return c||(o?p=rh(nh,o.length)+" "+p:r&&(p=rh(nh,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=zl(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=eh(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(ih)<0)return;t=e.search(ih),e=e.replace(ih,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],oh(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var n=t.international,i=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var r=e.usesNationalPrefix();if(r&&i||!r&&!n)return!0}}}]),e}();function Ih(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,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Rh(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 Rh(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 Rh(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 Oh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Eh=new RegExp("^"+("["+nl+tl+"]+")+"$","i"),Nh="(?:[++]["+nl+tl+"]*|["+nl+tl+"]+)",Ah=new RegExp("[^"+nl+tl+"]+.*$"),jh=/[^\d\[\]]/,Ph=function(){function e(t){var n=t.defaultCountry,i=t.defaultCallingCode,r=t.metadata,o=t.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaultCountry=n,this.defaultCallingCode=i,this.metadata=r,this.onNationalSignificantNumberChange=o}return Oh(e,[{key:"input",value:function(e,t){var n,i=function(e){var t=function(e){var t=function(e){var t,n=e.search(Nh);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(Ah,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=Ih(t,2),i=n[0],r=n[1];Eh.test(i)||(i="");return[i,r]}(e),r=Ih(i,2),o=r[0],s=r[1],a=Ml(o);return s&&(t.digits||(t.startInternationalNumber(),a||(n=!0))),a&&this.inputDigits(a,t),{digits:a,justLeadingPlus:n}}},{key:"inputDigits",value:function(e,t){var n=t.digits,i=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),i&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,n=e.callingCode;return t&&!n}},{key:"extractCountryCallingCode",value:function(e){var t=$c("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode,i=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:i}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&jh.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=vc(e,this.metadata),i=n.nationalPrefix,r=n.nationalNumber,o=n.carrierCode;if(r!==e)return this.onExtractedNationalNumber(i,o,r,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var i=vc(e,this.metadata),r=i.nationalPrefix,o=i.nationalNumber,s=i.carrierCode;if(o!==t)return this.onExtractedNationalNumber(r,s,o,e,n),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,n,i,r){var o,s,a=i.lastIndexOf(n);if(a>=0&&a===i.length-n.length){s=!0;var d=i.slice(0,a);d!==e&&(o=d)}r({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:n,nationalSignificantNumberMatchesInput:s,complexPrefixBeforeNationalSignificantNumber:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,n=e.IDDPrefix,i=e.digits;if(e.nationalSignificantNumber,!t&&!n){var r=gc(i,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==i?(e.update({IDDPrefix:i.slice(0,i.length-r.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=yc(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode;if(t.number,n)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:n}),!0}}},{key:"startInternationalNumber",value:function(e,t){var n=t.country,i=t.callingCode;e.startInternationalNumber(n,i),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}]),e}();function Mh(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,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Th(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 Th(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 Th(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 Uh(e,t,n){return t&&function(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)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var _h,Lh=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new hl(n);var i=Mh(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return Uh(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(sl(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,n]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput="+";else if(n){var i;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(i=this.formatter.format(n,this.state)),void 0===i&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(i=this.formatter.format(r,this.state))}this.formattedOutput=i?this.getFullNumber(i):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Qu({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new xh({state:this.state,metadata:this.metadata}),this.parser=new Ph({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},i=this.state.callingCode;return n(i?e?"".concat(i," ").concat(e):i:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.complexPrefixBeforeNationalSignificantNumber,i=e.nationalPrefix,r=t,o=n||i;return o&&(r=o+r),r}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,nh)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(kc(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,n=e.callingCode,i=e.country,r=e.nationalSignificantNumber;if(t)return this.isInternational()?n?"+"+n+r:"+"+t:i||n?"+"+(i?this.metadata.countryCallingCode():n)+r:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,i=e.callingCode,r=this._getCountry();if(t&&(r||i)){if(r&&r===this.defaultCountry){var o=new hl(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=Cc(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new hc(r||i,t,this.metadata.metadata);return n&&(l.carrierCode=n),l}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function Wh(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(qd),e.apply(this,n)}(zc,arguments)}function Dh(e,t){return Yu.call(this,e,t,qd)}function Fh(e){return Lh.call(this,e,qd)}function qh(){return hl.call(this,qd)}Dh.prototype=Object.create(Yu.prototype,{}),Dh.prototype.constructor=Dh,Fh.prototype=Object.create(Lh.prototype,{}),Fh.prototype.constructor=Fh,qh.prototype=Object.create(hl.prototype,{}),qh.prototype.constructor=qh,function(e){e[e.text=1]="text",e[e.numeric=2]="numeric",e[e.bool=3]="bool",e[e.singleSelect=4]="singleSelect",e[e.array=5]="array",e[e.date=6]="date"}(_h||(_h={}));const Bh=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>{const[r,...o]=n.split(".");return t!==r?Object.assign(e,{[n]:i}):(e[r]||(e[r]={}),e[r][o.join(".")]=i,e)}),{}),Vh=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Kh=(e,t)=>e===_h.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t,Hh={enabled:"active",disabled:"disabled",invited:"invited"},Gh=e=>e.tenantRoles.data,zh=e=>e.selectedUsersLoginIds,Jh=e=>e.notifications,Zh=e=>e.customAttributes.data,Yh=Ya(Zh,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),Xh=Ya((e=>e.usersList.data),Yh,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes).map((([e,n])=>[e,Kh(t[e],n)])))}))))),Qh=Ya(Xh,(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Vh(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:Hh[e.status]||e.status,roles:e.roleNames}))))),ef=Ya(zh,Qh,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),tf=Ya(ef,(e=>e.map((e=>e.userId)))),nf=Ya(ef,(e=>e.map((e=>e.status)))),rf=Ya(ef,(e=>e.every((e=>e.editable)))),of=Ya(zh,(e=>!!e.length)),sf=Ya(zh,(e=>1===e.length)),af=Ya(zh,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),df=Ya(sf,nf,((e,t)=>e&&t.every((e=>e===Hh.enabled)))),lf=Ya(nf,(e=>e.every((e=>e===Hh.disabled)))),cf=Ya(ef,(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`})),uf=Ya(sf,lf,rf,((e,t,n)=>e&&t&&n)),hf=Ya(sf,df,rf,((e,t,n)=>e&&t&&n)),ff=Ya(sf,rf,((e,t)=>e&&t)),pf=Ya(sf,rf,((e,t)=>e&&t)),gf=Ya(sf,rf,((e,t)=>e&&t)),vf=of,mf=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)}))}))},yf=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}}),$f=({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)})}}),bf=Nd("users/create",((e,{extra:{api:t}})=>t.user.create(e))),wf=mf(bf)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},yf((e=>e.createUser)),$f({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>`}})),Cf={action:bf,reducer:wf},kf=Nd("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Sf=mf(kf)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},yf((e=>e.deleteUser)),$f({getSuccessMsg:e=>Hn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Hn(e.meta.arg.length)`Failed to delete user${["","s"]}`})),xf={action:kf,reducer:Sf},If=Nd("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Rf=mf(If)(yf((e=>e.setTempUserPassword)),$f({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>`}})),Of={action:If,reducer:Rf},Ef=Nd("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Nf=mf(Ef)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},yf((e=>e.customAttributes))),Af={action:Ef,reducer:Nf},jf=Nd("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),Pf=mf(jf)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},yf((e=>e.usersList))),Mf={action:jf,reducer:Pf},Tf=Nd("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Uf=mf(Tf)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},yf((e=>e.tenantRoles))),_f={action:Tf,reducer:Uf},Lf=Nd("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Wf=mf(Lf)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Bn(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},yf((e=>e.updateUser)),$f({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>`}})),Df={action:Lf,reducer:Wf},Ff=Nd("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),qf=mf(Ff)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Bn(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)}},yf((e=>e.enableUser)),$f({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>`}})),Bf={action:Ff,reducer:qf},Vf=Nd("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Kf=mf(Vf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Bn(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)}},yf((e=>e.disableUser)),$f({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>`}})),Hf={action:Vf,reducer:Kf},Gf=Nd("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),zf={action:Gf,reducer:mf(Gf)(yf((e=>e.removePasskey)),$f({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>`}}))},Jf={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:[]},Zf="/v1/mgmt/user/search",Yf="/v1/mgmt/user/delete/batch",Xf="/v1/mgmt/user/create",Qf="/v1/mgmt/user/update",ep="/v1/mgmt/user/update/status",tp="/v1/mgmt/user/password/set/temporary",np="/v1/mgmt/user/passkeys/delete",ip="/v1/mgmt/user/customattributes",rp="/v1/mgmt/role/all",op=e=>l(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)})),sp=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u}={}){if(n)return(e=>l(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const i=[],r=(new Date).getTime();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:r,createdTimeFormatted:new Date(1e3*(r||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.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:r,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u});const h=yield e.post(Zf,{limit:r,page:i,withTestUser:!1,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u},{queryParams:{tenant:t}});return yield op(h),(yield h.json()).users})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Yf,{userIds:i},{queryParams:{tenant:t}});return yield op(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b}){if(n)return(e=>l(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{const f=Math.random().toString(10).substring(15);h({loginIds:[e],externalIds:[e],userId:`user-${f}`,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b});const w=yield e.post(Xf,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b},{queryParams:{tenant:t}});return yield op(w),(yield w.json()).user})),update:i=>l(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v}){if(n)return(e=>l(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{h({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v});const m=yield e.post(Qf,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v},{queryParams:{tenant:t}});return yield op(m),(yield m.json()).user})),enable:i=>l(void 0,void 0,void 0,(function*(){if(n)return(e=>l(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(i);const r=yield e.post(ep,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield op(r),r.json()})),disable:i=>l(void 0,void 0,void 0,(function*(){if(n)return(e=>l(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(i);const r=yield e.post(ep,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield op(r),r.json()})),removePasskey:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(np,{loginId:i},{queryParams:{tenant:t}});return yield op(r),r.json()})),setTempPassword:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(tp,{loginId:i},{queryParams:{tenant:t}});return yield op(r),r.json()})),getCustomAttributes:()=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const i=yield e.get(ip,{queryParams:{tenant:t}});return yield op(i),(yield i.json()).data}))}),ap=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>l(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(rp,{queryParams:{tenant:t}});return yield op(i),i.json()}))}),dp=zn((e=>{var t,n,i,r;const o=Fn(Dr,Lr,Pr,Fr,Fd,Wr({tenant:Wr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=jn(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.7.13"}}));return{user:sp({httpClient:r.httpClient,tenant:t,mock:n}),tenant:ap({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),lp=zn((e=>{const t=Fn(Wd({name:"widget",initialState:Jf,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Cf.reducer(e),Df.reducer(e),Bf.reducer(e),Hf.reducer(e),xf.reducer(e),Mf.reducer(e),Of.reducer(e),zf.reducer(e),Af.reducer(e),_f.reducer(e)},asyncActions:{searchUsers:Mf.action,createUser:Cf.action,updateUser:Df.action,enableUser:Bf.action,disableUser:Hf.action,deleteUsers:xf.action,removePasskey:zf.action,getCustomAttributes:Af.action,getTenantRoles:_f.action,setTempUserPassword:Of.action}}),_r,Pr,dp)(e);return class extends t{constructor(...e){super(...e),this.state=Jf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),cp=zn((e=>{const t=Fn(Vr,Wr({"widget-id":Wr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),up=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,_r,eo,io,cp,lp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=qn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),hp=zn((e=>{var t,n,i,r,o,s;return s=class extends(Fn(lp,Ps,Dd,Pr,up)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>l(this,void 0,void 0,(function*(){yield c(this,n,"f").setData(Gh(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){return l(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(qn(yield this.fetchWidgetPage("create-user-modal.html"))),new bs((()=>{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)})),new bs((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(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({},Bh(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),u(this,n,new ks((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),c(this,o,"f").call(this),this.createUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,o,"f").call(this),c(this,t,"m",r).call(this)}))}))},r=function(){const e=Zh(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),fp=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,hp,up)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new bs(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})),pp=zn((e=>{var t,n,i;return i=class extends(Fn(lp,Ps,Pr,up)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(qn(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new bs((()=>{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 bs((()=>{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=tf(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new Is(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=cf(this.state);i.text=`Delete ${e}?`}}))},i})),gp=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp,pp)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),vf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new bs(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})),vp=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(lp,Ps,Pr,Dd,up)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new bs((()=>{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 bs((()=>{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=af(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(qn(yield this.fetchWidgetPage("disable-user-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Is(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=cf(this.state);r.text=`Disable ${e}?`}))}))},o})),mp=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp,vp,Dd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),hf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new bs(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})),yp=e=>{if(!e)return e;const t=Wh(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},$p=zn((e=>{var t,n,i,r,o,s,a,h,f,p;return p=class extends(Fn(lp,Ps,Pr,Dd,up)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),s.set(this,(()=>l(this,void 0,void 0,(function*(){yield c(this,i,"f").setData(Gh(this.state).map((({name:e})=>({value:e,label:e}))))})))),h.set(this,(()=>{var e,t;const n=null===(e=ef(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:yp(null==n?void 0:n.phone),roles:null==n?void 0:n.roles,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},Vh(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",f).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,h=new WeakMap,t=new WeakSet,r=function(){new bs((()=>{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()))},o=function(){new bs((()=>{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=d(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Bh(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=Zh(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},f=function(){return l(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(qn(yield this.fetchWidgetPage("edit-user-modal.html"))),c(this,t,"m",r).call(this),c(this,t,"m",o).call(this),u(this,n,new Rs(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),u(this,i,new ks((()=>{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=()=>l(this,void 0,void 0,(function*(){yield c(this,s,"f").call(this),c(this,n,"f").disable(),c(this,h,"f").call(this),c(this,t,"m",a).call(this)}))}))},p})),bp=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp,$p,Dd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),ff)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new bs(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})),wp=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(lp,Ps,Pr,Dd,up)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new bs((()=>{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 bs((()=>{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=af(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(qn(yield this.fetchWidgetPage("enable-user-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Is(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=cf(this.state);r.text=`Activate ${e}?`}))}))},o})),Cp=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp,wp,Dd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),uf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new bs(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})),kp=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Gn((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Rs(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Sp={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},xp=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(Pr,lp,Ts,_r)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Vn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Jh)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Sp[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"})},o})),Ip=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(lp,Ps,Pr,Dd,up)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new bs((()=>{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 bs((()=>{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=af(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(qn(yield this.fetchWidgetPage("remove-passkey-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Is(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=cf(this.state);r.text=`Remove passkey for ${e}?`}))}))},o})),Rp=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp,Ip,Dd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),pf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new bs(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})),Op=zn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Fn(lp,Pr,up)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Vn((e=>{this.usersTable.data=e}))),o.set(this,Gn(((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,Vn((e=>{this.usersTable.filterColumns((t=>{var n;const[i,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this),c(this,r,"f").call(this,Qh(this.state)),c(this,s,"f").call(this,Zh(this.state)),this.subscribe(c(this,s,"f").bind(this),Zh),this.subscribe(c(this,r,"f").bind(this),Qh)}))}},r=new WeakMap,o=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:r,type:o,attrs:s})=>{const a=e(i)||t(o);if(!a)return n({path:i,header:r,type:o,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}},i=function(){var e;this.usersTable=new $s(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(c(this,t,"m",a).bind(this)),c(this,t,"m",n).call(this),c(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,o,"f").call(this,e.target,e.detail)}))}))},d})),Ep=zn((e=>{var t,n,i;return i=class extends(Fn(lp,Ps,Pr,Dd,up)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(qn(yield this.fetchWidgetPage("generated-password-modal.html"))),new bs((()=>{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})),Np=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(lp,Ps,Pr,Dd,up,Ep)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new bs((()=>{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 bs((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){var e;const t=af(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(){return l(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(qn(yield this.fetchWidgetPage("reset-password-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Is(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=cf(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},o})),Ap=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,up,lp,Np,Dd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),gf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new bs(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})),jp=zn((e=>class extends(Fn(hs,oo,Op,fp,gp,bp,Cp,mp,Ap,Rp,kp,xp)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Pp=Fn((e=>class extends(jp(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Pp);var Mp=Object.freeze({__proto__:null,default:Pp});const Tp=e=>e.selectedRolesIds,Up=e=>e.notifications,_p=e=>e.tenantPermissions.data||[],Lp=Ya((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"})})))),Wp=Ya(Tp,Lp,((e,t)=>t.filter((t=>e.includes(t.name))))),Dp=Ya(Tp,(e=>!!e.length)),Fp=Ya(Tp,(e=>1===e.length)),qp=Ya(Wp,Fp,((e,t)=>t&&"yes"===e[0].editable)),Bp=Ya(Wp,(e=>1===e.length?e[0].name:`${e.length} roles`)),Vp=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)}))}))},Kp=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}}),Hp=({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)})}}),Gp=Nd("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),zp=Vp(Gp)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},Kp((e=>e.createRole)),Hp({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>`}})),Jp={action:Gp,reducer:zp},Zp=Nd("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Yp=Vp(Zp)({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=[]}},Kp((e=>e.deleteRole)),Hp({getSuccessMsg:e=>Hn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Hn(e.meta.arg.length)`Failed to delete role${["","s"]}`})),Xp={action:Zp,reducer:Yp},Qp=Nd("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),eg=Vp(Qp)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},Kp((e=>e.rolesList))),tg={action:Qp,reducer:eg},ng=Nd("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),ig=Vp(ng)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},Kp((e=>e.updateRole)),Hp({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>`}})),rg={action:ng,reducer:ig},og=Nd("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),sg={action:og,reducer:Vp(og)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},Kp((e=>e.tenantPermissions)))},ag={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:[]},dg="/v1/mgmt/role/search",lg="/v1/mgmt/role/delete/batch",cg="/v1/mgmt/role/create",ug="/v1/mgmt/role/update",hg="/v1/mgmt/permission/all",fg=e=>l(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)})),pg=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({text:e,sort:t},n){return new Promise((i=>{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 i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),i(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s},t);const a=yield e.post(dg,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield fg(a),(yield a.json()).roles})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(lg,{roleNames:i},{queryParams:{tenant:t}});return yield fg(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({name:i,description:r,permissionNames:o}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,description:t,permissionNames:n},i){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:i})}))})))({name:i,description:r,permissionNames:o},t);const s=yield e.post(cg,{name:i,description:r,permissionNames:o,tenantId:t},{queryParams:{tenant:t}});return yield fg(s),yield s.json()})),update:i=>l(void 0,[i],void 0,(function*({name:i,newName:r,description:o,permissionNames:s}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,newName:t,description:n,permissionNames:i},r){return new Promise((o=>{o({name:t,description:n,permissionNames:i,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:i,newName:r,description:o,permissionNames:s},t);const a=yield e.post(ug,{name:i,newName:r,description:o,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield fg(a);const d=yield a.json();return d.oldName=i,d}))}),gg=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>l(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(hg,{queryParams:{tenant:t}});return yield fg(i),i.json()}))}),vg=zn((e=>{var t,n,i,r;const o=Fn(Dr,Lr,Pr,Fr,Fd,Wr({tenant:Wr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=jn(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.3.14"}}));return{role:pg({httpClient:r.httpClient,tenant:t,mock:n}),tenant:gg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),mg=zn((e=>{const t=Fn(Wd({name:"widget",initialState:ag,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Jp.reducer(e),rg.reducer(e),Xp.reducer(e),tg.reducer(e),sg.reducer(e)},asyncActions:{searchRoles:tg.action,createRole:Jp.action,updateRole:rg.action,deleteRoles:Xp.action,getTenantPermissions:sg.action}}),_r,Pr,vg)(e);return class extends t{constructor(...e){super(...e),this.state=ag,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),yg=zn((e=>{const t=Fn(Vr,Wr({"widget-id":Wr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),$g=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,_r,eo,io,yg,mg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=qn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),bg=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(mg,Ps,Dd,Pr,$g)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>l(this,void 0,void 0,(function*(){var e;yield c(this,n,"f").setData(null===(e=_p(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}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function(){return l(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(qn(yield this.fetchWidgetPage("create-role-modal.html"))),new bs((()=>{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)})),new bs((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(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))})))),u(this,n,new ks((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),c(this,r,"f").call(this)}))},o})),wg=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,bg,$g)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new bs(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})),Cg=zn((e=>{var t,n,i;return i=class extends(Fn(mg,Ps,Pr,$g)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(qn(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new bs((()=>{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 bs((()=>{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=Wp(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new Is(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Bp(this.state);i.text=`Delete ${e}?`}}))},i})),kg=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,$g,mg,Cg)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Dp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new bs(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})),Sg=zn((e=>{var t,n,i,r,o,s,a,h;return h=class extends(Fn(mg,Ps,Pr,Dd,$g)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>l(this,void 0,void 0,(function*(){var e;yield c(this,n,"f").setData(null===(e=_p(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=Wp(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}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",a).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,i=function(){new bs((()=>{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 bs((()=>{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=d(t,["name"]),r=null===(e=Wp(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},i)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return l(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(qn(yield this.fetchWidgetPage("edit-role-modal.html"))),c(this,t,"m",i).call(this),c(this,t,"m",r).call(this),u(this,n,new ks((()=>{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=()=>l(this,void 0,void 0,(function*(){yield c(this,o,"f").call(this),c(this,s,"f").call(this)}))}))},h})),xg=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,$g,mg,Sg,Dd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),qp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new bs(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})),Ig=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,$g,mg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Gn((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Rs(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Rg={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},Og=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(Pr,mg,Ts,_r)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Vn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Up)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Rg[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"})},o})),Eg=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(mg,Pr,$g)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{this.rolesTable.data=e}))),r.set(this,Gn(((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}});return l(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),c(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,r,"f").call(this,e.target,e.detail)}))})),c(this,i,"f").call(this,Lp(this.state)),this.subscribe(c(this,i,"f").bind(this),Lp)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new $s(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)))}))},o})),Ng=zn((e=>class extends(Fn(hs,oo,Eg,wg,kg,xg,Ig,Og)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Ag=Fn((e=>class extends(Ng(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Ag);var jg=Object.freeze({__proto__:null,default:Ag});const Pg=e=>e.selectedAccessKeysIds,Mg=e=>e.notifications,Tg=Ya((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}))))),Ug=Ya(Pg,Tg,((e,t)=>t.filter((t=>e.includes(t.id))))),_g=Ya(Pg,(e=>!!e.length)),Lg=Ya(Ug,(e=>e.every((e=>e.editable)))),Wg=Ya(Lg,_g,((e,t)=>e&&t));Ya(Pg,(e=>1===e.length));const Dg=Ya(Ug,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Fg=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)}))}))},qg=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}}),Bg=({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)})}}),Vg=Nd("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),Kg=Fg(Vg)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},qg((e=>e.createAccessKey)),Bg({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>`}})),Hg={action:Vg,reducer:Kg},Gg=Nd("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),zg=Fg(Gg)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},qg((e=>e.deleteAccessKey)),Bg({getSuccessMsg:e=>Hn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Hn(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),Jg={action:Gg,reducer:zg},Zg=Nd("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),Yg=Fg(Zg)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},qg((e=>e.accessKeysList))),Xg={action:Zg,reducer:Yg},Qg=Nd("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),ev=Fg(Qg)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},qg((e=>e.activateAccessKey)),Bg({getSuccessMsg:e=>Hn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Hn(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),tv={action:Qg,reducer:ev},nv=Nd("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),iv=Fg(nv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},qg((e=>e.deactivateAccessKey)),Bg({getSuccessMsg:e=>Hn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Hn(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),rv={action:nv,reducer:iv},ov=Nd("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),sv={action:ov,reducer:Fg(ov)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},qg((e=>e.tenantRoles)))},av={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:[]},dv="/v1/mgmt/accesskey/search",lv="/v1/mgmt/accesskey/delete/batch",cv="/v1/mgmt/accesskey/create",uv="/v1/mgmt/accesskey/deactivate/batch",hv="/v1/mgmt/accesskey/activate/batch",fv="/v1/mgmt/role/all",pv=e=>l(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)})),gv=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((...e)=>l(void 0,[...e],void 0,(function*({text:e,sort:t}={}){return new Promise((n=>{const i=[],r=(new Date).getTime()/1e3+2592e3,o=new Date(r).toLocaleString();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:r,expireTimeFormatted:o,createdTime:r,createdTimeFormatted:o,roleNames:[`Role ${e}`],permittedIps:["127.1.2.3"],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.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:r,text:o,sort:s});const a=yield e.post(dv,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield pv(a),(yield a.json()).keys})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(lv,{ids:i},{queryParams:{tenant:t}});return yield pv(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({name:i,expiration:r,roleNames:o,userId:s,permittedIps:a}){const d=new Date;d.setDate(d.getDate()+ +r);const c="0"===r[0]?0:Math.floor(d.getTime()/1e3);if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,roleNames:t,userId:n,permittedIps:i},r){const o=Math.random().toString(10).substring(15);return new Promise((s=>{s({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:r,createdTime:(new Date).getTime()/1e3,roleNames:t,permittedIps:i,status:"active",clientId:`Client ID ${o}`,boundUserId:n||`User ${o}`}})}))})))({name:i,expiration:r,roleNames:o,userId:s,permittedIps:a},c);const u=yield e.post(cv,{name:i,expireTime:c,roleNames:o,userId:s,permittedIps:a},{queryParams:{tenant:t}});return yield pv(u),yield u.json()})),activate:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(hv,{ids:i},{queryParams:{tenant:t}});return yield pv(r),yield r.json()})),deactivate:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(uv,{ids:i},{queryParams:{tenant:t}});return yield pv(r),yield r.json()}))}),vv=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>l(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(fv,{queryParams:{tenant:t}});return yield pv(i),i.json()}))}),mv=zn((e=>{var t,n,i,r;const o=Fn(Dr,Lr,Pr,Fr,Fd,Wr({tenant:Wr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=jn(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.4.13"}}));return{accesskey:gv({httpClient:r.httpClient,tenant:t,mock:n}),tenant:vv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),yv=zn((e=>{const t=Fn(Wd({name:"widget",initialState:av,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Hg.reducer(e),Jg.reducer(e),Xg.reducer(e),tv.reducer(e),rv.reducer(e),sv.reducer(e)},asyncActions:{searchAccessKeys:Xg.action,createAccessKey:Hg.action,activateAccessKeys:tv.action,deactivateAccessKeys:rv.action,deleteAccessKeys:Jg.action,getTenantRoles:sv.action}}),_r,Pr,mv)(e);return class extends t{constructor(...e){super(...e),this.state=av,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),$v=zn((e=>{const t=Fn(Vr,Wr({"widget-id":Wr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),bv=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,_r,eo,io,$v,yv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=qn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),wv=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(yv,Pr,bv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{this.accessKeysTable.data=e}))),r.set(this,Gn(((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}});return l(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),c(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,r,"f").call(this,e.target,e.detail)}))})),c(this,i,"f").call(this,Tg(this.state)),this.subscribe(c(this,i,"f").bind(this),Tg)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new $s(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)))}))},o})),Cv=zn((e=>{var t,n,i;return i=class extends(Fn(yv,Ps,Pr,bv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(qn(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new bs((()=>{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 bs((()=>{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=Ug(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new Is(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Dg(this.state);i.text=`Activate ${e}?`}}))},i})),kv=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,bv,yv,Cv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Wg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new bs(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})),Sv=zn((e=>{var t,n,i;return i=class extends(Fn(yv,Ps,Dd,Pr,bv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(qn(yield this.fetchWidgetPage("created-access-key-modal.html"))),new bs((()=>{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})),xv=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(yv,Ps,Dd,Pr,bv,Sv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>l(this,void 0,void 0,(function*(){var e,t;yield c(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}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function e(){return l(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(qn(yield this.fetchWidgetPage("create-access-key-modal.html"))),new bs((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)})),new bs((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){var e,t;if(this.validateForm(this.createAccessKeyModal.ele)){const n=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),(null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext)&&(this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(t=null==n?void 0:n.payload)||void 0===t?void 0:t.cleartext}),this.createdAccessKeyModal.open())}})))),u(this,n,new ks((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),c(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{c(this,t,"m",e).call(this)}}))},o})),Iv=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,xv,bv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new bs(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})),Rv=zn((e=>{var t,n,i;return i=class extends(Fn(yv,Ps,Pr,bv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(qn(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new bs((()=>{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 bs((()=>{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=Ug(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new Is(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Dg(this.state);i.text=`Deactivate ${e}?`}}))},i})),Ov=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,bv,yv,Rv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Wg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new bs(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})),Ev=zn((e=>{var t,n,i;return i=class extends(Fn(yv,Ps,Pr,bv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(qn(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new bs((()=>{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 bs((()=>{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=Ug(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new Is(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Dg(this.state);i.text=`Delete ${e}?`}}))},i})),Nv=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,bv,yv,Ev)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Wg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new bs(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})),Av=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,bv,yv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Gn((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Rs(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),jv={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},Pv=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(Pr,yv,Ts,_r)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Vn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Mg)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=jv[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"})},o})),Mv=zn((e=>class extends(Fn(hs,oo,wv,Iv,Nv,Av,kv,Ov,Pv)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Tv=Fn((e=>class extends(Mv(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Tv);var Uv=Object.freeze({__proto__:null,default:Tv});const _v=(e,t)=>t?{[e]:t}:{},Lv=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},Wv=e=>e.selectedAuditId,Dv=Ya((e=>e.auditList.data),(e=>e.map((e=>{const t=e||{},{occurred:n,ID:i,type:r}=t,o=t.data,s=void 0===o?{saml_request:"",saml_response:"",saml_generated_user:"",saml_generated_roles:"",oidc_response:"",oidc_generated_user:""}:o,{saml_request:a,saml_response:l,saml_generated_user:c,saml_generated_roles:u,oidc_response:h,oidc_generated_user:f}=s,p=d(s,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user"]),g=d(t,["occurred","ID","type","data"]);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:p}),_v("type",(v=r)&&v[0].toUpperCase()+v.slice(1))),_v("saml_request",a)),_v("saml_response",l)),_v("saml_generated_user",Lv(c))),_v("saml_generated_roles",Lv(u))),_v("oidc_response",Lv(h))),_v("oidc_generated_user",Lv(f))),{occurredFormatted:n?new Date(Number(n)||0).toLocaleString():"N/A"});var v}))));Ya(Wv,Dv,((e,t)=>t.find((t=>e===t.id)))),Ya(Wv,(e=>!!e));const Fv=Nd("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),qv=(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)}))}))})(Fv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Bv=e=>e.auditList,{onFulfilled:e=>{Bv(e).loading=!1},onPending:e=>{Bv(e).loading=!0,Bv(e).error=null},onRejected:(e,t)=>{Bv(e).loading=!1,Bv(e).error=t.error}}));var Bv;const Vv={action:Fv,reducer:qv},Kv={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Hv="/v1/mgmt/audit/search",Gv=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s,from:a}={}){if(n)return(e=>l(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const i=[],r=(new Date).getTime()/1e3+2592e3,o=new Date(r).toLocaleString();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:r,occurredFormatted:o});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.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:r,text:o,sort:s});const d=yield e.post(Hv,{limit:r,page:i,text:o,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>l(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}))}),zv=zn((e=>{var t,n,i,r;const o=Fn(Dr,Lr,Pr,Fr,Fd,Wr({tenant:Wr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=jn(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.4.13"}}));return{audit:Gv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),Jv=zn((e=>{const t=Fn(Wd({name:"widget",initialState:Kv,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Vv.reducer(e)},asyncActions:{searchAudit:Vv.action}}),_r,Pr,zv)(e);return class extends t{constructor(...e){super(...e),this.state=Kv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Zv=zn((e=>{const t=Fn(Vr,Wr({"widget-id":Wr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Yv=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,_r,eo,io,Zv,Jv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=qn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Xv=zn((e=>{var t,n,i,r,o;return o=class extends(Fn(Pr,Yv,Jv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Gn((()=>{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}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this),c(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Rs(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f")),c(this,n,"f").call(this)},r=function(){var e;this.rangeInput=new Ss(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(c(this,n,"f"))},o})),Qv=zn((e=>{var t,n,i,r;return r=class extends(Fn(Jv,Pr,Yv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Vn((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),c(this,i,"f").call(this,Dv(this.state)),this.subscribe(c(this,i,"f").bind(this),Dv)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new $s(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})),em=zn((e=>class extends(Fn(hs,oo,Qv,Xv)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),tm=Fn((e=>class extends(em(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",tm);var nm=Object.freeze({__proto__:null,default:tm});const im=(e={})=>{const t=qn("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(Kn(e),n)})),t};function rm(e){return new URLSearchParams(window.location.search).get(e)}const om=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)}))}))},sm=Nd("users/me",((e,{extra:{api:t}})=>t.user.me())),am=om(sm)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(dm=e=>e.me,{onFulfilled:e=>{dm(e).loading=!1},onPending:e=>{dm(e).loading=!0,dm(e).error=null},onRejected:(e,t)=>{dm(e).loading=!1,dm(e).error=t.error}}));var dm;const lm={action:sm,reducer:am},cm=Nd("users/logout",((e,{extra:{api:t}})=>t.user.logout())),um={action:cm,reducer:om(cm)({})},hm={me:{loading:!1,error:null,data:{}}},fm="/v1/auth/me",pm=({httpClient:e,mock:t})=>({me:()=>l(void 0,void 0,void 0,(function*(){if(t)return l(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(fm);return yield(e=>l(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()}))}),gm=zn((e=>{var t,n,i,r;const o=Fn(Dr,Lr,Pr,Fr,Fd)(e);return r=class extends o{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 c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n)=>{const i=jn(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.4.14"}}));return{user:Object.assign(Object.assign({},pm({httpClient:i.httpClient,mock:t})),{logout:t?()=>l(void 0,void 0,void 0,(function*(){})):i.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),vm=zn((e=>{const t=Fn(Wd({name:"widget",initialState:hm,reducers:{},extraReducers:e=>{lm.reducer(e),um.reducer(e)},asyncActions:{getMe:lm.action,logout:um.action}}),_r,Pr,gm)(e);return class extends t{constructor(...e){super(...e),this.state=hm,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),mm="widget-flow",ym=zn((e=>{var t,n,i;return i=class extends(Fn(_r,Ps,vm,Fd,Pr,oo)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=rm(mm);r&&(function(e){if(window.history.replaceState&&rm(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())}}(mm),c(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(im({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),new As((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},i})),$m=e=>e.me.data,bm=Ya($m,(e=>e.picture)),wm=Ya($m,(e=>e.email)),Cm=Ya($m,(e=>e.verifiedEmail)),km=Ya($m,(e=>e.name)),Sm=Ya($m,(e=>e.phone)),xm=Ya($m,(e=>e.verifiedPhone)),Im=Ya($m,(e=>e.webauthn));Ya($m,(e=>e.password));const Rm=Ya($m,(e=>e.TOTP)),Om=Ya($m,(e=>e.customAttributes)),Em=zn((e=>{const t=Fn(Vr,Wr({"widget-id":Wr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Nm=zn((e=>{var t,n,i;return i=class extends(Fn(Pr,_r,eo,io,Em,vm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),c(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=qn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Am=zn((e=>class extends(Fn(oo,Lr)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),jm=zn((e=>{var t,n,i,r,o,s,a,d,h;return h=class extends(Fn(Am,oo,vm,Pr,Fd,Nm,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,Vn((e=>{this.avatar.image=e}))),d.set(this,Vn((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,bm(this.state)),c(this,d,"f").call(this,km(this.state)),this.subscribe(c(this,a,"f").bind(this),bm),this.subscribe(c(this,d,"f").bind(this),km)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){this.avatar.flowId&&(u(this,n,this.createModal({"data-id":"update-pic"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new Os((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},h})),Pm=zn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g,v;return v=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,Vn((e=>{this.emailUserAttr.value=e}))),g.set(this,Vn((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,wm(this.state)),c(this,g,"f").call(this,Cm(this.state)),this.subscribe(c(this,p,"f").bind(this),wm),this.subscribe(c(this,g,"f").bind(this),Cm)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){this.emailUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-email"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.emailUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-email"}),"f"),u(this,o,new As((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(im({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr=new Es((()=>{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((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},v})),Mm=zn((e=>{var t,n,i;return i=class extends(Fn(vm,Pr,Nm,Ps)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new bs((()=>{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((()=>l(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},i})),Tm=zn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g;return g=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,Vn((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,km(this.state)),this.subscribe(c(this,p,"f").bind(this),km)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.nameUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-name"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.nameUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-name"}),"f"),u(this,o,new As((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(im({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr=new Es((()=>{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((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},g})),Um=zn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,Vn((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Im(this.state)),this.subscribe(c(this,a,"f").bind(this),Im)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.passkeyUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"passkey"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new Ns((()=>{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((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},d})),_m=zn((e=>{var t,n,i,r,o,s;return s=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new Ns((()=>{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((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.initPasswordAuthMethod(),c(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.passwordUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"password"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close()}))},s})),Lm=zn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g,v;return v=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,Vn((e=>{this.phoneUserAttr.value=e}))),g.set(this,Vn((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,Sm(this.state)),c(this,g,"f").call(this,xm(this.state)),this.subscribe(c(this,p,"f").bind(this),Sm),this.subscribe(c(this,g,"f").bind(this),xm)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){this.phoneUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-phone"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.phoneUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-phone"}),"f"),u(this,o,new As((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(im({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr=new Es((()=>{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((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},v}));var Wm;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(Wm||(Wm={}));const Dm=zn((e=>{var t,n,i,r,o,s,a,d,u,h,f;return n=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),i.set(this,{}),r.set(this,{}),o.set(this,{}),s.set(this,{}),u.set(this,Vn((e=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||Wm.TEXT,s=e[r],a=new Es(i,{logger:this.logger});a.value=n.getFormattedValue(o,s),c(this,t,"m",h).call(this,i,r,a),c(this,t,"m",f).call(this,i,r,a)}))})))}static getFormattedValue(e,t){return e===Wm.DATE&&t?new Date(t).toLocaleString():e===Wm.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),c(this,u,"f").call(this,Om(this.state)),this.subscribe(c(this,u,"f").bind(this),Om)}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,u=new WeakMap,t=new WeakSet,a=function(e){var t,n;null===(t=c(this,i,"f")[e])||void 0===t||t.setContent(im({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(n=c(this,r,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=c(this,i,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},d=function(e){var t,n;null===(t=c(this,o,"f")[e])||void 0===t||t.setContent(im({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(n=c(this,s,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=c(this,o,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},h=function(e,n,o){const s=e.getAttribute("edit-flow-id");s&&(c(this,i,"f")[s]=this.createModal({"data-id":`edit-${n}`}),c(this,r,"f")[s]=new As((()=>{var e,t;return null===(t=null===(e=c(this,i,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),c(this,i,"f")[s].afterClose=c(this,t,"m",a).bind(this,s),o.onEditClick((()=>{var e,t;null===(t=null===(e=c(this,i,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),c(this,t,"m",a).call(this,s),this.syncFlowTheme(c(this,r,"f")[s]))},f=function(e,n,i){const r=e.getAttribute("delete-flow-id");r&&(c(this,o,"f")[r]=this.createModal({"data-id":`delete-${n}`}),c(this,s,"f")[r]=new As((()=>{var e,t;return null===(t=null===(e=c(this,o,"f")[r])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),c(this,o,"f")[r].afterClose=c(this,t,"m",d).bind(this,r),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=c(this,o,"f"))||void 0===e?void 0:e[r])||void 0===t||t.open()})),c(this,t,"m",d).call(this,r),this.syncFlowTheme(c(this,s,"f")[r]))},n})),Fm=zn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Fn(Am,vm,Pr,Nm,Fd,Ps)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,Vn((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Rm(this.state)),this.subscribe(c(this,a,"f").bind(this),Rm)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.totpUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"totp"}),"f"),u(this,i,new As((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(im({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.totpUserAuthMethod=new Ns((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},d})),qm=zn((e=>class extends(Fn(hs,oo,ym,Dm,Pm,jm,Tm,Lm,Um,_m,_m,Fm,Mm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Bm=Fn((e=>class extends(qm(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),(customElements.get("descope-wc")||(yield Promise.resolve().then((function(){return us})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.4.14"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Bm);var Vm,Km=Object.freeze({__proto__:null,default:Bm});!function(e){e.oidc="oidc",e.saml="saml"}(Vm||(Vm={}));const Hm=Ya((e=>e.ssoAppsList.data),(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===Vm.saml))})),Gm=Ya(Hm,(e=>e.map((e=>({name:e.name,icon:e.logo,url:e.samlSettings.idpInitiatedUrl}))))),zm=Nd("ssoApps/load",((e,{extra:{api:t}})=>t.ssoApps.load())),Jm=(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)}))}))})(zm)({onFulfilled:(e,t)=>{var n;e.ssoAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},(Zm=e=>e.ssoAppsList,{onFulfilled:e=>{Zm(e).loading=!1},onPending:e=>{Zm(e).loading=!0,Zm(e).error=null},onRejected:(e,t)=>{Zm(e).loading=!1,Zm(e).error=t.error}}));var Zm;const Ym={action:zm,reducer:Jm},Xm={ssoAppsList:{data:[],loading:!1,error:null}},Qm="/v1/mgmt/sso/idp/apps/load",ey=({httpClient:e,mock:t})=>({load:()=>l(void 0,void 0,void 0,(function*(){if(t)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:[{id:"ssoapp1",name:"App 1",description:"This is the first SAML app",enabled:!0,appType:Vm.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:Vm.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:Vm.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}}]})}))}));const n=yield e.get(Qm);return yield(e=>l(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()}))}),ty=zn((e=>{var t,n,i,r;const o=Fn(Dr,Lr,Pr,Fd,Fr)(e);return r=class extends o{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 c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n)=>{const i=jn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"applications-portal-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.3.13"}}));return{ssoApps:ey({httpClient:i.httpClient,mock:t})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),ny=zn((e=>{const t=Fn(Wd({name:"widget",initialState:Xm,reducers:{},extraReducers:e=>{Ym.reducer(e)},asyncActions:{loadSSOApps:Ym.action}}),_r,Pr,ty)(e);return class extends t{constructor(...e){super(...e),this.state=Xm,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),iy=zn((e=>{const t=Fn(Vr,Wr({"widget-id":Wr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${e}`,"text")).body}))}}})),ry=zn((e=>{var t,n,i,r;return r=class extends(Fn(Pr,_r,eo,io,iy,ny)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this);const[o]=yield Promise.all([c(this,t,"m",n).call(this),this.actions.loadSSOApps()]);c(this,t,"m",i).call(this,o),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=qn(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r})),oy=zn((e=>{var t,n,i;return i=class extends(Fn(ny,Pr,ry)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this,Gm(this.state))}))}},t=new WeakSet,n=function(e){this.appsList=new js((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=e},i})),sy=zn((e=>class extends(Fn(hs,oo,oy)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),ay=Fn((e=>class extends(sy(e)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",ay);var dy=Object.freeze({__proto__:null,default:ay});const ly=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o: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!==(a=i.bottom)&&void 0!==a?a:0))]};var cy,uy,hy,fy,py,gy,vy,my,yy,$y,by;const wy=document.createElement("template");wy.innerHTML='\n<div 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 Cy extends HTMLElement{constructor(){super(),cy.add(this),uy.set(this,new yr({messages:[]})),hy.set(this,void 0),fy.set(this,void 0),py.set(this,void 0),gy.set(this,{resize:c(this,cy,"m",by).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(wy.content.cloneNode(!0)),u(this,hy,this.shadowRoot.querySelector(".debugger"),"f"),u(this,fy,c(this,hy,"f").querySelector(".content"),"f"),u(this,py,c(this,hy,"f").querySelector(".header"),"f"),c(this,cy,"m",vy).call(this)}updateData(e){c(this,uy,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=ly(e,e.offsetLeft-i,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(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(c(this,hy,"f"),c(this,py,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",c(this,gy,"f").resize),(e=>{e.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}})(c(this,hy,"f")),c(this,hy,"f").onresize=c(this,cy,"m",$y).bind(this),c(this,uy,"f").subscribe(c(this,cy,"m",my).bind(this))}disconnectedCallback(){c(this,uy,"f").unsubscribeAll(),window.removeEventListener("resize",c(this,gy,"f").resize)}}uy=new WeakMap,hy=new WeakMap,fy=new WeakMap,py=new WeakMap,gy=new WeakMap,cy=new WeakSet,vy=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync('\n .debugger {\n all: initial;\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'),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n],c(this,hy,"f").style.top="32px",c(this,hy,"f").style.left=window.innerWidth-300-32+"px"},my=function(e){c(this,cy,"m",yy).call(this,e),c(this,cy,"m",$y).call(this)},yy=function(e){c(this,fy,"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("")},$y=function(){c(this,fy,"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)}))},by=function(){const[e,t]=ly(c(this,hy,"f"),Number.parseInt(c(this,hy,"f").style.left,10),Number.parseInt(c(this,hy,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});c(this,hy,"f").style.top=`${t}px`,c(this,hy,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Cy);var ky=Object.freeze({__proto__:null,default:Cy});var Sy=Object.freeze({__proto__:null,default:(e,t,n)=>l(void 0,void 0,void 0,(function*(){const{siteId:t}=e,i='\n(function () {\nvar merchantConfig = {\n csp: false\n};\n\nvar siteId = "{{SITE_ID}}";\nfunction t(t,n){for(var e=t.split(""),r=0;r<e.length;++r)e[r]=String.fromCharCode(e[r].charCodeAt(0)+n);return e.join("")}function n(n){return t(n,-L).replace(/%SN%/g,siteId)}function e(){var t="no"+"op"+"fn",n="g"+"a",e="n"+"ame";return window[n]&&window[n][e]===t}function r(){return!(!navigator.brave||"function"!=typeof navigator.brave.isBrave)}function o(){return document.currentScript&&document.currentScript.src}function i(t){try{if("number"==typeof t&&window.location&&window.location.pathname){for(var n=window.location.pathname.split("/"),e=[],r=0;r<=Math.min(n.length-1,Math.abs(t));r++)e.push(n[r]);return e.join("/")||"/"}}catch(t){}return"/"}function c(t){try{G.ex=t,e()&&-1===G.ex.indexOf(B.uB)&&(G.ex+=B.uB),r()&&-1===G.ex.indexOf(B.uBr)&&(G.ex+=B.uBr),o()&&-1===G.ex.indexOf(B.nIL)&&(G.ex+=B.nIL),window.ftr__snp_cwc||(G.ex+=B.s),M(G)}catch(t){}}function a(t,n){function e(o){try{o.blockedURI===t&&(n(),document.removeEventListener(r,e))}catch(t){document.removeEventListener(r,e)}}var r="securitypolicyviolation";document.addEventListener(r,e),setTimeout(function(){document.removeEventListener(r,e)},2*60*1e3)}function u(t,n,e,r){var o=!1;t="https://"+t,a(t,function(){r(!0),o=!0});var i=document.createElement("script");i.onerror=function(){if(!o)try{r(!1),o=!0}catch(t){}},i.onload=e,i.type="text/javascript",i.id="ftr__script",i.async=!0,i.src=t;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(i,c)}function f(){J(B.uDF),setTimeout(h,I,B.uDF)}function d(t,n,e,r){var o=!1,i=new XMLHttpRequest;if(a("https:"+t,function(){e(new Error("CSP Violation"),!0),o=!0}),"//"===t.slice(0,2)&&(t="https:"+t),"withCredentials"in i)i.open("GET",t,!0);else{if("undefined"==typeof XDomainRequest)return;i=new XDomainRequest,i.open("GET",t)}Object.keys(r).forEach(function(t){i.setRequestHeader(t,r[t])}),i.onload=function(){"function"==typeof n&&n(i)},i.onerror=function(t){if("function"==typeof e&&!o)try{e(t,!1),o=!0}catch(t){}},i.onprogress=function(){},i.ontimeout=function(){"function"==typeof e&&e("tim"+"eo"+"ut",!1)},setTimeout(function(){i.send()},0)}function s(t,siteId,n){function e(t){var n=t.toString(16);return n.length%2?"0"+n:n}function r(t){if(t<=0)return"";for(var n="0123456789abcdef",e="",r=0;r<t;r++)e+=n[Math.floor(Math.random()*n.length)];return e}function o(t){for(var n="",r=0;r<t.length;r++)n+=e(t.charCodeAt(r));return n}function i(t){for(var n=t.split(""),e=0;e<n.length;++e)n[e]=String.fromCharCode(255^n[e].charCodeAt(0));return n.join("")}n=n?"1":"0";var c=[];return c.push(t),c.push(siteId),c.push(n),function(t){var n=40,e="";return t.length<n/2&&(e=","+r(n/2-t.length-1)),o(i(t+e))}(c.join(","))}function w(){function t(){D&&(J(B.dUAL),setTimeout(h,I,B.dUAL))}function n(t,n){c(n?B.uAS+B.uF+B.cP:B.uAS+B.uF)}window.ftr__fdad(t,n)}function h(t){try{var n;switch(t){case B.uFP:n=q;break;case B.uDF:n=E;break;default:n=D}if(!n)return;u(n,void 0,function(){try{K(),c(t+B.uS)}catch(t){}},function(n){try{K(),G.td=1*new Date-G.ts,c(n?t+B.uF+B.cP:t+B.uF),t===B.uFP&&f(),t===B.uDF&&w()}catch(t){c(B.eUoe)}})}catch(n){c(t+B.eTlu)}}var m="22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv",v="fort",l="erTo",p="ken";window.ftr__config={m:merchantConfig,s:"23",si:siteId};var g=!1,_=v+l+p,y=400*24*60,T=10,k={write:function(t,n,e,r){void 0===r&&(r=!0);var o=0;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.ckDepth&&(o=window.ftr__config.m.ckDepth);var c,a,u=i(o);if(e?(c=new Date,c.setTime(c.getTime()+60*e*1e3),a="; expires="+c.toGMTString()):a="",!r)return void(document.cookie=escape(t)+"="+escape(n)+a+"; path="+u);for(var f=1,d=document.domain.split("."),s=T,w=!0;w&&d.length>=f&&s>0;){var h=d.slice(-f).join(".");document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h;var m=k.read(t);null!=m&&m==n||(h="."+h,document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h),w=-1===document.cookie.indexOf(t+"="+n),f++,s--}},read:function(t){var n=null;try{for(var e=escape(t)+"=",r=document.cookie.split(";"),o=32,i=0;i<r.length;i++){for(var c=r[i];c.charCodeAt(0)===o;)c=c.substring(1,c.length);0===c.indexOf(e)&&(n=unescape(c.substring(e.length,c.length)))}}finally{return n}}},S=window.ftr__config.s;S+="ck";var x=function(t){var n=!1,e=null,r=function(){try{if(!e||!n)return;e.remove&&"function"==typeof e.remove?e.remove():document.head.removeChild(e),n=!1}catch(t){}};document.head&&(!function(){e=document.createElement("link"),e.setAttribute("rel","pre"+"con"+"nect"),e.setAttribute("cros"+"sori"+"gin","anonymous"),e.onload=r,e.onerror=r,e.setAttribute("href",t),document.head.appendChild(e),n=!0}(),setTimeout(r,3e3))},L=3,A=n(m||"22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv"),F=t("[0Uhtxhvw0LG",-L),U=t("[0Fruuhodwlrq0LG",-L),b=t("Li0Qrqh0Pdwfk",-L),D,C="fgq71iruwhu1frp",E=n("(VQ(1"+C+"2vq2(VQ(2vfulsw1mv"),V=n("(VQ(1"+C+"2vqV2(VQ(2vfulsw1mv"),q;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.fpi&&(q=window.ftr__config.m.fpi+n("2vq2(VQ(2vfulsw1mv"));var I=10;window.ftr__startScriptLoad=1*new Date;var R=function(t){var n="ft"+"r:tok"+"enR"+"eady";window.ftr__tt&&clearTimeout(window.ftr__tt),window.ftr__tt=setTimeout(function(){try{delete window.ftr__tt,t+="_tt";var e=document.createEvent("Event");e.initEvent(n,!1,!1),e.detail=t,document.dispatchEvent(e)}catch(t){}},1e3)},M=function(t){var n=function(t){return t||""},e=n(t.id)+"_"+n(t.ts)+"_"+n(t.td)+"_"+n(t.ex)+"_"+n(S),r=y;!isNaN(window.ftr__config.m.ckTTL)&&window.ftr__config.m.ckTTL&&(r=window.ftr__config.m.ckTTL),k.write(_,e,r,!0),R(e),window.ftr__gt=e},P=function(){var t=k.read(_)||"",n=t.split("_"),e=function(t){return n[t]||void 0};return{id:e(0),ts:e(1),td:e(2),ex:e(3),vr:e(4)}},j=function(){for(var t={},n="fgu",e=[],r=0;r<256;r++)e[r]=(r<16?"0":"")+r.toString(16);var o=function(t,n,r,o,i){var c=i?"-":"";return e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+c+e[255&n]+e[n>>8&255]+c+e[n>>16&15|64]+e[n>>24&255]+c+e[63&r|128]+e[r>>8&255]+c+e[r>>16&255]+e[r>>24&255]+e[255&o]+e[o>>8&255]+e[o>>16&255]+e[o>>24&255]},i=function(){if(window.Uint32Array&&window.crypto&&window.crypto.getRandomValues){var t=new window.Uint32Array(4);return window.crypto.getRandomValues(t),{d0:t[0],d1:t[1],d2:t[2],d3:t[3]}}return{d0:4294967296*Math.random()>>>0,d1:4294967296*Math.random()>>>0,d2:4294967296*Math.random()>>>0,d3:4294967296*Math.random()>>>0}},c=function(){var t="",n=function(t,n){for(var e="",r=t;r>0;--r)e+=n.charAt(1e3*Math.random()%n.length);return e};return t+=n(2,"0123456789"),t+=n(1,"123456789"),t+=n(8,"0123456789")};return t.safeGenerateNoDash=function(){try{var t=i();return o(t.d0,t.d1,t.d2,t.d3,!1)}catch(t){try{return n+c()}catch(t){}}},t.isValidNumericalToken=function(t){return t&&t.toString().length<=11&&t.length>=9&&parseInt(t,10).toString().length<=11&&parseInt(t,10).toString().length>=9},t.isValidUUIDToken=function(t){return t&&32===t.toString().length&&/^[a-z0-9]+$/.test(t)},t.isValidFGUToken=function(t){return 0==t.indexOf(n)&&t.length>=12},t}(),B={uDF:"UDF",dUAL:"dUAL",uAS:"UAS",uFP:"UFP",mLd:"1",eTlu:"2",eUoe:"3",uS:"4",uF:"9",tmos:["T5","T10","T15","T30","T60"],tmosSecs:[5,10,15,30,60],bIR:"43",uB:"u",uBr:"b",cP:"c",nIL:"i",s:"s"};try{var G=P();try{G.id&&(j.isValidNumericalToken(G.id)||j.isValidUUIDToken(G.id)||j.isValidFGUToken(G.id))?window.ftr__ncd=!1:(G.id=j.safeGenerateNoDash(),window.ftr__ncd=!0),G.ts=window.ftr__startScriptLoad,M(G),window.ftr__snp_cwc=!!k.read(_),window.ftr__snp_cwc||(E=V);for(var N="for"+"ter"+".co"+"m",O="ht"+"tps://c"+"dn9."+N,Q="ht"+"tps://"+G.id+"-"+siteId+".cd"+"n."+N,H="http"+"s://cd"+"n3."+N,X=[O,Q,H],z=0;z<X.length;z++)x(X[z]);var $=new Array(B.tmosSecs.length),J=function(t){for(var n=0;n<B.tmosSecs.length;n++)$[n]=setTimeout(c,1e3*B.tmosSecs[n],t+B.tmos[n])},K=function(){for(var t=0;t<B.tmosSecs.length;t++)clearTimeout($[t])};window.ftr__fdad=function(n,e){if(!g){g=!0;var r={};r[b]=s(window.ftr__config.s,siteId,window.ftr__config.m.csp),d(A,function(e){try{var r=e.getAllResponseHeaders().toLowerCase();if(r.indexOf(U.toLowerCase())>=0){var o=e.getResponseHeader(U);window.ftr__altd2=t(atob(o),-L-1)}if(r.indexOf(F.toLowerCase())<0)return;var i=e.getResponseHeader(F),c=t(atob(i),-L-1);if(c){var a=c.split(":");if(a&&2===a.length){for(var u=a[0],f=a[1],d="",s=0,w=0;s<20;++s)d+=s%3>0&&w<12?siteId.charAt(w++):G.id.charAt(s);var h=f.split(",");if(h.length>1){var m=h[0],v=h[1];D=u+"/"+m+"."+d+"."+v}}}n()}catch(t){}},function(t,n){e&&e(t,n)},r)}};var W=q?B.uFP:B.uDF;J(W),setTimeout(h,I,W)}catch(t){c(B.mLd)}}catch(t){}})();\n'.replace(/{{SITE_ID}}/g,t),r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("id",t),r.text=i,document.body.appendChild(r),document.addEventListener("ftr:tokenReady",(e=>{n(e.detail)}))}))});const xy=(e,t,n)=>l(void 0,void 0,void 0,(function*(){try{const{publicApiKey:t,useCloudflareIntegration:i,cloudflareScriptUrl:r,cloudflareEndpointUrl:o}=e;let s=[];s=i&&o?[o,Ct]:[Ct];let a=[];if(i&&r){a=[`${new URL(r).toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,Et]}else a=[Et];const d=Nt({apiKey:t,endpoint:s,scriptUrlPattern:a}),l=yield d,{requestId:c}=yield l.get();n(c)}catch(e){console.warn("Could not load fingerprint",e)}}));var Iy=Object.freeze({__proto__:null,default:xy,loadFingerprint:xy});const Ry=(e,t,n)=>l(void 0,void 0,void 0,(function*(){try{const{customDomain:i,publicApiKey:r,cloudflareEndpointPath:o,cloudflareScriptPath:s}=e,{baseUrl:a}=t;let d;d=i?`https://${i}`:a||"https://api.descope.com";const l=new URL(d);l.pathname=o;const c=new URL(d);c.pathname=s;const u=`${c.toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,h=Nt({apiKey:r,endpoint:[l.toString(),Ct],scriptUrlPattern:[u,Et]}),f=yield h,{requestId:p}=yield f.get();n(p)}catch(e){console.warn("Could not load descope fingerprint",e)}}));var Oy=Object.freeze({__proto__:null,default:Ry,loadFingerprint:Ry});const Ey=105e3,Ny=(e,t,n)=>{let i=(new Date).getTime();const r=()=>{var t;return e.enterprise?null===(t=window.grecaptcha)||void 0===t?void 0:t.enterprise:window.grecaptcha};let o,s;const a=(t,r)=>{t.ready((()=>{e.siteKey&&(null==t||t.execute(s,{action:"load"}).then(((e,r)=>{r?console.warn("could not execute recaptcha",r):(n(e),i=(new Date).getTime(),o=setTimeout((()=>{a(t)}),Ey))})))}))},d=()=>{clearTimeout(o)},c=(()=>{const e=document.createElement("div");return e.style.display="none",e.id="recaptcha",document.body.appendChild(e)})(),u=()=>{const e=r();e&&a(e)};return window.onRecaptchaLoadCallback=()=>{const t=c;if(t.hasChildNodes())return;const n=r();n&&setTimeout((()=>{s=n.render(t,{sitekey:e.siteKey,badge:"inline",size:"invisible"}),a(n)}),0)},(()=>{const t=document.createElement("script");t.src=(()=>{const t=new URL("https://www.google.com/recaptcha/");return t.pathname+=(e.enterprise?"enterprise":"api")+".js",t.searchParams.append("onload","onRecaptchaLoadCallback"),t.searchParams.append("render","explicit"),t.toString()})(),t.async=!0,t.id="recaptcha-script",t.defer=!0,document.body.appendChild(t)})(),{stop:d,start:u,refresh:()=>l(void 0,void 0,void 0,(function*(){if(Date.now()-i>Ey){d();const e=i;return u(),new Promise((t=>{const n=setTimeout((()=>{console.warn("reCAPTCHA token refresh timed out"),t()}),5e3),r=()=>{i!==e?(clearTimeout(n),t()):setTimeout(r,150)};r()}))}return Promise.resolve()}))}};var Ay=Object.freeze({__proto__:null,default:Ny,loadGRecaptcha:Ny});const jy=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o: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!==(a=i.bottom)&&void 0!==a?a:0))]};var Py,My,Ty,Uy,_y,Ly,Wy,Dy,Fy,qy;const By=document.createElement("template");By.innerHTML=`\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 Vy extends HTMLElement{constructor(){var e,t,n;super(),Py.add(this),My.set(this,new ei({messages:[]})),Ty.set(this,void 0),Uy.set(this,void 0),_y.set(this,void 0),Ly.set(this,{resize:c(this,Py,"m",qy).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(By.content.cloneNode(!0));const i=new CSSStyleSheet;i.replaceSync('\n.debugger {\n all: initial;\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'),null!==(t=(n=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(n.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,i],u(this,Ty,this.shadowRoot.querySelector(".debugger"),"f"),u(this,Uy,c(this,Ty,"f").querySelector(".content"),"f"),u(this,_y,c(this,Ty,"f").querySelector(".header"),"f")}updateData(e){c(this,My,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=jy(e,e.offsetLeft-i,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(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(c(this,Ty,"f"),c(this,_y,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",c(this,Ly,"f").resize),(e=c(this,Ty,"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},c(this,Ty,"f").onresize=c(this,Py,"m",Fy).bind(this),c(this,My,"f").subscribe(c(this,Py,"m",Wy).bind(this))}disconnectedCallback(){c(this,My,"f").unsubscribeAll(),window.removeEventListener("resize",c(this,Ly,"f").resize)}}My=new WeakMap,Ty=new WeakMap,Uy=new WeakMap,_y=new WeakMap,Ly=new WeakMap,Py=new WeakSet,Wy=function(e){c(this,Py,"m",Dy).call(this,e),c(this,Py,"m",Fy).call(this)},Dy=function(e){c(this,Uy,"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("")},Fy=function(){c(this,Uy,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),i=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;i||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)}))},qy=function(){const[e,t]=jy(c(this,Ty,"f"),Number.parseInt(c(this,Ty,"f").style.left,10),Number.parseInt(c(this,Ty,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});c(this,Ty,"f").style.top=`${t}px`,c(this,Ty,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Vy);var Ky=Object.freeze({__proto__:null,default:Vy});e.AccessKeyManagement=fi,e.ApplicationsPortal=$i,e.AuditManagement=gi,e.AuthProvider=({projectId:e,baseUrl:r="",baseStaticUrl:s="",sessionTokenViaCookie:a=!1,persistTokens:d=!0,oidcConfig:l,storeLastAuthenticatedUser:c=!0,keepLastAuthenticatedUserAfterLogout:u=!1,refreshCookieName:h="",getExternalToken:f,logger:p,hooks:g,children:v})=>{const[m,y]=t.useState(),[$,b]=t.useState(),[w,C]=t.useState(!1),[k,S]=t.useState(!1),[x,I]=t.useState(!1),[R,O]=t.useState(!!l),E=t.useRef(!1),N=(({projectId:e,baseUrl:n,persistTokens:i,sessionTokenViaCookie:r,refreshCookieName:s,oidcConfig:a,storeLastAuthenticatedUser:d,keepLastAuthenticatedUserAfterLogout:l,logger:c,hooks:u,getExternalToken:h})=>t.useMemo((()=>{if(e)return Mn({logger:c,hooks:u,projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:o,persistTokens:i,refreshCookieName:s,oidcConfig:a,storeLastAuthenticatedUser:d,keepLastAuthenticatedUserAfterLogout:l,autoRefresh:!0,getExternalToken:h})}),[e,n,r,h]))({projectId:e,baseUrl:r,persistTokens:d,sessionTokenViaCookie:a,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,refreshCookieName:h,getExternalToken:f,logger:p,hooks:g});t.useEffect((()=>{if(N){const e=N.onSessionTokenChange(b),t=N.onUserChange(y),n=N.onIsAuthenticatedChange(C);return()=>{e(),t(),n()}}}),[N]);const A=t.useRef(!1),j=t.useRef(!1);t.useEffect((()=>{N&&l&&!E.current&&(E.current=!0,N.oidc.finishLoginIfNeed().finally((()=>{O(!1),A.current=!0})))}),[]);const P=t.useCallback((()=>{A.current||(A.current=!0,I(!0),i(null==N?void 0:N.refresh)().then((()=>{I(!1)})))}),[N]),M=t.useCallback((()=>{j.current||(j.current=!0,S(!0),i(N.me)().then((()=>{S(!1)})))}),[N]),T=t.useMemo((()=>({fetchUser:M,user:m,isUserLoading:k,isUserFetched:j.current,fetchSession:P,session:$,isAuthenticated:w,isSessionLoading:x,isOidcLoading:R,isSessionFetched:A.current,projectId:e,baseUrl:r,baseStaticUrl:s,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,refreshCookieName:h,setUser:y,setSession:b,setIsAuthenticated:C,sdk:N})),[M,m,k,j.current,P,$,w,x,R,A.current,e,r,s,u,h,y,b,C,N]);return t.createElement(n.Provider,{value:T},v)},e.Descope=ri,e.RoleManagement=ui,e.SignInFlow=e=>t.createElement(ri,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>t.createElement(ri,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>t.createElement(ri,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=li,e.UserProfile=mi,e.baseHeaders=o,e.getCurrentTenant=Dn,e.getJwtPermissions=Ln,e.getJwtRoles=Wn,e.getRefreshToken=_n,e.getSessionToken=Un,e.isRefreshTokenExpired=(e=_n())=>null==Pn?void 0:Pn.isJwtExpired(e),e.isSessionTokenExpired=(e=Un())=>null==Pn?void 0:Pn.isJwtExpired(e),e.refresh=(e=_n())=>null==Pn?void 0:Pn.refresh(e),e.useDescope=()=>{const{sdk:e}=oi();return t.useMemo((()=>e||new Proxy(Tn(),ai)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,isOidcLoading:i,fetchSession:r,isSessionFetched:o,isAuthenticated:s}=oi(),a=t.useRef(n||i);t.useMemo((()=>{a.current=n||i}),[n,i]);const d=!s&&!n;return t.useMemo((()=>{d&&!o&&(a.current=!0)}),[o]),t.useEffect((()=>{d&&r()}),[r]),{isSessionLoading:a.current,sessionToken:e,isAuthenticated:s}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,isAuthenticated:r,isUserFetched:o}=oi(),[s,a]=t.useState(!1),d=t.useRef(i),l=t.useMemo((()=>!e&&!i&&r&&!s),[n,r,s]);return t.useMemo((()=>{d.current=i}),[i]),t.useMemo((()=>{l&&!o&&(d.current=!0)}),[l,o]),t.useEffect((()=>{l&&(a(!0),n())}),[l]),{isUserLoading:d.current,user:e}}}));
|
|
4
4
|
//# sourceMappingURL=index.umd.js.map
|