@descope/user-management-widget 0.20.1 → 0.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/user-management-widget v0.20.
|
|
3
|
+
* @descope/user-management-widget v0.20.3
|
|
4
4
|
*/
|
|
5
|
-
this["descope-user-management-widget"]=function(){"use strict";var e=function(){return e=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},e.apply(this,arguments)};function t(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 n(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 i(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 r(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 o(...e){return t=>e.reduce(((e,t)=>t(e)),t)}"function"==typeof SuppressedError&&SuppressedError;const s=e=>{const t=document.createElement("template");return t.innerHTML=e,t},a=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),d=e=>{let t,n;return(...i)=>(t&&a(t,i)||(t=i,n=e(...i)),n)},l=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])||""}`}),""),c=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},u=(e={})=>{const t=s("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),(e=>"string"==typeof e?e:"boolean"==typeof e?String(e):(e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype)(e)?JSON.stringify(e):"")(n))})),t},h=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 f,p,g,v;function m(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(!m(o,s))return!1}else if(o!==s)return!1}return!0}let $=class{constructor(e={},{forceUpdate:t=!1}={}){f.set(this,void 0),p.set(this,{}),g.set(this,0),v.set(this,!0),this.update=e=>{const t="function"==typeof e?e(i(this,f,"f")):e,n=Object.assign(Object.assign({},i(this,f,"f")),t);if(i(this,v,"f")||!m(i(this,f,"f"),n)){const e=i(this,f,"f");r(this,f,n,"f"),Object.freeze(i(this,f,"f")),setTimeout((()=>{Object.values(i(this,p,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},r(this,f,e,"f"),r(this,v,t,"f")}get current(){return Object.assign({},i(this,f,"f"))}subscribe(e){return r(this,g,i(this,g,"f")+1,"f"),i(this,p,"f")[i(this,g,"f")]=e,i(this,g,"f").toString()}unsubscribe(e){const t=!!i(this,p,"f")[e];return t&&delete i(this,p,"f")[e],t}unsubscribeAll(){return r(this,p,{},"f"),!0}};function y(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:""}}f=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakMap;const b=["error","warn","info","debug"],w={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},C=h((e=>{var t,n,o,s;return s=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,i(this,t,"m",o).call(this,w))}set logger(e){r(this,n,i(this,t,"m",o).call(this,e||w),"f")}get logger(){return i(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return b.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},s})),k="undefined"!=typeof localStorage,S="https://static.descope.com/pages",x="https://static2.descope.com/pages",I=k&&localStorage.getItem("base.content.url")||"",O=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,E=h((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)&&i(this,t,"f")&&(r(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),A=h((e=>{var t,n;const r=o(C,E)(e);return n=class extends r{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,r;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,r=e=>{var n;null===(n=i(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>r(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&r(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){i(this,t,"f")[e]||(i(this,t,"f")[e]=[]);const r=i(this,t,"f")[e].push(n);return()=>i(this,t,"f")[e].splice(r,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})),P=e=>t=>{var n,r,s;const a=o(C,E,A)(t),d=Object.keys(e);return s=class extends a{constructor(...e){super(...e),n.add(this),this.observeAttributes(d,i(this,n,"m",r).bind(this))}async init(){var e;d.forEach((e=>i(this,n,"m",r).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,r=function(t,n){const i=e[t],r="function"==typeof i?i(t,n):i;r&&this.logger.error(r)},s};P.missingAttrValidator=O;const N=h((e=>{const t=o(P({"project-id":O}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),j=h((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),R="Trying the next fallback URL...",T=async(e,t,{logger:n}={})=>{try{return await fetch(e,t)}catch(i){return null==n||n.debug(`Network error fetching URL ${e} [${i.message}], retrying...`),fetch(e,t)}};const M=h((e=>{var t,n,s,a,d,l,c;const u=o(C,N,j)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,new Set)}async fetchStaticResource(e,n){const o=i(this,t,"m",d).call(this,e),l=Array.isArray(o)?e=>{const{baseUrl:t}=o[e];r(this,s,t,"f");for(let t=0;t<e;t++){const e=o[t].baseUrl;i(this,a,"f").add(e)}}: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 T(o.toString(),t,{logger:n});if(r.ok)return null==i||i(e),null==n||n.debug(`Successfully fetched URL ${o}`),r;const a=`Error fetching URL ${o} [${r.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${R}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${R}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:l});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,s=new WeakMap,a=new WeakMap,t=new WeakSet,d=function(e){const o=I||this.baseStaticUrl;if(o)return i(this,t,"m",l).call(this,e,o);i(this,n,"f")!==this.baseUrl&&(r(this,n,this.baseUrl,"f"),r(this,s,void 0,"f"),i(this,a,"f").clear());const d=[];if(i(this,s,"f"))d.push(i(this,t,"m",l).call(this,e,i(this,s,"f"))),i(this,s,"f")===S&&d.push(i(this,t,"m",l).call(this,e,x));else{const n=this.baseUrl+"/pages";this.baseUrl&&!i(this,a,"f").has(n)&&d.push(i(this,t,"m",l).call(this,e,n)),i(this,a,"f").has(S)||d.push(i(this,t,"m",l).call(this,e,S)),d.push(i(this,t,"m",l).call(this,e,x))}return 1===d.length?d[0]:d},l=function(e,t){return function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i=S}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}({projectId:this.projectId,filename:e,baseUrl:t})},c})),U=h((e=>{var t,n;const r=o(P({"project-id":O}))(e);return n=class extends r{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(i(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return i(this,t,"f").set(e,n),()=>{i(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(i(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!i(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=i(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),L=h((e=>{var t,n,s,a,d;const l=o(M,U,E)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.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",i(this,t,"m",n).bind(this))}get config(){return i(this,s,"f")||r(this,s,i(this,a,"f").call(this),"f"),i(this,s,"f")}},s=new WeakMap,a=new WeakMap,t=new WeakSet,n=function(){r(this,s,void 0,"f")},d})),_=h((e=>{var t,n,s,a,d,l,c;return c=class extends(o(E,C)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,r)=>{var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,r),"debug"===e&&i(this,t,"m",d).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var r;null===(r=super.onLogEvent)||void 0===r||r.call(this,e,n),"error"===e&&i(this,t,"m",l).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),i(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){var e;null===(e=i(this,n,"f"))||void 0===e||e.remove(),r(this,n,null,"f")},a=async function(){r(this,n,document.createElement("descope-debugger"),"f"),Object.assign(i(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Lf})),document.body.appendChild(i(this,n,"f"))},d=function(){this.debug?i(this,t,"m",a).call(this):i(this,t,"m",s).call(this)},l=function(e,t){var r;e&&(null===(r=i(this,n,"f"))||void 0===r||r.updateData({title:e,description:t}))},c})),W=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],D=e=>{let t=0;const n=e.toString();for(let e=0;e<n.length;e++){t=(t<<5)-t+n.charCodeAt(e),t|=0}return`${Math.abs(t).toString()}`},F=(e,t,n)=>new Promise(((i,r)=>{const o=((e,t)=>{const n=document.createElement("script");return n.id=e,t&&(n.integrity=t,n.crossOrigin="anonymous"),window.DESCOPE_NONCE&&n.setAttribute("nonce",window.DESCOPE_NONCE),n})(e,n);o.onerror=e=>{o.setAttribute("status","error"),r(e)},o.onload=()=>{o.setAttribute("status","loaded"),i(o)},o.src=t.toString(),document.body.appendChild(o)})),q=(e,t)=>{if(t){const n=e.integrity;if(n!==t)return Promise.reject(new Error(`Integrity mismatch: expected ${t}, found ${n}`))}return"loaded"===e.getAttribute("status")?Promise.resolve(e):(e=>"error"===e.getAttribute("status"))(e)?Promise.reject():new Promise(((t,n)=>{e.addEventListener("load",(()=>{t(e)})),e.addEventListener("error",(e=>{n(e)}))}))},B=h((e=>{const t=o(C)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(e,t,n="",i=[],r){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"${r?" with SRI integrity check":""}`),(async(e,t)=>{for(const i of e){const{id:e,url:r,integrity:o}=i,s=(n=e,document.querySelector(`script#${n}`));if(s)try{return await q(s,o),i}catch(e){t(i,!0)}else try{return await F(e,r,o),i}catch(e){t(i,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,i="",r)=>e.reduce(((e,o)=>{const s=o;if(!s)return e;let a;try{a=new URL(s)}catch(e){throw new Error(`Invalid URL: ${s}`)}"/"!==a.pathname||(a.pathname=`/npm/${t}@${n}/${i}`);const d={url:a,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${D(a)}`};return r&&(d.integrity=r),[...e,d]}),[]))([...i,this.baseCdnUrl,...W],e,t,n,r),((e,t)=>{t?this.logger.error(`Existing script cannot be loaded: "${e.url}"`):this.logger.error(`Cannot load script from URL, Make sure this URL is valid and return the correct script: "${e.url}"`)}))}}})),V="base.ui.components.url",H=k&&localStorage.getItem(V),z=h((e=>{var t,n,s,a,d,l,c;const u=o(C,L,B)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),a.set(this,void 0)}get descopeUi(){return i(this,a,"f")||r(this,a,i(this,t,"m",l).call(this),"f"),i(this,a,"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=>i(this,t,"m",d).call(this,e))))}},a=new WeakMap,t=new WeakSet,n=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},s=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersionSri;return n&&this.logger.debug("SRI hash available for components"),n},d=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(", ")}"`)},l=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const e=await i(this,t,"m",n).call(this),r=H?void 0:await i(this,t,"m",s).call(this);return await this.injectNpmLib("@descope/web-components-ui",e,"dist/umd/index.js",[H],r),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},c})),G=h((e=>{var t,n,r;const s=o(E,A)(e);return r=class extends s{constructor(){super(...arguments),t.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.observeAttribute("nonce",i(this,t,"m",n).bind(this)),i(this,t,"m",n).call(this)}},t=new WeakSet,n=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},r}));class K{constructor(e,t,{prepend:n=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(n?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return null===(e=this.styleEle.sheet)||void 0===e?void 0:e.cssRules}}const J=h((e=>{const t=o(G)(e);return class extends t{injectStyle(e,{prepend:t=!1}={}){let n;try{n=new CSSStyleSheet}catch(e){n=new K(this.shadowRoot,this.nonce,{prepend:t})}if(e&&n.replaceSync(e),n instanceof CSSStyleSheet){const e=this.shadowRoot;if(e&&"adoptedStyleSheets"in e){const i=[...e.adoptedStyleSheets||[]];i[t?"unshift":"push"](n),e.adoptedStyleSheets=i}}return n}}})),Y="content-root",Z="root",X=h((e=>{const t=o(J)(e);return class extends t{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${Z}">\n <div id="${Y}"></div>\n </div>\n `,this.injectStyle(`\n #${Z}, #${Y} {\n height: 100%;\n }\n #${Z} {\n position: relative;\n height: fit-content;\n }\n `),this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Y),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Z)}}})),Q="descope-modal";var ee,te,ne;let ie=class{constructor(e,t){ee.set(this,void 0),this.nodeName="",r(this,ee,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)})))(i(this,ee,"f"))}get ele(){var e,t;const n="function"==typeof i(this,ee,"f")?i(this,ee,"f").call(this):i(this,ee,"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)}get isExists(){return!!this.ele}};ee=new WeakMap;let re=class extends ie{constructor(){super(...arguments),this.nodeName="descope-filter",te.set(this,null)}get data(){var e;try{return JSON.parse((null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data"))||"[]")}catch(e){return[]}}set data(e){var t,n;r(this,te,JSON.stringify(e),"f"),i(this,te,"f")!==(null===(t=this.ele)||void 0===t?void 0:t.getAttribute("data"))&&(null===(n=this.ele)||void 0===n||n.setAttribute("data",i(this,te,"f")))}get value(){var e;try{return JSON.parse((null===(e=this.ele)||void 0===e?void 0:e.getAttribute("value"))||"[]")}catch(e){return[]}}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",JSON.stringify(e))}onApply(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("filter-apply",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("filter-apply",n)}}onClear(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("filter-clear",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("filter-clear",n)}}onDataChange(e){const t=this.ele;if(!t)return()=>{};const n=new MutationObserver((()=>{var n;(null!==(n=t.getAttribute("data"))&&void 0!==n?n:"[]")!==i(this,te,"f")&&e()}));return n.observe(t,{attributes:!0,attributeFilter:["data"]}),()=>n.disconnect()}};te=new WeakMap;let oe=class extends ie{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")}},se=class extends ie{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")}start(){var e,t;null===(t=null===(e=this.ele)||void 0===e?void 0:e.start)||void 0===t||t.call(e)}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}onPageUpdated(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("page-updated",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("page-updated",e)}}},ae=class extends oe{get flowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id"))||""}get enableMode(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("enable-mode")}};const de=/^descope-grid-([^-]+)-column$/,le={text:class extends ie{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 ie{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 ce=class extends ie{constructor(){super(...arguments),this.nodeName="descope-grid",ne.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=de.exec(t.localName))||void 0===n?void 0:n[1],r=le[i];return r?(e.push(new r(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const r=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);r&&this.ele.columns&&(a(r,this.ele.columns)||(this.ele.columns=r,null===(n=i(this,ne,"f"))||void 0===n||n.call(this,r)))}onColumnsChange(e){r(this,ne,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};var ue,he,fe,pe;ne=new WeakMap;let ge=class extends ie{constructor(...e){super(...e),ue.add(this),he.set(this,void 0),fe.set(this,void 0),this.nodeName="descope-modal",i(this,ue,"m",pe).call(this)}get isOpen(){var e;return"true"===(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("opened"))}get isClosed(){return!this.isOpen}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),i(this,ue,"m",pe).call(this),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),i(this,he,"f")&&(null===(e=this.ele)||void 0===e||e.append(i(this,he,"f").content.cloneNode(!0)))}setContent(e){r(this,he,e,"f"),this.reset()}remove(){var e,t;null===(e=i(this,fe,"f"))||void 0===e||e.disconnect(),null===(t=this.ele)||void 0===t||t.remove()}};he=new WeakMap,fe=new WeakMap,ue=new WeakSet,pe=function(){if(i(this,fe,"f"))return;const e=this.ele;e&&(r(this,fe,new MutationObserver((t=>{t.forEach(((n,i)=>{var r;const o="true"===n.oldValue,s=t[i+1]?t[i+1].oldValue:e.getAttribute("opened");o&&"true"!==s&&(null===(r=this.afterClose)||void 0===r||r.call(this))}))})),"f"),i(this,fe,"f").observe(e,{attributes:!0,attributeFilter:["opened"],attributeOldValue:!0}))};let ve=class extends ie{constructor(){super(...arguments),this.nodeName="descope-multi-line-mappings"}setData(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("data",JSON.stringify(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)}get mergedValue(){return Object.entries(this.value.filter((({tenantId:e})=>!!e)).reduce(((e,{tenantId:t,roleNames:n})=>(e[t]=[...new Set([...e[t]||[],...n])],e)),{})).map((([e,t])=>({tenantId:e,roleNames:t})))}};const me=({label:e,value:t,description:n})=>{const i=document.createElement("span");i.setAttribute("data-name",e),i.setAttribute("data-id",t),i.style.display="flex",i.style.flexDirection="column";const r=document.createElement("span");if(r.textContent=e,i.appendChild(r),n){const e=document.createElement("span");e.textContent=n,e.style.opacity="0.6",e.style.fontSize="0.85em",i.appendChild(e)}return i.outerHTML};let $e=class extends ie{constructor(){super(...arguments),this.nodeName="descope-multi-select-combo-box"}async setData(e){const t=await this.asyncEle;t&&(e.some((e=>e.description))&&(t.renderItem=me),t.setAttribute("data",JSON.stringify([...e].sort(((e,t)=>e.label.localeCompare(t.label))))))}},ye=class extends ie{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()}},be=class extends ie{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)}},we=class extends ie{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")}};const Ce=h((e=>{var t,n;const r=o(E,X,z)(e);return n=class extends r{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ge{setContent(t){e(t),super.setContent(t)}}})())}get modalDriverClass(){return i(this,t,"f")}createModal(e,n=i(this,t,"f")){const r=((e={})=>{const t=document.createElement(Q);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(r),new n(r,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Q]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),ke=h((e=>class extends(Ce(e)){createFlowModal(e){const t=this.modalDriverClass;return this.createModal(e,class extends t{setContent(e){const t=e.content.querySelector("descope-wc");t&&!t.hasAttribute("lazy-start")&&t.setAttribute("lazy-start","true"),super.setContent(e)}async open(){var e,t,n;await super.open(),null===(n=null===(t=null===(e=this.ele)||void 0===e?void 0:e.querySelector("descope-wc"))||void 0===t?void 0:t.start)||void 0===n||n.call(t)}})}})),Se="descope-notification",xe=h((e=>{var t,n;const r=o(E,X,z)(e);return n=class extends r{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ye{setContent(t){const n="string"==typeof t?s(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Se);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(i(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([Se])}},t=new WeakMap,n})),Ie="theme",Oe=(e,t,n="")=>Object.entries(e).reduce(((e,[i,r])=>{if(!/^[a-zA-Z0-9-]+$/.test(i))return t("Ignoring invalid override-css token path segment"),e;const o=n?`${n}-${i}`:i;if("object"==typeof r&&null!==r)return e+Oe(r,t,o);const s=(e=>"number"==typeof e?Number.isFinite(e)?String(e):null:"string"!=typeof e||/[;{}]/.test(e)?null:e.trim())(r);return null===s?(t("Ignoring invalid override-css token value"),e):`${e}--descope-${o}:${s};`}),"");function Ee(e,t){const n=Object.assign({},e);for(const[e,i]of Object.entries(t||{}))if(null!=i)if("object"==typeof i){if(0===Object.keys(i).length)continue;n[e]=Ee(n[e]||{},i)}else n[e]="string"==typeof i?(n[e]||"")+i:i;return n}const Ae=(e,t)=>null!==t&&!/^[a-zA-Z0-9_-]*$/.test(t)&&"tenant must contain only alphanumeric characters, hyphens, or underscores",Pe=h((e=>{const t=o(P({tenant:Ae}))(e);return class extends t{get tenantId(){return this.getAttribute("tenant")||void 0}}})),Ne=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',je=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g,v,m,$,y,b,w,C,k,S,x;const I=o(P({theme:Ne}),Pe,M,E,z,L,X,A,J)(e);return x=class extends I{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,void 0),l.set(this,void 0),c.set(this,void 0),C.set(this,(()=>{i(this,t,"m",k).call(this),i(this,S,"f").call(this,"os"===this.getAttribute("theme"))})),S.set(this,(e=>{var n,r,o;const s=e?"addEventListener":"removeEventListener";null===(o=null===(r=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===r?void 0:r[s])||void 0===o||o.call(r,"change",(()=>i(this,t,"m",k).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")||Ie}get themeOverride(){const e=this.getAttribute("theme-override");if(!e)return null;try{return JSON.parse(e)}catch(e){return this.logger.error("Failed to parse theme-override attribute. error: ",e),null}}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),i(this,C,"f").call(this),await Promise.all([i(this,t,"m",f).call(this),i(this,t,"m",v).call(this),i(this,t,"m",$).call(this)]),i(this,t,"m",m).call(this),this.observeAttributes(["theme"],i(this,C,"f")),this.observeAttributes(["theme-override"],(()=>i(this,t,"m",m).call(this))),this.observeAttributes(["tenant"],(()=>{r(this,c,null,"f"),i(this,t,"m",v).call(this),i(this,t,"m",$).call(this)})),this.observeAttributes(["style-id"],(()=>{r(this,l,null,"f"),i(this,t,"m",b).call(this),i(this,t,"m",f).call(this),i(this,t,"m",$).call(this)}))}},n=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,C=new WeakMap,S=new WeakMap,t=new WeakSet,d=function(){const e=this.themeOverride;return e?["light","dark"].map((t=>{var n,i,r,o,s,a;const d=null===(r=null===(i=null===(n=e[t])||void 0===n?void 0:n.globals)||void 0===i?void 0:i.colors)||void 0===r?void 0:r.primary,l=null===(a=null===(s=null===(o=e[t])||void 0===o?void 0:o.globals)||void 0===s?void 0:s.colors)||void 0===a?void 0:a.secondary;return d||l?`[data-theme="${t}"]{${Oe({colors:{primary:d,secondary:l}},(e=>this.logger.error(e)))}}`:""})).join(""):""},u=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(V))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(V),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")}},h=function(){return i(this,l,"f")||(r(this,l,i(this,t,"m",u).call(this),"f"),i(this,l,"f").then((e=>this.logger.debug("Fetched theme",e)))),i(this,l,"f")},f=async function(){var e,o;const s=await i(this,t,"a",h);if(!s)return;const a=((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.globals)||"")+((null===(o=null==s?void 0:s.dark)||void 0===o?void 0:o.globals)||"");i(this,n,"f")?i(this,n,"f").replaceSync(a):r(this,n,this.injectStyle(a,{prepend:!0}),"f")},p=async function(){const e=this.tenantId;if(e)try{const{body:t}=await this.fetchStaticResource(`${e}/theme.json`,"json");return t}catch(e){this.logger.warn("No tenant style exists, using project default theme.")}},g=function(){return i(this,c,"f")||r(this,c,i(this,t,"m",p).call(this),"f"),i(this,c,"f")},v=async function(){var e,n,o,a;if(!this.tenantId)return void(null===(e=i(this,s,"f"))||void 0===e||e.replaceSync(""));const d=await i(this,t,"a",g);if(!d)return void(null===(n=i(this,s,"f"))||void 0===n||n.replaceSync(""));const l=((null===(o=d.light)||void 0===o?void 0:o.globals)||"")+((null===(a=d.dark)||void 0===a?void 0:a.globals)||"");i(this,s,"f")?i(this,s,"f").replaceSync(l):r(this,s,this.injectStyle(l),"f")},m=async function(){var e;if(!this.themeOverride)return void(null===(e=i(this,a,"f"))||void 0===e||e.replaceSync(""));const n=i(this,t,"m",d).call(this);i(this,a,"f")?i(this,a,"f").replaceSync(n):r(this,a,this.injectStyle(n),"f")},$=async function(){var e,n,r,o;const s=await i(this,t,"a",h);if(!s)return;const a=await this.descopeUi;if(!(null==a?void 0:a.componentsThemeManager))return;const d=await i(this,t,"a",g);a.componentsThemeManager.themes={light:Ee((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.components)||{},(null===(n=null==d?void 0:d.light)||void 0===n?void 0:n.components)||{}),dark:Ee((null===(r=null==s?void 0:s.dark)||void 0===r?void 0:r.components)||{},(null===(o=null==d?void 0:d.dark)||void 0===o?void 0:o.components)||{})}},y=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},b=async function(){const e=await i(this,t,"m",y).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")},w=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)},k=function(){i(this,t,"m",b).call(this),i(this,t,"m",w).call(this)},x}));var Re=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Te=()=>Math.random().toString(36).substring(7).split("").join("."),Me={INIT:`@@redux/INIT${Te()}`,REPLACE:`@@redux/REPLACE${Te()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Te()}`};function Ue(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 Le(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 _e(e){let t=typeof e;return t=Le(e),t}function We(e,t,n){if("function"!=typeof e)throw new Error(`Expected the root reducer to be a function. Instead, received: '${_e(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("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(`Expected the enhancer to be a function. Instead, received: '${_e(n)}'`);return n(We)(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("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(`Expected the listener to be a function. Instead, received: '${_e(e)}'`);if(d)throw new Error("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("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(!Ue(e))throw new Error(`Actions must be plain objects. Instead, the actual type was: '${_e(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('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(`Action "type" property must be a string. Instead, the actual type was: '${_e(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,r=i(r,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Me.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(`Expected the nextReducer to be a function. Instead, received: '${_e(e)}`);i=e,h({type:Me.REPLACE})},[Re]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(`Expected the observer to be an object. Instead, received: '${_e(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Re](){return this}}}}}function De(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Fe(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];void 0===e[r]&&De(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r,o;r={};try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Me.INIT}))throw new Error(`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:Me.PROBE_UNKNOWN_ACTION()}))throw new Error(`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Me.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;{const i=function(e,t,n,i){const r=Object.keys(t),o=n&&n.type===Me.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(!Ue(e))return`The ${o} has unexpected type of "${_e(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===Me.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&&De(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(`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 qe(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Be(e){return Ue(e)&&"type"in e&&"string"==typeof e.type}var Ve=Symbol.for("immer-nothing"),He=Symbol.for("immer-draftable"),ze=Symbol.for("immer-state"),Ge=[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 Ke(e,...t){{const n=Ge[e],i="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${i}`)}}var Je=Object.getPrototypeOf;function Ye(e){return!!e&&!!e[ze]}function Ze(e){return!!e&&(Qe(e)||Array.isArray(e)||!!e[He]||!!e.constructor?.[He]||rt(e)||ot(e))}var Xe=Object.prototype.constructor.toString();function Qe(e){if(!e||"object"!=typeof e)return!1;const t=Je(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)===Xe}function et(e,t){0===tt(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function tt(e){const t=e[ze];return t?t.type_:Array.isArray(e)?1:rt(e)?2:ot(e)?3:0}function nt(e,t){return 2===tt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function it(e,t,n){const i=tt(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function rt(e){return e instanceof Map}function ot(e){return e instanceof Set}function st(e){return e.copy_||e.base_}function at(e,t){if(rt(e))return new Map(e);if(ot(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Qe(e)){if(!Je(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ze];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(Je(e),n)}function dt(e,t=!1){return ct(e)||Ye(e)||!Ze(e)||(tt(e)>1&&(e.set=e.add=e.clear=e.delete=lt),Object.freeze(e),t&&et(e,((e,t)=>dt(t,!0)))),e}function lt(){Ke(2)}function ct(e){return Object.isFrozen(e)}var ut,ht={};function ft(e){const t=ht[e];return t||Ke(0,e),t}function pt(){return ut}function gt(e,t){t&&(ft("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function vt(e){mt(e),e.drafts_.forEach(yt),e.drafts_=null}function mt(e){e===ut&&(ut=e.parent_)}function $t(e){return ut={drafts_:[],parent_:ut,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yt(e){const t=e[ze];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function bt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ze].modified_&&(vt(t),Ke(4)),Ze(e)&&(e=wt(t,e),t.parent_||kt(t,e)),t.patches_&&ft("Patches").generateReplacementPatches_(n[ze].base_,e,t.patches_,t.inversePatches_)):e=wt(t,n,[]),vt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ve?e:void 0}function wt(e,t,n){if(ct(t))return t;const i=t[ze];if(!i)return et(t,((r,o)=>Ct(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return kt(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),et(r,((r,s)=>Ct(e,i,t,r,s,n,o))),kt(e,t,!1),n&&e.patches_&&ft("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Ct(e,t,n,i,r,o,s){if(r===n&&Ke(5),Ye(r)){const s=wt(e,r,o&&t&&3!==t.type_&&!nt(t.assigned_,i)?o.concat(i):void 0);if(it(n,i,s),!Ye(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(Ze(r)&&!ct(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;wt(e,r),t&&t.scope_.parent_||kt(e,r)}}function kt(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&dt(t,n)}var St={get(e,t){if(t===ze)return e;const n=st(e);if(!nt(n,t))return function(e,t,n){const i=Ot(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_||!Ze(i)?i:i===It(e.base_,t)?(At(e),e.copy_[t]=Pt(i,e)):i},has:(e,t)=>t in st(e),ownKeys:e=>Reflect.ownKeys(st(e)),set(e,t,n){const i=Ot(st(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=It(st(e),t),r=i?.[ze];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||nt(e.base_,t)))return!0;At(e),Et(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!==It(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,At(e),Et(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=st(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){Ke(11)},getPrototypeOf:e=>Je(e.base_),setPrototypeOf(){Ke(12)}},xt={};function It(e,t){const n=e[ze];return(n?st(n):e)[t]}function Ot(e,t){if(!(t in e))return;let n=Je(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Je(n)}}function Et(e){e.modified_||(e.modified_=!0,e.parent_&&Et(e.parent_))}function At(e){e.copy_||(e.copy_=at(e.base_,e.scope_.immer_.useStrictShallowCopy_))}et(St,((e,t)=>{xt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),xt.deleteProperty=function(e,t){return isNaN(parseInt(t))&&Ke(13),xt.set.call(this,e,t,void 0)},xt.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&Ke(14),St.set.call(this,e[0],t,n,e[0])};function Pt(e,t){const n=rt(e)?ft("MapSet").proxyMap_(e,t):ot(e)?ft("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:pt(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=St;n&&(r=[i],o=xt);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:pt()).drafts_.push(n),n}function Nt(e){return Ye(e)||Ke(10,e),jt(e)}function jt(e){if(!Ze(e)||ct(e))return e;const t=e[ze];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=at(e,t.scope_.immer_.useStrictShallowCopy_)}else n=at(e,!0);return et(n,((e,t)=>{it(n,e,jt(t))})),t&&(t.finalized_=!1),n}var Rt=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&&Ke(6),void 0!==n&&"function"!=typeof n&&Ke(7),Ze(e)){const r=$t(this),o=Pt(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?vt(r):mt(r)}return gt(r,n),bt(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===Ve&&(i=void 0),this.autoFreeze_&&dt(i,!0),n){const t=[],r=[];ft("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}Ke(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){Ze(e)||Ke(8),Ye(e)&&(e=Nt(e));const t=$t(this),n=Pt(e,void 0);return n[ze].isManual_=!0,mt(t),n}finishDraft(e,t){const n=e&&e[ze];n&&n.isManual_||Ke(9);const{scope_:i}=n;return gt(i,t),bt(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=ft("Patches").applyPatches_;return Ye(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},Tt=Rt.produce;Rt.produceWithPatches.bind(Rt),Rt.setAutoFreeze.bind(Rt),Rt.setUseStrictShallowCopy.bind(Rt),Rt.applyPatches.bind(Rt),Rt.createDraft.bind(Rt),Rt.finishDraft.bind(Rt);var Mt=(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})}}},Ut=(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})}},Lt={inputStabilityCheck:"once",identityFunctionCheck:"once"};var _t=e=>Array.isArray(e)?e:[e];function Wt(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 Dt(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var Ft="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},qt=0,Bt=1;function Vt(){return{s:qt,v:void 0,o:null,p:null}}function Ht(e,t={}){let n=Vt();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=Vt(),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=Vt(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===Bt)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 Ft(d):d}return a.s=Bt,a.v=d,d}return s.clearCache=()=>{n=Vt(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function zt(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=Ht,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=_t(l),p=_t(u),g=Wt(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const $=c((function(){r++;const e=Dt(g,arguments);t=v.apply(null,e);{const{identityFunctionCheck:n,inputStabilityCheck:i}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:i}={...Lt,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Mt},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Ut}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=Dt(g,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign($,{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 Gt=zt(Ht),Kt=Object.assign(((e,t=Gt)=>{!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:()=>Kt});function Jt(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var Yt=Jt(),Zt=Jt;((...e)=>{const t=zt(...e)})(Ht);var Xt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?qe:qe.apply(null,arguments)},Qt=e=>e&&"function"==typeof e.match;function en(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("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=>Be(t)&&t.type===e,n}function tn(e){return"function"==typeof e&&"type"in e&&Qt(e)}function nn(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 rn=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 on(e){return Ze(e)?Tt(e,(()=>{})):e}function sn(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("No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function an(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function dn(e,t,n){const i=ln(e,t,n);return{detectMutations:()=>cn(e,t,i,n)}}function ln(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]=ln(e,t,n[r],s))}}return o}function cn(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=cn(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function un(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ue(e)}function hn(e,t="",n=un,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=hn(l,a,n,i,r,o),s))return s}return o&&fn(e)&&o.add(e),!1}function fn(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!fn(t))return!1;return!0}function pn(e){return"boolean"==typeof e}var gn=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new rn;if(t&&(pn(t)?o.push(Yt):o.push(Zt(t.extraArgument))),n){let e={};pn(n)||(e=n),o.unshift(function(e={}){{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=an,ignoredPaths:r,warnAfter:o=32}=e;const s=dn.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=nn(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error(`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(`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={};pn(i)||(e=i),o.push(function(e={}){{const{isSerializable:t=un,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(!Be(u))return l(u);const h=l(u),f=nn(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=hn(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=hn(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={};pn(r)||(e=r),o.unshift(function(e={}){const{isActionCreator:t=tn}=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},vn=e=>t=>{setTimeout(t,e)},mn="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:vn(10),$n=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new rn(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?mn:"callback"===e.type?e.queueNotification:vn(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};function yn(e){const t=gn(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ue(n))throw new Error("`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Fe(n)}if(i&&"function"!=typeof i)throw new Error("`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!Array.isArray(d))throw new Error("when using a middleware builder function, an array of middleware must be returned")}else d=t();if(d.some((e=>"function"!=typeof e)))throw new Error("each middleware provided to configureStore must be a function");let l=qe;r&&(l=Xt({trace:!0,..."object"==typeof r&&r}));const c=function(...e){return t=>(n,i)=>{const r=t(n,i);let o=()=>{throw new Error("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=qe(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=$n(c);if(s&&"function"!=typeof s)throw new Error("`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Array.isArray(h))throw new Error("`enhancers` callback must return an array");if(h.some((e=>"function"!=typeof e)))throw new Error("each enhancer provided to configureStore must be a function");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 We(a,o,l(...h))}function bn(e){const t={},n=[];let i;const r={addCase(e,o){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");const s="string"==typeof e?e:e.type;if(!s)throw new Error("`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error(`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,r},addMatcher(e,t){if(i)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if(i)throw new Error("`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function wn(...e){return t=>e.some((e=>((e,t)=>Qt(e)?e.match(t):e(t))(e,t)))}var Cn=["name","message","stack","code"],kn=class{constructor(e,t){this.payload=e,this.meta=t}_type},Sn=class{constructor(e,t){this.payload=e,this.meta=t}_type},xn=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Cn)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},In=(()=>{function e(e,t,n){const i=en(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=en(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=en(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||xn)(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 kn(e,t),fulfillWithValue:(e,t)=>new Sn(e,t)})).then((t=>{if(t instanceof kn)throw t;return t instanceof Sn?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof kn?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(On)})}}),{pending:r,rejected:o,fulfilled:i,settled:wn(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function On(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var En=Symbol.for("rtk-slice-createasyncthunk");function An(e,t){return`${e}/${t}`}function Pn(e,t,n,i){function r(r,...o){let s=n.call(e,r);if(void 0===s){if(!i)throw new Error("selectState returned undefined for an uninjected slice reducer");s=e.getInitialState()}return t(s,...o)}return r.unwrapped=t,r}var Nn=function({creators:e}={}){const t=e?.asyncThunk?.[En];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("`name` is a required option for createSlice");"undefined"!=typeof process&&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("`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("`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("object"==typeof e.extraReducers)throw new Error("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?bn(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("object"==typeof t)throw new Error("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]=bn(t);if(function(e){return"function"==typeof e}(e))n=()=>on(e());else{const t=on(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(Ye(e)){const i=n(e,t);return void 0===i?e:i}if(Ze(e))return Tt(e,(e=>n(e,t)));{const i=n(e,t);if(void 0===i){if(null===e)return e;throw new Error("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:An(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("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?en(e,s):en(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("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||jn,pending:a||jn,rejected:d||jn,settled:l||jn})}(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=sn(c,this,{insert:()=>new WeakMap});return sn(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Pn(this,r,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t){if(this===h)throw new Error("selectSlice returned undefined for an uninjected slice reducer");t=this.getInitialState()}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 jn(){}var Rn="listenerMiddleware";en(`${Rn}/add`),en(`${Rn}/removeAll`),en(`${Rn}/remove`);const Tn=e=>h((t=>{const n=Nn(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(o(C)(t)){constructor(...e){super(...e);const t=yn({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{On(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()))))}}})),Mn=h((e=>class extends(C(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()}})),Un=h((e=>{const t=o(P({"widget-id":O}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}}})),Ln=h((e=>{const t=o(L,Un)(e);return class extends t{async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async getWidgetConfig(){var e,t;const n=await this.config;return null===(t=null===(e=null==n?void 0:n.projectConfig)||void 0===e?void 0:e.widgets)||void 0===t?void 0:t[this.widgetId]}}})),_n=h((e=>class extends e{get locale(){return this.getAttribute("locale")||""}get localeCandidates(){const{locale:e,fallback:t}=y(this.locale);return[...new Set([e,t].filter(Boolean))]}firstAvailableLocale(e){var t;const n=(null!=e?e:[]).map((e=>e.toLowerCase()));return null!==(t=this.localeCandidates.find((e=>n.includes(e))))&&void 0!==t?t:""}})),Wn=e=>h((t=>{var n,r,s;const a=o(M,Un,Ln,_n)(t);return s=class extends a{constructor(){super(...arguments),n.add(this)}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async fetchWidgetPage(t){const o=await i(this,n,"m",r).call(this,t);if(void 0!==o)return o;const s=await this.fetchStaticResource(`${e}/${this.widgetId}/${t}`,"text");return null==s?void 0:s.body}},n=new WeakSet,r=async function(t){var n;const i=await this.getWidgetConfig(),r=this.firstAvailableLocale(null!==(n=null==i?void 0:i.targetLocales)&&void 0!==n?n:[]);if(!r)return;const o=".html",s=t.endsWith(o)?t.slice(0,-5):t;try{const t=await this.fetchStaticResource(`${e}/${this.widgetId}/${s}-${r}${o}`,"text");return null==t?void 0:t.body}catch(e){return}},s})),Dn=h((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),Fn=k&&localStorage.getItem("base.debug.logs.url"),qn=h((e=>{const t=o(P({"flow-id":O}))(e);return class extends t{get flowId(){return this.getAttribute("flow-id")}}}));function Bn(e){const t=Math.floor(e/1e3);if(t<60)return`${t} seconds`;const n=Math.floor(t/60);if(n<60)return`${n} minutes`;const i=Math.floor(n/60);return i<24?`${i} hours`:`${Math.floor(i/24)} days`}const Vn=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g;const v=o(B,C,E,L,N,qn)(e);return g=class extends v{constructor(){super(...arguments),t.add(this),n.set(this,null),s.set(this,!1),a.set(this,null),p.set(this,null)}get telemetryManager(){return i(this,n,"f")}updateTelemetryContext(e){if(i(this,n,"f"))try{i(this,n,"f").updateContext(e)}catch(e){this.logger.error("Error updating telemetry context:",e)}}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this));const n=this.sdkVersion||"1.0.0";r(this,p,i(this,t,"m",h).call(this).then((e=>i(this,t,"m",d).call(this,e,{projectId:this.projectId,flowId:this.flowId,sdkVersion:n}))).catch((e=>{this.logger.error("Failed to start telemetry:",e)})),"f")}get telemetryReady(){var e;return null!==(e=i(this,p,"f"))&&void 0!==e?e:Promise.resolve()}disconnectedCallback(){var e;null===(e=super.disconnectedCallback)||void 0===e||e.call(this),i(this,t,"m",c).call(this)}},n=new WeakMap,s=new WeakMap,a=new WeakMap,p=new WeakMap,t=new WeakSet,d=async function(e,o){if(null==e?void 0:e.enabled)if(i(this,s,"f"))this.logger.debug("Telemetry already initialized");else if(e.expiration&&Date.now()>=e.expiration)this.logger.info(`Telemetry expiration time has passed (${new Date(e.expiration).toISOString()}), skipping initialization`);else try{this.logger.debug("Initializing telemetry...");const a=e.version||"latest";await this.injectNpmLib("@descope/debug-logs",a,"dist/index.js",[Fn]);const d=window.DescopeDebugLogs;if(!d)throw new Error("DescopeDebugLogs not found after loading @descope/debug-logs. This likely means the UMD build failed to load from CDN.");if(r(this,n,new d({enabled:!0,rumConfig:e.rumConfig,capture:e.capture},{projectId:o.projectId,flowId:o.flowId,version:o.sdkVersion||"1.0.0"},this.logger),"f"),!i(this,n,"f").isReady())return this.logger.error("Telemetry manager failed to initialize (RUM client not ready)"),void r(this,n,null,"f");r(this,s,!0,"f"),this.logger.info("Telemetry initialized successfully"),e.expiration&&i(this,t,"m",l).call(this,e.expiration)}catch(e){this.logger.error("Failed to initialize telemetry:",e),r(this,s,!1,"f")}else this.logger.debug("Telemetry is disabled, skipping initialization")},l=function(e){const n=e-Date.now();if(n<=0)return this.logger.info("Telemetry expiration time reached, shutting down"),void i(this,t,"m",c).call(this);const o=864e5,s=Math.min(n,o);n>o&&this.logger.warn(`Telemetry expiration is beyond maximum timeout (${Bn(n)}). Setting to maximum.`),this.logger.info(`Telemetry will expire at ${new Date(e).toISOString()} (in ${Bn(s)})`),r(this,a,setTimeout((()=>{this.logger.info("Telemetry expiration time reached, shutting down"),i(this,t,"m",c).call(this)}),s),"f")},c=function(){if(i(this,a,"f")&&(clearTimeout(i(this,a,"f")),r(this,a,null,"f")),i(this,n,"f"))try{this.logger.debug("Shutting down telemetry..."),i(this,n,"f").shutdown(),r(this,n,null,"f"),r(this,s,!1,"f"),this.logger.info("Telemetry shutdown complete")}catch(e){this.logger.error("Error shutting down telemetry:",e)}},u=function(e){return Boolean((null==e?void 0:e.applicationId)&&(null==e?void 0:e.identityPoolId)&&(null==e?void 0:e.region))},h=async function(){var e;const n=await this.config,r=null===(e=null==n?void 0:n.projectConfig)||void 0===e?void 0:e.telemetry;let o;try{const e=Number(process.env.DESCOPE_TELEMETRY_SESSION_SAMPLE_RATE);o={enabled:"true"===(process.env.DESCOPE_TELEMETRY_ENABLED||"").toLowerCase(),rumConfig:Object.assign({applicationId:process.env.DESCOPE_TELEMETRY_APPLICATION_ID||"",identityPoolId:process.env.DESCOPE_TELEMETRY_IDENTITY_POOL_ID||"",region:process.env.DESCOPE_TELEMETRY_REGION||"",sessionSampleRate:Number.isFinite(e)&&e>0?e:1},process.env.DESCOPE_TELEMETRY_GUEST_ROLE_ARN&&{guestRoleArn:process.env.DESCOPE_TELEMETRY_GUEST_ROLE_ARN})}}catch(e){o={enabled:!1,rumConfig:{applicationId:"",identityPoolId:"",region:"",sessionSampleRate:1}}}const s=Object.assign(Object.assign(Object.assign({},o),r),{rumConfig:Object.assign(Object.assign({},o.rumConfig),null==r?void 0:r.rumConfig),capture:i(this,t,"m",f).call(this,null==r?void 0:r.capture)});return s.enabled&&!i(this,t,"m",u).call(this,s.rumConfig)&&(this.logger.warn("Telemetry enabled but rumConfig is incomplete (applicationId/identityPoolId/region required). Skipping initialization."),s.enabled=!1),r||(s.expiration=Date.now()+3e5,this.logger.debug("No backend telemetry config present; applying a 5-minute safety cap on the session.")),s},f=function(e){const t=null==e?void 0:e.dom;return!1===t?Object.assign(Object.assign({console:!0,network:!0,navigation:!0},e),{dom:!1}):Object.assign(Object.assign({console:!0,network:!0,navigation:!0},e),{dom:Object.assign(Object.assign({throttleMs:2e3},"object"==typeof t?t:{}),{rootElement:this.shadowRoot})})},g})),Hn=h((e=>{var n,r,o;return o=class extends(je(e)){constructor(){super(...arguments),n.add(this)}get clientInput(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get formInput(){return this.getAttribute("form")||void 0}createFlowTemplate(e){var{flowId:o,client:s,form:a}=e,d=t(e,["flowId","client","form"]);return u(Object.assign({projectId:this.getAttribute("project-id"),flowId:o,baseUrl:this.getAttribute("base-url")||"",baseStaticUrl:this.getAttribute("base-static-url")||"",baseCdnUrl:this.getAttribute("base-cdn-url")||"",refreshCookieName:this.getAttribute("refresh-cookie-name")||"",theme:this.theme,"style-id":this.styleId,locale:this.getAttribute("locale")||"",form:i(this,n,"m",r).call(this,a),client:Object.assign(Object.assign({},this.clientInput),s)},d))}},n=new WeakSet,r=function(e){const t=this.formInput;if(!e)return t;if(!t)return e;try{return Object.assign(Object.assign({},JSON.parse(t)),e)}catch(t){return e}},o})),zn=/(["\\])/g;function Gn(e,t){return Array.from(e.querySelectorAll(`[data-id="${n=t,"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(n):n.replace(zn,"\\$1")}"]`));var n}function Kn(e,t){e&&t&&Object.entries(t).forEach((([t,n])=>{Gn(e,t).forEach((e=>function(e,t){var n;switch(t){case"hide":e.setAttribute("hidden",""),null===(n=e.style)||void 0===n||n.setProperty("display","none","important");break;case"disable":e.setAttribute("disabled","true");break;case"read-only":e.setAttribute("readonly","true")}}(e,n)))}))}const Jn=h((e=>{var t,n,s,a,d,l;const c=o(C,X)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,{})}async init(){var e,o;if("true"===this.getAttribute("mock"))return r(this,n,Promise.resolve({}),"f"),void await(null===(e=super.init)||void 0===e?void 0:e.call(this));const s=i(this,t,"m",a).call(this);r(this,n,i(this,t,"m",d).call(this,s),"f"),await(null===(o=super.init)||void 0===o?void 0:o.call(this))}async onWidgetRootReady(){var e,t;await(null===(e=super.onWidgetRootReady)||void 0===e?void 0:e.call(this)),r(this,s,null!==(t=await i(this,n,"f"))&&void 0!==t?t:{},"f"),Kn(this.contentRootElement,i(this,s,"f"))}async reevaluateComponentsState(){const e=i(this,t,"m",a).call(this);var n,o;n=this.contentRootElement,o=i(this,s,"f"),n&&o&&Object.entries(o).forEach((([e,t])=>{Gn(n,e).forEach((e=>function(e,t){var n;switch(t){case"hide":e.removeAttribute("hidden"),null===(n=e.style)||void 0===n||n.removeProperty("display");break;case"disable":e.removeAttribute("disabled");break;case"read-only":e.removeAttribute("readonly")}}(e,t)))})),r(this,s,await i(this,t,"m",d).call(this,e),"f"),Kn(this.contentRootElement,i(this,s,"f"))}},n=new WeakMap,s=new WeakMap,t=new WeakSet,a=function(){var e;const t=null===(e=this.api)||void 0===e?void 0:e.httpClient;if(!t)throw new Error("componentsConditionsMixin: the widget sdk must expose `httpClient`. Compose apiMixin and return `webSdk.httpClient` from createSdk.");return t},d=async function(e){var t;try{const n=await e.get("/v1/mgmt/widget/components-state");if(!(null==n?void 0:n.ok))return{};const i=await n.json();return null!==(t=null==i?void 0:i.componentsState)&&void 0!==t?t:{}}catch(e){return this.logger.debug("components-conditions: failed to fetch, showing all components",null==e?void 0:e.message),{}}},l}));var Yn;!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"}(Yn||(Yn={}));const Zn=(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)}),{}),Xn=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Qn=(e,t)=>e===Yn.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t;function ei(e){return new URLSearchParams(window.location.search).get(e)}const ti={enabled:"active",disabled:"disabled",invited:"invited"},ni=e=>e.tenantRoles.data,ii=e=>e.selectedUsersLoginIds,ri=e=>e.notifications,oi=e=>e.customAttributes.data,si=Gt((e=>e.subTenantRoles.data),(e=>Object.fromEntries(e.map((({tenantId:e,tenantName:t,roleNames:n})=>[e,t?{label:t,options:n}:n]))))),ai=Gt(si,(e=>Object.keys(e).length>0)),di=Gt(oi,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),li=Gt((e=>e.usersList.data),di,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes||{}).map((([e,n])=>[e,Qn(t[e],n)])))}))))),ci=e=>{const t=[e.roleNames||[],...(e.userTenants||[]).map((e=>e.roleNames||[]))].filter((e=>e.length>0));if(0===t.length)return e.roleNames||[];const n=t.map((e=>[...e].sort().join("\0"))),i=n.every((e=>e===n[0]));return i?t[0]:"Multiple roles"},ui=Gt(li,(e=>e.map((e=>{var t;return Object.assign(Object.assign(Object.assign({},e),Xn(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:ti[e.status]||e.status,roles:ci(e),tenants:null===(t=e.userTenants)||void 0===t?void 0:t.map((e=>e.tenantName||e.tenantId))})})))),hi=Gt(ii,ui,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),fi=Gt(hi,(e=>e.map((e=>e.userId)))),pi=Gt(hi,(e=>e.map((({userId:e,loginIds:t})=>({userId:e,loginIds:t}))))),gi=Gt(hi,(e=>e.map((e=>({userId:e.userId,roles:e.roleNames}))))),vi=Gt(hi,(e=>e.map((e=>e.status)))),mi=Gt(hi,(e=>e.every((e=>e.editable)))),$i=Gt(ii,(e=>!!e.length)),yi=Gt(ii,(e=>1===e.length)),bi=Gt(ii,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),wi=Gt(yi,vi,((e,t)=>e&&t.every((e=>e===ti.enabled)))),Ci=Gt(vi,(e=>e.every((e=>e===ti.disabled)))),ki=Gt(hi,(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`})),Si=Gt(yi,Ci,mi,((e,t,n)=>e&&t&&n)),xi=Gt(yi,wi,mi,((e,t,n)=>e&&t&&n)),Ii=Gt(yi,mi,((e,t)=>e&&t)),Oi=Gt(yi,mi,((e,t)=>e&&t)),Ei=Gt(yi,mi,((e,t)=>e&&t)),Ai=$i,Pi=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)}))}))},Ni=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}}),ji=({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)})}}),Ri=In("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Ti=Pi(Ri)({onFulfilled:(e,t)=>{var n;const i=(null===(n=t.payload)||void 0===n?void 0:n.userId)?e.usersList.data.findIndex((e=>e.userId===t.payload.userId)):-1;-1!==i?e.usersList.data[i]=t.payload:e.usersList.data.unshift(t.payload)}},Ni((e=>e.createUser)),ji({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>`}})),Mi={action:Ri,reducer:Ti},Ui=In("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Li=Pi(Ui)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Ni((e=>e.deleteUser)),ji({getSuccessMsg:e=>l(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>l(e.meta.arg.length)`Failed to delete user${["","s"]}`})),_i={action:Ui,reducer:Li},Wi=In("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Di=Pi(Wi)(Ni((e=>e.setTempUserPassword)),ji({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>`}})),Fi={action:Wi,reducer:Di},qi=In("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Bi=Pi(qi)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Ni((e=>e.customAttributes))),Vi={action:qi,reducer:Bi},Hi=In("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),zi=Pi(Hi)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Ni((e=>e.usersList))),Gi={action:Hi,reducer:zi},Ki=In("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Ji=Pi(Ki)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Ni((e=>e.tenantRoles))),Yi={action:Ki,reducer:Ji},Zi=In("tenant/getSubTenantRoles",((e,{extra:{api:t}})=>t.tenant.getSubTenantRoles())),Xi=Pi(Zi)({onFulfilled:(e,t)=>{e.subTenantRoles.data=t.payload.roles},onRejected:e=>{e.subTenantRoles.data=[]}},Ni((e=>e.subTenantRoles))),Qi={action:Zi,reducer:Xi},er=In("users/update",((e,{extra:{api:t}})=>t.user.update(e))),tr=Pi(er)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>a(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Ni((e=>e.updateUser)),ji({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>`}})),nr={action:er,reducer:tr},ir=In("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),rr=Pi(ir)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return a(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)}},Ni((e=>e.enableUser)),ji({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>`}})),or={action:ir,reducer:rr},sr=In("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),ar=Pi(sr)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return a(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)}},Ni((e=>e.disableUser)),ji({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>`}})),dr={action:sr,reducer:ar},lr=In("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),cr={action:lr,reducer:Pi(lr)(Ni((e=>e.removePasskey)),ji({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>`}}))},ur={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:[]},subTenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]};class hr extends Error{}function fr(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 pr(e,t){if("string"!=typeof e)throw new hr("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 hr(`Invalid token specified: missing part #${n+1}`);let r;try{r=fr(i)}catch(e){throw new hr(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new hr(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}hr.prototype.name="InvalidTokenError";var gr={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},sso:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next",event:"/v1/flow/event"}};const vr="<region>",mr=`https://api.${vr}descope.com`,$r=6e5,yr=()=>{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},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},br=[503,520,521,522,524,530],wr=[100,5e3,5e3],Cr=e=>new Promise((t=>setTimeout(t,e))),kr=e=>async function(...t){let n=await e(...t);const i=!!(null==(r=t[1])?void 0:r.disableRetry);var r;let o=0;for(;!i&&br.includes(n.status)&&o<wr.length;)await Cr(wr[o]),n=await e(...t),o++;o>0&&(n.retries=o);const s=await n.text();return n.text=()=>Promise.resolve(s),n.json=()=>Promise.resolve(JSON.parse(s)),n.clone=()=>n,n};let Sr;const xr=()=>{if(Sr)return Sr;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 Sr=`${t}-${n}`,Sr};var Ir;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(Ir||(Ir={}));const Or=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(vr,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},Er=(...e)=>new Headers(e.reduce(((e,t)=>((e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t).forEach((([t,n])=>{e[t]="function"==typeof n?n():n})),e)),{})),Ar={"Content-Type":"application/json"},Pr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Nr=(e,t)=>{const n={"x-descope-sdk-session-id":xr(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.72.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},jr=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e};var Rr=e=>{var t;return(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{const d=e||mr,l=((e,t)=>{const 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 function(...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=>yr().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await kr(n)(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return yr().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).retries(e.retries).build()})(i)),i}:kr(n)})(r,a),c=async e=>{var r;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(e):e,{path:c,body:u,headers:h,queryParams:f,method:p,token:g,keepalive:v,disableRetry:m}=a,$=(e=>void 0===e?void 0:JSON.stringify(e))(u),y=Object.assign(Object.assign({headers:Er(Pr(t,g),Nr(t,i),(null==n?void 0:n.baseHeaders)||{},jr($)?Ar:{},h),method:p,body:$},v?{keepalive:!0}:{}),m?{disableRetry:!0}:{});null!==s&&(y.credentials=s||"include");const b=await l(Or({path:c,baseUrl:d,queryParams:f,projectId:t}),y);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(e,null==b?void 0:b.clone()),null==o?void 0:o.transformResponse){const e=await b.json(),t=(w=(null===(r=b.headers)||void 0===r?void 0:r.get("set-cookie"))||"",Object.fromEntries(function(e){if(!e)return[];const t=[];let n=0;function i(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function r(){const t=e.charAt(n);return"="!==t&&";"!==t&&","!==t}for(;n<e.length;){const o=n;let s,a,d=!1;for(;i();)if(","===e.charAt(n)){for(s=n,n+=1,i(),a=n;n<e.length&&r();)n+=1;if(n<e.length&&"="===e.charAt(n)){d=!0,n=a,t.push(e.substring(o,s));break}n=s+1}else n+=1;(!d||n>=e.length)&&t.push(e.substring(o,e.length))}return t}(w).map((e=>{const t=e.split(";")[0],n=t.indexOf("=");return n<1?null:[t.substring(0,n).trim(),t.substring(n+1).trim()]})).filter(Boolean))),n=Object.assign(Object.create(null),{json:()=>Promise.resolve(e),cookies:t}),i=new Proxy(b,{get:(e,t)=>{if(t in n)return n[t];const i=e[t];return"function"==typeof i?i.bind(e):i},set:(e,t,i)=>(n[t]=i,!0),has:(e,t)=>t in n||t in e});return n.clone=()=>i,o.transformResponse(i)}var w;return b};return{get:(e,{headers:t,queryParams:n,token:i,keepalive:r,disableRetry:o}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:Ir.get,token:i,keepalive:r,disableRetry:o}),post:(e,t,{headers:n,queryParams:i,token:r,keepalive:o,disableRetry:s}={})=>c({path:e,headers:n,queryParams:i,body:t,method:Ir.post,token:r,keepalive:o,disableRetry:s}),patch:(e,t,{headers:n,queryParams:i,token:r,keepalive:o,disableRetry:s}={})=>c({path:e,headers:n,queryParams:i,body:t,method:Ir.patch,token:r,keepalive:o,disableRetry:s}),put:(e,t,{headers:n,queryParams:i,token:r,keepalive:o,disableRetry:s}={})=>c({path:e,headers:n,queryParams:i,body:t,method:Ir.put,token:r,keepalive:o,disableRetry:s}),delete:(e,{headers:t,queryParams:n,token:i,keepalive:r,disableRetry:o}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:Ir.delete,token:i,keepalive:r,disableRetry:o}),hooks:o,buildUrl:(e,n)=>Or({projectId:t,baseUrl:d,path:e,queryParams:n})}})(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}}))},Tr=429;function Mr(e,t,n){var i;let r=Ur(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(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 Ur(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return pr(e)}function Lr(e){const{exp:t}=Ur(e);return(new Date).getTime()/1e3>t}function _r(e){let t=Ur(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Wr(e,t){return Mr(e,t,"permissions")}function Dr(e,t){return Mr(e,t,"roles")}const Fr=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function qr(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===Tr&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function Br(e){var t;return(null===(t=Ur(e))||void 0===t?void 0:t.dct)||""}const Vr=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Hr=(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 "))},zr=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Gr=e=>t=>e.test(t),Kr=Gr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Jr=Gr(/^\+[1-9]{1}[0-9]{3,14}$/),Yr=Vr(Kr,'"{val}" is not a valid email'),Zr=Vr(Jr,'"{val}" is not a valid phone number'),Xr=Vr((e=>e.length>=1),"Minimum length is 1");const Qr=Vr((e=>"string"==typeof e),"Input is not a string"),eo=Vr((e=>Array.isArray(e)),"Input is not an array"),to=Vr((e=>"boolean"==typeof e),"Input is not a boolean"),no=Vr((e=>void 0===e),"Input is defined"),io=Hr([Qr(),no()],"Input is not a string or undefined"),ro=Hr([eo(),to()],"Input is not an array or boolean"),oo=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>zr(...e).validate(n[t]))),t(...n)),so=e=>[Qr(`"${e}" must be a string`)],ao=e=>[io(`"${e}" must be string or undefined`)],lo=e=>[Qr(`"${e}" must be a string`),Xr(`"${e}" must not be empty`)],co=e=>[Qr(`"${e}" must be a string`),Yr()],uo=e=>[Qr(`"${e}" must be a string`),Zr()],ho=oo(lo("accessKey")),fo=e=>({exchange:ho(((t,n)=>qr(e.post(gr.accessKey.exchange,{loginOptions:n},{token:t}))))}),po=(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),go=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||$r,$r)});var vo,mo;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"}(vo||(vo={})),function(e){e.email="email"}(mo||(mo={}));const $o=Object.assign(Object.assign({},vo),mo);var yo;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(yo||(yo={}));const bo=lo("loginId"),wo=oo(lo("token")),Co=oo(bo),ko=oo(lo("pendingRef")),So=oo(bo,co("email")),xo=e=>({verify:wo((t=>qr(e.post(gr.enchantedLink.verify,{token:t})))),signIn:Co(((n,i,r={},o)=>{var{providerId:s}=r,a=t(r,["providerId"]);return qr(e.post(Fr(gr.enchantedLink.signIn,$o.email),{loginId:n,URI:i,loginOptions:a,providerId:s},{token:o}))})),signUpOrIn:Co(((n,i,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(Fr(gr.enchantedLink.signUpOrIn,$o.email),{loginId:n,URI:i,loginOptions:s,providerId:o}))})),signUp:Co(((n,i,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(Fr(gr.enchantedLink.signUp,$o.email),{loginId:n,URI:i,user:r,loginOptions:a,providerId:s}))})),waitForSession:ko(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=go(n);let s;const a=setInterval((async()=>{const n=await e.post(gr.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:So(((t,n,i,r,o)=>qr(e.post(gr.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),Io=oo(lo("flowId")),Oo=oo(lo("executionId"),lo("stepId"),lo("interactionId")),Eo=oo(lo("executionId")),Ao=e=>({start:Io(((t,n,i,r,o,s,a,d=!1)=>qr(e.post(gr.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a,isCustomScreen:d})))),next:Oo(((t,n,i,r,o,s,a=!1,d)=>qr(e.post(gr.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s,isCustomScreen:a,options:d})))),event:Eo(((t,n,i)=>qr(e.post(gr.flow.event,{executionId:t,events:n},{keepalive:i,disableRetry:!0}))))}),Po=lo("loginId"),No=oo(lo("token")),jo=oo(Po),Ro=oo(Po,uo("phone")),To=oo(Po,co("email")),Mo=Object.keys($o).filter((e=>e!==vo.voice&&e!==vo.im)),Uo=e=>({verify:No((t=>qr(e.post(gr.magicLink.verify,{token:t})))),signIn:Mo.reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:jo(((n,r,o={},s)=>{var{providerId:a}=o,d=t(o,["providerId"]);return qr(e.post(Fr(gr.magicLink.signIn,i),{loginId:n,URI:r,loginOptions:d,providerId:a},{token:s}))}))})),{}),signUp:Mo.reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:jo(((n,r,o,s={})=>{var{providerId:a}=s,d=t(s,["providerId"]);return qr(e.post(Fr(gr.magicLink.signUp,i),{loginId:n,URI:r,user:o,loginOptions:d,providerId:a}))}))})),{}),signUpOrIn:Mo.reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:jo(((n,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(Fr(gr.magicLink.signUpOrIn,i),{loginId:n,URI:r,loginOptions:a,providerId:s}))}))})),{}),update:{email:To(((t,n,i,r,o)=>qr(e.post(gr.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(vo).filter((e=>e!==vo.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ro(((t,i,r,o,s)=>qr(e.post(Fr(gr.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var Lo;!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"}(Lo||(Lo={}));const _o=oo(lo("code")),Wo=e=>({start:Object.assign(((t,n,i,r,o)=>qr(e.post(gr.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),o&&{loginHint:o}),token:r}))),Object.keys(Lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r,o)=>qr(e.post(gr.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:n},t&&{redirectURL:t}),o&&{loginHint:o}),token:r}))})),{})),exchange:_o((t=>qr(e.post(gr.oauth.exchange,{code:t})))),startNative:(t,n,i)=>qr(e.post(gr.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>qr(e.post(gr.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>qr(e.get(gr.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>qr(e.post(gr.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>qr(e.post(gr.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),Do=lo("appId"),Fo=oo(Do),qo=e=>({connect:Fo(((t,n,i)=>{const r=null==n?void 0:n.tenantId,o=null==n?void 0:n.tenantLevel;return null==n||delete n.tenantId,null==n||delete n.tenantLevel,qr(e.post(gr.outbound.connect,{appId:t,tenantId:r,tenantLevel:o,options:n},{token:i}))}))}),Bo=lo("loginId"),Vo=oo(Bo,lo("code")),Ho=oo(Bo),zo=oo(Bo,uo("phone")),Go=oo(Bo,co("email")),Ko=e=>({verify:Object.keys($o).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Vo(((t,i)=>qr(e.post(Fr(gr.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys($o).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:Ho(((n,r={},o)=>{var{providerId:s}=r,a=t(r,["providerId"]);return qr(e.post(Fr(gr.otp.signIn,i),{loginId:n,loginOptions:a,providerId:s},{token:o}))}))})),{}),signUp:Object.keys($o).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:Ho(((n,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(Fr(gr.otp.signUp,i),{loginId:n,user:r,loginOptions:a,providerId:s}))}))})),{}),signUpOrIn:Object.keys($o).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:Ho(((n,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(Fr(gr.otp.signUpOrIn,i),{loginId:n,loginOptions:s,providerId:o}))}))})),{}),update:{email:Go(((t,n,i,r)=>qr(e.post(gr.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(vo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:zo(((t,i,r,o)=>qr(e.post(Fr(gr.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Jo=oo(lo("tenant")),Yo=oo(lo("code")),Zo=e=>({start:Jo(((t,n,i,r,o,s,a,d)=>qr(e.post(gr.sso.start,i||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o}),s&&{forceAuthn:"true"}),a&&{loginHint:a}),d&&{initiatedEmail:t})},r&&{token:r}))))),exchange:Yo((t=>qr(e.post(gr.sso.exchange,{code:t}))))}),Xo=lo("loginId"),Qo=oo(Xo,lo("code")),es=oo(Xo),ts=oo(Xo),ns=e=>({signUp:es(((t,n)=>qr(e.post(gr.totp.signUp,{loginId:t,user:n})))),verify:Qo(((t,n,i,r)=>qr(e.post(gr.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:ts(((t,n)=>qr(e.post(gr.totp.update,{loginId:t},{token:n}))))}),is=lo("loginId"),rs=lo("newPassword"),os=oo(is,lo("password")),ss=oo(is),as=oo(is,rs),ds=oo(is,lo("oldPassword"),rs),ls=e=>({signUp:os(((n,i,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(gr.password.signUp,{loginId:n,password:i,user:r,loginOptions:a,providerId:s}))})),signIn:os(((n,i,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(gr.password.signIn,{loginId:n,password:i,loginOptions:s,providerId:o}))})),sendReset:ss(((t,n,i)=>qr(e.post(gr.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:as(((t,n,i)=>qr(e.post(gr.password.update,{loginId:t,newPassword:n},{token:i})))),replace:ds(((t,n,i)=>qr(e.post(gr.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>qr(e.get(gr.password.policy))}),cs=so("loginId"),us=lo("loginId"),hs=so("origin"),fs=oo(us,hs,lo("name")),ps=oo(us,hs),gs=oo(cs,hs),vs=oo(us,hs,ao("token")),ms=oo(lo("transactionId"),lo("response")),$s=e=>({signUp:{start:fs(((t,n,i,r,o)=>qr(e.post(gr.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,loginOptions:o,passkeyOptions:r})))),finish:ms(((t,n)=>qr(e.post(gr.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:gs(((t,n,i,r,o)=>qr(e.post(gr.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:ms(((t,n)=>qr(e.post(gr.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:ps(((t,n,i,r)=>qr(e.post(gr.webauthn.signUpOrIn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:i}))))},update:{start:vs(((t,n,i,r,o)=>qr(e.post(gr.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r,mfa:o},{token:i})))),finish:ms(((t,n)=>qr(e.post(gr.webauthn.update.finish,{transactionId:t,response:n}))))}}),ys=so("loginId"),bs=oo(ys),ws=oo(lo("pendingRef")),Cs=e=>({signUpOrIn:bs(((n,i={})=>{var{providerId:r}=i,o=t(i,["providerId"]);return qr(e.post(gr.notp.signUpOrIn,{loginId:n,loginOptions:o,providerId:r}))})),signUp:bs(((n,i,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(gr.notp.signUp,{loginId:n,user:i,providerId:o,loginOptions:s}))})),signIn:bs(((n,i={},r)=>{var{providerId:o}=i,s=t(i,["providerId"]);return qr(e.post(gr.notp.signIn,{loginId:n,loginOptions:s,providerId:o},{token:r}))})),waitForSession:ws(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=go(n);let s;const a=setInterval((async()=>{const n=await e.post(gr.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),ks=oo(lo("token")),Ss=oo(ao("token"));var xs,Is=oo([(xs=lo("projectId"),Vr(((e,t)=>n=>zr(...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",xs))())])((e=>{const{projectId:t,logger:n,baseUrl:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a}=e;return d=Rr({baseUrl:i,projectId:t,logger:n,hooks:{get beforeRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest},get afterRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.afterRequest},get transformResponse(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:fo(d),otp:Ko(d),magicLink:Uo(d),enchantedLink:xo(d),oauth:Wo(d),outbound:qo(d),sso:Zo(d),saml:Zo(d),totp:ns(d),notp:Cs(d),webauthn:$s(d),password:ls(d),flow:Ao(d),refresh:Ss(((e,t,n,i)=>{const r={};n&&(r.externalToken=n);const o=i?gr.tryRefresh:gr.refresh;return qr(d.post(o,r,{token:e,queryParams:t}))})),selectTenant:oo([Qr("tenantId")],[io('"token" must be string or undefined')])(((e,t)=>qr(d.post(gr.selectTenant,{tenant:e},{token:t})))),logout:Ss((e=>qr(d.post(gr.logout,{},{token:e})))),logoutAll:Ss((e=>qr(d.post(gr.logoutAll,{},{token:e})))),me:Ss((e=>qr(d.get(gr.me,{token:e})))),myTenants:oo([ro('"tenants" must a string array or a boolean')],[io('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,qr(d.post(gr.myTenants,n,{token:t}))})),history:Ss((e=>qr(d.get(gr.history,{token:e})))),isJwtExpired:ks(Lr),getTenants:ks(_r),getJwtPermissions:ks(Wr),getJwtRoles:ks(Dr),getCurrentTenant:ks(Br),httpClient:d};var d})),Os=Object.assign(Is,{DeliveryMethods:$o});
|
|
6
|
-
/*! js-cookie v3.0.8 | MIT */function Es(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)"__proto__"!==i&&(e[i]=n[i])}return e}var As=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=Es({},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(a in i||(i[a]=t.read(s,a)),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",Es({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Es({},this.attributes,t))},withConverter:function(t){return e(Es({},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 Ps={default:"endpoint"},Ns="Blocked by CSP",js="The endpoint parameter is not a valid URL",Rs="Failed to load the JS script of the agent",Ts="9319";function Ms(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===Ns||s===js)n.exclude(),o=0;else if(s===Ts)n.exclude();else if(s===Rs){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 Us="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Ls=Us;function _s(n){var i;n.scriptUrlPattern;var r=n.token,o=n.apiKey,s=void 0===o?r:o,a=t(n,["scriptUrlPattern","token","apiKey"]),d=null!==(i=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(n,"scriptUrlPattern"))&&void 0!==i?i:Us,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 Ms(e,Ws)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Ts?new Error(Rs):e}(e)})).then((function(t){var n=t[0],i=t[1];return u(),n.load(e(e({},a),{ldi:{attempts:i,visibilityStates:c}}))}))}function Ws(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(js);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(Rs))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(Ns)})).then(Ds)}function Ds(){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(Ts);return n}const Fs="3.2.0",qs="undefined"!=typeof window,Bs=Math.pow(2,31)-1,Vs=`https://descopecdn.com/npm/oidc-client-ts@${Fs}/dist/browser/oidc-client-ts.min.js`,Hs=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Fs}/dist/browser/oidc-client-ts.min.js`,zs=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let Gs;const Ks=e=>{try{return pr(e).exp}catch(e){return null}},Js=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Ks(n)},Ys=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Ks(i):void 0)},Zs=e=>{const{access_token:n,id_token:i,refresh_token:r,refresh_expire_in:o}=e,s=t(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||n,idToken:i,refreshJwt:e.refreshJwt||r,sessionExpiration:e.sessionExpiration||Ys(e),cookieExpiration:e.cookieExpiration||Js(e)},s)},Xs=(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},Qs=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json()),n=(null==t?void 0:t.authInfo)||t||{};return Zs(n)},ea=()=>qs&&!!window.descopeBridge,ta=(e,t)=>{if(!((null==t?void 0:t.status)>=400&&(null==t?void 0:t.status)<500))return!1;const n=(null==e?void 0:e.path)||"";return zs.includes(n)},na=void 0!==Gs||qs&&void 0!==window.localStorage,ia=(e,t)=>{var n,i;return null===(i=null===(n=Gs||qs&&window.localStorage)||void 0===n?void 0:n.setItem)||void 0===i?void 0:i.call(n,e,t)},ra=e=>{var t,n;return null===(n=null===(t=Gs||qs&&window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e)},oa=e=>{var t,n;return null===(n=null===(t=Gs||qs&&window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n?void 0:n.call(t,e)},sa=e=>{var t,n,i,r,o;return null!==(o=null!==(n=null===(t=null==Gs?void 0:Gs.key)||void 0===t?void 0:t.call(Gs,e))&&void 0!==n?n:qs&&(null===(r=null===(i=window.localStorage)||void 0===i?void 0:i.key)||void 0===r?void 0:r.call(i,e)))&&void 0!==o?o:null},aa=e=>{var t,n;return qs&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e))||null},da=e=>{var t,n;try{qs&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n||n.call(t,e))}catch(e){}},la=(...e)=>{console.debug(...e)},ca=(...e)=>{console.warn(...e)},ua="DS",ha="DSR",fa="DSI",pa="DSRCN";function ga(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=va(i);As.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}function va(e){const t=window.location.hostname.split("."),n=null==e?void 0:e.split(".");return t.slice(-(null==n?void 0:n.length)).join(".")===e}const ma=e=>(null==e?void 0:e.cookieName)||ua,$a=e=>(null==e?void 0:e.cookieName)||ha;function ya(e="",t){return As.get($a(t))||ra(`${e}${ha}`)||""}function ba(e="",t){return As.get(ma(t))||ra(`${e}${ua}`)||""}function wa(e=""){return ra(`${e}${fa}`)||""}function Ca(e="",t,n,i){oa(`${e}${ha}`),oa(`${e}${ua}`),oa(`${e}${fa}`),oa(`${e}${pa}`);const r=ma(t);As.remove(r,null==i?void 0:i.session);const o=$a(n);As.remove(o,null==i?void 0:i.refresh)}const ka=(e,t,n)=>i=>{const r=Object.assign(i,{token:i.token||ya(e,t)});if(!n){const t=function(e=""){return ra(`${e}${pa}`)}(e);t&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":t}))}const o=function(e=""){return ra(`${e}DTD`)||""}(e);o&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":o}));const s=function(e=""){return ra(`${e}DKD`)||""}(e);return s&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-known-device-token":s})),r},Sa=qs&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",xa="vsid",Ia="vrid",Oa="fp",Ea=(e=!1)=>{const t=ra(Oa);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Aa=async(e,t=Sa)=>{try{if(Ea())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=_s({apiKey:e,endpoint:[i.toString(),Ps],scriptUrlPattern:[o,Ls]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[xa]:e,[Ia]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};ia(Oa,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Pa=e=>{const t=Ea(!0);return t&&e.body&&(e.body.fpData=t),e},Na="descopeFlowNonce",ja="X-Descope-Flow-Nonce",Ra="/v1/flow/start",Ta="/v1/flow/next",Ma=(e,t=Na)=>`${t}${e}`,Ua=(e,t=Na)=>{try{const n=Ma(e,t),i=ra(n);if(!i)return null;const r=JSON.parse(i);return r.expiry<Date.now()?(La(e,t),null):{value:r.value,seq:r.seq}}catch(e){return console.error("Error getting flow nonce:",e),null}},La=(e,t=Na)=>{try{const n=Ma(e,t);oa(n)}catch(e){console.error("Error removing flow nonce:",e)}},_a=e=>{var t;return(null===(t=/.*\|#\|(.*)/.exec(e))||void 0===t?void 0:t[1])||null},Wa=e=>{var t;return e.path===Ta&&(null===(t=e.body)||void 0===t?void 0:t.executionId)?_a(e.body.executionId):null},Da="dls_last_user_login_id",Fa="dls_last_user_display_name",qa=e=>ia(Da,e),Ba=()=>ra(Da),Va=()=>ra(Fa),Ha=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=Ba(),o=Va();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)},za="DSLI",Ga=e=>async(...t)=>{const n=await e(...t);return da(za),n};function Ka(){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 Ja(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=nd(n.publicKey.challenge),n.publicKey.user.id=nd(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=nd(e.id)})),n}(e);try{return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:id(n.rawId),type:n.type,response:{attestationObject:id(n.response.attestationObject),clientDataJSON:id(n.response.clientDataJSON)}})}catch(e){throw await Xa(e,t,!0)}var n}async function Ya(e){const t=ed(e);try{return td(await navigator.credentials.get(t))}catch(e){throw await Xa(e,t,!1)}}async function Za(e,t){const n=ed(e);n.signal=t.signal,n.mediation="conditional";try{return td(await navigator.credentials.get(n))}catch(e){throw await Xa(e,n,!1)}}async function Xa(e,t,n){if(e&&"object"==typeof e)try{e.reason=await async function(e,t,n){var i,r;const o=null==e?void 0:e.name;if("AbortError"===o&&(null==t?void 0:t.signal)instanceof AbortSignal)return"aborted";if("InvalidStateError"===o&&n)return"authenticator_already_registered";if("NotSupportedError"===o)return"no_supported_algorithm";if("ConstraintError"===o)return"authenticator_constraints_unsupported";if("SecurityError"===o){const e=window.location.hostname;return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)?"invalid_rpid":"invalid_domain"}if(!await Qa())return"webauthn_unsupported";const s="platform"===(null===(r=null===(i=null==t?void 0:t.publicKey)||void 0===i?void 0:i.authenticatorSelection)||void 0===r?void 0:r.authenticatorAttachment);return n&&s&&!await Qa(!0)?"platform_authenticator_unsupported":"NotAllowedError"===o?"not_allowed":"unknown"}(e,t,n)}catch(e){}return e}async function Qa(e=!1){var t,n;if(!qs)return Promise.resolve(!1);if(ea()){const e=null===(n=null===(t=window.descopeBridge)||void 0===t?void 0:t.hostInfo)||void 0===n?void 0:n.webauthn;if("boolean"==typeof e)return e}const i=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return i&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():i}function ed(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=nd(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=nd(e.id)})),n}function td(e){return JSON.stringify({id:e.id,rawId:id(e.rawId),type:e.type,response:{authenticatorData:id(e.response.authenticatorData),clientDataJSON:id(e.response.clientDataJSON),signature:id(e.response.signature),userHandle:e.response.userHandle?id(e.response.userHandle):void 0}})}function nd(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function id(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var rd,od=(rd=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 Ja(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 Ya(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 Ja(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await Ya(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 Ja(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:Ja,get:Ya,isSupported:Qa,conditional:Za}}),(...e)=>{const t=rd(...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 sd="/fedcm/config";async function ad(e,t){var n;try{await dd(e,t)}catch(e){null===(n=null==t?void 0:t.onFailed)||void 0===n||n.call(t,e)}}async function dd(e,t){var n,i;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)}}var ld=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Qa(),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 cd;const ud=(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",(()=>{ud(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),hd=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{cd||(cd=(async()=>{try{return require("oidc-client-ts")}catch(e){return ud([Vs,Hs],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await cd;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=(null==n?void 0:n.redirectUri)||window.location.href;let s,a,d,l;if(null==n?void 0:n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,a=n.clientId,d=`${a}_user`,l="openid"}else(null==n?void 0:n.applicationId)?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access");const c={authority:s,client_id:a,redirect_uri:o,response_type:"code",scope:(null==n?void 0:n.scope)||l,stateStore:new r({store:window.localStorage,prefix:a}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),{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)))),ia(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(t={},n=!1)=>{var r;const{client:o}=await i(),s=await o.createSigninRequest(t),{url:a}=s;return n||(await(null===(r=e.httpClient.hooks)||void 0===r?void 0:r.afterRequest({},new Response(JSON.stringify(s)))),window.location.href=a),{ok:!0,data:s}},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=ra(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||wa(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return oa(r),t||window.location.replace(s),o}}},fd=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var n;return n=t.customStorage,Gs=n,e(t)}),(e=>n=>{var{fpKey:i,fpLoad:r}=n,o=t(n,["fpKey","fpLoad"]);return qs?(i&&r&&Aa(i).catch((()=>null)),e(Xs(o,{beforeRequest:Pa}))):e(o)}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.53.1"},t.baseHeaders)}))),(e=>t=>{const n=Ka(),i=Ka(),r=Ka(),o=Ka(),s=e(Xs(t,{afterRequest:async(e,t)=>{if(ta(e,t))la("Session invalidated, notifying subscribers with empty values"),i.pub(null),r.pub(null),n.pub(null),o.pub(null);else{const e=await(async e=>{const t=await Qs(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)})(t);e&&r.pub(e);const{sessionJwt:s,sessionExpiration:a,claims:d}=await Qs(t);s&&i.pub(s),d&&o.pub(d),(a||s)&&n.pub(a||42)}}})),a=po(s,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const s=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o.pub(null),s}));return Object.assign(a,{onSessionTokenChange:i.sub,onUserChange:r.sub,onClaimsChange:o.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>n=>{var i;const{enableFlowNonce:r=!0,nonceStoragePrefix:o=Na}=n,s=t(n,["enableFlowNonce","nonceStoragePrefix"]);if(!r)return e(s);((e=Na)=>{try{if(!na)return;for(let r=0;r<(void 0,n=void 0,void 0,null!==(i=null!==(t=null==Gs?void 0:Gs.length)&&void 0!==t?t:qs&&(null===(n=window.localStorage)||void 0===n?void 0:n.length))&&void 0!==i?i:0);r++){const t=sa(r);if(t&&t.startsWith(e)){const n=ra(t);if(n)try{JSON.parse(n).expiry<Date.now()&&oa(t)}catch(e){oa(t)}}}}catch(e){console.error("Error cleaning up expired nonces:",e)}var t,n,i})(o);const a=e(Xs(s,{afterRequest:async(e,t)=>{var n;if(e.path!==Ra&&e.path!==Ta)return;const{nonce:i,seq:r,executionId:s}=await(async(e,t)=>{try{const n=t.headers.get(ja),i=null===n?void 0:(e=>{const t=e.indexOf(".");if(t<=0)return;const n=e.slice(0,t);if(!/^\d+$/.test(n))return;const i=Number(n);return Number.isSafeInteger(i)?i:void 0})(n);let r=await t.clone().json().then((e=>(null==e?void 0:e.executionId)||null)).catch((()=>null));return r||(r=Wa(e)),{nonce:n,seq:i,executionId:_a(r)}}catch(e){return{nonce:null,seq:void 0,executionId:null}}})(e,t);if(!i||!s)return;const a=e.path===Ra,d=null===(n=Ua(s,o))||void 0===n?void 0:n.seq;!a&&void 0!==r&&void 0!==d&&r<=d||((e,t,n,i=Na,r)=>{try{const o=Ma(e,i),s=n?172800:10800,a={value:t,expiry:Date.now()+1e3*s,isStart:n,seq:r};ia(o,JSON.stringify(a))}catch(e){console.error("Error setting flow nonce:",e)}})(s,i,a,o,null!=r?r:a?void 0:d)},beforeRequest:e=>{if(e.path===Ta){const t=Wa(e);if(t){const n=((e,t=Na)=>{var n,i;return null!==(i=null===(n=Ua(e,t))||void 0===n?void 0:n.value)&&void 0!==i?i:null})(t,o);n&&(e.headers=e.headers||{},e.headers[ja]=n)}}return e}}));if(null===(i=a.flow)||void 0===i?void 0:i.next){let e=Promise.resolve();const t=a.flow.next.bind(a.flow);a.flow.next=async(...n)=>{const i=e;let r;e=new Promise((e=>{r=e})),await i;try{return await t(...n)}finally{r()}}}return a}),(e=>t=>{const n=e(Xs(t,{afterRequest:async(e,t)=>{if(ta(e,t))return void da(za);const n=await Qs(t);(null==n?void 0:n.sessionExpiration)&&((e,t)=>{var n,i;try{qs&&(null===(i=null===(n=window.localStorage)||void 0===n?void 0:n.setItem)||void 0===i||i.call(n,e,t))}catch(e){}})(za,String(n.sessionExpiration))}}));return po(n,["logout","logoutAll","oidc.logout"],Ga)}),(e=>n=>{var{autoRefresh:i}=n,r=t(n,["autoRefresh"]);const o=!!i,s="object"==typeof i&&(null==i?void 0:i.customActivityTracking);if(!o||ea())return Object.assign(e(r),{markUserActive:()=>{ca("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:d}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let l,c,u=null,h=!1,f=!1;s&&(la("Activity-based refresh enabled"),u=(()=>{let e=!0;return{hadActivity:()=>e,reset:()=>{e=!1},markActive:()=>{e=!0}}})()),qs&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&l&&new Date>l&&(la("Expiration time passed, refreshing session"),p.refresh(ya()||c))}));const p=e(Xs(r,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:r,nextRefreshSeconds:o}=await Qs(t);if(ta(e,t))la("Session invalidated, canceling all timers"),a();else if(n||r){if(l=((e,t)=>{if(t)return new Date(1e3*t);la("Could not extract expiration time from session token, trying to decode the token");try{const t=pr(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,r),!l)return void la("Could not extract expiration time from session token");c=i,h=o>0;const e=((e,t)=>{let n;var i;return t>0?(n=1e3*t,la(`Using provided nextRefreshSeconds: ${t}s`)):n=((i=e)?i.getTime()-(new Date).getTime():0)-2e4,n>Bs&&(la(`Timeout is too large (${n}ms), setting it to ${Bs}ms`),n=Bs),n})(l,o);if(a(),e<=2e4)return void la("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});la(`Setting refresh timer for ${t}. (${e}ms)`),u&&(u.reset(),f=!1),d((()=>{if(qs&&"hidden"===document.visibilityState)la("Skipping refresh due to timer - document is hidden");else{if(u&&h&&!u.hadActivity())return la("Skipping refresh due to timer - user is idle"),void(f=!0);la("Refreshing session due to timer"),p.refresh(ya()||i)}}),e)}}}));return Object.assign(po(p,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return la("Clearing all timers"),a(),n})),{markUserActive:u?()=>{la("markUserActive() called"),h||la("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),f&&(la("User became active after skipped refresh, triggering refresh"),f=!1,a(),p.refresh(ya()||c))}:()=>{ca("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})}),(e=>n=>{var{storeLastAuthenticatedUser:i=!0,keepLastAuthenticatedUserAfterLogout:r=!1}=n,o=t(n,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!i)return Object.assign(e(o),{getLastUserLoginId:Ba,getLastUserDisplayName:Va});const s=e(Xs(o,{afterRequest:async(e,t)=>{var n;const{userInfo:i,lastAuth:r}=await(async e=>{if(!(null==e?void 0:e.ok))return{userInfo:void 0,lastAuth:void 0};const t=await(null==e?void 0:e.clone().json()),n=Zs((null==t?void 0:t.authInfo)||t||{});return{userInfo:(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0),lastAuth:t.lastAuth}})(t),o=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],s=null==i?void 0:i.name;o?(qa(o),(e=>{ia(Fa,e)})(s)):(null==r?void 0:r.loginId)&&qa(r.loginId)}}));let a=po(s,["flow.start"],Ha);return a=po(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(oa(Da),oa(Fa)),i})(r)),Object.assign(a,{getLastUserLoginId:Ba,getLastUserDisplayName:Va})}),(e=>n=>{var{persistTokens:i,sessionTokenViaCookie:r,refreshTokenViaCookie:o,storagePrefix:s,refreshCookieName:a}=n,d=t(n,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!i||!qs)return e(Object.assign({refreshCookieName:a},d));let l;const c=e(Xs(Object.assign({refreshCookieName:a},d),{beforeRequest:ka(s,o,a),afterRequest:async(e,t)=>{if(ta(e,t))la("Session invalidated, clearing persisted tokens"),Ca(s,r,o,l);else{const e=await Qs(t);e.cookieName?ia(`${s||""}${pa}`,e.cookieName):e.refreshJwt&&oa(`${s||""}${pa}`);const n=((e={},t=!1,n="",i=!1)=>{var r,o,s,a;const{sessionJwt:d,refreshJwt:l,trustedDeviceJwt:c,knownDeviceJwt:u}=e;let h;if(l)if(i){oa(`${n}${ha}`);const t=i.sameSite||"Strict",s=null===(r=i.secure)||void 0===r||r,a=null!==(o=i.domain)&&void 0!==o?o:e.cookieDomain,d=$a(i);s&&"https:"!==window.location.protocol&&ca("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const c=Object.assign(Object.assign({},e),{cookieSameSite:t,cookieSecure:s,cookieDomain:a});ga(d,l,c);const u=va(a);h=Object.assign(Object.assign({},h),{refresh:{path:c.cookiePath,domain:u?a:void 0}})}else{const e=$a(i);As.remove(e),ia(`${n}${ha}`,l)}if(d)if(t){const n=t.sameSite||"Strict",i=null===(s=t.secure)||void 0===s||s,r=null!==(a=t.domain)&&void 0!==a?a:e.cookieDomain,o=ma(t);i&&"https:"!==window.location.protocol&&ca("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const l=Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:i,cookieDomain:r});ga(o,d,l);const c=va(r);h=Object.assign(Object.assign({},h),{session:{path:l.cookiePath,domain:c?r:void 0}})}else ia(`${n}${ua}`,d);return e.idToken&&ia(`${n}${fa}`,e.idToken),c&&ia(`${n}DTD`,c),u&&ia(`${n}DKD`,u),h})(e,r,s,o);n&&(l=n)}}})),u=po(c,["logout","logoutAll","oidc.logout"],((e,t,n,i)=>r=>async(...o)=>{const s=await r(...o);return Ca(e,t,n,null==i?void 0:i()),s})(s,r,o,(()=>l)));return Object.assign(u,{getRefreshToken:()=>ya(s,o),getSessionToken:()=>ba(s,r),getIdToken:()=>wa(s)})}))((e=>{const t=Os(e),n=hd(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,r)=>{var o;if(ea())return la(`Refresh called in native flow: ${(new Error).stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}if(r&&qs&&void 0!==window.localStorage&&!aa(za)&&!ra(Da)&&!aa("DSLI_DISABLED"))return Promise.resolve({ok:!0});const s=ba(),a=ya();let d="";if(e.getExternalToken)try{d=await(null===(o=e.getExternalToken)||void 0===o?void 0:o.call(e))}catch(e){la("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:s?"t":"f",dcr:a?"t":"f"},d,r)},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:ld(t),webauthn:od(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){ad(i,e)},requestAuthentication(e){ad(i,e)}},async oneTap(e,t,n,r,o){await dd(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+sd),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>qs&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+sd);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})),pd={search:"/v1/mgmt/user/search",deleteBatch:"/v1/mgmt/user/delete/batch",create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/patch",status:"/v1/mgmt/user/update/status",setTempPassword:"/v1/mgmt/user/password/set/temporary",removePasskey:"/v1/mgmt/user/passkeys/delete",customAttributes:"/v1/mgmt/user/customattributes"},gd={roles:"/v1/mgmt/role/all",subTenantRoles:"/v1/mgmt/role/subtenant/all"},vd=e=>n(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)})),md=e=>n(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}`,recoveryEmail:`recovery${e}@company.com`,recoveryPhone:`+1-202-555-020${e}`,verifiedEmail:!0,verifiedPhone:!0,verifiedRecoveryEmail:!0,verifiedRecoveryPhone:!0,userTenants:[{tenantId:"sub-tenant-1",tenantName:"Hurray",roleNames:["Role 1","Role 2"]}],status:"enabled",editable:!0,createdTime:r,createdTimeFormatted:new Date(1e3*(r||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:e%3==0,OIDC:e%3==1,SCIM:e%3==2,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>((e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof t){const i=e?1:0,r=t?1:0;return n?i-r:r-i}const i=(null==e?void 0:e.toString())||"",r=(null==t?void 0:t.toString())||"";return n?r.localeCompare(i):i.localeCompare(r)})(t[e.field],n[e.field],e.desc)))})),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()))))}))})),$d=e=>n(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,userTenants:h}){return new Promise((f=>{const p=Math.random().toString(10).substring(15);f({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),yd=e=>n(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,userTenants:h}){return new Promise((f=>{f({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:i,roleNames:r,customAttributes:o||{},picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),bd=()=>n(void 0,void 0,void 0,(function*(){})),wd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),Cd=()=>n(void 0,void 0,void 0,(function*(){})),kd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),Sd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),xd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),Id=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})})),Od=()=>new Promise((e=>{e({roles:[{tenantId:"sub-tenant-1",tenantName:"Sub Tenant 1",roleNames:["Role 1","Role 2"]},{tenantId:"sub-tenant-2",tenantName:"Sub Tenant 2",roleNames:["Role 1","Role 3"]},{tenantId:"sub-tenant-3",tenantName:"Sub Tenant 3",roleNames:["Role 2"]}]})})),Ed=({httpClient:e,tenant:i,mock:r})=>({search:(...o)=>n(void 0,[...o],void 0,(function*(n={}){const{limit:o=1e4}=n,s=t(n,["limit"]);if(r)return md(Object.assign(Object.assign({},s),{limit:o}));const a=yield e.post(pd.search,Object.assign(Object.assign({},s),{limit:o,withTestUser:!1}),{queryParams:{tenant:i}});yield vd(a);return(yield a.json()).users})),deleteBatch:t=>n(void 0,void 0,void 0,(function*(){if(r)return bd();const n=yield e.post(pd.deleteBatch,{userIds:t},{queryParams:{tenant:i}});return yield vd(n),n.json()})),create:t=>n(void 0,[t],void 0,(function*({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C}){if(r)return $d({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C});const k=yield e.post(pd.create,{loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:C,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w},{queryParams:{tenant:i}});yield vd(k);return(yield k.json()).user})),update:t=>n(void 0,[t],void 0,(function*({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$}){if(r)return yd({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$});const y=yield e.patch(pd.update,{loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:$,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m},{queryParams:{tenant:i}});yield vd(y);return(yield y.json()).user})),enable:t=>n(void 0,void 0,void 0,(function*(){if(r)return kd(t);const n=yield e.post(pd.status,{loginId:t,status:"enabled"},{queryParams:{tenant:i}});return yield vd(n),n.json()})),disable:t=>n(void 0,void 0,void 0,(function*(){if(r)return Sd(t);const n=yield e.post(pd.status,{loginId:t,status:"disabled"},{queryParams:{tenant:i}});return yield vd(n),n.json()})),removePasskey:t=>n(void 0,void 0,void 0,(function*(){if(r)return Cd();const n=yield e.post(pd.removePasskey,{loginId:t},{queryParams:{tenant:i}});return yield vd(n),n.json()})),setTempPassword:t=>n(void 0,void 0,void 0,(function*(){if(r)return wd();const n=yield e.post(pd.setTempPassword,{loginId:t},{queryParams:{tenant:i}});return yield vd(n),n.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(r)return xd();const t=yield e.get(pd.customAttributes,{queryParams:{tenant:i}});yield vd(t);return(yield t.json()).data}))}),Ad=({httpClient:e,tenant:t,mock:i})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(i)return Id(t);const n=yield e.get(gd.roles,{queryParams:{tenant:t}});return yield vd(n),n.json()})),getSubTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(i)return Od();const n=yield e.get(gd.subTenantRoles,{queryParams:{tenant:t}});return yield vd(n),n.json()}))}),Pd=h((e=>{var t,s,a,d;const l=o(N,Un,A,C,j,Dn,P({tenant:P.missingAttrValidator}))(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||Ie}get api(){return i(this,s,"f")||i(this,t,"m",a).call(this),i(this,s,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{i(this,s,"f")&&i(this,t,"m",a).call(this)}))}))}},s=new WeakMap,t=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),r(this,s,((e,t,n,i)=>{const r=fd(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.20.1"}}));return{user:Ed({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Ad({httpClient:r.httpClient,tenant:t,mock:n}),httpClient:r.httpClient}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},d})),Nd=h((e=>{const t=o(Tn({name:"widget",initialState:ur,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Mi.reducer(e),nr.reducer(e),or.reducer(e),dr.reducer(e),_i.reducer(e),Gi.reducer(e),Fi.reducer(e),cr.reducer(e),Vi.reducer(e),Yi.reducer(e),Qi.reducer(e)},asyncActions:{searchUsers:Gi.action,createUser:Mi.action,updateUser:nr.action,enableUser:or.action,disableUser:dr.action,deleteUsers:_i.action,removePasskey:cr.action,getCustomAttributes:Vi.action,getTenantRoles:Yi.action,getSubTenantRoles:Qi.action,setTempUserPassword:Fi.action}}),E,C,Pd)(e);return class extends t{constructor(...e){super(...e),this.state=ur,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),jd=h((e=>{var t,r,a;return a=class extends(o(C,E,z,X,Wn("user-management-widget"),Nd,Ln)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return n(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.injectStyle(".hidden { display: none; }");const o=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([i(this,t,"m",r).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes(),o]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){const e=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},a})),Rd=h((e=>{var t,a,d,l,c,u,h,f,p;return p=class extends(o(Nd,Ce,Mn,C,Ln,jd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,(()=>n(this,void 0,void 0,(function*(){yield i(this,a,"f").setData(ni(this.state).map((({name:e,description:t})=>({value:e,label:e,description:t}))))})))),f.set(this,(()=>{var e;const t=ai(this.state);null===(e=i(this,d,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&i(this,l,"f").setData(si(this.state))}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",c).call(this)}))}},a=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,t=new WeakSet,c=function(){return n(this,void 0,void 0,(function*(){var e;this.createUserModal=this.createModal(),this.createUserModal.setContent(s(yield this.fetchWidgetPage("create-user-modal.html")));const o=new oe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}),c=()=>{this.resetFormData(this.createUserModal.ele),i(this,l,"f").value=[]};o.onClick((()=>{this.createUserModal.close(),c()}));const p=new oe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});p.onClick((()=>n(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele),t=i(this,l,"f").mergedValue;this.actions.createUser(Object.assign(Object.assign({},Zn(e,"customAttributes")),{userTenants:t,invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),c()}})))),r(this,a,new $e((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),r(this,d,null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-section"]'),"f"),r(this,l,new ve((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),i(this,h,"f").call(this),this.createUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield i(this,h,"f").call(this),i(this,f,"f").call(this),i(this,t,"m",u).call(this)}))}))},u=function(){const e=oi(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)}))},p})),Td=h((e=>{var t,r,s;return s=class extends(o(C,Rd,jd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",r).call(this)}))}},t=new WeakSet,r=function(){var e;this.createButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},s})),Md=h((e=>{var t,r,a;return a=class extends(o(Nd,Ce,C,jd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",r).call(this)}))}},t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(s(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new oe((()=>{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 oe((()=>{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=fi(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new be(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=ki(this.state);i.text=`Delete ${e}?`}}))},a})),Ud=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd,Md)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Ai)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.deleteButton=new oe(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()}))},a})),Ld=h((e=>{var t,r,a,d,l;return l=class extends(o(Nd,Ce,C,Mn,jd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{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=bi(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(s(yield this.fetchWidgetPage("disable-user-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`Disable ${e}?`}))}))},l})),_d=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd,Ld,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),xi)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.disableButton=new oe(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()}))},a}));var Wd={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 Dd(e){return Dd="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},Dd(e)}function Fd(e){var t=Hd();return function(){var n,i=Gd(e);if(t){var r=Gd(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Dd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qd(e)}(this,n)}}function qd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bd(e){var t="function"==typeof Map?new Map:void 0;return Bd=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 Vd(e,arguments,Gd(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),zd(i,e)},Bd(e)}function Vd(e,t,n){return Vd=Hd()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&zd(r,n.prototype),r},Vd.apply(null,arguments)}function Hd(){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 zd(e,t){return zd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},zd(e,t)}function Gd(e){return Gd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gd(e)}var Kd=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&&zd(e,t)}(i,e);var t,n=Fd(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(qd(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(Bd(Error)),Jd=2,Yd=17,Zd=3,Xd="0-90-9٠-٩۰-۹",Qd="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),el="++";function tl(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 nl={}.constructor;function il(e){return null!=e&&e.constructor===nl}function rl(e){return rl="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},rl(e)}function ol(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sl(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 al=" ext. ",dl=/^\d+$/,ll=function(){function e(t){ol(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!il(e)||!il(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(il(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+gl(e)+": "+e,"."))}(t),this.metadata=t,$l.call(this,t)}return sl(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&&dl.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new cl(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new cl(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}(),cl=function(){function e(t,n){ol(this,e),this.globalMetadataObject=n,this.metadata=t,$l.call(this,n.metadata)}return sl(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 ul(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()&&pl(this.types(),e))return new fl(pl(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?al:this.metadata[13]||al}}]),e}(),ul=function(){function e(t,n){ol(this,e),this._format=t,this.metadata=n}return sl(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()||hl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),hl=/^\(?\$1\)?$/,fl=function(){function e(t,n){ol(this,e),this.type=t,this.metadata=n}return sl(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 pl(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 gl=function(e){return rl(e)};function vl(e,t){if((t=new ll(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function ml(e,t){return t.countries.hasOwnProperty(e)}function $l(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===tl(t,"1.2.0")?this.v2=!0:-1===tl(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var yl=function(e){return"([".concat(Xd,"]{1,").concat(e,"})")};function bl(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+yl("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+yl("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+yl("9")+i)+"|"+("[- ]+"+yl("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+yl("15")+i)+"|"+(r+"(?:,)+"+n+yl("9")+i)}var wl="["+Xd+"]{"+Jd+"}",Cl="[++]{0,1}(?:["+Qd+"]*["+Xd+"]){3,}["+Qd+Xd+"]*",kl=new RegExp("^[++]{0,1}(?:["+Qd+"]*["+Xd+"]){1,2}$","i"),Sl=Cl+"(?:"+bl()+")?",xl=new RegExp("^"+wl+"$|^"+Sl+"$","i");var Il=new RegExp("(?:"+bl()+")$","i");function Ol(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 El(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 El(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 El(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 Al={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 Al[e]}function Nl(e){for(var t,n="",i=Ol(e.split(""));!(t=i()).done;){var r=Pl(t.value);r&&(n+=r)}return n}function jl(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 Rl(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 Rl(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 Rl(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 Tl(e){for(var t,n="",i=jl(e.split(""));!(t=i()).done;){n+=Ml(t.value,n)||""}return n}function Ml(e,t,n){if("+"===e){if(t)return;return"+"}return Pl(e)}function Ul(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 Ll(e,t){return"IS_POSSIBLE"===Ul(e,t)}function _l(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Wl(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 Dl(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 Dl(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 Dl(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 Fl=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ql(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new ll(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(_l(i,n.nationalNumberPattern())){if(Bl(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Bl(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=Wl(Fl);!(r=o()).done;){var s=r.value;if(Bl(i,s,n))return s}}}}function Bl(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&_l(e,t.pattern()))}function Vl(e,t,n){var i=new ll(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new ll(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function Hl(e){return e.replace(new RegExp("[".concat(Qd,"]+"),"g")," ").trim()}var zl=/(\$\d)/;function Gl(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(zl,t.nationalPrefixFormattingRule()):t.format());return i?Hl(o):o}var Kl=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Jl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Yl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yl(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Zl(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 Xl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zl(Object(n),!0).forEach((function(t){Ql(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ec={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function tc(e,t,n,i){if(n=n?Xl(Xl({},ec),n):ec,i=new ll(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?rc(r=nc(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=nc(s,null,"INTERNATIONAL",i,n),rc(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=vl(i,r.metadata);if(o===n){var s=nc(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new ll(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():Kl.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(nc(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return rc(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function nc(e,t,n,i,r){var o=ic(i.formats(),e);return o?Gl(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function ic(e,t){for(var n,i=Jl(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(_l(t,r.pattern()))return r}}function rc(e,t,n,i){return t?i(e,t,n):e}function oc(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 sc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oc(Object(n),!0).forEach((function(t){ac(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ac(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dc(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 lc=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 ll(t);cc(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 dc(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Vl(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new ll(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 Ll(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 ll(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==ql(e,t,n.metadata):_l(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new ll(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return ql(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return tc(this,e,t?sc(sc({},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}(),cc=function(e){return/^[A-Z]{2}$/.test(e)};var uc=new RegExp("(["+Xd+"])");function hc(e,t,n,i){if(t){var r=new ll(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(uc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function fc(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 pc(e,t){var n=fc(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(_l(e,n.nationalNumberPattern())&&!_l(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Ul(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function gc(e,t,n,i){var r=t?vl(t,i):n;if(0===e.indexOf(r)){(i=new ll(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=pc(o,i).nationalNumber,a=pc(e,i).nationalNumber;if(!_l(a,i.nationalNumberPattern())&&_l(s,i.nationalNumberPattern())||"TOO_LONG"===Ul(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function vc(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=hc(e,t,n,i);if(!o||o===e){if(t||n){var s=gc(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 ll(i);for(var l=2;l-1<=Zd&&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 mc(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 $c(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 $c(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 $c(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 yc(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new ll(i);for(var r,o=mc(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(ql({phone:e,country:s},void 0,i.metadata))return s}}function bc(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:yc(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var wc="+",Cc="(["+Xd+"]|[\\-\\.\\(\\)]?)",kc=new RegExp("^\\"+wc+Cc+"*["+Xd+"]"+Cc+"*$","g"),Sc=new RegExp("^("+("["+Xd+"]+((\\-)*["+Xd+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Xd+"])*")+"\\.?$","g"),xc="tel:",Ic=";phone-context=",Oc=";isub=";function Ec(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Ic);if(t<0)return null;var n=t+Ic.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&&(kc.test(e)||Sc.test(e))}(r))throw new Kd("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===wc&&(n+=r);var o,s=e.indexOf(xc);o=s>=0?s+xc.length:0;var a=e.indexOf(Ic);n+=e.substring(o,a)}var d=n.indexOf(Oc);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Ac=250,Pc=new RegExp("[++"+Xd+"]"),Nc=new RegExp("[^"+Xd+"#]+$");function jc(e,t,n){if(t=t||{},n=new ll(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Kd("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=Ec(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>Ac){if(n)throw new Kd("TOO_LONG");return}if(!1===t)return e;var i=e.search(Pc);if(i<0)return;return e.slice(i).replace(Nc,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=Jd&&xl.test(e)}(i))return function(e){return kl.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Il);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(Il),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 Kd("TOO_SHORT");throw new Kd("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=vc(Tl(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||vl(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=pc(Tl(d),i),c=l.nationalNumber,u=l.carrierCode,h=bc(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 Kd("INVALID_COUNTRY");return{}}if(!l||l.length<Jd){if(t.v2)throw new Kd("TOO_SHORT");return{}}if(l.length>Yd){if(t.v2)throw new Kd("TOO_LONG");return{}}if(t.v2){var f=new lc(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)&&_l(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!Ll(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 Rc(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?Rc(Object(n),!0).forEach((function(t){Mc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mc(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){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,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _c(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 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)||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 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 Dc(e){var t,n,i,r=_c(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(!il(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?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}({defaultCountry:s},n));return{text:t,options:n,metadata:i}}function Fc(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 qc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fc(Object(n),!0).forEach((function(t){Bc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Bc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vc(e,t,n){t&&t.defaultCountry&&!ml(t.defaultCountry,n)&&(t=qc(qc({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return jc(e,Tc(Tc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Kd))throw e}}function Hc(){var e=Dc(arguments);return Vc(e.text,e.options,e.metadata)}function zc(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 Gc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Kc=zc((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;Gc(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),Jc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Gc(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return zc(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Kc(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Kc(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 Yc(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 Zc=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 Jc(t)}return Yc(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 Xc(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function Qc(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var eu=" - \u2028\u2029 ",tu="[".concat(eu,"]"),nu="[^".concat(eu,"]"),iu="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),ru="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",ou="[".concat(ru,"]"),su=new RegExp(ou),au="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),du=new RegExp(au),lu="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),cu=new RegExp(lu),uu=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function hu(e){return!(!su.test(e)&&!cu.test(e))&&uu.test(e)}function fu(e){return"%"===e||du.test(e)}function pu(e,t,n){var i=!0,r=Hc(e,n);if(r||(i=!1,r=Hc(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 gu={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()||!vu(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!vu(e,n,r)||$u(e,n)||!mu(e,{defaultCountry:i,metadata:r}))&&yu()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!vu(e,n,r)||$u(e,n)||!mu(e,{defaultCountry:i,metadata:r}))&&yu()}};function vu(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"!==pu(t.substring(i),e,n))return!1}else{var s=Nl(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function mu(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new ll(i);r.selectNumberingPlan(e.countryCallingCode),e.country||bc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=ic(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function $u(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)||Nl(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function yu(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var bu=/[\\/] *x/;function wu(e){return Qc(bu,e)}var Cu=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,ku=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Su=/^:[0-5]\d/;function xu(e,t,n){if(Cu.test(e))return!1;if(ku.test(e)){var i=n.slice(t+e.length);if(Su.test(i))return!1}return!0}var Iu="(\\[([",Ou=")\\])]",Eu="[^".concat(Iu).concat(Ou,"]"),Au="[".concat(Iu).concat(el,"]"),Pu=new RegExp("^"+Au),Nu=Xc(0,3),ju=new RegExp("^(?:[(\\[([])?(?:"+Eu+"+["+Ou+"])?"+Eu+"+(?:["+Iu+"]"+Eu+"+["+Ou+"])"+Nu+Eu+"*$"),Ru=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function Tu(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 Mu(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 Mu(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 Mu(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 Uu(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 Lu=bl(),_u=["\\/+(.*)/","(\\([^(]*)","(?:".concat(tu,"-|-").concat(tu,")").concat(tu,"*(.+)"),"[‒-―-]".concat(tu,"*(.+)"),"\\.+".concat(tu,"*([^.]+)"),"".concat(tu,"+(").concat(nu,"+)")],Wu=Xc(0,2),Du=Xc(0,4),Fu=Yd+Zd,qu=Xc(0,Fu),Bu="[".concat(Qd,"]")+Du,Vu=iu+Xc(1,Fu),Hu="(?:"+Au+Bu+")"+Wu+Vu+"(?:"+Bu+Vu+")"+qu+"(?:"+Lu+")?",zu=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(ru,"#]+$")),Gu=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Ku=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&&ml(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Gu}).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=gu[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(Hu,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new Zc(32)}return Uu(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(xu(t=wu(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=Tu(_u);!(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=Qc(zu,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=Qc(zu,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(ju.test(e)&&!Ru.test(e)){if("POSSIBLE"!==i){if(t>0&&!Pu.test(e)){var r=n[t-1];if(fu(r)||hu(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(fu(s)||hu(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=Hc(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 Ju(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 Yu=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 Ju(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 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 Xu(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 Xu(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 Xu(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="x",eh=new RegExp(Qu);function th(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function nh(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 ih(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=rh(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return rh(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function rh(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Gl(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 Nl(e)===t.getNationalDigits()}(s,e))return s}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 sh=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return oh(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([ch(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(lh);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(ch(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(ch(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:ah(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(dh.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function ah(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 dh=/[\(\)\[\]\?\:\|]/,lh=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function ch(e){return 1===e.length?e[0]:e}function uh(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 hh(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 hh(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 hh(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,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 ph=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 sh).parse(t)}return fh(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=gh(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function gh(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=gh(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=uh(t.args);!(d=l()).done;){var c=gh(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=uh(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 vh(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 mh(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 mh(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 mh(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 $h(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 yh=th("9",15),bh=/[- ]/,wh=new RegExp("["+Qd+"]*\\$1["+Qd+"]*(\\$\\d["+Qd+"]*)*$"),Ch=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 $h(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"===Ul(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=vh(this.matchingFormats);!(i=r()).done;){var o=i.value,s=ih(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,Qu),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(Qu),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 ph(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":wh.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=vh(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()&&bh.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(Qu,t+1),n++;return nh(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,Qu)+th(Qu,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=yh.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(zl,e.nationalPrefixFormattingRule());if(Nl(e.nationalPrefixFormattingRule())===(r||"")+Nl("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,Qu),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),Qu);return c||(o?p=th(Qu,o.length)+" "+p:r&&(p=th(Qu,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=Hl(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=Zu(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(eh)<0)return;t=e.search(eh),e=e.replace(eh,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],nh(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 kh(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 Sh(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 Sh(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 Sh(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 xh(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 Ih=new RegExp("^"+("["+Qd+Xd+"]+")+"$","i"),Oh="(?:[++]["+Qd+Xd+"]*|["+Qd+Xd+"]+)",Eh=new RegExp("[^"+Qd+Xd+"]+.*$"),Ah=/[^\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 xh(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(Oh);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(Eh,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=kh(t,2),i=n[0],r=n[1];Ih.test(i)||(i="");return[i,r]}(e),r=kh(i,2),o=r[0],s=r[1],a=Nl(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=vc("+"+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&&Ah.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=fc(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=fc(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=hc(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=gc(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 Nh(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 jh(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 jh(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 jh(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 Rh(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 Th=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 ll(n);var i=Nh(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return Rh(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(il(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 Yu({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 Ch({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,Qu)}},{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(bc(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 ll(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=yc(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new lc(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 Mh(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Wd),e.apply(this,n)}(Hc,arguments)}function Uh(e,t){return Ku.call(this,e,t,Wd)}function Lh(e){return Th.call(this,e,Wd)}function _h(){return ll.call(this,Wd)}Uh.prototype=Object.create(Ku.prototype,{}),Uh.prototype.constructor=Uh,Lh.prototype=Object.create(Th.prototype,{}),Lh.prototype.constructor=Lh,_h.prototype=Object.create(ll.prototype,{}),_h.prototype.constructor=_h;const Wh=e=>{if(!e)return e;const t=Mh(e.startsWith("+")?e:`+${e}`);if(!t)return e;const n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return(null==t?void 0:t.number.replace(n,"$1-$2"))||e},Dh=h((e=>{var a,d,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(Nd,Ce,C,Mn,Ln,jd)(e)){constructor(){super(...arguments),a.add(this),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),u.set(this,void 0),p.set(this,(()=>n(this,void 0,void 0,(function*(){yield i(this,l,"f").setData(ni(this.state).map((({name:e,description:t})=>({value:e,label:e,description:t}))))})))),g.set(this,(()=>{var e;const t=ai(this.state);null===(e=i(this,c,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&i(this,u,"f").setData(si(this.state))})),m.set(this,(()=>{var e,t;const n=null===(e=hi(this.state))||void 0===e?void 0:e[0],r=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:Wh(null==n?void 0:n.phone),recoveryEmail:null==n?void 0:n.recoveryEmail,recoveryPhone:Wh(null==n?void 0:n.recoveryPhone),roles:null==n?void 0:n.roleNames,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},Xn(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,r),i(this,u,"f").value=(null==n?void 0:n.userTenants)||[]}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),yield i(this,a,"m",$).call(this)}))}},d=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,a=new WeakSet,h=function(){new oe((()=>{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()))},f=function(){new oe((()=>{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:n}=e,r=t(e,["loginId"]),o=i(this,c,"f")&&!i(this,c,"f").classList.contains("hidden")?i(this,u,"f").mergedValue:void 0;this.actions.updateUser(Object.assign(Object.assign({loginId:n.split(", ")[0]},Zn(r,"customAttributes")),void 0!==o&&{userTenants:o})),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},v=function(){const e=oi(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)}))},$=function(){return n(this,void 0,void 0,(function*(){var e,t;this.editUserModal=this.createModal(),this.editUserModal.setContent(s(yield this.fetchWidgetPage("edit-user-modal.html"))),i(this,a,"m",h).call(this),i(this,a,"m",f).call(this),r(this,d,new we(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),r(this,l,new $e((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),r(this,c,null===(t=this.editUserModal.ele)||void 0===t?void 0:t.querySelector('[data-id="sub-tenant-section"]'),"f"),r(this,u,new ve((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield i(this,p,"f").call(this),i(this,d,"f").disable(),i(this,g,"f").call(this),i(this,m,"f").call(this),i(this,a,"m",v).call(this)}))}))},y})),Fh=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd,Dh,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Ii)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.editButton=new oe(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()}))},a})),qh=h((e=>{var t,r,a,d,l;return l=class extends(o(Nd,Ce,C,Mn,jd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{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=bi(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(s(yield this.fetchWidgetPage("enable-user-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`Activate ${e}?`}))}))},l})),Bh=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd,qh,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Si)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.enableButton=new oe(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()}))},a})),Vh=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd)(e)){constructor(){super(...arguments),t.add(this),r.set(this,c((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",s).call(this)}))}},r=new WeakMap,t=new WeakSet,s=function(){var e;this.searchInput=new we(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(i(this,r,"f"))},a})),Hh=new Set(["contains","not-contains","starts-with","ends-with","not-equal"]),zh=e=>{const t=Array.isArray(e)?e[0]:e;return null==t||""===t?null:String(t)},Gh=e=>Array.isArray(e)?e:null==e||""===e?[]:[String(e)],Kh=(e,t)=>({[e]:t}),Jh=(e,t)=>({customAttributes:{[e]:t}}),Yh=(e,t)=>{var n,i;const r=zh(t.value);if(null===r)return{};return((e,t,n)=>({searchFields:[Object.assign({field:e,valStr:t},n?{negative:!0}:{})]}))(e,`${null!==(n=t.prefix)&&void 0!==n?n:""}${r}${null!==(i=t.suffix)&&void 0!==i?i:""}`,t.operator.startsWith("not-"))},Zh=(e,t)=>((e,t)=>"equal"===t.operator&&null!=e.exactField)(e,t)?((e,t)=>{const n=Gh(t.value);return n.length?Kh(e,n):{}})(e.exactField,t):((e,t)=>Hh.has(t.operator)&&null!=e.likeField)(e,t)?Yh(e.likeField,t):null,Xh=(e,t,n)=>{if((e=>"is-empty"===e.operator)(t))return Jh(e.name,null);if(!(e=>"equal"===e.operator||"is-any-of"===e.operator)(t))return{};const i=((e,t)=>{if(Array.isArray(e))return e.length?e:void 0;if(null!=e&&""!==e){if("boolean"===t)return"true"===e||"false"!==e&&void 0;if("number"===t){const t=Number(e);return Number.isFinite(t)?t:void 0}return e}})(t.value,n);return void 0===i?{}:Jh(e.name,i)},Qh=(e,t)=>{const{mapping:n}=e;if(!n)return null;switch(n.kind){case"array":return((e,t)=>{if("is-any-of"!==t.operator)return null;const n=Gh(t.value);if(!n.length)return{};const i=e.valueMap?n.map((t=>{var n;return null!==(n=e.valueMap[t])&&void 0!==n?n:t})):n;return Kh(e.field,i)})(n,t);case"boolean":return((e,t)=>{if("equal"!==t.operator)return null;const n=zh(t.value);return"true"===n?Kh(e.field,!0):"false"===n?Kh(e.field,!1):{}})(n,t);case"text":return Zh(n,t);case"customAttribute":return Xh(n,t,e.inputType);default:return null}},ef=(e,n)=>{const{searchFields:i,customAttributes:r}=n,o=t(n,["searchFields","customAttributes"]),s=i?(a=e.searchFields,d=i,[...null!=a?a:[],...d]):e.searchFields;var a,d;const l=r?((e,t)=>Object.assign(Object.assign({},null!=e?e:{}),t))(e.customAttributes,r):e.customAttributes,c=Object.assign({},e);return Object.entries(o).forEach((([e,t])=>{var n,i;c[e]=(n=c[e],i=t,Array.isArray(n)&&Array.isArray(i)?[...n,...i.filter((e=>!n.includes(e)))]:i)})),Object.assign(Object.assign({},c),{searchFields:s,customAttributes:l})},tf=(e,t=[])=>{const n={};(e=>{const t=new Set(["searchFields","customAttributes"]);return e.forEach((e=>{const n=null==e?void 0:e.mapping;n&&("array"===n.kind||"boolean"===n.kind?t.add(n.field):"text"===n.kind&&n.exactField&&t.add(n.exactField))})),t})(t).forEach((e=>{n[e]=void 0}));const i=new Map(t.filter((e=>Boolean(e))).map((e=>[e.id,e])));return e.reduce(((e,t)=>{const n=((e,t)=>{if(e.column&&e.operator)return t.get(e.column)})(t,i);if(!n)return e;const r=Qh(n,t);return r?ef(e,r):e}),n)},nf="customAttributes.",rf="roles",of=e=>{if("string"==typeof e)return{value:e,label:e};const{value:t,label:n}=e;return{value:t,label:n||t}},sf=(e,t)=>{const n=e.id.slice(17),i=null==t?void 0:t.find((e=>e.name===n));if(!i)return e;const r=e.label||i.displayName||n,o=(e=>Array.isArray(e.options)&&e.options.length?e.options.map(of):void 0)(i),s=Object.assign(Object.assign({},e),{label:r});return o&&(s.options=o),s},af=(e,t,n)=>{var i;const r=((e,t)=>{if(!(null==t?void 0:t.length))return e.filter((e=>(null==e?void 0:e.id)!==rf));const n=t.map((e=>({value:e.name,label:e.name})));return e.map((e=>(null==e?void 0:e.id)===rf?Object.assign(Object.assign({},e),{options:n}):e))})(null!==(i=null==e?void 0:e.slice())&&void 0!==i?i:[],t);return((e,t)=>e.filter((e=>{var n;if(!(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n.startsWith(nf))||!(null==t?void 0:t.length))return!0;const i=e.id.slice(17);return t.some((e=>e.name===i))})).map((e=>{var n;return(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n.startsWith(nf))?sf(e,t):e})))(r,n)},df=h((e=>{var t,s,a,l,c,u,h,f;return f=class extends(o(C,jd,Nd)(e)){constructor(){super(...arguments),t.set(this,null),s.set(this,(()=>i(this,t,"f")?[...i(this,t,"f")]:this.filter.data)),a.set(this,(e=>{const t=Array.isArray(null==e?void 0:e.value)?e.value:[];this.actions.searchUsers(Object.assign(Object.assign({},tf(t,i(this,s,"f").call(this))),{page:0}))})),l.set(this,(()=>{this.actions.searchUsers(Object.assign(Object.assign({},tf([],i(this,s,"f").call(this))),{page:0}))})),c.set(this,d(((e,t,n)=>{this.filter.data=af(e,t,n)}))),u.set(this,(()=>{var e;(null===(e=this.filter)||void 0===e?void 0:e.isExists)&&i(this,c,"f").call(this,i(this,t,"f"),ni(this.state),oi(this.state))})),h.set(this,(()=>{r(this,t,Object.freeze(this.filter.data.slice()),"f"),i(this,u,"f").call(this)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t,n;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this);const r=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector("descope-filter");this.filter=new re(r,{logger:this.logger}),this.filter.isExists&&(this.filter.onDataChange(i(this,h,"f")),i(this,h,"f").call(this),this.subscribe(i(this,u,"f"),ni),this.subscribe(i(this,u,"f"),oi),this.filter.onApply(i(this,a,"f")),this.filter.onClear(i(this,l,"f")))}))}},t=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,h=new WeakMap,f}));const lf={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},cf=h((e=>{var t,r,s,a,l;return l=class extends(o(C,Nd,xe,E)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{e.length&&(e.forEach((({type:e,msg:n})=>{const o=i(this,t,"m",s).call(this,e);o.setContent(i(this,t,"m",r).call(this,{type:e,msg:n})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(i(this,a,"f").bind(this),ri)}))}},a=new WeakMap,t=new WeakSet,r=function({type:e,msg:t}){const n=lf[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}`},s=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},l})),uf=h((e=>{var t,r,a,d,l;return l=class extends(o(Nd,Ce,C,Mn,jd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{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=bi(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(s(yield this.fetchWidgetPage("remove-passkey-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`Remove passkey for ${e}?`}))}))},l})),hf=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd,uf,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Oi)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.removePasskeyButton=new oe(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()}))},a})),ff=h((e=>{var t,r,s,a,l,u,h,f;return f=class extends(o(Nd,C,jd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{this.usersTable.data=e}))),l.set(this,c(((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})}))),u.set(this,d((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 n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",s).call(this),i(this,a,"f").call(this,ui(this.state)),i(this,u,"f").call(this,oi(this.state)),this.subscribe(i(this,u,"f").bind(this),oi),this.subscribe(i(this,a,"f").bind(this),ui)}))}},a=new WeakMap,l=new WeakMap,u=new WeakMap,t=new WeakSet,r=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}},s=function(){var e;this.usersTable=new ce(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(i(this,t,"m",h).bind(this)),i(this,t,"m",r).call(this),i(this,t,"m",h).call(this)},h=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{i(this,l,"f").call(this,e.target,e.detail)}))}))},f})),pf=h((e=>{var t,r,a;return a=class extends(o(Nd,Ce,C,Mn,jd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",r).call(this)}))}},t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(s(yield this.fetchWidgetPage("generated-password-modal.html")));new oe((()=>{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()}))}))},a})),gf=h((e=>{var t,r,a,d,l;return l=class extends(o(Nd,Ce,C,Mn,jd,pf)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){var e;const t=bi(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()}))))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(s(yield this.fetchWidgetPage("reset-password-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`This will generate a new temporary password for ${e}?`}))}))},l})),vf=h((e=>{var t,r,s,a;return a=class extends(o(C,jd,Nd,gf,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Ei)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.resetPasswordButton=new oe(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()}))},a})),mf=h((e=>class extends(o(je,A)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),$f=h((e=>{var t,s,a,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(_n,mf,Nd,ke,C,Mn,jd,Hn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.set(this,void 0),l.set(this,[]),c.set(this,null),u.set(this,null),$.set(this,d((e=>{i(this,l,"f").forEach((t=>{"onlyOne"===t.enableMode&&1===e.length||"oneOrMore"===t.enableMode&&e.length>0||"always"===t.enableMode?t.enable():t.disable()}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",p).call(this),i(this,t,"m",f).call(this),i(this,$,"f").call(this,ii(this.state))}))}},s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,$=new WeakMap,t=new WeakSet,h=function(e){const n=new ae(e,{logger:this.logger});n.onClick((()=>{i(this,t,"m",m).call(this,n.flowId)})),this.subscribe(i(this,$,"f").bind(this),ii),i(this,l,"f").push(n)},f=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{i(this,t,"m",h).call(this,e)}))},p=function(){r(this,s,this.createFlowModal({"data-id":"generic-flow-modal"}),"f"),i(this,s,"f").afterClose=()=>{var e;i(this,c,"f")&&(null===(e=i(this,u,"f"))||void 0===e||e.call(this),r(this,c,null,"f"))},r(this,a,new se((()=>{var e;return null===(e=i(this,s,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(i(this,a,"f"))},g=function(){var e;i(this,s,"f").open(),null===(e=i(this,u,"f"))||void 0===e||e.call(this)},v=function(e,n){n=()=>i(this,t,"m",g).call(this),r(this,u,i(this,a,"f").onPageUpdated(n),"f")},m=function(e){i(this,s,"f").setContent(this.createFlowTemplate({flowId:e,lazyStart:!1,client:{userIds:fi(this.state),loginIds:pi(this.state),usersAndRoles:gi(this.state)},tenant:this.tenantId})),i(this,t,"m",v).call(this,i(this,s,"f"),i(this,c,"f")),i(this,a,"f").onSuccess((()=>{i(this,s,"f").close(),this.actions.searchUsers()}))},y})),yf="widget-flow",bf=h((e=>{var t,r,s;return s=class extends(o(_n,E,ke,Nd,Dn,C,je,Hn)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this);const o=ei(yf);o&&(!function(e){if(window.history.replaceState&&ei(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())}}(yf),i(this,t,"m",r).call(this,o))}))}},t=new WeakSet,r=function(e){const t=this.createFlowModal({"data-id":"redirect-flow"});t.setContent(this.createFlowTemplate({flowId:e}));new se((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close()})),t.afterClose=()=>{t.remove()},t.open()},s})),wf=h((e=>class extends(o(_,je,bf,ff,Td,Ud,Fh,Bh,_d,vf,hf,Vh,df,cf,$f,Jn)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Cf=o((e=>class extends(wf(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(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 wm})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.20.1"}}}))}}))(HTMLElement);customElements.define("descope-user-management-widget",Cf);const kf=(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 Sf,xf,If,Of,Ef,Af,Pf,Nf,jf,Rf;const Tf=document.createElement("template");Tf.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';const Mf=o(J)(HTMLElement);class Uf extends Mf{constructor(){var e;super(),Sf.add(this),xf.set(this,new $({messages:[]})),If.set(this,void 0),Of.set(this,void 0),Ef.set(this,void 0),Af.set(this,{resize:i(this,Sf,"m",Rf).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Tf.content.cloneNode(!0)),this.injectStyle('\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'),r(this,If,this.shadowRoot.querySelector(".debugger"),"f"),i(this,If,"f").style.top="32px",i(this,If,"f").style.left=window.innerWidth-300-32+"px",r(this,Of,i(this,If,"f").querySelector(".content"),"f"),r(this,Ef,i(this,If,"f").querySelector(".header"),"f")}updateData(e){i(this,xf,"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]=kf(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})(i(this,If,"f"),i(this,Ef,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",i(this,Af,"f").resize),(e=i(this,If,"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},i(this,If,"f").onresize=i(this,Sf,"m",jf).bind(this),i(this,xf,"f").subscribe(i(this,Sf,"m",Pf).bind(this))}disconnectedCallback(){i(this,xf,"f").unsubscribeAll(),window.removeEventListener("resize",i(this,Af,"f").resize)}}xf=new WeakMap,If=new WeakMap,Of=new WeakMap,Ef=new WeakMap,Af=new WeakMap,Sf=new WeakSet,Pf=function(e){i(this,Sf,"m",Nf).call(this,e),i(this,Sf,"m",jf).call(this)},Nf=function(e){i(this,Of,"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("")},jf=function(){i(this,Of,"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)}))},Rf=function(){const[e,t]=kf(i(this,If,"f"),Number.parseInt(i(this,If,"f").style.left,10),Number.parseInt(i(this,If,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});i(this,If,"f").style.top=`${t}px`,i(this,If,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Uf);var Lf=Object.freeze({__proto__:null,default:Uf});const _f="undefined"!=typeof localStorage,Wf="J151000",Df="E103205",Ff="E108201",qf=_f&&localStorage.getItem("base.content.url")||"",Bf="base.ui.components.url";_f&&localStorage.getItem(Bf),_f&&localStorage.getItem(Bf);const Vf="descope-login-flow",Hf="code",zf="redirect_mode",Gf="err",Kf="data-exclude-field",Jf="data-exclude-next",Yf="dls_last_auth",Zf="dls_last_submitted_login_id",Xf="state_id",Qf="saml_idp_state_id",ep="wsfed_idp_state_id",tp="saml_idp_username",np="descope_idp_initiated",ip="sso_app_id",rp="custom_app_id",op="third_party_app_id",sp="third_party_app_state_id",ap="oidc_login_hint",dp="oidc_prompt",lp="oidc_resource",cp="oidc_error_redirect_uri",up="application_scopes",hp="data-type",fp="redirect",pp="poll",gp="webauthnCreate",vp="webauthnGet",mp="nativeBridge",$p="loadForm",yp="submit",bp="polling",wp=["descope-multi-select-combo-box","descope-text-area"],Cp="dls_last_auth_in_flight",kp=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts","data","totp","notp","sentTo","sso","selfProvisionDomains"];var Sp;!function(e){e.backward="backward",e.forward="forward"}(Sp||(Sp={}));const xp=["descope-enriched-text"];function Ip(e){return new URLSearchParams(window.location.search).get(e)}function Op(e){if(window.history.replaceState&&Ip(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 Ep(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?Sp.forward:n<i?Sp.backward:void 0}const Ap=e=>{let[t="",n=""]=(Ip(Vf)||"").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 Pp(){Op(Vf)}function Np(){return Ip(ip)}function jp(){Op(ip)}const Rp=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),Tp=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=Ap(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&Pp();const o=Ip("t")||void 0;o&&Op("t");const s=Ip(Hf)||void 0;s&&Op(Hf);const a="popup"===Ip(zf);a&&Op(zf);const d=Ip(Gf)||void 0;d&&Op(Gf);const{redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h}={redirectAuthCodeChallenge:Ip("ra-challenge"),redirectAuthCallbackUrl:Ip("ra-callback"),redirectAuthBackupCallbackUri:Ip("ra-backup-callback"),redirectAuthInitiator:Ip("ra-initiator")},f=Ip(Xf);f&&Op(Xf);const p=Ip(Qf);p&&Op(Qf);const g=Ip(ep);g&&Op(ep);const v=Ip(tp);p&&Op(tp);const m=Ip(np);m&&Op(np);const $=Np();$&&jp();const y=Ip(rp);y&&Op(rp);const b=Ip(op);b&&Op(op);const w=Ip(sp);w&&Op(sp);const C=Ip(up);C&&Op(up);const k=Ip(ap);k&&Op(ap);const S=Ip(dp);S&&Op(dp);const x=Ip(cp);x&&Op(cp);const I=Ip(lp);return I&&Op(lp),{executionId:n,stepId:i,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h,ssoQueryParams:{oidcIdpStateId:f,samlIdpStateId:p,wsfedIdpStateId:g,samlIdpUsername:v,descopeIdpInitiated:"true"===m,ssoAppId:$,customAppId:y,oidcLoginHint:k,oidcPrompt:S,oidcErrorRedirectUri:x,oidcResource:I,thirdPartyAppId:b,thirdPartyAppStateId:w,applicationScopes:C}}},Mp=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}})},Up=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector('*[name]:not([auto-focus="false"]):not([aria-hidden="true"])');setTimeout((()=>{null==t||t.focus()}))}};function Lp(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 _p=(e,{oidcIdpStateId:t,samlIdpStateId:n,wsfedIdpStateId:i,samlIdpUsername:r,ssoAppId:o,customAppId:s,oidcLoginHint:a,oidcPrompt:d,oidcErrorRedirectUri:l,oidcResource:c,thirdPartyAppId:u,thirdPartyAppStateId:h,applicationScopes:f})=>!(!e||t||n||i||r||o||s||a||d||l||c||u||h||f),Wp=(e,t,n)=>{const i=document.createElement("input");return i.type="hidden",i.name=e,i.value=t,n&&i.setAttribute("role",n),i},Dp=e=>null==e?void 0:e.submit(),Fp=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},qp=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}},Bp={minLength:"data-password-policy-value-minlength",strength:"data-password-policy-value-passwordstrength",disallowedChars:"data-password-policy-value-disallowedchars",email:"data-password-policy-value-email",activePolicies:"active-policies",availablePolicies:"available-policies"},Vp=(e,t)=>{var n;const i=null==e?void 0:e.componentsDynamicAttrs;if(!i)return;const r=Object.entries(i).find((([e])=>(e=>{var t;return null===(t=e.match(/\[data-name=["']([^"']+)["']\]/))||void 0===t?void 0:t[1]})(e)===t));return null===(n=null==r?void 0:r[1])||void 0===n?void 0:n.attributes},Hp=[{key:"totp",from:e=>e.totp},{key:"notp",from:e=>e.notp},{key:"sentTo",from:e=>e.sentTo},{key:"sso",from:e=>e.sso},{key:"selfProvisionDomains",from:e=>e.selfProvisionDomains},{key:"inboundAppApproveScopes",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.thirdPartyAppApproveScopes)||void 0===n?void 0:n.data}},{key:"securityQuestionsSetup",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqSetup}},{key:"securityQuestionsVerify",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqVerify}},{key:"userTenants",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userSelectedTenant)||void 0===n?void 0:n.data}},{key:"userRoles",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userRoles)||void 0===n?void 0:n.data}},{key:"ssoApplications",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoApplications)||void 0===n?void 0:n.data}},{key:"ssoConfigurations",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoConfigurations)||void 0===n?void 0:n.data}},{key:"samlAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlMappings)||void 0===n?void 0:n.options}},{key:"oidcAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.oidcMappings)||void 0===n?void 0:n.options}},{key:"samlGroupMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlGroupMappings)||void 0===n?void 0:n.options}},{key:"passwordPolicy",from:e=>{var t;return(e=>{if(!e)return;const t=Object.fromEntries(Object.entries(Bp).map((([t,n])=>[t,e[n]])).filter((([,e])=>void 0!==e)));return Object.keys(t).length?t:void 0})(null===(t=e.componentsConfig)||void 0===t?void 0:t.newPassword)}},{key:"recoveryCodes",from:e=>(e=>{const t=Vp(e,"recoveryCodes");if(t)return Array.isArray(t.data)?t.data.map((e=>e.value)):[]})(e.componentsConfig)},{key:"outboundApp",from:e=>(e=>{const t=Vp(e,"outboundApp");if(t)return{label:t.label,iconSrc:t["icon-src"],appId:t["data-descope-outbound-oauth-app-id"]}})(e.componentsConfig)}],zp=e=>{const t=Object.assign({},e);return e.inboundAppApproveScopes&&(t.thirdPartyAppApproveScopes=e.inboundAppApproveScopes),t};function Gp(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var Kp,Jp,Yp,Zp;function Xp(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(!Xp(o,s))return!1}else if(o!==s)return!1}return!0}let Qp=class{constructor(e={},{forceUpdate:t=!1}={}){Kp.set(this,void 0),Jp.set(this,{}),Yp.set(this,0),Zp.set(this,!0),this.update=e=>{const t="function"==typeof e?e(i(this,Kp,"f")):e,n=Object.assign(Object.assign({},i(this,Kp,"f")),t),o=i(this,Kp,"f");r(this,Kp,n,"f"),Object.freeze(i(this,Kp,"f")),setTimeout((()=>{Object.values(i(this,Jp,"f")).forEach((({cb:e,selector:t,forceUpdate:r})=>{const s=t(o),a=t(n);(i(this,Zp,"f")||r||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(a)?!Xp(s,a):s!==a))&&e(a,s,((e,t)=>n=>e[n]!==t[n])(a,s))}))}),0)},r(this,Kp,e,"f"),r(this,Zp,t,"f")}get current(){return Object.assign({},i(this,Kp,"f"))}set forceUpdate(e){r(this,Zp,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return r(this,Yp,i(this,Yp,"f")+1,"f"),i(this,Jp,"f")[i(this,Yp,"f")]={cb:e,selector:t,forceUpdate:n},i(this,Yp,"f").toString()}unsubscribe(e){const t=!!i(this,Jp,"f")[e];return t&&delete i(this,Jp,"f")[e],t}unsubscribeAll(){return r(this,Jp,{},"f"),!0}};Kp=new WeakMap,Jp=new WeakMap,Yp=new WeakMap,Zp=new WeakMap;const eg=["*","#","/","(",")","[","]","_","<",">","`"],tg=e=>"string"!=typeof e?e:e.replace((e=>{const t=eg.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),ng=["disabled"],ig=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Kf}])`)).forEach((e=>{e.value=n}))}))},rg=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),og=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?tg(rg(t,i)):rg(t,i))),sg=(e,t,n)=>{e.querySelectorAll(`[${hp}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},ag=(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})`))},dg=(e,n,i,r)=>{var o,s;sg(e,"totp-link",null===(o=null==n?void 0:n.totp)||void 0===o?void 0:o.provisionUrl),sg(e,"notp-link",null===(s=null==n?void 0:n.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=>xp.includes(e))(e.localName);e.textContent=og(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",og(i,t))}))})(e,n),((e,n,i)=>{if(!n)return;const{componentsDynamicAttrs:r}=n,o=t(n,["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 n=s[t];Object.keys(n).forEach((t=>{let r=n[t];if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){i.error(`Could not stringify value "${r}" for "${t}"`,e.message),r=""}e.setAttribute(t,r)}))}))}))})(e,null==n?void 0:n.componentsConfig,r),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=og(e.value,t)}))}))})(e,n),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{ng.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,i)},lg=Mp((()=>n(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 Lp(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}}))));let cg;const ug=(e,t)=>{cg?cg.setItem(e,t):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.setItem(e,t)},hg=e=>cg?cg.getItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)?window.localStorage.getItem(e):null,fg="dls_ab_testing_id",pg={"lastAuth.loginId":{"not-empty":e=>{var t;return!!e.loginId||!!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)},empty:e=>{var t;return!e.loginId&&!(null===(t=e.lastAuth)||void 0===t?void 0:t.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,"greater-than-or-equal":(e,t)=>(e.abTestingKey||0)>=t,"less-than-or-equal":(e,t)=>(e.abTestingKey||0)<=t,"in-range":(e,t)=>{const[n,i]=t?t.split(",").map(Number):[void 0,void 0];return(e.abTestingKey||0)>=(null!=n?n:0)&&(e.abTestingKey||0)<=(null!=i?i:0)},"not-in-range":(e,t)=>{const[n,i]=t?t.split(",").map(Number):[void 0,void 0];return!(void 0!==n&&void 0!==i&&!Number.isNaN(n)&&!Number.isNaN(i))||(e.abTestingKey||0)<n||(e.abTestingKey||0)>i},"devised-by":(e,t)=>{const n=Number(t);return!Number.isNaN(n)&&(e.abTestingKey||0)%n==0}}};function gg(e,t){const n={};try{Object.assign(n,JSON.parse(hg(Yf)))}catch(e){null==t||t.warn("[Descope] Failed to read last auth from storage",String(e))}return n.loginId||e?n:{}}function vg(e,t){(null==e?void 0:e.authMethod)&&(t&&!e.loginId||ug(Yf,JSON.stringify(e)))}function mg(){try{return JSON.parse(hg(Cp)||"{}")}catch(e){return{}}}function $g(e){try{(e=>{cg?cg.removeItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.removeItem(e)})(Cp)}catch(t){null==e||e.warn("[Descope] Failed to clear in-flight last auth storage",String(t))}}const yg=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if(Array.isArray(e[i]))return Object.assign(Object.assign({},n),{[i]:{value:e[i].map((e=>"object"==typeof e&&null!==e?yg(e):e))}});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),yg(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}),[]),bg=h((e=>{var t,n,r,o;return o=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;i(this,t,"m",n).call(this)&&i(this,t,"m",r).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)},r=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)},o})),wg=["input","change"];function Cg(e){if("number"==typeof e&&Number.isFinite(e))return{value:e,ok:!0};if("boolean"==typeof e)return{value:e?1:0,ok:!0};if("string"==typeof e){if(""===e.trim())return{value:0,ok:!1};const t=Number(e);if(Number.isFinite(t))return{value:t,ok:!0}}return{value:0,ok:!1}}function kg(e){return null==e?"":"string"==typeof e?e:"boolean"==typeof e?e?"true":"false":"number"==typeof e?Number.isFinite(e)?String(e):"":String(e)}function Sg(e){if("boolean"==typeof e)return{value:e,ok:!0};if("string"==typeof e){if("true"===e)return{value:!0,ok:!0};if("false"===e)return{value:!1,ok:!0}}return"number"==typeof e?{value:0!==e,ok:!0}:{value:!1,ok:!1}}function xg(e){return Array.isArray(e)?e:"string"==typeof e?e.split(","):null}function Ig(e){return null==e||("string"==typeof e?""===e:Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)}const Og=new Map,Eg={equal:(e,t)=>e===t||kg(e)===kg(t),"not-equal":(e,t)=>e!==t&&kg(e)!==kg(t),contains:(e,t)=>Array.isArray(e)?e.includes(t):"string"==typeof e&&e.includes(kg(t)),"doesnt-contains":(e,t)=>Array.isArray(e)?!e.includes(t):"string"==typeof e&&!e.includes(kg(t)),"greater-than":(e,t)=>{const n=Cg(e),i=Cg(t);return n.ok&&i.ok&&n.value>i.value},"greater-than-or-equal":(e,t)=>{const n=Cg(e),i=Cg(t);return n.ok&&i.ok&&n.value>=i.value},"less-than":(e,t)=>{const n=Cg(e),i=Cg(t);return n.ok&&i.ok&&n.value<i.value},"less-than-or-equal":(e,t)=>{const n=Cg(e),i=Cg(t);return n.ok&&i.ok&&n.value<=i.value},empty:e=>Ig(e),"not-empty":e=>!Ig(e),"is-true":e=>{const t=Sg(e);return t.ok&&t.value},"is-false":e=>{const t=Sg(e);return t.ok&&!t.value},in:(e,t)=>{const n=xg(t);return null!==n&&n.includes(e)},"not-in":(e,t)=>{const n=xg(t);return null!==n&&!n.includes(e)},matches:(e,t)=>{if("string"!=typeof e)return!1;const n=function(e){var t;if(Og.has(e))return null!==(t=Og.get(e))&&void 0!==t?t:null;let n;try{n=new RegExp(e)}catch(e){n=null}return Og.set(e,n),n}(kg(t));return null!==n&&n.test(e)}};function Ag(e,t){var n;if(e)return"form"===e.kind&&e.form?t[e.form]:"list"===e.kind?(null!==(n=e.items)&&void 0!==n?n:[]).map((e=>Ag(e,t))):e.value}function Pg(e,t){const n=Eg[e.operator];return!!n&&n(Ag(e.target,t),Ag(e.predicate,t))}function Ng(e,t){const n={};return(null!=e?e:[]).forEach((e=>{var i;(function(e,t){var n;return(null!==(n=e.rules)&&void 0!==n?n:[]).some((e=>function(e,t){var n;const i=null!==(n=e.atomicConditions)&&void 0!==n?n:[];return!!i.length&&(e.logicalOr?i.some((e=>Pg(e,t))):i.every((e=>Pg(e,t))))}(e,t)))})(e,t)&&(null!==(i=e.componentIds)&&void 0!==i?i:[]).forEach((t=>{n[t]=e.action}))})),n}const jg=["hide","disable","read-only"];const Rg=/(["\\])/g;function Tg(e){return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(e):e.replace(Rg,"\\$1")}function Mg(e,t){return Array.from(e.querySelectorAll(`[id="${Tg(t)}"]`))}function Ug(e,t,n){return Object.keys(t).forEach((i=>{const r=t[i];n[i]!==r&&Mg(e,i).forEach((e=>function(e,t){switch(t){case"hide":e.classList.remove("hidden");break;case"disable":e.removeAttribute("disabled");break;case"read-only":e.removeAttribute("readonly")}}(e,r)))})),Object.keys(n).forEach((i=>{const r=n[i],o=t[i];r!==o&&Mg(e,i).forEach((e=>function(e,t){switch(t){case"hide":e.classList.add("hidden");break;case"disable":e.setAttribute("disabled","true");break;case"read-only":e.setAttribute("readonly","true")}}(e,r)))})),Object.assign({},n)}const Lg="component-conditions:";function _g(e){return e instanceof HTMLInputElement?"checkbox"===e.type?e.checked:e.value:"checked"in e?e.checked:"value"in e?e.value:void 0}function Wg(e,t){const n=Object.keys(e),i=Object.keys(t);return n.length===i.length&&n.every((n=>e[n]===t[n]))}function Dg(){return{conditions:[],touchedIds:new Set,snapshot:{},applied:{},serverBaseline:{},debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:null}}function Fg(e,t,n){const i={};return n.forEach((n=>{e[n]?i[n]=e[n]:t[n]&&(i[n]=t[n])})),i}const qg=h((e=>{var t,n,s,a,d,l;const c=o(C)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,Dg())}applyComponentsState(e,t){t&&(Object.entries(t).forEach((([e,t])=>{jg.includes(t)||this.logger.error(`Unknown component action "${t}" for component with id "${e}"`,`Valid actions are ${jg.map((e=>`"${e}"`)).join(", ")}`)})),Ug(e,{},t))}initRealtimeConditions(e,o){var a,l,c,u;i(this,t,"m",d).call(this);const h=null!==(a=null==o?void 0:o.realtimeComponentsConditions)&&void 0!==a?a:[];if(!h.length)return void this.logger.debug(`${Lg} no real-time rules to apply on this screen`);this.logger.info(`${Lg} found ${h.length} real-time rule(s) for this screen`);const f={};Object.entries(null!==(l=null==o?void 0:o.form)&&void 0!==l?l:{}).forEach((([e,t])=>{f[`form.${e}`]=t})),function(e){const t=new Set,n=e=>{var i;e&&("form"===e.kind&&e.form?t.add(e.form):"list"===e.kind&&(null!==(i=e.items)&&void 0!==i?i:[]).forEach(n))};return(null!=e?e:[]).forEach((e=>{var t;return(null!==(t=e.rules)&&void 0!==t?t:[]).forEach((e=>{var t;return(null!==(t=e.atomicConditions)&&void 0!==t?t:[]).forEach((e=>{n(e.target),n(e.predicate)}))}))})),t}(h).forEach((t=>{const n=function(e,t){const n=t.startsWith("form.")?t.slice(5):t;return e.querySelector(`[name="${Tg(t)}"]`)||e.querySelector(`[name="${Tg(n)}"]`)}(e,t);if(!n)return;const i=_g(n);void 0!==i&&(f[t]=i)}));const p=function(e){const t=new Set;return(null!=e?e:[]).forEach((e=>{var n;(null!==(n=e.componentIds)&&void 0!==n?n:[]).forEach((e=>t.add(e)))})),t}(h),g={},v={};Object.entries(null!==(c=null==o?void 0:o.componentsState)&&void 0!==c?c:{}).forEach((([e,t])=>{p.has(e)&&(v[e]=t)})),Object.entries(null!==(u=null==o?void 0:o.serverOnlyComponentsState)&&void 0!==u?u:{}).forEach((([e,t])=>{p.has(e)&&(g[e]=t)}));const m={conditions:h,touchedIds:p,snapshot:f,applied:v,serverBaseline:g,debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:e},$=Fg(Ng(h,f),g,p);Wg(v,$)||(m.applied=Ug(e,v,$)),m.inputHandler=e=>i(this,t,"m",s).call(this,e),wg.forEach((t=>{e.addEventListener(t,m.inputHandler,!0)})),this.logger.debug(`${Lg} listening for "${wg.join('" and "')}" events on form fields; ${Object.keys(v).length} component(s) start hidden / disabled / read-only by these rules`);const y=this.nextRequestStatus;if(null==y?void 0:y.subscribe){const e=({isLoading:e})=>{m.paused=e,e&&m.debounceTimer&&(clearTimeout(m.debounceTimer),m.debounceTimer=null)},t=y.subscribe(e);m.unsubscribePauseListener=()=>{var e;null!=t&&(null===(e=y.unsubscribe)||void 0===e||e.call(y,t))}}r(this,n,m,"f")}disconnectedCallback(){var e;null===(e=super.disconnectedCallback)||void 0===e||e.call(this),i(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(e){var r,o;const s=i(this,n,"f");if(!s.root||s.paused)return;const d=e.target;if(!d)return;if(null===(r=d.hasAttribute)||void 0===r?void 0:r.call(d,Kf))return;const l=null===(o=d.getAttribute)||void 0===o?void 0:o.call(d,"name");if(!l)return;const c=function(e){return e.startsWith("form.")?e:`form.${e}`}(l);s.snapshot[c]=_g(d),s.debounceTimer&&clearTimeout(s.debounceTimer),s.debounceTimer=setTimeout((()=>{s.debounceTimer=null,i(this,t,"m",a).call(this)}),50)},a=function(){const e=i(this,n,"f");if(!e.root)return;let t;try{t=Fg(Ng(e.conditions,e.snapshot),e.serverBaseline,e.touchedIds)}catch(e){return void this.logger.error(`${Lg} failed to evaluate real-time rules — keeping the previous state`,null==e?void 0:e.message)}const r=e.applied;Wg(r,t)||(this.logger.debug(`${Lg} form changed — updating components: was ${JSON.stringify(r)}, now ${JSON.stringify(t)}`),e.applied=Ug(e.root,r,t))},d=function(){const e=i(this,n,"f");e.debounceTimer&&clearTimeout(e.debounceTimer),e.unsubscribePauseListener&&e.unsubscribePauseListener(),e.root&&(Object.keys(e.applied).length>0&&e.root.isConnected&&Ug(e.root,e.applied,{}),wg.forEach((t=>{e.root.removeEventListener(t,e.inputHandler,!0)}))),r(this,n,Dg(),"f")},l})),Bg="project-id",Vg="flow-id",Hg=e=>{const t=(e=>{const t=e.getAttribute(Bg),n=e.getAttribute(Vg);return t&&n?Array.from(e.ownerDocument.querySelectorAll("descope-wc")).filter((e=>e.getAttribute(Bg)===t&&e.getAttribute(Vg)===n)):[]})(e);return t.length>1&&t[0]!==e},zg=h((e=>{var t,n,s,a;const d=o(C)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}connectedCallback(){var e;null===(e=super.connectedCallback)||void 0===e||e.call(this),i(this,t,"m",s).call(this)}attributeChangedCallback(e,n,r){var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,r),n===r||e!==Bg&&e!==Vg||i(this,t,"m",s).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){queueMicrotask((()=>{if(!this.isConnected)return;const e=this.getAttribute(Bg),t=this.getAttribute(Vg),o=`${e}|${t}`;i(this,n,"f")!==o&&Hg(this)&&(r(this,n,o,"f"),this.logger.warn("Multiple Descope flow components detected on the same page",`The same flow ("${t}") and project ("${e}") are running more than once on this page. This is not supported and may cause the flow to behave unexpectedly.`))}))},a})),Gg=["externalId","email","phone"],Kg=["newPassword","password"],Jg="data-username-anchor",Yg=e=>{var t;if(!e)return"";try{const n=null===(t=window.sessionStorage)||void 0===t?void 0:t.getItem(Zf);if(!n)return"";const i=JSON.parse(n);return i.executionId===e&&i.loginId||""}catch(e){return""}},Zg=h((e=>{var t,n,s,a,d;const l=o(C)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}updateScreenUser(e){var o,d,l;r(this,n,{email:null==e?void 0:e.email,loginIds:(null===(o=null==e?void 0:e.loginIds)||void 0===o?void 0:o.length)?e.loginIds:[Yg(i(this,t,"a",a))||(null===(l=null===(d=i(this,t,"a",s).sdk)||void 0===d?void 0:d.getLastUserLoginId)||void 0===l?void 0:l.call(d))].filter(Boolean)},"f")}updateUsernameAnchor(){document.querySelectorAll(`[${Jg}="true"]`).forEach((e=>e.remove())),((e,t,n,i)=>{var r;const o=(null==n?void 0:n.email)||(null===(r=null==n?void 0:n.loginIds)||void 0===r?void 0:r[0]);(e=>e.querySelector("descope-new-password")||e.querySelector("descope-password"))(t)?o?(e=>{const t=['input[autocomplete="username"]',...Gg.map((e=>`[name="${e}"]`))].join(", ");return e.some((e=>e.querySelector(t)))})([e,t])?i.debug("Username anchor: screen already has an identifier field"):(i.debug("Username anchor: injecting hidden username input"),e.appendChild((e=>{const t=document.createElement("input");return t.setAttribute("autocomplete","username"),t.setAttribute("name","username"),t.setAttribute("type","email"),t.setAttribute("readonly","true"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.setAttribute(Kf,"true"),t.setAttribute(Jg,"true"),t.setAttribute("value",e),t.value=e,Object.assign(t.style,{position:"absolute",opacity:"0",pointerEvents:"none",height:"0",border:"0"}),t})(o))):i.debug("Username anchor: no user identifier available"):i.debug("Username anchor: no password component on screen")})(this,i(this,t,"a",s).contentRootElement,i(this,n,"f"),this.logger)}captureLastSubmittedLoginId(e={},n){const r=Fp(e,Gg);r&&((e,t)=>{var n;if(e&&t)try{null===(n=window.sessionStorage)||void 0===n||n.setItem(Zf,JSON.stringify({executionId:t,loginId:e}))}catch(e){}})(r,n||i(this,t,"a",a))}storeCredentials(e={}){var t,r,o,s,a,d;const l=Fp(e,Gg)||(null===(t=i(this,n,"f"))||void 0===t?void 0:t.email)||(null===(o=null===(r=i(this,n,"f"))||void 0===r?void 0:r.loginIds)||void 0===o?void 0:o[0]),c=Fp(e,Kg);if(l&&c)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:l,password:c});null===(d=null===(a=null===(s=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,e))||void 0===d||d.catch((e=>{this.logger.error("Could not store credentials",null==e?void 0:e.message)}))}catch(e){this.logger.error("Could not store credentials",e.message)}}},n=new WeakMap,t=new WeakSet,s=function(){return this},a=function(){var e,n;return(null===(n=null===(e=i(this,t,"a",s).flowState)||void 0===e?void 0:e.current)||void 0===n?void 0:n.executionId)||""},d})),Xg=e=>`${e.screenId}|${e.field}|${e.rule}`,Qg=()=>{try{return crypto.randomUUID()}catch(e){return`${Date.now()}-${Math.round(1e9*Math.random())}`}},ev=(e,t)=>e?e.badInput?"bad-input":e.valueMissing?"required":e.typeMismatch?"email"===t||"url"===t?t:"type-mismatch":e.patternMismatch?"pattern":e.tooShort?"too-short":e.tooLong?"too-long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.customError?"custom":"unknown":"unknown",tv=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g,v,m,$,y,b,w,k,S;const x=o(C)(e);return S=class extends x{constructor(){super(...arguments),t.add(this),n.set(this,[]),s.set(this,void 0),a.set(this,void 0),d.set(this,new Set),l.set(this,!1),c.set(this,0),u.set(this,void 0),h.set(this,!1),f.set(this,(()=>i(this,t,"m",y).call(this,!1))),p.set(this,(()=>{"hidden"===document.visibilityState&&i(this,t,"m",y).call(this,!0)})),g.set(this,(()=>i(this,t,"m",y).call(this,!0)))}setValidationTrackingEnabled(e){i(this,h,"f")!==e&&(r(this,h,e,"f"),e||i(this,t,"m",$).call(this))}setValidationTrackingSender(e){r(this,u,e,"f")}setValidationTrackingExecution(e){i(this,h,"f")&&e&&i(this,n,"f").length&&(r(this,s,e,"f"),i(this,t,"m",y).call(this,!1))}trackValidationErrors(e,n){var r,o;try{i(this,t,"m",v).call(this,e,n)}catch(e){null===(o=null===(r=this.logger)||void 0===r?void 0:r.debug)||void 0===o||o.call(r,"Failed to track validation errors",String(e))}}teardownValidationTracking(){i(this,t,"m",y).call(this,!1),r(this,c,i(this,c,"f")+1,"f"),i(this,d,"f").forEach(clearTimeout),i(this,d,"f").clear(),i(this,l,"f")&&(r(this,l,!1,"f"),this.removeEventListener("screen-updated",i(this,f,"f")),this.removeEventListener("success",i(this,f,"f")),this.removeEventListener("error",i(this,f,"f")),document.removeEventListener("visibilitychange",i(this,p,"f")),window.removeEventListener("pagehide",i(this,g,"f")))}},n=new WeakMap,s=new WeakMap,a=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,v=function(e,o){if(!i(this,h,"f")||!(null==e?void 0:e.length))return;const a=o||{};i(this,t,"m",k).call(this),e.forEach((e=>{if(i(this,n,"f").length>=20)return;const o=((e,t)=>{var n;const i=null===(n=null==e?void 0:e.getAttribute)||void 0===n?void 0:n.call(e,"name");return i?{id:Qg(),field:i,rule:ev(e.validity,e.type),message:e.validationMessage||"",screenId:t.screenId||"",screenName:t.screenName||"",ts:Date.now()}:null})(e,a);if(!o)return;const d=Xg(o);i(this,n,"f").some((e=>Xg(e)===d))||(i(this,n,"f").push(o),r(this,s,a.executionId||i(this,s,"f"),"f"),i(this,n,"f").length>=20&&i(this,t,"m",y).call(this,!1))})),i(this,n,"f").length>=20?i(this,t,"m",y).call(this,!1):i(this,t,"m",m).call(this)},m=function(){clearTimeout(i(this,a,"f")),r(this,a,setTimeout((()=>i(this,t,"m",y).call(this,!1)),2e3),"f")},$=function(){clearTimeout(i(this,a,"f")),r(this,c,i(this,c,"f")+1,"f"),i(this,d,"f").forEach(clearTimeout),i(this,d,"f").clear(),r(this,n,[],"f"),r(this,s,void 0,"f")},y=function(e){var o,d;if(clearTimeout(i(this,a,"f")),!i(this,n,"f").length)return void r(this,s,void 0,"f");if(!i(this,s,"f"))return;if(!i(this,u,"f"))return;const l=i(this,n,"f"),h=i(this,s,"f");r(this,n,[],"f"),r(this,s,void 0,"f");try{const n={executionId:h,events:l};e?i(this,u,"f").call(this,n,{keepalive:!0}).catch((()=>{})):i(this,t,"m",b).call(this,n,2,i(this,c,"f"))}catch(e){null===(d=null===(o=this.logger)||void 0===o?void 0:o.debug)||void 0===d||d.call(o,"Failed to send validation events",String(e))}},b=function(e,n,r){i(this,u,"f").call(this,e,{keepalive:!1}).then((o=>{!o.ok&&o.retryable&&n>0&&i(this,t,"m",w).call(this,e,n,r)})).catch((()=>{n>0&&i(this,t,"m",w).call(this,e,n,r)}))},w=function(e,n,r){if(r!==i(this,c,"f"))return;const o=setTimeout((()=>{i(this,d,"f").delete(o),r===i(this,c,"f")&&i(this,t,"m",b).call(this,e,n-1,r)}),800*(2-n+1));i(this,d,"f").add(o)},k=function(){i(this,l,"f")||(r(this,l,!0,"f"),this.addEventListener("screen-updated",i(this,f,"f")),this.addEventListener("success",i(this,f,"f")),this.addEventListener("error",i(this,f,"f")),document.addEventListener("visibilitychange",i(this,p,"f")),window.addEventListener("pagehide",i(this,g,"f")))},S}));var nv,iv,rv,ov,sv,av,dv,lv,cv,uv,hv,fv,pv,gv,vv,mv,$v,yv,bv,wv,Cv,kv,Sv,xv,Iv,Ov;const Ev=o(je,M,bg,qg,zg,Zg,J,Vn,tv)(HTMLElement);class Av extends Ev{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","send-session-token","style-id"]}constructor(e){super(),nv.add(this),this.sdkVersion="4.4.1",rv.set(this,!1),ov.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),i(this,nv,"m",Ov).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)}},sv.set(this,new Qp),av.set(this,new Qp),dv.set(this,{}),this.getComponentsContext=()=>i(this,dv,"f"),this.nextRequestStatus=new Qp({isLoading:!1}),lv.set(this,void 0),cv.set(this,{popstate:i(this,nv,"m",gv).bind(this),componentsContext:i(this,nv,"m",wv).bind(this)}),uv.set(this,void 0),this.getConfig=()=>n(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),Cv.set(this,void 0),kv.set(this,void 0),r(this,uv,e,"f"),i(this,nv,"m",fv).call(this)}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}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 sendSessionToken(){return"true"===this.getAttribute("send-session-token")}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{return yg(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 popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return i(this,ov,"f")}set customStorage(e){if(e&&"function"!=typeof e.getItem)throw new Error("Custom storage must have a getItem method");if(e&&"function"!=typeof e.setItem)throw new Error("Custom storage must have a setItem method");if(e&&"function"!=typeof e.removeItem)throw new Error("Custom storage must have a removeItem method");r(this,ov,e,"f"),(e=>{cg=e})(e)}get lazyStart(){return"true"===this.getAttribute("lazy-start")}start(){var e;null===(e=i(this,kv,"f"))||void 0===e||e.call(this),r(this,Cv,Promise.resolve(),"f")}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return n(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 n(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=wp.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()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return n(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 n(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),i(this,av,"f").subscribe(i(this,nv,"m",Iv).bind(this)),i(this,av,"f").update({isDebug:this.debug}),i(this,nv,"m",pv).call(this),yield i(this,nv,"m",yv).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");const{executionId:o,stepId:s,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:g}=Tp(this.flowId,this.loggerWrapper);window.addEventListener("popstate",i(this,cv,"f").popstate),window.addEventListener("components-context",i(this,cv,"f").componentsContext),i(this,sv,"f").subscribe(i(this,nv,"m",$v).bind(this)),i(this,sv,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:s,executionId:o,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},g)),r(this,rv,!0,"f")}))}disconnectedCallback(){var e;i(this,sv,"f").unsubscribeAll(),i(this,av,"f").unsubscribeAll(),i(this,nv,"m",xv).call(this),window.removeEventListener("popstate",i(this,cv,"f").popstate),window.removeEventListener("components-context",i(this,cv,"f").componentsContext),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}attributeChangedCallback(e,t,n){var r;if(null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,t,n),this.shadowRoot.isConnected&&i(this,rv,"f")&&t!==n&&iv.observedAttributes.includes(e)){i(this,nv,"m",pv).call(this);const r=null===t;i(this,sv,"f").update((({stepId:t,executionId:i})=>{let o=t,s=i;return r||(s=null,o=null,Pp()),{[Rp(e)]:n,stepId:o,executionId:s}})),i(this,av,"f").update({isDebug:this.debug})}}}var Pv,Nv,jv,Rv,Tv,Mv,Uv,Lv,_v,Wv,Dv,Fv,qv,Bv,Vv,Hv,zv,Gv,Kv,Jv,Yv,Zv,Xv,Qv,em,tm,nm,im,rm,om,sm,am,dm,lm,cm,um,hm,fm,pm,gm,vm,mm,$m,ym;iv=Av,rv=new WeakMap,ov=new WeakMap,sv=new WeakMap,av=new WeakMap,dv=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,Cv=new WeakMap,kv=new WeakMap,nv=new WeakSet,hv=function(){this.injectStyle("\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 ")},fv=function(){i(this,nv,"m",hv).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},pv=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","send-session-token","style-id","outbound-app-id","outbound-app-scopes","theme-override"];iv.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Rp(t)])throw Error(`${t} cannot be empty`)}))},gv=function(){const{stepId:e,executionId:t}=Ap(this.flowId);i(this,sv,"f").update({stepId:e,executionId:t})},vv=function(e,t){fd&&"function"==typeof fd||this.logger.error("SDK was not loaded properly",fd,JSON.stringify(fd));const r=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},iv.sdkConfigOverrides),{projectId:e,baseUrl:t});i(this,ov,"f")&&(r.customStorage=i(this,ov,"f")),this.sdk=fd(r);const o={start:1,next:7};["start","next"].forEach((e=>{const t=function(e,t,i){return(...r)=>n(this,void 0,void 0,(function*(){let n;const o=i+1;for(let s=0;s<o;s++)try{return yield e(...r)}catch(e){n=e,s<i&&(yield new Promise((e=>{setTimeout(e,t*Math.pow(2,s+1))})))}throw n}))}(this.sdk.flow[e],1e3,3);this.sdk.flow[e]=(...r)=>n(this,void 0,void 0,(function*(){const n=[...r],s=o[e],a=i(this,nv,"m",mv).call(this,n[s]);void 0!==a&&(n[s]=a);try{return yield t(...n)}catch(t){return this.logger.error(`Error in sdk flow ${e} function`,t),{error:{errorCode:Wf,errorDescription:t.toString()}}}}))}));const s=this.sdk.flow.start;this.sdk.flow.start=(...e)=>n(this,void 0,void 0,(function*(){return yield i(this,nv,"m",Sv).call(this),s.apply(this.sdk.flow,e)}))},mv=function(e){if(!this.sendSessionToken)return e;const t=null==ba?void 0:ba(this.storagePrefix);return t?Object.assign(Object.assign({},null!=e?e:{}),{sessionJwt:t}):e},$v=function(e,t,r){return n(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:n}=e;if(r("projectId")||r("baseUrl")){if(!t)return;i(this,nv,"m",vv).call(this,t,n)}i(this,uv,"f").call(this,e)}))},yv=function(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield i(this,nv,"m",bv).call(this))}))},bv=function(){return n(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(qf||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 n(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}}))},wv=function(e){r(this,dv,Object.assign(Object.assign({},i(this,dv,"f")),e.detail),"f")},Sv=function(){return this.lazyStart?(i(this,Cv,"f")||r(this,Cv,new Promise((e=>{r(this,kv,e,"f")})),"f"),i(this,Cv,"f")):Promise.resolve()},xv=function(){var e;null===(e=i(this,lv,"f"))||void 0===e||e.remove(),r(this,lv,null,"f")},Iv=function(e){return n(this,arguments,void 0,(function*({isDebug:e}){e?(r(this,lv,document.createElement("descope-debugger"),"f"),Object.assign(i(this,lv,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return _m})),document.body.appendChild(i(this,lv,"f"))):i(this,nv,"m",xv).call(this)}))},Ov=function(e,t){var n;e&&this.debug&&(null===(n=i(this,lv,"f"))||void 0===n||n.updateData({title:e,description:t}))},Av.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.4.1"}};class bm extends Av{static set sdkConfigOverrides(e){Av.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Av.sdkConfigOverrides}constructor(){const e=new Qp({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),Pv.add(this),this.stepState=new Qp({}),Nv.set(this,void 0),jv.set(this,null),Rv.set(this,null),Tv.set(this,{visibilitychange:i(this,Pv,"m",Mv).bind(this)}),this.bridgeVersion=bm.bridgeVersion,Uv.set(this,void 0),this.nativeCallbacks={},Vv.set(this,!1),this.handleRedirect=e=>{window.location.assign(e)},zv.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()?i(this,Pv,"m",Gv).call(this,t):t()})),Kv.set(this,((e,t,o,s,a=!1)=>{const d=[Df,"E103202",Ff];if(this.flowState.current.action===pp){if(i(this,Yv,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const l=Date.now(),c=a?500:2e3;r(this,Nv,setTimeout((()=>n(this,void 0,void 0,(function*(){var n,r;this.logger.debug("polling - Calling next");const u=this.sdk.flow.next(e,t,bp,o,s,{}),h=document.hidden&&!a&&Date.now()-l>c+500;let f;h&&this.logger.debug("polling - The polling seems to be throttled");try{const e=h?1e3:6e3;f=yield Lp(e,u)}catch(n){return this.logger.warn(`polling - The ${h?"throttled fetch":"fetch"} call timed out or was aborted`),void i(this,Kv,"f").call(this,e,t,o,s,h)}if((null===(n=null==f?void 0:f.error)||void 0===n?void 0:n.errorCode)===Wf)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void i(this,Kv,"f").call(this,e,t,o,s);this.logger.debug("polling - Got a response"),(null==f?void 0:f.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),(null===(r=null==f?void 0:f.error)||void 0===r?void 0:r.errorCode)&&d.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):i(this,Kv,"f").call(this,e,t,o,s),i(this,Zv,"f").call(this,f)}))),c),"f")}})),Jv.set(this,(()=>{clearTimeout(i(this,Nv,"f")),r(this,Nv,null,"f")})),Yv.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),Zv.set(this,(e=>{var t,n,o,s,a,d,l,c,u,h,f,p,g;if(!(null==e?void 0:e.ok)){const r=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===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;i(this,Pv,"m",$m).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:l,errorMessage:r}),this.loggerWrapper.error((null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorDescription)||r,(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&&c!==Df&&c!==Ff||!this.isRestartOnError||i(this,Pv,"m",Bv).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 v=null===(f=null===(h=null===(u=e.data)||void 0===u?void 0:u.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:$,lastAuth:y,action:b,openInNewTabUrl:w}=e.data;if(b!==pp&&i(this,Jv,"f").call(this),"completed"===m){this.storeLastAuthenticatedUser&&vg(Object.assign(Object.assign({},y),{lastUsedPerScreen:mg()})),$g(this.loggerWrapper);const t=Object.assign({},$);return e.data.output&&Object.keys(e.data.output).length>0&&(t.flowOutput=e.data.output),this.setValidationTrackingExecution(e.data.executionId),void i(this,Pv,"m",$m).call(this,"success",t)}this.storeLastAuthenticatedUser&&vg(y,!0),w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:x,redirect:I,webauthn:O,error:E,samlIdpResponse:A,wsFedIdpResponse:P,nativeResponse:N}=e.data,j=Date.now();b!==pp?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:x,status:m,stepId:k,stepName:S,action:b,error:E}),(null===(g=x.state)||void 0===g?void 0:g.clientScripts)&&r(this,Rv,this.loadSdkScripts(x.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==I?void 0:I.url,redirectIsPopup:null==I?void 0:I.isPopup,screenId:null==x?void 0:x.id,screenState:null==x?void 0:x.state,webauthnTransactionId:null==O?void 0:O.transactionId,webauthnOptions:null==O?void 0:O.options,samlIdpResponseUrl:null==A?void 0:A.url,samlIdpResponseSamlResponse:null==A?void 0:A.samlResponse,samlIdpResponseRelayState:null==A?void 0:A.relayState,wsFedIdpResponseUrl:null==P?void 0:P.url,wsFedIdpResponseWresult:null==P?void 0:P.wresult,wsFedIdpResponseWctx:null==P?void 0:P.wctx,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:j})):this.flowState.update({action:b,reqTimestamp:j})})),Xv.set(this,Mp((()=>n(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)}}))))),nm.set(this,void 0),im.set(this,void 0),dm.set(this,null),hm.set(this,qp(((e,t,r)=>n(this,void 0,void 0,(function*(){var n,o;if("true"===e.getAttribute("formnovalidate")||i(this,Pv,"m",sm).call(this)){const s=null==e?void 0:e.getAttribute("id");i(this,Pv,"m",gm).call(this,e,s,r),i(this,Pv,"m",lm).call(this,e);const a=yield i(this,Pv,"m",am).call(this),d=(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);this.nextRequestStatus.update({isLoading:!0});const l=Object.assign(Object.assign(Object.assign({},d),a),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin}),c=yield t(s,l);this.nextRequestStatus.update({isLoading:!1}),this.captureLastSubmittedLoginId(a,null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.executionId),this.storeCredentials(a)}}))))),this.flowState=e,this.setValidationTrackingSender(((e,t)=>n(this,[e,t],void 0,(function*({executionId:e,events:t},{keepalive:n}){const i=yield this.sdk.flow.event(e,t,n);return{ok:i.ok,retryable:i.code>=500||429===i.code}}))))}nativeResume(e,t){var n,r,o,s,a,d;const l=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let e,{exchangeCode:t}=l;if(!t){const i=new URL(l.url);t=null===(n=i.searchParams)||void 0===n?void 0:n.get(Hf),e=(null===(r=i.searchParams)||void 0===r?void 0:r.get(Gf))||void 0}null===(s=(o=this.nativeCallbacks).complete)||void 0===s||s.call(o,{exchangeCode:t,exchangeError:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(l.url),t=e.searchParams.get("t"),n=e.searchParams.get(Vf).split("_").pop();i(this,Jv,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const{screenResolve:e}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:t}=l;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=l,{screenNext:n}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(d=(a=this.nativeCallbacks).complete)||void 0===d||d.call(a,l)}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:{[Gp(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 i=Promise.all(null==e?void 0:e.map((e=>n(this,void 0,void 0,(function*(){var n,i,r;const o=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(o){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=o;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}(null===(i=globalThis.descope)||void 0===i?void 0:i[e.id])||(yield this.injectNpmLib("@descope/flow-scripts","1.0.19",`dist/${e.id}.js`));const s=null===(r=globalThis.descope)||void 0===r?void 0:r[e.id];return new Promise(((n,i)=>{try{const i=s(e.initArgs,{baseUrl:this.baseUrl,ref:this},t(e,n),this.loggerWrapper);if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t);const r=this.nextRequestStatus.subscribe((()=>{var n;this.loggerWrapper.debug("Stopping script",e.id),(null===(n=i.stop)||void 0===n?void 0:n.call(i))&&(this.nextRequestStatus.unsubscribe(r),this.loggerWrapper.debug("Removing script",e.id),this.shadowRoot.removeChild(t))}));"function"==typeof i.present&&n(e.id)}}catch(e){i(e)}}))}))))),r=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([i,r])}get isDismissScreenErrorOnInput(){return"true"===this.getAttribute("dismiss-screen-error-on-input")}init(){var e,t;if(!window.descopeBridge)return this._init();this.lazyInit=this._init,r(this,Uv,null===(t=null===(e=null===window||void 0===window?void 0:window.descopeBridge)||void 0===e?void 0:e.registerFlow)||void 0===t?void 0:t.call(e,this),"f")}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(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)),i(this,Pv,"m",Fv).call(this),window.addEventListener("visibilitychange",i(this,Tv,"f").visibilitychange)),yield null===(n=e.init)||void 0===n?void 0:n.call(this)}))}disconnectedCallback(){var e,t,n;super.disconnectedCallback(),this.teardownValidationTracking(),i(this,Uv,"f")&&(null===(t=null===(e=window.descopeBridge)||void 0===e?void 0:e.unregisterFlow)||void 0===t||t.call(e,i(this,Uv,"f")),r(this,Uv,void 0,"f")),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),i(this,Jv,"f").call(this),null===(n=i(this,jv,"f"))||void 0===n||n.abort(),r(this,jv,null,"f"),window.removeEventListener("visibilitychange",i(this,Tv,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return n(this,void 0,void 0,(function*(){let n;const i=y(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 n(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,o,s){return n(this,void 0,void 0,(function*(){var a,d;const{projectId:l,flowId:c,tenant:u,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectIsPopup:$,redirectUrl:b,token:w,code:C,isPopup:k,exchangeError:S,webauthnTransactionId:x,webauthnOptions:I,redirectAuthCodeChallenge:O,redirectAuthCallbackUrl:E,redirectAuthBackupCallbackUri:A,redirectAuthInitiator:P,locale:N,samlIdpResponseUrl:j,samlIdpResponseSamlResponse:R,samlIdpResponseRelayState:T,wsFedIdpResponseUrl:M,wsFedIdpResponseWresult:U,wsFedIdpResponseWctx:L,nativeResponseType:_,nativePayload:W,reqTimestamp:D}=e,F=t(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx","nativeResponseType","nativePayload","reqTimestamp"]);let q,B,V;const H=(()=>{const e=hg(fg);if(!e){const e=Math.floor(100*Math.random()+1);return ug(fg,e.toString()),e}return Number(e)})(),{outboundAppId:z,outboundAppScopes:G}=this,K=this.sdk.getLastUserLoginId();s("flowId")&&this.setValidationTrackingEnabled(!1);const J=yield this.getFlowConfig();i(this,Pv,"m",rm).call(this,J,f,s);const Y=yield this.getProjectConfig(),Z=Object.entries(Y.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),X=E&&O?{callbackUrl:E,codeChallenge:O,backupCallbackUri:A}:void 0,Q=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect,externalAuthRedirect:this.nativeOptions.externalAuthRedirect}:void 0;let ee={};if(!f){$g(this.loggerWrapper);const e=[...J.clientScripts||[],...J.sdkScripts||[]];if(J.conditions){let t=[];({startScreenId:q,conditionInteractionId:V,startScreenName:B,clientScripts:t,componentsConfig:ee}=((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=pg[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:K,code:C,token:w,abTestingKey:H,lastAuth:gg(K,this.loggerWrapper)},J.conditions)),e.push(...t||[])}else J.condition?({startScreenId:q,startScreenName:B,conditionInteractionId:V}=((e,t)=>{var n;const i=null===(n=pg[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}})(J.condition,{loginId:K,code:C,token:w,abTestingKey:H,lastAuth:gg(K,this.loggerWrapper)})):(B=J.startScreenName,q=J.startScreenId);if(r(this,nm,q,"f"),r(this,im,B,"f"),r(this,Rv,this.loadSdkScripts(e),"f"),J.fingerprintEnabled&&J.fingerprintKey?yield Aa(J.fingerprintKey,this.baseUrl):oa(Oa),!_p(q,F)){const e=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},F),{client:this.client}),b&&{redirectUrl:b}),{lastAuth:gg(K,this.loggerWrapper),abTestingKey:H,locale:y(N).locale,nativeOptions:Q,outboundAppId:z,outboundAppScopes:G}),V,"",Y.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),C?{exchangeCode:C,idpInitiated:!0}:{}),F.descopeIdpInitiated&&{idpInitiated:!0}),w?{token:w}:{}),F.oidcLoginHint?{externalId:F.oidcLoginHint}:{}));return i(this,Zv,"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(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:k,code:C,exchangeError:S,isCodeChanged:s("code"),isExchangeErrorChanged:s("exchangeError")})),k&&(s("code")&&C||s("exchangeError")&&S))return void i(this,Pv,"m",ym).call(this,f,C,S);if(f&&(s("token")&&w||s("code")&&C||s("exchangeError")&&S)){const e=yield this.sdk.flow.next(f,h,yp,J.version,Y.componentsVersion,{token:w,exchangeCode:C,exchangeError:S});return i(this,Zv,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===$p&&j&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>s(e)))){if(!R)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.appendChild(Wp("SAMLResponse",t,"saml-response")),r.appendChild(Wp("RelayState",n,"saml-relay-state"));const o=document.createElement("input");o.type="submit",o.id="SAMLSubmitButton",o.value="Continue",o.style.display="none",r.appendChild(o),document.body.appendChild(r),i(r)})(j,R,T||"",Dp)}if(p===$p&&M&&["wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx"].some((e=>s(e)))){if(!U)return void this.loggerWrapper.error("Did not get wsfed idp params data to load");((e,t,n,i)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.appendChild(Wp("wa","wsignin1.0")),r.appendChild(Wp("wresult",t)),r.appendChild(Wp("wctx",n));const o=document.createElement("input");o.type="submit",o.id="WSFedSubmitButton",o.value="Continue",o.style.display="none",r.appendChild(o),document.body.appendChild(r),i(r)})(M,U,L||"",Dp)}if(p===fp&&(s("redirectTo")||s("deferredRedirect"))){if(!m)return void this.loggerWrapper.error("Did not get redirect url");if("no-op"===m)return;if("android"===P&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${$}`),$){this.loggerWrapper.debug("Opening redirect in popup");const e=((e,t,n,i)=>{const r=void 0!==window.screenLeft?window.screenLeft:window.screen.left,o=void 0!==window.screenTop?window.screenTop:window.screen.top,s=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-n)/2+r,a=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-i)/2+o,d=function(){const e=navigator.userAgent||"",t=/\b(iPhone)\b/.test(e),n=/Safari/.test(e)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(e);return t&&n}()?"about:blank":"",l=window.open(d,t,`width=${n},height=${i},top=${a},left=${s},scrollbars=yes,resizable=yes`);return l.location.href=e,l.focus(),l})(m,"?",598,700),t=this.shouldUsePopupPostMessage();t&&(e.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(t?"postMessage":"BroadcastChannel"));let n=!1;const r=e=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(e.data));const i=t?this.popupOrigin:window.location.origin;if(e.origin!==i)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${e.origin}", expected: "${i}"`);const{action:r,data:o}=e.data||{};"code"===r&&(n=!0,this.flowState.update({code:o.code,exchangeError:o.exchangeError}))};let o;this.loggerWrapper.debug("Starting popup closed detection");const s=setInterval((()=>{e.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(s),i(this,Pv,"m",$m).call(this,"popupclosed",{abandoned:!n}),this.loggerWrapper.debug("Cleaning up popup listeners"),null==o||o())}),1e3);if(t)window.addEventListener("message",r),o=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",r)};else{this.loggerWrapper.debug("Creating broadcast channel");const e=new BroadcastChannel(f);e.onmessage=r,o=()=>{this.loggerWrapper.debug("Closing channel"),e.close()}}}else this.handleRedirect(m),this.flowState.update({redirectTo:"no-op"}),i(this,Pv,"m",$m).call(this,"popupclosed",{});return}if(p===gp||p===vp){if(!x||!I)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t,n,o;null===(d=i(this,jv,"f"))||void 0===d||d.abort(),r(this,jv,null,"f");try{e=p===gp?yield this.sdk.webauthn.helpers.create(I):yield this.sdk.webauthn.helpers.get(I)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name,n=e.reason,o=e.message}const s=yield this.sdk.flow.next(f,h,yp,J.version,Y.componentsVersion,{transactionId:x,response:e,failure:t,failureReason:n,failureMessage:o});i(this,Zv,"f").call(this,s)}if(p===mp)return this.nativeCallbacks.complete=e=>n(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,yp,J.version,Y.componentsVersion,e);i(this,Zv,"f").call(this,t)})),i(this,Pv,"m",Wv).call(this,_,W),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((s("action")||s("deferredPolling"))&&i(this,Kv,"f").call(this,f,h,J.version,Y.componentsVersion),!g&&!q)return void this.loggerWrapper.warn("No screen was found to show");const te=q||g,ne=yield this.getHtmlFilenameWithLocale(N,te),{oidcLoginHint:ie,oidcPrompt:re,oidcErrorRedirectUri:oe,oidcResource:se,samlIdpUsername:ae}=F,de={direction:Ep(h,o.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:K,name:this.sdk.getLastUserDisplayName()||K},componentsConfig:Object.assign(Object.assign(Object.assign({},J.componentsConfig),ee),null==v?void 0:v.componentsConfig)}),htmlFilename:`${te}.html`,htmlLocaleFilename:ne,screenId:te,stepName:e.stepName||B,samlIdpUsername:ae,oidcLoginHint:ie,oidcPrompt:re,oidcErrorRedirectUri:oe,oidcResource:se,action:p,locale:y(N).locale},le=gg(K,this.loggerWrapper);_p(q,F)?de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==J?void 0:J.clientScripts)||[];yield i(this,Pv,"m",fm).call(this,n);const r=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},F),{lastAuth:le,preview:this.preview,abTestingKey:H,client:this.client}),b&&{redirectUrl:b}),{locale:y(N).locale,nativeOptions:Q,outboundAppId:z,outboundAppScopes:G}),V,e,Y.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),zp(t)),C&&{exchangeCode:C,idpInitiated:!0}),F.descopeIdpInitiated&&{idpInitiated:!0}),w&&{token:w}),de.next.isCustomScreen);return i(this,Zv,"f").call(this,r),r})):(s("projectId")||s("baseUrl")||s("executionId")||s("stepId"))&&(de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==v?void 0:v.clientScripts)||[];yield i(this,Pv,"m",fm).call(this,n);const r=yield this.sdk.flow.next(f,h,e,J.version,Y.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),zp(t)),de.next.isCustomScreen);return i(this,Zv,"f").call(this,r),r}))),this.loggerWrapper.debug("Got a screen with id",de.screenId),yield i(this,Pv,"m",Hv).call(this,de),this.stepState.update(de)}))}onStepChange(e,t){return n(this,void 0,void 0,(function*(){var r,o,s;const{htmlFilename:a,htmlLocaleFilename:d,direction:l,next:c,screenState:u,screenId:h}=e;this.loggerWrapper.debug("Rendering a flow screen"),this.updateScreenUser(null==u?void 0:u.user);const f=document.createElement("template");f.innerHTML=yield this.getPageContent(a,d);const p=f.content.cloneNode(!0),g=this.loadDescopeUiComponents(f);this.sdk.webauthn.helpers.isSupported()?yield i(this,Pv,"m",em).call(this,p,c):(e=>{e.querySelectorAll(`descope-button[${hp}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(p),!e.samlIdpUsername||(null===(r=u.form)||void 0===r?void 0:r.loginId)||(null===(o=u.form)||void 0===o?void 0:o.email)||(u.form||(u.form={}),u.form.loginId=e.samlIdpUsername,u.form.email=e.samlIdpUsername),dg(p,u,this.formConfig,this.loggerWrapper),this.applyComponentsState(p,null==u?void 0:u.componentsState);const{geo:v}=null!==(s=yield this.getExecutionContext())&&void 0!==s?s:{};((e,t)=>{Object.entries({"default-code":"autoDetect","default-country":"autoDetect"}).forEach((([n,i])=>{Array.from(e.querySelectorAll(`[${n}="${i}"]`)).forEach((e=>{e.setAttribute(n,t||i)}))}))})(p,v),((e,t)=>{let n=t;if(t)try{const[e]=Intl.getCanonicalLocales(t);e&&(n=e)}catch(e){}Object.entries({lang:"autoDetect"}).forEach((([t,i])=>{Array.from(e.querySelectorAll(`[${t}="${i}"]`)).forEach((e=>{e.setAttribute(t,n||i)}))}))})(p,e.locale);const m=()=>n(this,void 0,void 0,(function*(){var n,r;yield g;const o=this.contentRootElement;((e,t)=>{ag(e,"descope-totp-image",t)})(o,null===(n=null==u?void 0:u.totp)||void 0===n?void 0:n.image),((e,t)=>{ag(e,"descope-notp-image",t)})(o,null===(r=null==u?void 0:u.notp)||void 0===r?void 0:r.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{if(!t.querySelector(r))return void 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.debug(`Could not find component class for ${r}`,"Check if the component is registered")}))})(o,p,u.cssVars,this.loggerWrapper),o.replaceChildren(p);const s=!t.htmlFilename;setTimeout((()=>{i(this,Pv,"m",cm).call(this),this.updateUsernameAnchor(),this.validateOnBlur&&((e,t)=>{e.querySelectorAll("*[name]").forEach((n=>{n.addEventListener("blur",(()=>{var i;const r=()=>{var e;const i=n.focus;n.focus=()=>{};const r=null===(e=n.reportValidity)||void 0===e?void 0:e.call(n);t&&!1===r&&t(n),setTimeout((()=>{n.focus=i}))};if("true"===n.getAttribute("invalid")||(null===(i=n.value)||void 0===i?void 0:i.length))return void r();const o={timer:void 0},s=e=>{"true"===e.target.getAttribute("formnovalidate")&&(clearTimeout(o.timer),o.timer=void 0)};o.timer=setTimeout((()=>{e.removeEventListener("click",s),r(),o.timer=void 0}),150),e.addEventListener("click",s,{once:!0})}))}))})(o,(e=>this.trackValidationErrors([e],i(this,Pv,"a",om)))),((e,t)=>{ig(e,null==t?void 0:t.inputs),ig(e,null==t?void 0:t.form)})(o,u),this.initRealtimeConditions(o,u),i(this,Pv,"m",tm).call(this,{isFirstScreen:s,isCustomScreen:!1,stepName:e.stepName}),Up(o,this.autoFocus,s),i(this,Pv,"m",vm).call(this,h)})),i(this,Pv,"m",mm).call(this,c,h),o.querySelector(`[${hp}="polling"]`)&&c(bp,{})}));l?i(this,Pv,"m",Gv).call(this,m):m()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${Kf}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch(e){return!1}return!0}}Nv=new WeakMap,jv=new WeakMap,Rv=new WeakMap,Tv=new WeakMap,Uv=new WeakMap,Vv=new WeakMap,zv=new WeakMap,Kv=new WeakMap,Jv=new WeakMap,Yv=new WeakMap,Zv=new WeakMap,Xv=new WeakMap,nm=new WeakMap,im=new WeakMap,dm=new WeakMap,hm=new WeakMap,Pv=new WeakSet,Mv=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},Lv=function(e,t,r){return n(this,void 0,void 0,(function*(){var n;return(null===(n=this.nativeOptions)||void 0===n?void 0:n.bridgeVersion)>=2&&new Promise((n=>{this.nativeCallbacks.screenNext=r,this.nativeCallbacks.screenResolve=n,i(this,Pv,"m",Wv).call(this,"beforeScreen",{screen:e,context:t})}))}))},_v=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&i(this,Pv,"m",Wv).call(this,"afterScreen",{screen:e})},Wv=function(e,t){i(this,Pv,"m",$m).call(this,"bridge",{type:e,payload:t})},Dv=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(`[${hp}="${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()},Fv=function(){var e,n,r,o;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var n=e.screenState,i=t(void 0===n?{}:n,["errorText","errorType"]),r=t(e,["screenState"]);return Object.assign(Object.assign({},r),{screenState:i})})),null===(n=this.stepState)||void 0===n||n.subscribe(i(this,Pv,"m",Dv).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}}),{forceUpdate:!0}),null===(r=this.stepState)||void 0===r||r.subscribe(i(this,Pv,"m",qv).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}}),{forceUpdate:!0}),null===(o=this.flowState)||void 0===o||o.subscribe((({screenId:e,executionId:t})=>{var n;try{this.updateTelemetryContext({screenId:e,executionId:t})}catch(e){null===(n=this.logger)||void 0===n||n.error("Error updating telemetry screenId:",e)}}),(e=>({screenId:e.screenId,executionId:e.executionId})))},qv=function({errorText:e,errorType:t}){(t||e)&&(this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((e=>{e.shadowRoot.querySelectorAll("descope-text-field[data-id]").forEach((e=>{e.value=""}))})),Up(this.contentRootElement,this.autoFocus,!1))},Bv=function(){return n(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")}))},Hv=function(e){return n(this,void 0,void 0,(function*(){var n;const o=Object.assign(Object.assign({},this.stepState.current),e),{next:s,stepName:a}=o,d=(e=>{const t=(n=e.screenState,i=(e,t)=>kp.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;(r||o)&&(t.error={text:r,type:o}),e.action&&(t.action=e.action);const s=(e=>{if(!e)return;const t={};return Hp.forEach((({key:n,from:i})=>{const r=i(e);void 0!==r&&(t[n]=r)})),Object.keys(t).length?t:void 0})(e.screenState);return s&&(t.data=s),t})(t(o,["next","stepName"]));let l=yield i(this,Pv,"m",Lv).call(this,a,d,s);l||(l=Boolean(yield null===(n=this.onScreenUpdate)||void 0===n?void 0:n.call(this,a,d,s,this)));const c=!this.stepState.current.htmlFilename;if(i(this,zv,"f").call(this,l),s&&(s.isCustomScreen=l),i(this,Vv,"f")!==l){const[e,t]=["flow","custom"].sort((()=>l?-1:1));this.loggerWrapper.debug(`Switching from ${t} screen to ${e} screen`),r(this,Vv,l,"f"),l?this.stepState.unsubscribeAll():i(this,Pv,"m",Fv).call(this)}l?(this.loggerWrapper.debug("Showing a custom screen"),i(this,Pv,"m",tm).call(this,{isFirstScreen:c,isCustomScreen:l,stepName:e.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=l}))},Gv=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")},Qv=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)}))}},em=function(e,t){return n(this,void 0,void 0,(function*(){var o;null===(o=i(this,jv,"f"))||void 0===o||o.abort();const s=e.querySelector('*[autocomplete="webauthn"]');if(s&&(yield lg())){const{options:e,transactionId:o}=(yield i(this,Xv,"f").call(this))||{};e&&o&&(i(this,Pv,"m",Qv).call(this,s),r(this,jv,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,i(this,jv,"f")).then((e=>n(this,void 0,void 0,(function*(){t(s.id,{transactionId:o,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},tm=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&i(this,Pv,"m",$m).call(this,"ready",{}),t||i(this,Pv,"m",_v).call(this,n),i(this,Pv,"m",$m).call(this,"page-updated",{screenName:n}),i(this,Pv,"m",$m).call(this,"screen-updated",{screenName:n})},rm=function(e,t,n){this.setValidationTrackingEnabled(!!e.clientValidationTrackingEnabled),t&&n("executionId")&&this.setValidationTrackingExecution(t)},om=function(){var e,t,n,r,o,s,a;const d=null===(e=this.flowState)||void 0===e?void 0:e.current;return(null==d?void 0:d.executionId)?{executionId:d.executionId,screenId:d.screenId,screenName:(null===(a=null===(s=this.stepState)||void 0===s?void 0:s.current)||void 0===a?void 0:a.stepName)||d.stepName}:{executionId:void 0,screenId:null!==(t=i(this,nm,"f"))&&void 0!==t?t:null==d?void 0:d.screenId,screenName:null!==(n=i(this,im,"f"))&&void 0!==n?n:(null===(o=null===(r=this.stepState)||void 0===r?void 0:r.current)||void 0===o?void 0:o.stepName)||(null==d?void 0:d.stepName)}},sm=function(){let e=!0;const t=[];return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((n=>{var i,r;"slot"===n.localName||n.classList.contains("hidden")||(null===(i=n.reportValidity)||void 0===i||i.call(n),n.validity&&!n.validity.valid&&t.push(n),e&&(e=null===(r=n.checkValidity)||void 0===r?void 0:r.call(n)))})),t.length&&this.trackValidationErrors(t,i(this,Pv,"a",om)),e},am=function(){return n(this,void 0,void 0,(function*(){const e=this.getInputs();return(yield Promise.all(e.map((e=>n(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})),{})}))},lm=function(e){var t,o;const s=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((t=>t!==e)),a=(null===(o=null===(t=this.flowState.current)||void 0===t?void 0:t.screenState)||void 0===o?void 0:o.clientScripts)||[],d=()=>{e.removeAttribute("loading"),s.forEach((e=>{e.removeAttribute("disabled")}))},l=e=>n(this,void 0,void 0,(function*(){var t;if(this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",l),!0===(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.abandoned)&&a.length)return r(this,Rv,(()=>n(this,void 0,void 0,(function*(){try{yield this.loadSdkScripts(a)}catch(e){this.loggerWrapper.warn("Failed to refresh client scripts on popup close",null==e?void 0:e.message)}})))(),"f"),void d();d();const i=yield this.getFlowConfig(),o=[...i.clientScripts||[],...i.sdkScripts||[]];this.loadSdkScripts(o)})),c=()=>{var e;window.removeEventListener("pageshow",i(this,dm,"f")),r(this,dm,(e=>{e.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),l())}),"f"),window.addEventListener("pageshow",i(this,dm,"f"),{once:!0});const t=null===(e=this.stepState)||void 0===e?void 0:e.subscribe(((e,n)=>{e===n&&l(),this.removeEventListener("popupclosed",l),this.stepState.unsubscribe(t)}),(e=>e.screenId),{forceUpdate:!0})},u=this.nextRequestStatus.subscribe((({isLoading:t})=>{t?(this.addEventListener("popupclosed",l,{once:!0}),e.setAttribute("loading","true"),s.forEach((e=>e.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(u),"success"===this.flowStatus?(this.removeEventListener("popupclosed",l),d()):c())}))},cm=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>i(this,Pv,"m",um).call(this,e)))},um=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)}))},fm=function(e){return n(this,void 0,void 0,(function*(){if(i(this,Rv,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield i(this,Rv,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const t=this.loadSdkScriptsModules(),n=e.map((e=>e.id));for(const e of t)if(n.includes(e.id))try{"function"==typeof e.present&&((yield e.present())||this.loggerWrapper.debug(`Sdk script ${e.id} was cancelled`))}catch(t){this.loggerWrapper.error(`Failed to present ${e.id} script module`,t.message)}const r=[];for(const e of t)"function"==typeof e.refresh&&r.push(e.refresh());if(r.length>0)try{yield Lp(5e3,Promise.all(r),null)}catch(e){this.loggerWrapper.error("Failed to refresh script module",e.message)}}))},pm=function(e,t){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((n=>{n.addEventListener("input",(()=>{var r;(null===(r=n.checkValidity)||void 0===r?void 0:r.call(n))&&i(this,hm,"f").call(this,n,e,t)}))}))},gm=function(e,t,n){t&&n&&"true"===e.getAttribute("data-opt-in-last-used-auth")&&function(e,t,n){try{const n=mg();n[e]=t,ug(Cp,JSON.stringify(n))}catch(e){null==n||n.warn("[Descope] Failed to update in-flight last auth storage",String(e))}}(n,t,this.loggerWrapper)},vm=function(e){var t;const n=null===(t=gg(this.sdk.getLastUserLoginId(),this.loggerWrapper).lastUsedPerScreen)||void 0===t?void 0:t[e];if(!n)return;const i=this.contentRootElement.querySelector('descope-attachment[data-type="last-auth-badge"]'),r=this.contentRootElement.querySelector(`#${CSS.escape(n)}`);i&&r&&(r.replaceWith(i),i.appendChild(r))},mm=function(e,t){this.contentRootElement.querySelectorAll(`descope-button:not([${Jf}]), [data-type="button"]:not([${Jf}]`).forEach((n=>{n.onclick=()=>{i(this,hm,"f").call(this,n,e,t)}})),i(this,Pv,"m",pm).call(this,e,t),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Kf}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},$m=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},ym=function(e,t,n){var i;const[r,o]=(null===(i=window.name)||void 0===i?void 0:i.split("|"))||[],s={data:{code:t,exchangeError:n},action:"code"};if("descope-wc"===r&&o){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",o);try{window.opener.postMessage(s,o)}catch(e){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",null==e?void 0:e.message)}}else{this.loggerWrapper.debug("Creating popup channel",e);const t=new BroadcastChannel(e);t.postMessage(s),t.close()}try{window.close()}catch(e){}},bm.bridgeVersion=3,customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",bm);var wm=Object.freeze({__proto__:null,default:bm});const Cm=(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))]},km=(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]=Cm(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};var Sm,xm,Im,Om,Em,Am,Pm,Nm,jm,Rm,Tm;const Mm=document.createElement("template");Mm.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';const Um=o(J)(HTMLElement);class Lm extends Um{constructor(){super(),Sm.add(this),xm.set(this,new Qp({messages:[]})),Im.set(this,void 0),Om.set(this,void 0),Em.set(this,void 0),Am.set(this,{resize:i(this,Sm,"m",Tm).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Mm.content.cloneNode(!0)),r(this,Im,this.shadowRoot.querySelector(".debugger"),"f"),r(this,Om,i(this,Im,"f").querySelector(".content"),"f"),r(this,Em,i(this,Im,"f").querySelector(".header"),"f"),i(this,Sm,"m",Pm).call(this)}updateData(e){i(this,xm,"f").update((t=>({messages:t.messages.concat(e)})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;null===(t=e.init)||void 0===t||t.call(this),km(i(this,Im,"f"),i(this,Em,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",i(this,Am,"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}})(i(this,Im,"f")),i(this,Im,"f").onresize=i(this,Sm,"m",Rm).bind(this),i(this,xm,"f").subscribe(i(this,Sm,"m",Nm).bind(this))}))}disconnectedCallback(){i(this,xm,"f").unsubscribeAll(),window.removeEventListener("resize",i(this,Am,"f").resize)}}xm=new WeakMap,Im=new WeakMap,Om=new WeakMap,Em=new WeakMap,Am=new WeakMap,Sm=new WeakSet,Pm=function(){this.injectStyle('\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'),i(this,Im,"f").style.top="32px",i(this,Im,"f").style.left=window.innerWidth-300-32+"px"},Nm=function(e){i(this,Sm,"m",jm).call(this,e),i(this,Sm,"m",Rm).call(this)},jm=function(e){i(this,Om,"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("")},Rm=function(){i(this,Om,"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)}))},Tm=function(){const[e,t]=Cm(i(this,Im,"f"),Number.parseInt(i(this,Im,"f").style.left,10),Number.parseInt(i(this,Im,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});i(this,Im,"f").style.top=`${t}px`,i(this,Im,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Lm);var _m=Object.freeze({__proto__:null,default:Lm});return Cf}();
|
|
5
|
+
this["descope-user-management-widget"]=function(){"use strict";var e=function(){return e=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},e.apply(this,arguments)};function t(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 n(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 i(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 r(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 o(...e){return t=>e.reduce(((e,t)=>t(e)),t)}"function"==typeof SuppressedError&&SuppressedError;const s=e=>{const t=document.createElement("template");return t.innerHTML=e,t},a=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),d=e=>{let t,n;return(...i)=>(t&&a(t,i)||(t=i,n=e(...i)),n)},l=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])||""}`}),""),c=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},u=(e={})=>{const t=s("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),(e=>"string"==typeof e?e:"boolean"==typeof e?String(e):(e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype)(e)?JSON.stringify(e):"")(n))})),t},h=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 f,p,g,v;function m(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(!m(o,s))return!1}else if(o!==s)return!1}return!0}let $=class{constructor(e={},{forceUpdate:t=!1}={}){f.set(this,void 0),p.set(this,{}),g.set(this,0),v.set(this,!0),this.update=e=>{const t="function"==typeof e?e(i(this,f,"f")):e,n=Object.assign(Object.assign({},i(this,f,"f")),t);if(i(this,v,"f")||!m(i(this,f,"f"),n)){const e=i(this,f,"f");r(this,f,n,"f"),Object.freeze(i(this,f,"f")),setTimeout((()=>{Object.values(i(this,p,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},r(this,f,e,"f"),r(this,v,t,"f")}get current(){return Object.assign({},i(this,f,"f"))}subscribe(e){return r(this,g,i(this,g,"f")+1,"f"),i(this,p,"f")[i(this,g,"f")]=e,i(this,g,"f").toString()}unsubscribe(e){const t=!!i(this,p,"f")[e];return t&&delete i(this,p,"f")[e],t}unsubscribeAll(){return r(this,p,{},"f"),!0}};function y(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:""}}f=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakMap;const b=["error","warn","info","debug"],w={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},C=h((e=>{var t,n,o,s;return s=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,i(this,t,"m",o).call(this,w))}set logger(e){r(this,n,i(this,t,"m",o).call(this,e||w),"f")}get logger(){return i(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return b.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},s})),k="undefined"!=typeof localStorage,S="https://static.descope.com/pages",I="https://static2.descope.com/pages",x=k&&localStorage.getItem("base.content.url")||"",O=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,E=h((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)&&i(this,t,"f")&&(r(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),A=h((e=>{var t,n;const r=o(C,E)(e);return n=class extends r{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,r;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,r=e=>{var n;null===(n=i(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>r(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&r(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){i(this,t,"f")[e]||(i(this,t,"f")[e]=[]);const r=i(this,t,"f")[e].push(n);return()=>i(this,t,"f")[e].splice(r,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})),P=e=>t=>{var n,r,s;const a=o(C,E,A)(t),d=Object.keys(e);return s=class extends a{constructor(...e){super(...e),n.add(this),this.observeAttributes(d,i(this,n,"m",r).bind(this))}async init(){var e;d.forEach((e=>i(this,n,"m",r).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,r=function(t,n){const i=e[t],r="function"==typeof i?i(t,n):i;r&&this.logger.error(r)},s};P.missingAttrValidator=O;const N=h((e=>{const t=o(P({"project-id":O}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),j=h((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),R="Trying the next fallback URL...",T=async(e,t,{logger:n}={})=>{try{return await fetch(e,t)}catch(i){return null==n||n.debug(`Network error fetching URL ${e} [${i.message}], retrying...`),fetch(e,t)}};const M=h((e=>{var t,n,s,a,d,l,c;const u=o(C,N,j)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,new Set)}async fetchStaticResource(e,n){const o=i(this,t,"m",d).call(this,e),l=Array.isArray(o)?e=>{const{baseUrl:t}=o[e];r(this,s,t,"f");for(let t=0;t<e;t++){const e=o[t].baseUrl;i(this,a,"f").add(e)}}: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 T(o.toString(),t,{logger:n});if(r.ok)return null==i||i(e),null==n||n.debug(`Successfully fetched URL ${o}`),r;const a=`Error fetching URL ${o} [${r.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${R}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${R}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:l});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,s=new WeakMap,a=new WeakMap,t=new WeakSet,d=function(e){const o=x||this.baseStaticUrl;if(o)return i(this,t,"m",l).call(this,e,o);i(this,n,"f")!==this.baseUrl&&(r(this,n,this.baseUrl,"f"),r(this,s,void 0,"f"),i(this,a,"f").clear());const d=[];if(i(this,s,"f"))d.push(i(this,t,"m",l).call(this,e,i(this,s,"f"))),i(this,s,"f")===S&&d.push(i(this,t,"m",l).call(this,e,I));else{const n=this.baseUrl+"/pages";this.baseUrl&&!i(this,a,"f").has(n)&&d.push(i(this,t,"m",l).call(this,e,n)),i(this,a,"f").has(S)||d.push(i(this,t,"m",l).call(this,e,S)),d.push(i(this,t,"m",l).call(this,e,I))}return 1===d.length?d[0]:d},l=function(e,t){return function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i=S}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}({projectId:this.projectId,filename:e,baseUrl:t})},c})),U=h((e=>{var t,n;const r=o(P({"project-id":O}))(e);return n=class extends r{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(i(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return i(this,t,"f").set(e,n),()=>{i(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(i(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!i(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=i(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),L=h((e=>{var t,n,s,a,d;const l=o(M,U,E)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.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",i(this,t,"m",n).bind(this))}get config(){return i(this,s,"f")||r(this,s,i(this,a,"f").call(this),"f"),i(this,s,"f")}},s=new WeakMap,a=new WeakMap,t=new WeakSet,n=function(){r(this,s,void 0,"f")},d})),_=h((e=>{var t,n,s,a,d,l,c;return c=class extends(o(E,C)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,r)=>{var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,r),"debug"===e&&i(this,t,"m",d).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var r;null===(r=super.onLogEvent)||void 0===r||r.call(this,e,n),"error"===e&&i(this,t,"m",l).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),i(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){var e;null===(e=i(this,n,"f"))||void 0===e||e.remove(),r(this,n,null,"f")},a=async function(){r(this,n,document.createElement("descope-debugger"),"f"),Object.assign(i(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return _f})),document.body.appendChild(i(this,n,"f"))},d=function(){this.debug?i(this,t,"m",a).call(this):i(this,t,"m",s).call(this)},l=function(e,t){var r;e&&(null===(r=i(this,n,"f"))||void 0===r||r.updateData({title:e,description:t}))},c})),W=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],D=e=>{let t=0;const n=e.toString();for(let e=0;e<n.length;e++){t=(t<<5)-t+n.charCodeAt(e),t|=0}return`${Math.abs(t).toString()}`},F=(e,t,n)=>new Promise(((i,r)=>{const o=((e,t)=>{const n=document.createElement("script");return n.id=e,t&&(n.integrity=t,n.crossOrigin="anonymous"),window.DESCOPE_NONCE&&n.setAttribute("nonce",window.DESCOPE_NONCE),n})(e,n);o.onerror=e=>{o.setAttribute("status","error"),r(e)},o.onload=()=>{o.setAttribute("status","loaded"),i(o)},o.src=t.toString(),document.body.appendChild(o)})),q=(e,t)=>{if(t){const n=e.integrity;if(n!==t)return Promise.reject(new Error(`Integrity mismatch: expected ${t}, found ${n}`))}return"loaded"===e.getAttribute("status")?Promise.resolve(e):(e=>"error"===e.getAttribute("status"))(e)?Promise.reject():new Promise(((t,n)=>{e.addEventListener("load",(()=>{t(e)})),e.addEventListener("error",(e=>{n(e)}))}))},B=h((e=>{const t=o(C)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(e,t,n="",i=[],r){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"${r?" with SRI integrity check":""}`),(async(e,t)=>{for(const i of e){const{id:e,url:r,integrity:o}=i,s=(n=e,document.querySelector(`script#${n}`));if(s)try{return await q(s,o),i}catch(e){t(i,!0)}else try{return await F(e,r,o),i}catch(e){t(i,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,i="",r)=>e.reduce(((e,o)=>{const s=o;if(!s)return e;let a;try{a=new URL(s)}catch(e){throw new Error(`Invalid URL: ${s}`)}"/"!==a.pathname||(a.pathname=`/npm/${t}@${n}/${i}`);const d={url:a,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${D(a)}`};return r&&(d.integrity=r),[...e,d]}),[]))([...i,this.baseCdnUrl,...W],e,t,n,r),((e,t)=>{t?this.logger.error(`Existing script cannot be loaded: "${e.url}"`):this.logger.error(`Cannot load script from URL, Make sure this URL is valid and return the correct script: "${e.url}"`)}))}}})),V="base.ui.components.url",H=k&&localStorage.getItem(V),z=h((e=>{var t,n,s,a,d,l,c;const u=o(C,L,B)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),a.set(this,void 0)}get descopeUi(){return i(this,a,"f")||r(this,a,i(this,t,"m",l).call(this),"f"),i(this,a,"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=>i(this,t,"m",d).call(this,e))))}},a=new WeakMap,t=new WeakSet,n=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},s=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersionSri;return n&&this.logger.debug("SRI hash available for components"),n},d=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(", ")}"`)},l=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const e=await i(this,t,"m",n).call(this),r=H?void 0:await i(this,t,"m",s).call(this);return await this.injectNpmLib("@descope/web-components-ui",e,"dist/umd/index.js",[H],r),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},c})),G=h((e=>{var t,n,r;const s=o(E,A)(e);return r=class extends s{constructor(){super(...arguments),t.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.observeAttribute("nonce",i(this,t,"m",n).bind(this)),i(this,t,"m",n).call(this)}},t=new WeakSet,n=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},r}));class K{constructor(e,t,{prepend:n=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(n?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return null===(e=this.styleEle.sheet)||void 0===e?void 0:e.cssRules}}const J=h((e=>{const t=o(G)(e);return class extends t{injectStyle(e,{prepend:t=!1}={}){let n;try{n=new CSSStyleSheet}catch(e){n=new K(this.shadowRoot,this.nonce,{prepend:t})}if(e&&n.replaceSync(e),n instanceof CSSStyleSheet){const e=this.shadowRoot;if(e&&"adoptedStyleSheets"in e){const i=[...e.adoptedStyleSheets||[]];i[t?"unshift":"push"](n),e.adoptedStyleSheets=i}}return n}}})),Y="content-root",Z="root",X=h((e=>{const t=o(J)(e);return class extends t{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${Z}">\n <div id="${Y}"></div>\n </div>\n `,this.injectStyle(`\n #${Z}, #${Y} {\n height: 100%;\n }\n #${Z} {\n position: relative;\n height: fit-content;\n }\n `),this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Y),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Z)}}})),Q="descope-modal";var ee,te,ne;let ie=class{constructor(e,t){ee.set(this,void 0),this.nodeName="",r(this,ee,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)})))(i(this,ee,"f"))}get ele(){var e,t;const n="function"==typeof i(this,ee,"f")?i(this,ee,"f").call(this):i(this,ee,"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)}get isExists(){return!!this.ele}};ee=new WeakMap;let re=class extends ie{constructor(){super(...arguments),this.nodeName="descope-filter",te.set(this,null)}get data(){var e;try{return JSON.parse((null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data"))||"[]")}catch(e){return[]}}set data(e){var t,n;r(this,te,JSON.stringify(e),"f"),i(this,te,"f")!==(null===(t=this.ele)||void 0===t?void 0:t.getAttribute("data"))&&(null===(n=this.ele)||void 0===n||n.setAttribute("data",i(this,te,"f")))}get value(){var e;try{return JSON.parse((null===(e=this.ele)||void 0===e?void 0:e.getAttribute("value"))||"[]")}catch(e){return[]}}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",JSON.stringify(e))}onApply(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("filter-apply",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("filter-apply",n)}}onClear(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("filter-clear",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("filter-clear",n)}}onDataChange(e){const t=this.ele;if(!t)return()=>{};const n=new MutationObserver((()=>{var n;(null!==(n=t.getAttribute("data"))&&void 0!==n?n:"[]")!==i(this,te,"f")&&e()}));return n.observe(t,{attributes:!0,attributeFilter:["data"]}),()=>n.disconnect()}};te=new WeakMap;let oe=class extends ie{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")}},se=class extends ie{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")}start(){var e,t;null===(t=null===(e=this.ele)||void 0===e?void 0:e.start)||void 0===t||t.call(e)}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}onPageUpdated(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("page-updated",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("page-updated",e)}}},ae=class extends oe{get flowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id"))||""}get enableMode(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("enable-mode")}};const de=/^descope-grid-([^-]+)-column$/,le={text:class extends ie{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 ie{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 ce=class extends ie{constructor(){super(...arguments),this.nodeName="descope-grid",ne.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=de.exec(t.localName))||void 0===n?void 0:n[1],r=le[i];return r?(e.push(new r(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const r=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);r&&this.ele.columns&&(a(r,this.ele.columns)||(this.ele.columns=r,null===(n=i(this,ne,"f"))||void 0===n||n.call(this,r)))}onColumnsChange(e){r(this,ne,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};var ue,he,fe,pe;ne=new WeakMap;let ge=class extends ie{constructor(...e){super(...e),ue.add(this),he.set(this,void 0),fe.set(this,void 0),this.nodeName="descope-modal",i(this,ue,"m",pe).call(this)}get isOpen(){var e;return"true"===(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("opened"))}get isClosed(){return!this.isOpen}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),i(this,ue,"m",pe).call(this),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),i(this,he,"f")&&(null===(e=this.ele)||void 0===e||e.append(i(this,he,"f").content.cloneNode(!0)))}setContent(e){r(this,he,e,"f"),this.reset()}remove(){var e,t;null===(e=i(this,fe,"f"))||void 0===e||e.disconnect(),null===(t=this.ele)||void 0===t||t.remove()}};he=new WeakMap,fe=new WeakMap,ue=new WeakSet,pe=function(){if(i(this,fe,"f"))return;const e=this.ele;e&&(r(this,fe,new MutationObserver((t=>{t.forEach(((n,i)=>{var r;const o="true"===n.oldValue,s=t[i+1]?t[i+1].oldValue:e.getAttribute("opened");o&&"true"!==s&&(null===(r=this.afterClose)||void 0===r||r.call(this))}))})),"f"),i(this,fe,"f").observe(e,{attributes:!0,attributeFilter:["opened"],attributeOldValue:!0}))};let ve=class extends ie{constructor(){super(...arguments),this.nodeName="descope-multi-line-mappings"}setData(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("data",JSON.stringify(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)}get mergedValue(){return Object.entries(this.value.filter((({tenantId:e})=>!!e)).reduce(((e,{tenantId:t,roleNames:n})=>(e[t]=[...new Set([...e[t]||[],...n])],e)),{})).map((([e,t])=>({tenantId:e,roleNames:t})))}};const me=({label:e,value:t,description:n})=>{const i=document.createElement("span");i.setAttribute("data-name",e),i.setAttribute("data-id",t),i.style.display="flex",i.style.flexDirection="column";const r=document.createElement("span");if(r.textContent=e,i.appendChild(r),n){const e=document.createElement("span");e.textContent=n,e.style.opacity="0.6",e.style.fontSize="0.85em",i.appendChild(e)}return i.outerHTML};let $e=class extends ie{constructor(){super(...arguments),this.nodeName="descope-multi-select-combo-box"}async setData(e){const t=await this.asyncEle;t&&(e.some((e=>e.description))&&(t.renderItem=me),t.setAttribute("data",JSON.stringify([...e].sort(((e,t)=>e.label.localeCompare(t.label))))))}},ye=class extends ie{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()}},be=class extends ie{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)}},we=class extends ie{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")}};const Ce=h((e=>{var t,n;const r=o(E,X,z)(e);return n=class extends r{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ge{setContent(t){e(t),super.setContent(t)}}})())}get modalDriverClass(){return i(this,t,"f")}createModal(e,n=i(this,t,"f")){const r=((e={})=>{const t=document.createElement(Q);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(r),new n(r,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Q]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),ke=h((e=>class extends(Ce(e)){createFlowModal(e){const t=this.modalDriverClass;return this.createModal(e,class extends t{setContent(e){const t=e.content.querySelector("descope-wc");t&&!t.hasAttribute("lazy-start")&&t.setAttribute("lazy-start","true"),super.setContent(e)}async open(){var e,t,n;await super.open(),null===(n=null===(t=null===(e=this.ele)||void 0===e?void 0:e.querySelector("descope-wc"))||void 0===t?void 0:t.start)||void 0===n||n.call(t)}})}})),Se="descope-notification",Ie=h((e=>{var t,n;const r=o(E,X,z)(e);return n=class extends r{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ye{setContent(t){const n="string"==typeof t?s(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Se);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(i(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([Se])}},t=new WeakMap,n})),xe="theme",Oe=(e,t,n="")=>Object.entries(e).reduce(((e,[i,r])=>{if(!/^[a-zA-Z0-9-]+$/.test(i))return t("Ignoring invalid override-css token path segment"),e;const o=n?`${n}-${i}`:i;if("object"==typeof r&&null!==r)return e+Oe(r,t,o);const s=(e=>"number"==typeof e?Number.isFinite(e)?String(e):null:"string"!=typeof e||/[;{}]/.test(e)?null:e.trim())(r);return null===s?(t("Ignoring invalid override-css token value"),e):`${e}--descope-${o}:${s};`}),"");function Ee(e,t){const n=Object.assign({},e);for(const[e,i]of Object.entries(t||{}))if(null!=i)if("object"==typeof i){if(0===Object.keys(i).length)continue;n[e]=Ee(n[e]||{},i)}else n[e]="string"==typeof i?(n[e]||"")+i:i;return n}const Ae=(e,t)=>null!==t&&!/^[a-zA-Z0-9_-]*$/.test(t)&&"tenant must contain only alphanumeric characters, hyphens, or underscores",Pe=h((e=>{const t=o(P({tenant:Ae}))(e);return class extends t{get tenantId(){return this.getAttribute("tenant")||void 0}}})),Ne=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',je=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g,v,m,$,y,b,w,C,k,S,I;const x=o(P({theme:Ne}),Pe,M,E,z,L,X,A,J)(e);return I=class extends x{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,void 0),l.set(this,void 0),c.set(this,void 0),C.set(this,(()=>{i(this,t,"m",k).call(this),i(this,S,"f").call(this,"os"===this.getAttribute("theme"))})),S.set(this,(e=>{var n,r,o;const s=e?"addEventListener":"removeEventListener";null===(o=null===(r=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===r?void 0:r[s])||void 0===o||o.call(r,"change",(()=>i(this,t,"m",k).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")||xe}get themeOverride(){const e=this.getAttribute("theme-override");if(!e)return null;try{return JSON.parse(e)}catch(e){return this.logger.error("Failed to parse theme-override attribute. error: ",e),null}}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),i(this,C,"f").call(this),await Promise.all([i(this,t,"m",f).call(this),i(this,t,"m",v).call(this),i(this,t,"m",$).call(this)]),i(this,t,"m",m).call(this),this.observeAttributes(["theme"],i(this,C,"f")),this.observeAttributes(["theme-override"],(()=>i(this,t,"m",m).call(this))),this.observeAttributes(["tenant"],(()=>{r(this,c,null,"f"),i(this,t,"m",v).call(this),i(this,t,"m",$).call(this)})),this.observeAttributes(["style-id"],(()=>{r(this,l,null,"f"),i(this,t,"m",b).call(this),i(this,t,"m",f).call(this),i(this,t,"m",$).call(this)}))}},n=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,C=new WeakMap,S=new WeakMap,t=new WeakSet,d=function(){const e=this.themeOverride;return e?["light","dark"].map((t=>{var n,i,r,o,s,a;const d=null===(r=null===(i=null===(n=e[t])||void 0===n?void 0:n.globals)||void 0===i?void 0:i.colors)||void 0===r?void 0:r.primary,l=null===(a=null===(s=null===(o=e[t])||void 0===o?void 0:o.globals)||void 0===s?void 0:s.colors)||void 0===a?void 0:a.secondary;return d||l?`[data-theme="${t}"]{${Oe({colors:{primary:d,secondary:l}},(e=>this.logger.error(e)))}}`:""})).join(""):""},u=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(V))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(V),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")}},h=function(){return i(this,l,"f")||(r(this,l,i(this,t,"m",u).call(this),"f"),i(this,l,"f").then((e=>this.logger.debug("Fetched theme",e)))),i(this,l,"f")},f=async function(){var e,o;const s=await i(this,t,"a",h);if(!s)return;const a=((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.globals)||"")+((null===(o=null==s?void 0:s.dark)||void 0===o?void 0:o.globals)||"");i(this,n,"f")?i(this,n,"f").replaceSync(a):r(this,n,this.injectStyle(a,{prepend:!0}),"f")},p=async function(){const e=this.tenantId;if(e)try{const{body:t}=await this.fetchStaticResource(`${e}/theme.json`,"json");return t}catch(e){this.logger.warn("No tenant style exists, using project default theme.")}},g=function(){return i(this,c,"f")||r(this,c,i(this,t,"m",p).call(this),"f"),i(this,c,"f")},v=async function(){var e,n,o,a;if(!this.tenantId)return void(null===(e=i(this,s,"f"))||void 0===e||e.replaceSync(""));const d=await i(this,t,"a",g);if(!d)return void(null===(n=i(this,s,"f"))||void 0===n||n.replaceSync(""));const l=((null===(o=d.light)||void 0===o?void 0:o.globals)||"")+((null===(a=d.dark)||void 0===a?void 0:a.globals)||"");i(this,s,"f")?i(this,s,"f").replaceSync(l):r(this,s,this.injectStyle(l),"f")},m=async function(){var e;if(!this.themeOverride)return void(null===(e=i(this,a,"f"))||void 0===e||e.replaceSync(""));const n=i(this,t,"m",d).call(this);i(this,a,"f")?i(this,a,"f").replaceSync(n):r(this,a,this.injectStyle(n),"f")},$=async function(){var e,n,r,o;const s=await i(this,t,"a",h);if(!s)return;const a=await this.descopeUi;if(!(null==a?void 0:a.componentsThemeManager))return;const d=await i(this,t,"a",g);a.componentsThemeManager.themes={light:Ee((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.components)||{},(null===(n=null==d?void 0:d.light)||void 0===n?void 0:n.components)||{}),dark:Ee((null===(r=null==s?void 0:s.dark)||void 0===r?void 0:r.components)||{},(null===(o=null==d?void 0:d.dark)||void 0===o?void 0:o.components)||{})}},y=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},b=async function(){const e=await i(this,t,"m",y).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")},w=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)},k=function(){i(this,t,"m",b).call(this),i(this,t,"m",w).call(this)},I}));var Re=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Te=()=>Math.random().toString(36).substring(7).split("").join("."),Me={INIT:`@@redux/INIT${Te()}`,REPLACE:`@@redux/REPLACE${Te()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Te()}`};function Ue(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 Le(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 _e(e){let t=typeof e;return t=Le(e),t}function We(e,t,n){if("function"!=typeof e)throw new Error(`Expected the root reducer to be a function. Instead, received: '${_e(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("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(`Expected the enhancer to be a function. Instead, received: '${_e(n)}'`);return n(We)(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("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(`Expected the listener to be a function. Instead, received: '${_e(e)}'`);if(d)throw new Error("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("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(!Ue(e))throw new Error(`Actions must be plain objects. Instead, the actual type was: '${_e(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('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(`Action "type" property must be a string. Instead, the actual type was: '${_e(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,r=i(r,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Me.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(`Expected the nextReducer to be a function. Instead, received: '${_e(e)}`);i=e,h({type:Me.REPLACE})},[Re]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(`Expected the observer to be an object. Instead, received: '${_e(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Re](){return this}}}}}function De(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Fe(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];void 0===e[r]&&De(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r,o;r={};try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Me.INIT}))throw new Error(`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:Me.PROBE_UNKNOWN_ACTION()}))throw new Error(`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Me.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;{const i=function(e,t,n,i){const r=Object.keys(t),o=n&&n.type===Me.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(!Ue(e))return`The ${o} has unexpected type of "${_e(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===Me.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&&De(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(`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 qe(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Be(e){return Ue(e)&&"type"in e&&"string"==typeof e.type}var Ve=Symbol.for("immer-nothing"),He=Symbol.for("immer-draftable"),ze=Symbol.for("immer-state"),Ge=[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 Ke(e,...t){{const n=Ge[e],i="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${i}`)}}var Je=Object.getPrototypeOf;function Ye(e){return!!e&&!!e[ze]}function Ze(e){return!!e&&(Qe(e)||Array.isArray(e)||!!e[He]||!!e.constructor?.[He]||rt(e)||ot(e))}var Xe=Object.prototype.constructor.toString();function Qe(e){if(!e||"object"!=typeof e)return!1;const t=Je(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)===Xe}function et(e,t){0===tt(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function tt(e){const t=e[ze];return t?t.type_:Array.isArray(e)?1:rt(e)?2:ot(e)?3:0}function nt(e,t){return 2===tt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function it(e,t,n){const i=tt(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function rt(e){return e instanceof Map}function ot(e){return e instanceof Set}function st(e){return e.copy_||e.base_}function at(e,t){if(rt(e))return new Map(e);if(ot(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Qe(e)){if(!Je(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ze];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(Je(e),n)}function dt(e,t=!1){return ct(e)||Ye(e)||!Ze(e)||(tt(e)>1&&(e.set=e.add=e.clear=e.delete=lt),Object.freeze(e),t&&et(e,((e,t)=>dt(t,!0)))),e}function lt(){Ke(2)}function ct(e){return Object.isFrozen(e)}var ut,ht={};function ft(e){const t=ht[e];return t||Ke(0,e),t}function pt(){return ut}function gt(e,t){t&&(ft("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function vt(e){mt(e),e.drafts_.forEach(yt),e.drafts_=null}function mt(e){e===ut&&(ut=e.parent_)}function $t(e){return ut={drafts_:[],parent_:ut,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yt(e){const t=e[ze];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function bt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ze].modified_&&(vt(t),Ke(4)),Ze(e)&&(e=wt(t,e),t.parent_||kt(t,e)),t.patches_&&ft("Patches").generateReplacementPatches_(n[ze].base_,e,t.patches_,t.inversePatches_)):e=wt(t,n,[]),vt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ve?e:void 0}function wt(e,t,n){if(ct(t))return t;const i=t[ze];if(!i)return et(t,((r,o)=>Ct(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return kt(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),et(r,((r,s)=>Ct(e,i,t,r,s,n,o))),kt(e,t,!1),n&&e.patches_&&ft("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Ct(e,t,n,i,r,o,s){if(r===n&&Ke(5),Ye(r)){const s=wt(e,r,o&&t&&3!==t.type_&&!nt(t.assigned_,i)?o.concat(i):void 0);if(it(n,i,s),!Ye(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(Ze(r)&&!ct(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;wt(e,r),t&&t.scope_.parent_||kt(e,r)}}function kt(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&dt(t,n)}var St={get(e,t){if(t===ze)return e;const n=st(e);if(!nt(n,t))return function(e,t,n){const i=Ot(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_||!Ze(i)?i:i===xt(e.base_,t)?(At(e),e.copy_[t]=Pt(i,e)):i},has:(e,t)=>t in st(e),ownKeys:e=>Reflect.ownKeys(st(e)),set(e,t,n){const i=Ot(st(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=xt(st(e),t),r=i?.[ze];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||nt(e.base_,t)))return!0;At(e),Et(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!==xt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,At(e),Et(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=st(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){Ke(11)},getPrototypeOf:e=>Je(e.base_),setPrototypeOf(){Ke(12)}},It={};function xt(e,t){const n=e[ze];return(n?st(n):e)[t]}function Ot(e,t){if(!(t in e))return;let n=Je(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Je(n)}}function Et(e){e.modified_||(e.modified_=!0,e.parent_&&Et(e.parent_))}function At(e){e.copy_||(e.copy_=at(e.base_,e.scope_.immer_.useStrictShallowCopy_))}et(St,((e,t)=>{It[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),It.deleteProperty=function(e,t){return isNaN(parseInt(t))&&Ke(13),It.set.call(this,e,t,void 0)},It.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&Ke(14),St.set.call(this,e[0],t,n,e[0])};function Pt(e,t){const n=rt(e)?ft("MapSet").proxyMap_(e,t):ot(e)?ft("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:pt(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=St;n&&(r=[i],o=It);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:pt()).drafts_.push(n),n}function Nt(e){return Ye(e)||Ke(10,e),jt(e)}function jt(e){if(!Ze(e)||ct(e))return e;const t=e[ze];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=at(e,t.scope_.immer_.useStrictShallowCopy_)}else n=at(e,!0);return et(n,((e,t)=>{it(n,e,jt(t))})),t&&(t.finalized_=!1),n}var Rt=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&&Ke(6),void 0!==n&&"function"!=typeof n&&Ke(7),Ze(e)){const r=$t(this),o=Pt(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?vt(r):mt(r)}return gt(r,n),bt(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===Ve&&(i=void 0),this.autoFreeze_&&dt(i,!0),n){const t=[],r=[];ft("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}Ke(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){Ze(e)||Ke(8),Ye(e)&&(e=Nt(e));const t=$t(this),n=Pt(e,void 0);return n[ze].isManual_=!0,mt(t),n}finishDraft(e,t){const n=e&&e[ze];n&&n.isManual_||Ke(9);const{scope_:i}=n;return gt(i,t),bt(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=ft("Patches").applyPatches_;return Ye(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},Tt=Rt.produce;Rt.produceWithPatches.bind(Rt),Rt.setAutoFreeze.bind(Rt),Rt.setUseStrictShallowCopy.bind(Rt),Rt.applyPatches.bind(Rt),Rt.createDraft.bind(Rt),Rt.finishDraft.bind(Rt);var Mt=(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})}}},Ut=(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})}},Lt={inputStabilityCheck:"once",identityFunctionCheck:"once"};var _t=e=>Array.isArray(e)?e:[e];function Wt(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 Dt(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var Ft="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},qt=0,Bt=1;function Vt(){return{s:qt,v:void 0,o:null,p:null}}function Ht(e,t={}){let n=Vt();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=Vt(),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=Vt(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===Bt)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 Ft(d):d}return a.s=Bt,a.v=d,d}return s.clearCache=()=>{n=Vt(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function zt(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=Ht,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=_t(l),p=_t(u),g=Wt(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const $=c((function(){r++;const e=Dt(g,arguments);t=v.apply(null,e);{const{identityFunctionCheck:n,inputStabilityCheck:i}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:i}={...Lt,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Mt},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Ut}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=Dt(g,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign($,{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 Gt=zt(Ht),Kt=Object.assign(((e,t=Gt)=>{!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:()=>Kt});function Jt(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var Yt=Jt(),Zt=Jt;((...e)=>{const t=zt(...e)})(Ht);var Xt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?qe:qe.apply(null,arguments)},Qt=e=>e&&"function"==typeof e.match;function en(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("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=>Be(t)&&t.type===e,n}function tn(e){return"function"==typeof e&&"type"in e&&Qt(e)}function nn(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 rn=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 on(e){return Ze(e)?Tt(e,(()=>{})):e}function sn(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("No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function an(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function dn(e,t,n){const i=ln(e,t,n);return{detectMutations:()=>cn(e,t,i,n)}}function ln(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]=ln(e,t,n[r],s))}}return o}function cn(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=cn(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function un(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ue(e)}function hn(e,t="",n=un,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=hn(l,a,n,i,r,o),s))return s}return o&&fn(e)&&o.add(e),!1}function fn(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!fn(t))return!1;return!0}function pn(e){return"boolean"==typeof e}var gn=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new rn;if(t&&(pn(t)?o.push(Yt):o.push(Zt(t.extraArgument))),n){let e={};pn(n)||(e=n),o.unshift(function(e={}){{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=an,ignoredPaths:r,warnAfter:o=32}=e;const s=dn.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=nn(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error(`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(`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={};pn(i)||(e=i),o.push(function(e={}){{const{isSerializable:t=un,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(!Be(u))return l(u);const h=l(u),f=nn(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=hn(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=hn(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={};pn(r)||(e=r),o.unshift(function(e={}){const{isActionCreator:t=tn}=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},vn=e=>t=>{setTimeout(t,e)},mn="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:vn(10),$n=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new rn(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?mn:"callback"===e.type?e.queueNotification:vn(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};function yn(e){const t=gn(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ue(n))throw new Error("`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Fe(n)}if(i&&"function"!=typeof i)throw new Error("`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!Array.isArray(d))throw new Error("when using a middleware builder function, an array of middleware must be returned")}else d=t();if(d.some((e=>"function"!=typeof e)))throw new Error("each middleware provided to configureStore must be a function");let l=qe;r&&(l=Xt({trace:!0,..."object"==typeof r&&r}));const c=function(...e){return t=>(n,i)=>{const r=t(n,i);let o=()=>{throw new Error("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=qe(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=$n(c);if(s&&"function"!=typeof s)throw new Error("`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Array.isArray(h))throw new Error("`enhancers` callback must return an array");if(h.some((e=>"function"!=typeof e)))throw new Error("each enhancer provided to configureStore must be a function");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 We(a,o,l(...h))}function bn(e){const t={},n=[];let i;const r={addCase(e,o){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");const s="string"==typeof e?e:e.type;if(!s)throw new Error("`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error(`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,r},addMatcher(e,t){if(i)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if(i)throw new Error("`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function wn(...e){return t=>e.some((e=>((e,t)=>Qt(e)?e.match(t):e(t))(e,t)))}var Cn=["name","message","stack","code"],kn=class{constructor(e,t){this.payload=e,this.meta=t}_type},Sn=class{constructor(e,t){this.payload=e,this.meta=t}_type},In=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Cn)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},xn=(()=>{function e(e,t,n){const i=en(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=en(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=en(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||In)(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 kn(e,t),fulfillWithValue:(e,t)=>new Sn(e,t)})).then((t=>{if(t instanceof kn)throw t;return t instanceof Sn?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof kn?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(On)})}}),{pending:r,rejected:o,fulfilled:i,settled:wn(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function On(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var En=Symbol.for("rtk-slice-createasyncthunk");function An(e,t){return`${e}/${t}`}function Pn(e,t,n,i){function r(r,...o){let s=n.call(e,r);if(void 0===s){if(!i)throw new Error("selectState returned undefined for an uninjected slice reducer");s=e.getInitialState()}return t(s,...o)}return r.unwrapped=t,r}var Nn=function({creators:e}={}){const t=e?.asyncThunk?.[En];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("`name` is a required option for createSlice");"undefined"!=typeof process&&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("`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("`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("object"==typeof e.extraReducers)throw new Error("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?bn(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("object"==typeof t)throw new Error("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]=bn(t);if(function(e){return"function"==typeof e}(e))n=()=>on(e());else{const t=on(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(Ye(e)){const i=n(e,t);return void 0===i?e:i}if(Ze(e))return Tt(e,(e=>n(e,t)));{const i=n(e,t);if(void 0===i){if(null===e)return e;throw new Error("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:An(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("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?en(e,s):en(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("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||jn,pending:a||jn,rejected:d||jn,settled:l||jn})}(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=sn(c,this,{insert:()=>new WeakMap});return sn(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Pn(this,r,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t){if(this===h)throw new Error("selectSlice returned undefined for an uninjected slice reducer");t=this.getInitialState()}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 jn(){}var Rn="listenerMiddleware";en(`${Rn}/add`),en(`${Rn}/removeAll`),en(`${Rn}/remove`);const Tn=e=>h((t=>{const n=Nn(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(o(C)(t)){constructor(...e){super(...e);const t=yn({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{On(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()))))}}})),Mn=h((e=>class extends(C(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()}})),Un=h((e=>{const t=o(P({"widget-id":O}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}}})),Ln=h((e=>{const t=o(L,Un)(e);return class extends t{async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async getWidgetConfig(){var e,t;const n=await this.config;return null===(t=null===(e=null==n?void 0:n.projectConfig)||void 0===e?void 0:e.widgets)||void 0===t?void 0:t[this.widgetId]}}})),_n=h((e=>class extends e{get locale(){return this.getAttribute("locale")||""}get localeCandidates(){const{locale:e,fallback:t}=y(this.locale);return[...new Set([e,t].filter(Boolean))]}firstAvailableLocale(e){var t;const n=(null!=e?e:[]).map((e=>e.toLowerCase()));return null!==(t=this.localeCandidates.find((e=>n.includes(e))))&&void 0!==t?t:""}})),Wn=e=>h((t=>{var n,r,s;const a=o(M,Un,Ln,_n)(t);return s=class extends a{constructor(){super(...arguments),n.add(this)}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async fetchWidgetPage(t){const o=await i(this,n,"m",r).call(this,t);if(void 0!==o)return o;const s=await this.fetchStaticResource(`${e}/${this.widgetId}/${t}`,"text");return null==s?void 0:s.body}},n=new WeakSet,r=async function(t){var n;const i=await this.getWidgetConfig(),r=this.firstAvailableLocale(null!==(n=null==i?void 0:i.targetLocales)&&void 0!==n?n:[]);if(!r)return;const o=".html",s=t.endsWith(o)?t.slice(0,-5):t;try{const t=await this.fetchStaticResource(`${e}/${this.widgetId}/${s}-${r}${o}`,"text");return null==t?void 0:t.body}catch(e){return}},s})),Dn=h((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),Fn=k&&localStorage.getItem("base.debug.logs.url"),qn=h((e=>{const t=o(P({"flow-id":O}))(e);return class extends t{get flowId(){return this.getAttribute("flow-id")}}}));function Bn(e){const t=Math.floor(e/1e3);if(t<60)return`${t} seconds`;const n=Math.floor(t/60);if(n<60)return`${n} minutes`;const i=Math.floor(n/60);return i<24?`${i} hours`:`${Math.floor(i/24)} days`}const Vn=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g;const v=o(B,C,E,L,N,qn)(e);return g=class extends v{constructor(){super(...arguments),t.add(this),n.set(this,null),s.set(this,!1),a.set(this,null),p.set(this,null)}get telemetryManager(){return i(this,n,"f")}updateTelemetryContext(e){if(i(this,n,"f"))try{i(this,n,"f").updateContext(e)}catch(e){this.logger.error("Error updating telemetry context:",e)}}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this));const n=this.sdkVersion||"1.0.0";r(this,p,i(this,t,"m",h).call(this).then((e=>i(this,t,"m",d).call(this,e,{projectId:this.projectId,flowId:this.flowId,sdkVersion:n}))).catch((e=>{this.logger.error("Failed to start telemetry:",e)})),"f")}get telemetryReady(){var e;return null!==(e=i(this,p,"f"))&&void 0!==e?e:Promise.resolve()}disconnectedCallback(){var e;null===(e=super.disconnectedCallback)||void 0===e||e.call(this),i(this,t,"m",c).call(this)}},n=new WeakMap,s=new WeakMap,a=new WeakMap,p=new WeakMap,t=new WeakSet,d=async function(e,o){if(null==e?void 0:e.enabled)if(i(this,s,"f"))this.logger.debug("Telemetry already initialized");else if(e.expiration&&Date.now()>=e.expiration)this.logger.info(`Telemetry expiration time has passed (${new Date(e.expiration).toISOString()}), skipping initialization`);else try{this.logger.debug("Initializing telemetry...");const a=e.version||"latest";await this.injectNpmLib("@descope/debug-logs",a,"dist/index.js",[Fn]);const d=window.DescopeDebugLogs;if(!d)throw new Error("DescopeDebugLogs not found after loading @descope/debug-logs. This likely means the UMD build failed to load from CDN.");if(r(this,n,new d({enabled:!0,rumConfig:e.rumConfig,capture:e.capture},{projectId:o.projectId,flowId:o.flowId,version:o.sdkVersion||"1.0.0"},this.logger),"f"),!i(this,n,"f").isReady())return this.logger.error("Telemetry manager failed to initialize (RUM client not ready)"),void r(this,n,null,"f");r(this,s,!0,"f"),this.logger.info("Telemetry initialized successfully"),e.expiration&&i(this,t,"m",l).call(this,e.expiration)}catch(e){this.logger.error("Failed to initialize telemetry:",e),r(this,s,!1,"f")}else this.logger.debug("Telemetry is disabled, skipping initialization")},l=function(e){const n=e-Date.now();if(n<=0)return this.logger.info("Telemetry expiration time reached, shutting down"),void i(this,t,"m",c).call(this);const o=864e5,s=Math.min(n,o);n>o&&this.logger.warn(`Telemetry expiration is beyond maximum timeout (${Bn(n)}). Setting to maximum.`),this.logger.info(`Telemetry will expire at ${new Date(e).toISOString()} (in ${Bn(s)})`),r(this,a,setTimeout((()=>{this.logger.info("Telemetry expiration time reached, shutting down"),i(this,t,"m",c).call(this)}),s),"f")},c=function(){if(i(this,a,"f")&&(clearTimeout(i(this,a,"f")),r(this,a,null,"f")),i(this,n,"f"))try{this.logger.debug("Shutting down telemetry..."),i(this,n,"f").shutdown(),r(this,n,null,"f"),r(this,s,!1,"f"),this.logger.info("Telemetry shutdown complete")}catch(e){this.logger.error("Error shutting down telemetry:",e)}},u=function(e){return Boolean((null==e?void 0:e.applicationId)&&(null==e?void 0:e.identityPoolId)&&(null==e?void 0:e.region))},h=async function(){var e;const n=await this.config,r=null===(e=null==n?void 0:n.projectConfig)||void 0===e?void 0:e.telemetry;let o;try{const e=Number(process.env.DESCOPE_TELEMETRY_SESSION_SAMPLE_RATE);o={enabled:"true"===(process.env.DESCOPE_TELEMETRY_ENABLED||"").toLowerCase(),rumConfig:Object.assign({applicationId:process.env.DESCOPE_TELEMETRY_APPLICATION_ID||"",identityPoolId:process.env.DESCOPE_TELEMETRY_IDENTITY_POOL_ID||"",region:process.env.DESCOPE_TELEMETRY_REGION||"",sessionSampleRate:Number.isFinite(e)&&e>0?e:1},process.env.DESCOPE_TELEMETRY_GUEST_ROLE_ARN&&{guestRoleArn:process.env.DESCOPE_TELEMETRY_GUEST_ROLE_ARN})}}catch(e){o={enabled:!1,rumConfig:{applicationId:"",identityPoolId:"",region:"",sessionSampleRate:1}}}const s=Object.assign(Object.assign(Object.assign({},o),r),{rumConfig:Object.assign(Object.assign({},o.rumConfig),null==r?void 0:r.rumConfig),capture:i(this,t,"m",f).call(this,null==r?void 0:r.capture)});return s.enabled&&!i(this,t,"m",u).call(this,s.rumConfig)&&(this.logger.warn("Telemetry enabled but rumConfig is incomplete (applicationId/identityPoolId/region required). Skipping initialization."),s.enabled=!1),r||(s.expiration=Date.now()+3e5,this.logger.debug("No backend telemetry config present; applying a 5-minute safety cap on the session.")),s},f=function(e){const t=null==e?void 0:e.dom;return!1===t?Object.assign(Object.assign({console:!0,network:!0,navigation:!0},e),{dom:!1}):Object.assign(Object.assign({console:!0,network:!0,navigation:!0},e),{dom:Object.assign(Object.assign({throttleMs:2e3},"object"==typeof t?t:{}),{rootElement:this.shadowRoot})})},g})),Hn=h((e=>{var n,r,o;return o=class extends(je(e)){constructor(){super(...arguments),n.add(this)}get clientInput(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get formInput(){return this.getAttribute("form")||void 0}createFlowTemplate(e){var{flowId:o,client:s,form:a}=e,d=t(e,["flowId","client","form"]);return u(Object.assign({projectId:this.getAttribute("project-id"),flowId:o,baseUrl:this.getAttribute("base-url")||"",baseStaticUrl:this.getAttribute("base-static-url")||"",baseCdnUrl:this.getAttribute("base-cdn-url")||"",refreshCookieName:this.getAttribute("refresh-cookie-name")||"",theme:this.theme,"style-id":this.styleId,locale:this.getAttribute("locale")||"",form:i(this,n,"m",r).call(this,a),client:Object.assign(Object.assign({},this.clientInput),s)},d))}},n=new WeakSet,r=function(e){const t=this.formInput;if(!e)return t;if(!t)return e;try{return Object.assign(Object.assign({},JSON.parse(t)),e)}catch(t){return e}},o})),zn=/(["\\])/g;function Gn(e,t){return Array.from(e.querySelectorAll(`[data-id="${n=t,"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(n):n.replace(zn,"\\$1")}"]`));var n}function Kn(e,t){e&&t&&Object.entries(t).forEach((([t,n])=>{Gn(e,t).forEach((e=>function(e,t){var n;switch(t){case"hide":e.setAttribute("hidden",""),null===(n=e.style)||void 0===n||n.setProperty("display","none","important");break;case"disable":e.setAttribute("disabled","true");break;case"read-only":e.setAttribute("readonly","true")}}(e,n)))}))}const Jn=h((e=>{var t,n,s,a,d,l;const c=o(C,X)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,{})}async init(){var e,o;if("true"===this.getAttribute("mock"))return r(this,n,Promise.resolve({}),"f"),void await(null===(e=super.init)||void 0===e?void 0:e.call(this));const s=i(this,t,"m",a).call(this);r(this,n,i(this,t,"m",d).call(this,s),"f"),await(null===(o=super.init)||void 0===o?void 0:o.call(this))}async onWidgetRootReady(){var e,t;await(null===(e=super.onWidgetRootReady)||void 0===e?void 0:e.call(this)),r(this,s,null!==(t=await i(this,n,"f"))&&void 0!==t?t:{},"f"),Kn(this.contentRootElement,i(this,s,"f"))}async reevaluateComponentsState(){const e=i(this,t,"m",a).call(this);var n,o;n=this.contentRootElement,o=i(this,s,"f"),n&&o&&Object.entries(o).forEach((([e,t])=>{Gn(n,e).forEach((e=>function(e,t){var n;switch(t){case"hide":e.removeAttribute("hidden"),null===(n=e.style)||void 0===n||n.removeProperty("display");break;case"disable":e.removeAttribute("disabled");break;case"read-only":e.removeAttribute("readonly")}}(e,t)))})),r(this,s,await i(this,t,"m",d).call(this,e),"f"),Kn(this.contentRootElement,i(this,s,"f"))}},n=new WeakMap,s=new WeakMap,t=new WeakSet,a=function(){var e;const t=null===(e=this.api)||void 0===e?void 0:e.httpClient;if(!t)throw new Error("componentsConditionsMixin: the widget sdk must expose `httpClient`. Compose apiMixin and return `webSdk.httpClient` from createSdk.");return t},d=async function(e){var t;try{const n=await e.get("/v1/mgmt/widget/components-state");if(!(null==n?void 0:n.ok))return{};const i=await n.json();return null!==(t=null==i?void 0:i.componentsState)&&void 0!==t?t:{}}catch(e){return this.logger.debug("components-conditions: failed to fetch, showing all components",null==e?void 0:e.message),{}}},l}));var Yn;!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"}(Yn||(Yn={}));const Zn=(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)}),{}),Xn=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Qn=(e,t)=>e===Yn.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t;function ei(e){return new URLSearchParams(window.location.search).get(e)}const ti={enabled:"active",disabled:"disabled",invited:"invited"},ni=e=>e.tenantRoles.data,ii=e=>e.selectedUsersLoginIds,ri=e=>e.notifications,oi=e=>e.customAttributes.data,si=Gt((e=>e.subTenantRoles.data),(e=>Object.fromEntries(e.map((({tenantId:e,tenantName:t,roleNames:n})=>[e,t?{label:t,options:n}:n]))))),ai=Gt(si,(e=>Object.keys(e).length>0)),di=Gt(oi,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),li=Gt((e=>e.usersList.data),di,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes||{}).map((([e,n])=>[e,Qn(t[e],n)])))}))))),ci=e=>{const t=[e.roleNames||[],...(e.userTenants||[]).map((e=>e.roleNames||[]))].filter((e=>e.length>0));if(0===t.length)return e.roleNames||[];const n=t.map((e=>[...e].sort().join("\0"))),i=n.every((e=>e===n[0]));return i?t[0]:"Multiple roles"},ui=Gt(li,(e=>e.map((e=>{var t;return Object.assign(Object.assign(Object.assign({},e),Xn(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:ti[e.status]||e.status,roles:ci(e),tenants:null===(t=e.userTenants)||void 0===t?void 0:t.map((e=>e.tenantName||e.tenantId))})})))),hi=Gt(ii,ui,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),fi=Gt(hi,(e=>e.map((e=>e.userId)))),pi=Gt(hi,(e=>e.map((({userId:e,loginIds:t})=>({userId:e,loginIds:t}))))),gi=Gt(hi,(e=>e.map((e=>({userId:e.userId,roles:e.roleNames}))))),vi=Gt(hi,(e=>e.map((e=>e.status)))),mi=Gt(hi,(e=>e.every((e=>e.editable)))),$i=Gt(ii,(e=>!!e.length)),yi=Gt(ii,(e=>1===e.length)),bi=Gt(ii,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),wi=Gt(yi,vi,((e,t)=>e&&t.every((e=>e===ti.enabled)))),Ci=Gt(vi,(e=>e.every((e=>e===ti.disabled)))),ki=Gt(hi,(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`})),Si=Gt(yi,Ci,mi,((e,t,n)=>e&&t&&n)),Ii=Gt(yi,wi,mi,((e,t,n)=>e&&t&&n)),xi=Gt(yi,mi,((e,t)=>e&&t)),Oi=Gt(yi,mi,((e,t)=>e&&t)),Ei=Gt(yi,mi,((e,t)=>e&&t)),Ai=$i,Pi=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)}))}))},Ni=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}}),ji=({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)})}}),Ri=xn("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Ti=Pi(Ri)({onFulfilled:(e,t)=>{var n;const i=(null===(n=t.payload)||void 0===n?void 0:n.userId)?e.usersList.data.findIndex((e=>e.userId===t.payload.userId)):-1;-1!==i?e.usersList.data[i]=t.payload:e.usersList.data.unshift(t.payload)}},Ni((e=>e.createUser)),ji({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>`}})),Mi={action:Ri,reducer:Ti},Ui=xn("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Li=Pi(Ui)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Ni((e=>e.deleteUser)),ji({getSuccessMsg:e=>l(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>l(e.meta.arg.length)`Failed to delete user${["","s"]}`})),_i={action:Ui,reducer:Li},Wi=xn("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Di=Pi(Wi)(Ni((e=>e.setTempUserPassword)),ji({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>`}})),Fi={action:Wi,reducer:Di},qi=xn("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Bi=Pi(qi)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Ni((e=>e.customAttributes))),Vi={action:qi,reducer:Bi},Hi=xn("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),zi=Pi(Hi)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Ni((e=>e.usersList))),Gi={action:Hi,reducer:zi},Ki=xn("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Ji=Pi(Ki)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Ni((e=>e.tenantRoles))),Yi={action:Ki,reducer:Ji},Zi=xn("tenant/getSubTenantRoles",((e,{extra:{api:t}})=>t.tenant.getSubTenantRoles())),Xi=Pi(Zi)({onFulfilled:(e,t)=>{e.subTenantRoles.data=t.payload.roles},onRejected:e=>{e.subTenantRoles.data=[]}},Ni((e=>e.subTenantRoles))),Qi={action:Zi,reducer:Xi},er=xn("users/update",((e,{extra:{api:t}})=>t.user.update(e))),tr=Pi(er)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>a(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Ni((e=>e.updateUser)),ji({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>`}})),nr={action:er,reducer:tr},ir=xn("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),rr=Pi(ir)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return a(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)}},Ni((e=>e.enableUser)),ji({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>`}})),or={action:ir,reducer:rr},sr=xn("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),ar=Pi(sr)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return a(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)}},Ni((e=>e.disableUser)),ji({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>`}})),dr={action:sr,reducer:ar},lr=xn("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),cr={action:lr,reducer:Pi(lr)(Ni((e=>e.removePasskey)),ji({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>`}}))},ur={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:[]},subTenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]};class hr extends Error{}function fr(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 pr(e,t){if("string"!=typeof e)throw new hr("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 hr(`Invalid token specified: missing part #${n+1}`);let r;try{r=fr(i)}catch(e){throw new hr(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new hr(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}hr.prototype.name="InvalidTokenError";var gr={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",phone:"/v1/auth/enchantedlink/update/phone"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},sso:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next",event:"/v1/flow/event"}};const vr="<region>",mr=`https://api.${vr}descope.com`,$r=6e5,yr=()=>{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},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},br=[503,520,521,522,524,530],wr=[100,5e3,5e3],Cr=e=>new Promise((t=>setTimeout(t,e))),kr=e=>async function(...t){let n=await e(...t);const i=!!(null==(r=t[1])?void 0:r.disableRetry);var r;let o=0;for(;!i&&br.includes(n.status)&&o<wr.length;)await Cr(wr[o]),n=await e(...t),o++;o>0&&(n.retries=o);const s=await n.text();return n.text=()=>Promise.resolve(s),n.json=()=>Promise.resolve(JSON.parse(s)),n.clone=()=>n,n};let Sr;const Ir=()=>{if(Sr)return Sr;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 Sr=`${t}-${n}`,Sr};var xr;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(xr||(xr={}));const Or=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(vr,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},Er=(...e)=>new Headers(e.reduce(((e,t)=>((e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t).forEach((([t,n])=>{e[t]="function"==typeof n?n():n})),e)),{})),Ar={"Content-Type":"application/json"},Pr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Nr=(e,t)=>{const n={"x-descope-sdk-session-id":Ir(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.73.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},jr=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e};var Rr=e=>{var t;return(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{const d=e||mr,l=((e,t)=>{const 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 function(...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=>yr().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await kr(n)(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return yr().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).retries(e.retries).build()})(i)),i}:kr(n)})(r,a),c=async e=>{var r;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(e):e,{path:c,body:u,headers:h,queryParams:f,method:p,token:g,keepalive:v,disableRetry:m}=a,$=(e=>void 0===e?void 0:JSON.stringify(e))(u),y=Object.assign(Object.assign({headers:Er(Pr(t,g),Nr(t,i),(null==n?void 0:n.baseHeaders)||{},jr($)?Ar:{},h),method:p,body:$},v?{keepalive:!0}:{}),m?{disableRetry:!0}:{});null!==s&&(y.credentials=s||"include");const b=await l(Or({path:c,baseUrl:d,queryParams:f,projectId:t}),y);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(e,null==b?void 0:b.clone()),null==o?void 0:o.transformResponse){const e=await b.json(),t=(w=(null===(r=b.headers)||void 0===r?void 0:r.get("set-cookie"))||"",Object.fromEntries(function(e){if(!e)return[];const t=[];let n=0;function i(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function r(){const t=e.charAt(n);return"="!==t&&";"!==t&&","!==t}for(;n<e.length;){const o=n;let s,a,d=!1;for(;i();)if(","===e.charAt(n)){for(s=n,n+=1,i(),a=n;n<e.length&&r();)n+=1;if(n<e.length&&"="===e.charAt(n)){d=!0,n=a,t.push(e.substring(o,s));break}n=s+1}else n+=1;(!d||n>=e.length)&&t.push(e.substring(o,e.length))}return t}(w).map((e=>{const t=e.split(";")[0],n=t.indexOf("=");return n<1?null:[t.substring(0,n).trim(),t.substring(n+1).trim()]})).filter(Boolean))),n=Object.assign(Object.create(null),{json:()=>Promise.resolve(e),cookies:t}),i=new Proxy(b,{get:(e,t)=>{if(t in n)return n[t];const i=e[t];return"function"==typeof i?i.bind(e):i},set:(e,t,i)=>(n[t]=i,!0),has:(e,t)=>t in n||t in e});return n.clone=()=>i,o.transformResponse(i)}var w;return b};return{get:(e,{headers:t,queryParams:n,token:i,keepalive:r,disableRetry:o}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:xr.get,token:i,keepalive:r,disableRetry:o}),post:(e,t,{headers:n,queryParams:i,token:r,keepalive:o,disableRetry:s}={})=>c({path:e,headers:n,queryParams:i,body:t,method:xr.post,token:r,keepalive:o,disableRetry:s}),patch:(e,t,{headers:n,queryParams:i,token:r,keepalive:o,disableRetry:s}={})=>c({path:e,headers:n,queryParams:i,body:t,method:xr.patch,token:r,keepalive:o,disableRetry:s}),put:(e,t,{headers:n,queryParams:i,token:r,keepalive:o,disableRetry:s}={})=>c({path:e,headers:n,queryParams:i,body:t,method:xr.put,token:r,keepalive:o,disableRetry:s}),delete:(e,{headers:t,queryParams:n,token:i,keepalive:r,disableRetry:o}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:xr.delete,token:i,keepalive:r,disableRetry:o}),hooks:o,buildUrl:(e,n)=>Or({projectId:t,baseUrl:d,path:e,queryParams:n})}})(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}}))},Tr=429;function Mr(e,t,n){var i;let r=Ur(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(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 Ur(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return pr(e)}function Lr(e){const{exp:t}=Ur(e);return(new Date).getTime()/1e3>t}function _r(e){let t=Ur(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Wr(e,t){return Mr(e,t,"permissions")}function Dr(e,t){return Mr(e,t,"roles")}const Fr=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function qr(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===Tr&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function Br(e){var t;return(null===(t=Ur(e))||void 0===t?void 0:t.dct)||""}const Vr=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Hr=(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 "))},zr=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Gr=e=>t=>e.test(t),Kr=Gr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Jr=Gr(/^\+[1-9]{1}[0-9]{3,14}$/),Yr=Vr(Kr,'"{val}" is not a valid email'),Zr=Vr(Jr,'"{val}" is not a valid phone number'),Xr=Vr((e=>e.length>=1),"Minimum length is 1");const Qr=Vr((e=>"string"==typeof e),"Input is not a string"),eo=Vr((e=>Array.isArray(e)),"Input is not an array"),to=Vr((e=>"boolean"==typeof e),"Input is not a boolean"),no=Vr((e=>void 0===e),"Input is defined"),io=Hr([Qr(),no()],"Input is not a string or undefined"),ro=Hr([eo(),to()],"Input is not an array or boolean"),oo=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>zr(...e).validate(n[t]))),t(...n)),so=e=>[Qr(`"${e}" must be a string`)],ao=e=>[io(`"${e}" must be string or undefined`)],lo=e=>[Qr(`"${e}" must be a string`),Xr(`"${e}" must not be empty`)],co=e=>[Qr(`"${e}" must be a string`),Yr()],uo=e=>[Qr(`"${e}" must be a string`),Zr()],ho=oo(lo("accessKey")),fo=e=>({exchange:ho(((t,n)=>qr(e.post(gr.accessKey.exchange,{loginOptions:n},{token:t}))))}),po=(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),go=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||$r,$r)});var vo,mo;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"}(vo||(vo={})),function(e){e.email="email"}(mo||(mo={}));const $o=Object.assign(Object.assign({},vo),mo);var yo;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(yo||(yo={}));const bo=lo("loginId"),wo=oo(lo("token")),Co=oo(bo),ko=oo(lo("pendingRef")),So=oo(bo,uo("phone")),Io=oo(bo,co("email")),xo=e=>{const n=n=>(i,r,o={},s)=>{var{providerId:a}=o,d=t(o,["providerId"]);return qr(e.post(Fr(gr.enchantedLink.signIn,n),{loginId:i,URI:r,loginOptions:d,providerId:a},{token:s}))},i=n=>(i,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(Fr(gr.enchantedLink.signUpOrIn,n),{loginId:i,URI:r,loginOptions:a,providerId:s}))},r=n=>(i,r,o,s={})=>{var{providerId:a}=s,d=t(s,["providerId"]);return qr(e.post(Fr(gr.enchantedLink.signUp,n),{loginId:i,URI:r,user:o,loginOptions:d,providerId:a}))};return{verify:wo((t=>qr(e.post(gr.enchantedLink.verify,{token:t})))),signIn:Co(n($o.email)),signInWithPhone:Co(n(vo.sms)),signUpOrIn:Co(i($o.email)),signUpOrInWithPhone:Co(i(vo.sms)),signUp:Co(r($o.email)),signUpWithPhone:Co(r(vo.sms)),waitForSession:ko(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=go(n);let s;const a=setInterval((async()=>{const n=await e.post(gr.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:Io(((t,n,i,r,o)=>qr(e.post(gr.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:{sms:So(((t,n,i,r,o)=>qr(e.post(Fr(gr.enchantedLink.update.phone,vo.sms),Object.assign({loginId:t,phone:n,URI:i},o),{token:r}))))}}}},Oo=oo(lo("flowId")),Eo=oo(lo("executionId"),lo("stepId"),lo("interactionId")),Ao=oo(lo("executionId")),Po=e=>({start:Oo(((t,n,i,r,o,s,a,d=!1)=>qr(e.post(gr.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a,isCustomScreen:d})))),next:Eo(((t,n,i,r,o,s,a=!1,d)=>qr(e.post(gr.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s,isCustomScreen:a,options:d})))),event:Ao(((t,n,i)=>qr(e.post(gr.flow.event,{executionId:t,events:n},{keepalive:i,disableRetry:!0}))))}),No=lo("loginId"),jo=oo(lo("token")),Ro=oo(No),To=oo(No,uo("phone")),Mo=oo(No,co("email")),Uo=Object.keys($o).filter((e=>e!==vo.voice&&e!==vo.im)),Lo=e=>({verify:jo((t=>qr(e.post(gr.magicLink.verify,{token:t})))),signIn:Uo.reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:Ro(((n,r,o={},s)=>{var{providerId:a}=o,d=t(o,["providerId"]);return qr(e.post(Fr(gr.magicLink.signIn,i),{loginId:n,URI:r,loginOptions:d,providerId:a},{token:s}))}))})),{}),signUp:Uo.reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:Ro(((n,r,o,s={})=>{var{providerId:a}=s,d=t(s,["providerId"]);return qr(e.post(Fr(gr.magicLink.signUp,i),{loginId:n,URI:r,user:o,loginOptions:d,providerId:a}))}))})),{}),signUpOrIn:Uo.reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:Ro(((n,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(Fr(gr.magicLink.signUpOrIn,i),{loginId:n,URI:r,loginOptions:a,providerId:s}))}))})),{}),update:{email:Mo(((t,n,i,r,o)=>qr(e.post(gr.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(vo).filter((e=>e!==vo.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:To(((t,i,r,o,s)=>qr(e.post(Fr(gr.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var _o;!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"}(_o||(_o={}));const Wo=oo(lo("code")),Do=e=>({start:Object.assign(((t,n,i,r,o)=>qr(e.post(gr.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),o&&{loginHint:o}),token:r}))),Object.keys(_o).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r,o)=>qr(e.post(gr.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:n},t&&{redirectURL:t}),o&&{loginHint:o}),token:r}))})),{})),exchange:Wo((t=>qr(e.post(gr.oauth.exchange,{code:t})))),startNative:(t,n,i)=>qr(e.post(gr.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>qr(e.post(gr.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>qr(e.get(gr.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>qr(e.post(gr.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>qr(e.post(gr.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),Fo=lo("appId"),qo=oo(Fo),Bo=e=>({connect:qo(((t,n,i)=>{const r=null==n?void 0:n.tenantId,o=null==n?void 0:n.tenantLevel;return null==n||delete n.tenantId,null==n||delete n.tenantLevel,qr(e.post(gr.outbound.connect,{appId:t,tenantId:r,tenantLevel:o,options:n},{token:i}))}))}),Vo=lo("loginId"),Ho=oo(Vo,lo("code")),zo=oo(Vo),Go=oo(Vo,uo("phone")),Ko=oo(Vo,co("email")),Jo=e=>({verify:Object.keys($o).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ho(((t,i)=>qr(e.post(Fr(gr.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys($o).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:zo(((n,r={},o)=>{var{providerId:s}=r,a=t(r,["providerId"]);return qr(e.post(Fr(gr.otp.signIn,i),{loginId:n,loginOptions:a,providerId:s},{token:o}))}))})),{}),signUp:Object.keys($o).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:zo(((n,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(Fr(gr.otp.signUp,i),{loginId:n,user:r,loginOptions:a,providerId:s}))}))})),{}),signUpOrIn:Object.keys($o).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:zo(((n,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(Fr(gr.otp.signUpOrIn,i),{loginId:n,loginOptions:s,providerId:o}))}))})),{}),update:{email:Ko(((t,n,i,r)=>qr(e.post(gr.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(vo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Go(((t,i,r,o)=>qr(e.post(Fr(gr.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Yo=oo(lo("tenant")),Zo=oo(lo("code")),Xo=e=>({start:Yo(((t,n,i,r,o,s,a,d)=>qr(e.post(gr.sso.start,i||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o}),s&&{forceAuthn:"true"}),a&&{loginHint:a}),d&&{initiatedEmail:t})},r&&{token:r}))))),exchange:Zo((t=>qr(e.post(gr.sso.exchange,{code:t}))))}),Qo=lo("loginId"),es=oo(Qo,lo("code")),ts=oo(Qo),ns=oo(Qo),is=e=>({signUp:ts(((t,n)=>qr(e.post(gr.totp.signUp,{loginId:t,user:n})))),verify:es(((t,n,i,r)=>qr(e.post(gr.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:ns(((t,n)=>qr(e.post(gr.totp.update,{loginId:t},{token:n}))))}),rs=lo("loginId"),os=lo("newPassword"),ss=oo(rs,lo("password")),as=oo(rs),ds=oo(rs,os),ls=oo(rs,lo("oldPassword"),os),cs=e=>({signUp:ss(((n,i,r,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return qr(e.post(gr.password.signUp,{loginId:n,password:i,user:r,loginOptions:a,providerId:s}))})),signIn:ss(((n,i,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(gr.password.signIn,{loginId:n,password:i,loginOptions:s,providerId:o}))})),sendReset:as(((t,n,i)=>qr(e.post(gr.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:ds(((t,n,i)=>qr(e.post(gr.password.update,{loginId:t,newPassword:n},{token:i})))),replace:ls(((t,n,i)=>qr(e.post(gr.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>qr(e.get(gr.password.policy))}),us=so("loginId"),hs=lo("loginId"),fs=so("origin"),ps=oo(hs,fs,lo("name")),gs=oo(hs,fs),vs=oo(us,fs),ms=oo(hs,fs,ao("token")),$s=oo(lo("transactionId"),lo("response")),ys=e=>({signUp:{start:ps(((t,n,i,r,o)=>qr(e.post(gr.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,loginOptions:o,passkeyOptions:r})))),finish:$s(((t,n)=>qr(e.post(gr.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:vs(((t,n,i,r,o)=>qr(e.post(gr.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:$s(((t,n)=>qr(e.post(gr.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:gs(((t,n,i,r)=>qr(e.post(gr.webauthn.signUpOrIn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:i}))))},update:{start:ms(((t,n,i,r,o)=>qr(e.post(gr.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r,mfa:o},{token:i})))),finish:$s(((t,n)=>qr(e.post(gr.webauthn.update.finish,{transactionId:t,response:n}))))}}),bs=so("loginId"),ws=oo(bs),Cs=oo(lo("pendingRef")),ks=e=>({signUpOrIn:ws(((n,i={})=>{var{providerId:r}=i,o=t(i,["providerId"]);return qr(e.post(gr.notp.signUpOrIn,{loginId:n,loginOptions:o,providerId:r}))})),signUp:ws(((n,i,r={})=>{var{providerId:o}=r,s=t(r,["providerId"]);return qr(e.post(gr.notp.signUp,{loginId:n,user:i,providerId:o,loginOptions:s}))})),signIn:ws(((n,i={},r)=>{var{providerId:o}=i,s=t(i,["providerId"]);return qr(e.post(gr.notp.signIn,{loginId:n,loginOptions:s,providerId:o},{token:r}))})),waitForSession:Cs(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=go(n);let s;const a=setInterval((async()=>{const n=await e.post(gr.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),Ss=oo(lo("token")),Is=oo(ao("token"));var xs,Os=oo([(xs=lo("projectId"),Vr(((e,t)=>n=>zr(...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",xs))())])((e=>{const{projectId:t,logger:n,baseUrl:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a}=e;return d=Rr({baseUrl:i,projectId:t,logger:n,hooks:{get beforeRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest},get afterRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.afterRequest},get transformResponse(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:fo(d),otp:Jo(d),magicLink:Lo(d),enchantedLink:xo(d),oauth:Do(d),outbound:Bo(d),sso:Xo(d),saml:Xo(d),totp:is(d),notp:ks(d),webauthn:ys(d),password:cs(d),flow:Po(d),refresh:Is(((e,t,n,i)=>{const r={};n&&(r.externalToken=n);const o=i?gr.tryRefresh:gr.refresh;return qr(d.post(o,r,{token:e,queryParams:t}))})),selectTenant:oo([Qr("tenantId")],[io('"token" must be string or undefined')])(((e,t)=>qr(d.post(gr.selectTenant,{tenant:e},{token:t})))),logout:Is((e=>qr(d.post(gr.logout,{},{token:e})))),logoutAll:Is((e=>qr(d.post(gr.logoutAll,{},{token:e})))),me:Is((e=>qr(d.get(gr.me,{token:e})))),myTenants:oo([ro('"tenants" must a string array or a boolean')],[io('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,qr(d.post(gr.myTenants,n,{token:t}))})),history:Is((e=>qr(d.get(gr.history,{token:e})))),isJwtExpired:Ss(Lr),getTenants:Ss(_r),getJwtPermissions:Ss(Wr),getJwtRoles:Ss(Dr),getCurrentTenant:Ss(Br),httpClient:d};var d})),Es=Object.assign(Os,{DeliveryMethods:$o});
|
|
6
|
+
/*! js-cookie v3.0.8 | MIT */function As(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)"__proto__"!==i&&(e[i]=n[i])}return e}var Ps=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=As({},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(a in i||(i[a]=t.read(s,a)),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",As({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,As({},this.attributes,t))},withConverter:function(t){return e(As({},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 Ns={default:"endpoint"},js="Blocked by CSP",Rs="The endpoint parameter is not a valid URL",Ts="Failed to load the JS script of the agent",Ms="9319";function Us(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===js||s===Rs)n.exclude(),o=0;else if(s===Ms)n.exclude();else if(s===Ts){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 Ls="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",_s=Ls;function Ws(n){var i;n.scriptUrlPattern;var r=n.token,o=n.apiKey,s=void 0===o?r:o,a=t(n,["scriptUrlPattern","token","apiKey"]),d=null!==(i=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(n,"scriptUrlPattern"))&&void 0!==i?i:Ls,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 Us(e,Ds)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Ms?new Error(Ts):e}(e)})).then((function(t){var n=t[0],i=t[1];return u(),n.load(e(e({},a),{ldi:{attempts:i,visibilityStates:c}}))}))}function Ds(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(Rs);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(Ts))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(js)})).then(Fs)}function Fs(){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(Ms);return n}const qs="3.2.0",Bs="undefined"!=typeof window,Vs=Math.pow(2,31)-1,Hs=`https://descopecdn.com/npm/oidc-client-ts@${qs}/dist/browser/oidc-client-ts.min.js`,zs=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${qs}/dist/browser/oidc-client-ts.min.js`,Gs=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let Ks;const Js=e=>{try{return pr(e).exp}catch(e){return null}},Ys=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Js(n)},Zs=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Js(i):void 0)},Xs=e=>{const{access_token:n,id_token:i,refresh_token:r,refresh_expire_in:o}=e,s=t(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||n,idToken:i,refreshJwt:e.refreshJwt||r,sessionExpiration:e.sessionExpiration||Zs(e),cookieExpiration:e.cookieExpiration||Ys(e)},s)},Qs=(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},ea=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json()),n=(null==t?void 0:t.authInfo)||t||{};return Xs(n)},ta=()=>Bs&&!!window.descopeBridge,na=(e,t)=>{if(!((null==t?void 0:t.status)>=400&&(null==t?void 0:t.status)<500))return!1;const n=(null==e?void 0:e.path)||"";return Gs.includes(n)},ia=void 0!==Ks||Bs&&void 0!==window.localStorage,ra=(e,t)=>{var n,i;return null===(i=null===(n=Ks||Bs&&window.localStorage)||void 0===n?void 0:n.setItem)||void 0===i?void 0:i.call(n,e,t)},oa=e=>{var t,n;return null===(n=null===(t=Ks||Bs&&window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e)},sa=e=>{var t,n;return null===(n=null===(t=Ks||Bs&&window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n?void 0:n.call(t,e)},aa=e=>{var t,n,i,r,o;return null!==(o=null!==(n=null===(t=null==Ks?void 0:Ks.key)||void 0===t?void 0:t.call(Ks,e))&&void 0!==n?n:Bs&&(null===(r=null===(i=window.localStorage)||void 0===i?void 0:i.key)||void 0===r?void 0:r.call(i,e)))&&void 0!==o?o:null},da=e=>{var t,n;return Bs&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e))||null},la=e=>{var t,n;try{Bs&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n||n.call(t,e))}catch(e){}},ca=(...e)=>{console.debug(...e)},ua=(...e)=>{console.warn(...e)},ha="DS",fa="DSR",pa="DSI",ga="DSRCN";function va(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=ma(i);Ps.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}function ma(e){const t=window.location.hostname.split("."),n=null==e?void 0:e.split(".");return t.slice(-(null==n?void 0:n.length)).join(".")===e}const $a=e=>(null==e?void 0:e.cookieName)||ha,ya=e=>(null==e?void 0:e.cookieName)||fa;function ba(e="",t){return Ps.get(ya(t))||oa(`${e}${fa}`)||""}function wa(e="",t){return Ps.get($a(t))||oa(`${e}${ha}`)||""}function Ca(e=""){return oa(`${e}${pa}`)||""}function ka(e="",t,n,i){sa(`${e}${fa}`),sa(`${e}${ha}`),sa(`${e}${pa}`),sa(`${e}${ga}`);const r=$a(t);Ps.remove(r,null==i?void 0:i.session);const o=ya(n);Ps.remove(o,null==i?void 0:i.refresh)}const Sa=(e,t,n)=>i=>{const r=Object.assign(i,{token:i.token||ba(e,t)});if(!n){const t=function(e=""){return oa(`${e}${ga}`)}(e);t&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":t}))}const o=function(e=""){return oa(`${e}DTD`)||""}(e);o&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":o}));const s=function(e=""){return oa(`${e}DKD`)||""}(e);return s&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-known-device-token":s})),r},Ia=Bs&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",xa="vsid",Oa="vrid",Ea="fp",Aa=(e=!1)=>{const t=oa(Ea);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Pa=async(e,t=Ia)=>{try{if(Aa())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=Ws({apiKey:e,endpoint:[i.toString(),Ns],scriptUrlPattern:[o,_s]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[xa]:e,[Oa]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};ra(Ea,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Na=e=>{const t=Aa(!0);return t&&e.body&&(e.body.fpData=t),e},ja="descopeFlowNonce",Ra="X-Descope-Flow-Nonce",Ta="/v1/flow/start",Ma="/v1/flow/next",Ua=(e,t=ja)=>`${t}${e}`,La=(e,t=ja)=>{try{const n=Ua(e,t),i=oa(n);if(!i)return null;const r=JSON.parse(i);return r.expiry<Date.now()?(_a(e,t),null):{value:r.value,seq:r.seq}}catch(e){return console.error("Error getting flow nonce:",e),null}},_a=(e,t=ja)=>{try{const n=Ua(e,t);sa(n)}catch(e){console.error("Error removing flow nonce:",e)}},Wa=e=>{var t;return(null===(t=/.*\|#\|(.*)/.exec(e))||void 0===t?void 0:t[1])||null},Da=e=>{var t;return e.path===Ma&&(null===(t=e.body)||void 0===t?void 0:t.executionId)?Wa(e.body.executionId):null},Fa="dls_last_user_login_id",qa="dls_last_user_display_name",Ba=e=>ra(Fa,e),Va=()=>oa(Fa),Ha=()=>oa(qa),za=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=Va(),o=Ha();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)},Ga="DSLI",Ka=e=>async(...t)=>{const n=await e(...t);return la(Ga),n};function Ja(){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 Ya(e,t){const n=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=id(n.publicKey.challenge),n.publicKey.user.id=id(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=id(e.id)})),n}(e);t&&(n.signal=t.signal);try{return i=await navigator.credentials.create(n),JSON.stringify({id:i.id,rawId:rd(i.rawId),type:i.type,response:{attestationObject:rd(i.response.attestationObject),clientDataJSON:rd(i.response.clientDataJSON)}})}catch(e){throw await Qa(e,n,!0)}var i}async function Za(e,t){const n=td(e);t&&(n.signal=t.signal);try{return nd(await navigator.credentials.get(n))}catch(e){throw await Qa(e,n,!1)}}async function Xa(e,t){const n=td(e);n.signal=t.signal,n.mediation="conditional";try{return nd(await navigator.credentials.get(n))}catch(e){throw await Qa(e,n,!1)}}async function Qa(e,t,n){if(e&&"object"==typeof e)try{e.reason=await async function(e,t,n){var i,r;const o=null==e?void 0:e.name;if("AbortError"===o&&(null==t?void 0:t.signal)instanceof AbortSignal)return"aborted";if("InvalidStateError"===o&&n)return"authenticator_already_registered";if("NotSupportedError"===o)return"no_supported_algorithm";if("ConstraintError"===o)return"authenticator_constraints_unsupported";if("SecurityError"===o){const e=window.location.hostname;return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)?"invalid_rpid":"invalid_domain"}if(!await ed())return"webauthn_unsupported";const s="platform"===(null===(r=null===(i=null==t?void 0:t.publicKey)||void 0===i?void 0:i.authenticatorSelection)||void 0===r?void 0:r.authenticatorAttachment);return n&&s&&!await ed(!0)?"platform_authenticator_unsupported":"NotAllowedError"===o?"not_allowed":"unknown"}(e,t,n)}catch(e){}return e}async function ed(e=!1){var t,n;if(!Bs)return Promise.resolve(!1);if(ta()){const e=null===(n=null===(t=window.descopeBridge)||void 0===t?void 0:t.hostInfo)||void 0===n?void 0:n.webauthn;if("boolean"==typeof e)return e}const i=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return i&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():i}function td(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=id(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=id(e.id)})),n}function nd(e){return JSON.stringify({id:e.id,rawId:rd(e.rawId),type:e.type,response:{authenticatorData:rd(e.response.authenticatorData),clientDataJSON:rd(e.response.clientDataJSON),signature:rd(e.response.signature),userHandle:e.response.userHandle?rd(e.response.userHandle):void 0}})}function id(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function rd(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var od,sd=(od=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 Ya(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 Za(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 Ya(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await Za(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 Ya(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:Ya,get:Za,isSupported:ed,conditional:Xa}}),(...e)=>{const t=od(...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 ad="/fedcm/config";async function dd(e,t){var n;try{await ld(e,t)}catch(e){null===(n=null==t?void 0:t.onFailed)||void 0===n||n.call(t,e)}}async function ld(e,t){var n,i;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)}}var cd=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await ed(),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 ud;const hd=(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",(()=>{hd(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),fd=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{ud||(ud=(async()=>{try{return require("oidc-client-ts")}catch(e){return hd([Hs,zs],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await ud;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=(null==n?void 0:n.redirectUri)||window.location.href;let s,a,d,l;if(null==n?void 0:n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,a=n.clientId,d=`${a}_user`,l="openid"}else(null==n?void 0:n.applicationId)?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access");const c={authority:s,client_id:a,redirect_uri:o,response_type:"code",scope:(null==n?void 0:n.scope)||l,stateStore:new r({store:window.localStorage,prefix:a}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),{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)))),ra(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(t={},n=!1)=>{var r;const{client:o}=await i(),s=await o.createSigninRequest(t),{url:a}=s;return n||(await(null===(r=e.httpClient.hooks)||void 0===r?void 0:r.afterRequest({},new Response(JSON.stringify(s)))),window.location.href=a),{ok:!0,data:s}},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=oa(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||Ca(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return sa(r),t||window.location.replace(s),o}}},pd=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var n;return n=t.customStorage,Ks=n,e(t)}),(e=>n=>{var{fpKey:i,fpLoad:r}=n,o=t(n,["fpKey","fpLoad"]);return Bs?(i&&r&&Pa(i).catch((()=>null)),e(Qs(o,{beforeRequest:Na}))):e(o)}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.53.2"},t.baseHeaders)}))),(e=>t=>{const n=Ja(),i=Ja(),r=Ja(),o=Ja(),s=e(Qs(t,{afterRequest:async(e,t)=>{if(na(e,t))ca("Session invalidated, notifying subscribers with empty values"),i.pub(null),r.pub(null),n.pub(null),o.pub(null);else{const e=await(async e=>{const t=await ea(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)})(t);e&&r.pub(e);const{sessionJwt:s,sessionExpiration:a,claims:d}=await ea(t);s&&i.pub(s),d&&o.pub(d),(a||s)&&n.pub(a||42)}}})),a=po(s,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const s=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o.pub(null),s}));return Object.assign(a,{onSessionTokenChange:i.sub,onUserChange:r.sub,onClaimsChange:o.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>n=>{var i;const{enableFlowNonce:r=!0,nonceStoragePrefix:o=ja}=n,s=t(n,["enableFlowNonce","nonceStoragePrefix"]);if(!r)return e(s);((e=ja)=>{try{if(!ia)return;for(let r=0;r<(void 0,n=void 0,void 0,null!==(i=null!==(t=null==Ks?void 0:Ks.length)&&void 0!==t?t:Bs&&(null===(n=window.localStorage)||void 0===n?void 0:n.length))&&void 0!==i?i:0);r++){const t=aa(r);if(t&&t.startsWith(e)){const n=oa(t);if(n)try{JSON.parse(n).expiry<Date.now()&&sa(t)}catch(e){sa(t)}}}}catch(e){console.error("Error cleaning up expired nonces:",e)}var t,n,i})(o);const a=e(Qs(s,{afterRequest:async(e,t)=>{var n;if(e.path!==Ta&&e.path!==Ma)return;const{nonce:i,seq:r,executionId:s}=await(async(e,t)=>{try{const n=t.headers.get(Ra),i=null===n?void 0:(e=>{const t=e.indexOf(".");if(t<=0)return;const n=e.slice(0,t);if(!/^\d+$/.test(n))return;const i=Number(n);return Number.isSafeInteger(i)?i:void 0})(n);let r=await t.clone().json().then((e=>(null==e?void 0:e.executionId)||null)).catch((()=>null));return r||(r=Da(e)),{nonce:n,seq:i,executionId:Wa(r)}}catch(e){return{nonce:null,seq:void 0,executionId:null}}})(e,t);if(!i||!s)return;const a=e.path===Ta,d=null===(n=La(s,o))||void 0===n?void 0:n.seq;!a&&void 0!==r&&void 0!==d&&r<=d||((e,t,n,i=ja,r)=>{try{const o=Ua(e,i),s=n?172800:10800,a={value:t,expiry:Date.now()+1e3*s,isStart:n,seq:r};ra(o,JSON.stringify(a))}catch(e){console.error("Error setting flow nonce:",e)}})(s,i,a,o,null!=r?r:a?void 0:d)},beforeRequest:e=>{if(e.path===Ma){const t=Da(e);if(t){const n=((e,t=ja)=>{var n,i;return null!==(i=null===(n=La(e,t))||void 0===n?void 0:n.value)&&void 0!==i?i:null})(t,o);n&&(e.headers=e.headers||{},e.headers[Ra]=n)}}return e}}));if(null===(i=a.flow)||void 0===i?void 0:i.next){let e=Promise.resolve();const t=a.flow.next.bind(a.flow);a.flow.next=async(...n)=>{const i=e;let r;e=new Promise((e=>{r=e})),await i;try{return await t(...n)}finally{r()}}}return a}),(e=>t=>{const n=e(Qs(t,{afterRequest:async(e,t)=>{if(na(e,t))return void la(Ga);const n=await ea(t);(null==n?void 0:n.sessionExpiration)&&((e,t)=>{var n,i;try{Bs&&(null===(i=null===(n=window.localStorage)||void 0===n?void 0:n.setItem)||void 0===i||i.call(n,e,t))}catch(e){}})(Ga,String(n.sessionExpiration))}}));return po(n,["logout","logoutAll","oidc.logout"],Ka)}),(e=>n=>{var{autoRefresh:i}=n,r=t(n,["autoRefresh"]);const o=!!i,s="object"==typeof i&&(null==i?void 0:i.customActivityTracking);if(!o||ta())return Object.assign(e(r),{markUserActive:()=>{ua("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:d}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let l,c,u=null,h=!1,f=!1;s&&(ca("Activity-based refresh enabled"),u=(()=>{let e=!0;return{hadActivity:()=>e,reset:()=>{e=!1},markActive:()=>{e=!0}}})()),Bs&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&l&&new Date>l&&(ca("Expiration time passed, refreshing session"),p.refresh(ba()||c))}));const p=e(Qs(r,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:r,nextRefreshSeconds:o}=await ea(t);if(na(e,t))ca("Session invalidated, canceling all timers"),a();else if(n||r){if(l=((e,t)=>{if(t)return new Date(1e3*t);ca("Could not extract expiration time from session token, trying to decode the token");try{const t=pr(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,r),!l)return void ca("Could not extract expiration time from session token");c=i,h=o>0;const e=((e,t)=>{let n;var i;return t>0?(n=1e3*t,ca(`Using provided nextRefreshSeconds: ${t}s`)):n=((i=e)?i.getTime()-(new Date).getTime():0)-2e4,n>Vs&&(ca(`Timeout is too large (${n}ms), setting it to ${Vs}ms`),n=Vs),n})(l,o);if(a(),e<=2e4)return void ca("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});ca(`Setting refresh timer for ${t}. (${e}ms)`),u&&(u.reset(),f=!1),d((()=>{if(Bs&&"hidden"===document.visibilityState)ca("Skipping refresh due to timer - document is hidden");else{if(u&&h&&!u.hadActivity())return ca("Skipping refresh due to timer - user is idle"),void(f=!0);ca("Refreshing session due to timer"),p.refresh(ba()||i)}}),e)}}}));return Object.assign(po(p,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return ca("Clearing all timers"),a(),n})),{markUserActive:u?()=>{ca("markUserActive() called"),h||ca("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),f&&(ca("User became active after skipped refresh, triggering refresh"),f=!1,a(),p.refresh(ba()||c))}:()=>{ua("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})}),(e=>n=>{var{storeLastAuthenticatedUser:i=!0,keepLastAuthenticatedUserAfterLogout:r=!1}=n,o=t(n,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!i)return Object.assign(e(o),{getLastUserLoginId:Va,getLastUserDisplayName:Ha});const s=e(Qs(o,{afterRequest:async(e,t)=>{var n;const{userInfo:i,lastAuth:r}=await(async e=>{if(!(null==e?void 0:e.ok))return{userInfo:void 0,lastAuth:void 0};const t=await(null==e?void 0:e.clone().json()),n=Xs((null==t?void 0:t.authInfo)||t||{});return{userInfo:(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0),lastAuth:t.lastAuth}})(t),o=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],s=null==i?void 0:i.name;o?(Ba(o),(e=>{ra(qa,e)})(s)):(null==r?void 0:r.loginId)&&Ba(r.loginId)}}));let a=po(s,["flow.start"],za);return a=po(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(sa(Fa),sa(qa)),i})(r)),Object.assign(a,{getLastUserLoginId:Va,getLastUserDisplayName:Ha})}),(e=>n=>{var{persistTokens:i,sessionTokenViaCookie:r,refreshTokenViaCookie:o,storagePrefix:s,refreshCookieName:a}=n,d=t(n,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!i||!Bs)return e(Object.assign({refreshCookieName:a},d));let l;const c=e(Qs(Object.assign({refreshCookieName:a},d),{beforeRequest:Sa(s,o,a),afterRequest:async(e,t)=>{if(na(e,t))ca("Session invalidated, clearing persisted tokens"),ka(s,r,o,l);else{const e=await ea(t);e.cookieName?ra(`${s||""}${ga}`,e.cookieName):e.refreshJwt&&sa(`${s||""}${ga}`);const n=((e={},t=!1,n="",i=!1)=>{var r,o,s,a;const{sessionJwt:d,refreshJwt:l,trustedDeviceJwt:c,knownDeviceJwt:u}=e;let h;if(l)if(i){sa(`${n}${fa}`);const t=i.sameSite||"Strict",s=null===(r=i.secure)||void 0===r||r,a=null!==(o=i.domain)&&void 0!==o?o:e.cookieDomain,d=ya(i);s&&"https:"!==window.location.protocol&&ua("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const c=Object.assign(Object.assign({},e),{cookieSameSite:t,cookieSecure:s,cookieDomain:a});va(d,l,c);const u=ma(a);h=Object.assign(Object.assign({},h),{refresh:{path:c.cookiePath,domain:u?a:void 0}})}else{const e=ya(i);Ps.remove(e),ra(`${n}${fa}`,l)}if(d)if(t){const n=t.sameSite||"Strict",i=null===(s=t.secure)||void 0===s||s,r=null!==(a=t.domain)&&void 0!==a?a:e.cookieDomain,o=$a(t);i&&"https:"!==window.location.protocol&&ua("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const l=Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:i,cookieDomain:r});va(o,d,l);const c=ma(r);h=Object.assign(Object.assign({},h),{session:{path:l.cookiePath,domain:c?r:void 0}})}else ra(`${n}${ha}`,d);return e.idToken&&ra(`${n}${pa}`,e.idToken),c&&ra(`${n}DTD`,c),u&&ra(`${n}DKD`,u),h})(e,r,s,o);n&&(l=n)}}})),u=po(c,["logout","logoutAll","oidc.logout"],((e,t,n,i)=>r=>async(...o)=>{const s=await r(...o);return ka(e,t,n,null==i?void 0:i()),s})(s,r,o,(()=>l)));return Object.assign(u,{getRefreshToken:()=>ba(s,o),getSessionToken:()=>wa(s,r),getIdToken:()=>Ca(s)})}))((e=>{const t=Es(e),n=fd(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,r)=>{var o;if(ta())return ca(`Refresh called in native flow: ${(new Error).stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}if(r&&Bs&&void 0!==window.localStorage&&!da(Ga)&&!oa(Fa)&&!da("DSLI_DISABLED"))return Promise.resolve({ok:!0});const s=wa(),a=ba();let d="";if(e.getExternalToken)try{d=await(null===(o=e.getExternalToken)||void 0===o?void 0:o.call(e))}catch(e){ca("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:s?"t":"f",dcr:a?"t":"f"},d,r)},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:cd(t),webauthn:sd(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){dd(i,e)},requestAuthentication(e){dd(i,e)}},async oneTap(e,t,n,r,o){await ld(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+ad),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>Bs&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+ad);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})),gd={search:"/v1/mgmt/user/search",deleteBatch:"/v1/mgmt/user/delete/batch",create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/patch",status:"/v1/mgmt/user/update/status",setTempPassword:"/v1/mgmt/user/password/set/temporary",removePasskey:"/v1/mgmt/user/passkeys/delete",customAttributes:"/v1/mgmt/user/customattributes"},vd={roles:"/v1/mgmt/role/all",subTenantRoles:"/v1/mgmt/role/subtenant/all"},md=e=>n(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=e=>n(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}`,recoveryEmail:`recovery${e}@company.com`,recoveryPhone:`+1-202-555-020${e}`,verifiedEmail:!0,verifiedPhone:!0,verifiedRecoveryEmail:!0,verifiedRecoveryPhone:!0,userTenants:[{tenantId:"sub-tenant-1",tenantName:"Hurray",roleNames:["Role 1","Role 2"]}],status:"enabled",editable:!0,createdTime:r,createdTimeFormatted:new Date(1e3*(r||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:e%3==0,OIDC:e%3==1,SCIM:e%3==2,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>((e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof t){const i=e?1:0,r=t?1:0;return n?i-r:r-i}const i=(null==e?void 0:e.toString())||"",r=(null==t?void 0:t.toString())||"";return n?r.localeCompare(i):i.localeCompare(r)})(t[e.field],n[e.field],e.desc)))})),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()))))}))})),yd=e=>n(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,userTenants:h}){return new Promise((f=>{const p=Math.random().toString(10).substring(15);f({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),bd=e=>n(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,userTenants:h}){return new Promise((f=>{f({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:i,roleNames:r,customAttributes:o||{},picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),wd=()=>n(void 0,void 0,void 0,(function*(){})),Cd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),kd=()=>n(void 0,void 0,void 0,(function*(){})),Sd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),Id=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),xd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),Od=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})})),Ed=()=>new Promise((e=>{e({roles:[{tenantId:"sub-tenant-1",tenantName:"Sub Tenant 1",roleNames:["Role 1","Role 2"]},{tenantId:"sub-tenant-2",tenantName:"Sub Tenant 2",roleNames:["Role 1","Role 3"]},{tenantId:"sub-tenant-3",tenantName:"Sub Tenant 3",roleNames:["Role 2"]}]})})),Ad=({httpClient:e,tenant:i,mock:r})=>({search:(...o)=>n(void 0,[...o],void 0,(function*(n={}){const{limit:o=1e4}=n,s=t(n,["limit"]);if(r)return $d(Object.assign(Object.assign({},s),{limit:o}));const a=yield e.post(gd.search,Object.assign(Object.assign({},s),{limit:o,withTestUser:!1}),{queryParams:{tenant:i}});yield md(a);return(yield a.json()).users})),deleteBatch:t=>n(void 0,void 0,void 0,(function*(){if(r)return wd();const n=yield e.post(gd.deleteBatch,{userIds:t},{queryParams:{tenant:i}});return yield md(n),n.json()})),create:t=>n(void 0,[t],void 0,(function*({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C}){if(r)return yd({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C});const k=yield e.post(gd.create,{loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:C,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w},{queryParams:{tenant:i}});yield md(k);return(yield k.json()).user})),update:t=>n(void 0,[t],void 0,(function*({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$}){if(r)return bd({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$});const y=yield e.patch(gd.update,{loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:$,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m},{queryParams:{tenant:i}});yield md(y);return(yield y.json()).user})),enable:t=>n(void 0,void 0,void 0,(function*(){if(r)return Sd(t);const n=yield e.post(gd.status,{loginId:t,status:"enabled"},{queryParams:{tenant:i}});return yield md(n),n.json()})),disable:t=>n(void 0,void 0,void 0,(function*(){if(r)return Id(t);const n=yield e.post(gd.status,{loginId:t,status:"disabled"},{queryParams:{tenant:i}});return yield md(n),n.json()})),removePasskey:t=>n(void 0,void 0,void 0,(function*(){if(r)return kd();const n=yield e.post(gd.removePasskey,{loginId:t},{queryParams:{tenant:i}});return yield md(n),n.json()})),setTempPassword:t=>n(void 0,void 0,void 0,(function*(){if(r)return Cd();const n=yield e.post(gd.setTempPassword,{loginId:t},{queryParams:{tenant:i}});return yield md(n),n.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(r)return xd();const t=yield e.get(gd.customAttributes,{queryParams:{tenant:i}});yield md(t);return(yield t.json()).data}))}),Pd=({httpClient:e,tenant:t,mock:i})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(i)return Od(t);const n=yield e.get(vd.roles,{queryParams:{tenant:t}});return yield md(n),n.json()})),getSubTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(i)return Ed();const n=yield e.get(vd.subTenantRoles,{queryParams:{tenant:t}});return yield md(n),n.json()}))}),Nd=h((e=>{var t,s,a,d;const l=o(N,Un,A,C,j,Dn,P({tenant:P.missingAttrValidator}))(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||xe}get api(){return i(this,s,"f")||i(this,t,"m",a).call(this),i(this,s,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{i(this,s,"f")&&i(this,t,"m",a).call(this)}))}))}},s=new WeakMap,t=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),r(this,s,((e,t,n,i)=>{const r=pd(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.20.3"}}));return{user:Ad({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Pd({httpClient:r.httpClient,tenant:t,mock:n}),httpClient:r.httpClient}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},d})),jd=h((e=>{const t=o(Tn({name:"widget",initialState:ur,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Mi.reducer(e),nr.reducer(e),or.reducer(e),dr.reducer(e),_i.reducer(e),Gi.reducer(e),Fi.reducer(e),cr.reducer(e),Vi.reducer(e),Yi.reducer(e),Qi.reducer(e)},asyncActions:{searchUsers:Gi.action,createUser:Mi.action,updateUser:nr.action,enableUser:or.action,disableUser:dr.action,deleteUsers:_i.action,removePasskey:cr.action,getCustomAttributes:Vi.action,getTenantRoles:Yi.action,getSubTenantRoles:Qi.action,setTempUserPassword:Fi.action}}),E,C,Nd)(e);return class extends t{constructor(...e){super(...e),this.state=ur,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Rd=h((e=>{var t,r,a;return a=class extends(o(C,E,z,X,Wn("user-management-widget"),jd,Ln)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return n(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.injectStyle(".hidden { display: none; }");const o=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([i(this,t,"m",r).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes(),o]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){const e=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},a})),Td=h((e=>{var t,a,d,l,c,u,h,f,p;return p=class extends(o(jd,Ce,Mn,C,Ln,Rd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,(()=>n(this,void 0,void 0,(function*(){yield i(this,a,"f").setData(ni(this.state).map((({name:e,description:t})=>({value:e,label:e,description:t}))))})))),f.set(this,(()=>{var e;const t=ai(this.state);null===(e=i(this,d,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&i(this,l,"f").setData(si(this.state))}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",c).call(this)}))}},a=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,t=new WeakSet,c=function(){return n(this,void 0,void 0,(function*(){var e;this.createUserModal=this.createModal(),this.createUserModal.setContent(s(yield this.fetchWidgetPage("create-user-modal.html")));const o=new oe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}),c=()=>{this.resetFormData(this.createUserModal.ele),i(this,l,"f").value=[]};o.onClick((()=>{this.createUserModal.close(),c()}));const p=new oe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});p.onClick((()=>n(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele),t=i(this,l,"f").mergedValue;this.actions.createUser(Object.assign(Object.assign({},Zn(e,"customAttributes")),{userTenants:t,invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),c()}})))),r(this,a,new $e((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),r(this,d,null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-section"]'),"f"),r(this,l,new ve((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),i(this,h,"f").call(this),this.createUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield i(this,h,"f").call(this),i(this,f,"f").call(this),i(this,t,"m",u).call(this)}))}))},u=function(){const e=oi(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)}))},p})),Md=h((e=>{var t,r,s;return s=class extends(o(C,Td,Rd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",r).call(this)}))}},t=new WeakSet,r=function(){var e;this.createButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},s})),Ud=h((e=>{var t,r,a;return a=class extends(o(jd,Ce,C,Rd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",r).call(this)}))}},t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(s(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new oe((()=>{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 oe((()=>{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=fi(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new be(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=ki(this.state);i.text=`Delete ${e}?`}}))},a})),Ld=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd,Ud)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Ai)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.deleteButton=new oe(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()}))},a})),_d=h((e=>{var t,r,a,d,l;return l=class extends(o(jd,Ce,C,Mn,Rd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{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=bi(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(s(yield this.fetchWidgetPage("disable-user-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`Disable ${e}?`}))}))},l})),Wd=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd,_d,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Ii)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.disableButton=new oe(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()}))},a}));var Dd={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 Fd(e){return Fd="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},Fd(e)}function qd(e){var t=zd();return function(){var n,i=Kd(e);if(t){var r=Kd(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Fd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Bd(e)}(this,n)}}function Bd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vd(e){var t="function"==typeof Map?new Map:void 0;return Vd=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 Hd(e,arguments,Kd(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Gd(i,e)},Vd(e)}function Hd(e,t,n){return Hd=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&&Gd(r,n.prototype),r},Hd.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 Gd(e,t){return Gd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Gd(e,t)}function Kd(e){return Kd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Kd(e)}var Jd=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&&Gd(e,t)}(i,e);var t,n=qd(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(Bd(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(Vd(Error)),Yd=2,Zd=17,Xd=3,Qd="0-90-9٠-٩۰-۹",el="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),tl="++";function nl(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 il={}.constructor;function rl(e){return null!=e&&e.constructor===il}function ol(e){return ol="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},ol(e)}function sl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function al(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 dl=" ext. ",ll=/^\d+$/,cl=function(){function e(t){sl(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!rl(e)||!rl(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(rl(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+vl(e)+": "+e,"."))}(t),this.metadata=t,yl.call(this,t)}return al(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&&ll.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new ul(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new ul(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}(),ul=function(){function e(t,n){sl(this,e),this.globalMetadataObject=n,this.metadata=t,yl.call(this,n.metadata)}return al(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 hl(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()&&gl(this.types(),e))return new pl(gl(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?dl:this.metadata[13]||dl}}]),e}(),hl=function(){function e(t,n){sl(this,e),this._format=t,this.metadata=n}return al(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()||fl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),fl=/^\(?\$1\)?$/,pl=function(){function e(t,n){sl(this,e),this.type=t,this.metadata=n}return al(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 gl(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 vl=function(e){return ol(e)};function ml(e,t){if((t=new cl(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function $l(e,t){return t.countries.hasOwnProperty(e)}function yl(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===nl(t,"1.2.0")?this.v2=!0:-1===nl(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var bl=function(e){return"([".concat(Qd,"]{1,").concat(e,"})")};function wl(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+bl("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+bl("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+bl("9")+i)+"|"+("[- ]+"+bl("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+bl("15")+i)+"|"+(r+"(?:,)+"+n+bl("9")+i)}var Cl="["+Qd+"]{"+Yd+"}",kl="[++]{0,1}(?:["+el+"]*["+Qd+"]){3,}["+el+Qd+"]*",Sl=new RegExp("^[++]{0,1}(?:["+el+"]*["+Qd+"]){1,2}$","i"),Il=kl+"(?:"+wl()+")?",xl=new RegExp("^"+Cl+"$|^"+Il+"$","i");var Ol=new RegExp("(?:"+wl()+")$","i");function El(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 Pl={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 Nl(e){return Pl[e]}function jl(e){for(var t,n="",i=El(e.split(""));!(t=i()).done;){var r=Nl(t.value);r&&(n+=r)}return n}function Rl(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 Tl(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 Tl(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 Tl(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 Ml(e){for(var t,n="",i=Rl(e.split(""));!(t=i()).done;){n+=Ul(t.value,n)||""}return n}function Ul(e,t,n){if("+"===e){if(t)return;return"+"}return Nl(e)}function Ll(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 _l(e,t){return"IS_POSSIBLE"===Ll(e,t)}function Wl(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Dl(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 Fl(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 Fl(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 Fl(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 ql=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Bl(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new cl(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(Wl(i,n.nationalNumberPattern())){if(Vl(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Vl(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=Dl(ql);!(r=o()).done;){var s=r.value;if(Vl(i,s,n))return s}}}}function Vl(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Wl(e,t.pattern()))}function Hl(e,t,n){var i=new cl(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new cl(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(el,"]+"),"g")," ").trim()}var Gl=/(\$\d)/;function Kl(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(Gl,t.nationalPrefixFormattingRule()):t.format());return i?zl(o):o}var Jl=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Yl(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 Zl(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 Zl(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 Zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Xl(e,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 Ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xl(Object(n),!0).forEach((function(t){ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var tc={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function nc(e,t,n,i){if(n=n?Ql(Ql({},tc),n):tc,i=new cl(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?oc(r=ic(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=ic(s,null,"INTERNATIONAL",i,n),oc(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=ml(i,r.metadata);if(o===n){var s=ic(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new cl(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():Jl.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(ic(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return oc(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function ic(e,t,n,i,r){var o=rc(i.formats(),e);return o?Kl(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function rc(e,t){for(var n,i=Yl(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(Wl(t,r.pattern()))return r}}function oc(e,t,n,i){return t?i(e,t,n):e}function sc(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 ac(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sc(Object(n),!0).forEach((function(t){dc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}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 lc(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 cc=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 cl(t);uc(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 lc(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Hl(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new cl(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 _l(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 cl(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Bl(e,t,n.metadata):Wl(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new cl(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Bl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return nc(this,e,t?ac(ac({},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}(),uc=function(e){return/^[A-Z]{2}$/.test(e)};var hc=new RegExp("(["+Qd+"])");function fc(e,t,n,i){if(t){var r=new cl(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(hc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function pc(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 gc(e,t){var n=pc(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Wl(e,n.nationalNumberPattern())&&!Wl(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Ll(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function vc(e,t,n,i){var r=t?ml(t,i):n;if(0===e.indexOf(r)){(i=new cl(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=gc(o,i).nationalNumber,a=gc(e,i).nationalNumber;if(!Wl(a,i.nationalNumberPattern())&&Wl(s,i.nationalNumberPattern())||"TOO_LONG"===Ll(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function mc(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=fc(e,t,n,i);if(!o||o===e){if(t||n){var s=vc(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 cl(i);for(var l=2;l-1<=Xd&&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 $c(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 yc(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 yc(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 yc(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,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new cl(i);for(var r,o=$c(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(Bl({phone:e,country:s},void 0,i.metadata))return s}}function wc(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:bc(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var Cc="+",kc="(["+Qd+"]|[\\-\\.\\(\\)]?)",Sc=new RegExp("^\\"+Cc+kc+"*["+Qd+"]"+kc+"*$","g"),Ic=new RegExp("^("+("["+Qd+"]+((\\-)*["+Qd+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Qd+"])*")+"\\.?$","g"),xc="tel:",Oc=";phone-context=",Ec=";isub=";function Ac(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Oc);if(t<0)return null;var n=t+Oc.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&&(Sc.test(e)||Ic.test(e))}(r))throw new Jd("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===Cc&&(n+=r);var o,s=e.indexOf(xc);o=s>=0?s+xc.length:0;var a=e.indexOf(Oc);n+=e.substring(o,a)}var d=n.indexOf(Ec);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Pc=250,Nc=new RegExp("[++"+Qd+"]"),jc=new RegExp("[^"+Qd+"#]+$");function Rc(e,t,n){if(t=t||{},n=new cl(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Jd("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>Pc){if(n)throw new Jd("TOO_LONG");return}if(!1===t)return e;var i=e.search(Nc);if(i<0)return;return e.slice(i).replace(jc,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=Yd&&xl.test(e)}(i))return function(e){return Sl.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Ol);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(Ol),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 Jd("TOO_SHORT");throw new Jd("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=mc(Ml(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||ml(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=gc(Ml(d),i),c=l.nationalNumber,u=l.carrierCode,h=wc(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 Jd("INVALID_COUNTRY");return{}}if(!l||l.length<Yd){if(t.v2)throw new Jd("TOO_SHORT");return{}}if(l.length>Zd){if(t.v2)throw new Jd("TOO_LONG");return{}}if(t.v2){var f=new cc(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)&&Wl(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!_l(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 Tc(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 Mc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tc(Object(n),!0).forEach((function(t){Uc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lc(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,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){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 Dc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dc(e,t)}(e,t)||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 Dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Fc(e){var t,n,i,r=Wc(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(!rl(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?Lc(Object(n),!0).forEach((function(t){_c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lc(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 qc(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 Bc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qc(Object(n),!0).forEach((function(t){Vc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hc(e,t,n){t&&t.defaultCountry&&!$l(t.defaultCountry,n)&&(t=Bc(Bc({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Rc(e,Mc(Mc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Jd))throw e}}function zc(){var e=Fc(arguments);return Hc(e.text,e.options,e.metadata)}function Gc(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 Kc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Jc=Gc((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;Kc(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),Yc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Kc(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return Gc(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Jc(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Jc(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 Zc(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 Xc=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 Yc(t)}return Zc(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 Qc(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function eu(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var tu=" - \u2028\u2029 ",nu="[".concat(tu,"]"),iu="[^".concat(tu,"]"),ru="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),ou="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",su="[".concat(ou,"]"),au=new RegExp(su),du="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),lu=new RegExp(du),cu="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),uu=new RegExp(cu),hu=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function fu(e){return!(!au.test(e)&&!uu.test(e))&&hu.test(e)}function pu(e){return"%"===e||lu.test(e)}function gu(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 vu={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()||!mu(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!mu(e,n,r)||yu(e,n)||!$u(e,{defaultCountry:i,metadata:r}))&&bu()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!mu(e,n,r)||yu(e,n)||!$u(e,{defaultCountry:i,metadata:r}))&&bu()}};function mu(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"!==gu(t.substring(i),e,n))return!1}else{var s=jl(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function $u(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new cl(i);r.selectNumberingPlan(e.countryCallingCode),e.country||wc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=rc(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function yu(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)||jl(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function bu(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var wu=/[\\/] *x/;function Cu(e){return eu(wu,e)}var ku=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,Su=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Iu=/^:[0-5]\d/;function xu(e,t,n){if(ku.test(e))return!1;if(Su.test(e)){var i=n.slice(t+e.length);if(Iu.test(i))return!1}return!0}var Ou="(\\[([",Eu=")\\])]",Au="[^".concat(Ou).concat(Eu,"]"),Pu="[".concat(Ou).concat(tl,"]"),Nu=new RegExp("^"+Pu),ju=Qc(0,3),Ru=new RegExp("^(?:[(\\[([])?(?:"+Au+"+["+Eu+"])?"+Au+"+(?:["+Ou+"]"+Au+"+["+Eu+"])"+ju+Au+"*$"),Tu=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function Mu(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 Uu(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 Uu(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 Uu(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 Lu(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 _u=wl(),Wu=["\\/+(.*)/","(\\([^(]*)","(?:".concat(nu,"-|-").concat(nu,")").concat(nu,"*(.+)"),"[‒-―-]".concat(nu,"*(.+)"),"\\.+".concat(nu,"*([^.]+)"),"".concat(nu,"+(").concat(iu,"+)")],Du=Qc(0,2),Fu=Qc(0,4),qu=Zd+Xd,Bu=Qc(0,qu),Vu="[".concat(el,"]")+Fu,Hu=ru+Qc(1,qu),zu="(?:"+Pu+Vu+")"+Du+Hu+"(?:"+Vu+Hu+")"+Bu+"(?:"+_u+")?",Gu=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(ou,"#]+$")),Ku=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Ju=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&&$l(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Ku}).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=vu[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 Xc(32)}return Lu(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(xu(t=Cu(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=Mu(Wu);!(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=eu(Gu,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=eu(Gu,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(Ru.test(e)&&!Tu.test(e)){if("POSSIBLE"!==i){if(t>0&&!Nu.test(e)){var r=n[t-1];if(pu(r)||fu(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(pu(s)||fu(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 Yu(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 Zu=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 Yu(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 Xu(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 Qu(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 Qu(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 Qu(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 eh="x",th=new RegExp(eh);function nh(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function ih(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 rh(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=oh(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return oh(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function oh(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Kl(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 jl(e)===t.getNationalDigits()}(s,e))return s}function sh(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 ah=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return sh(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([uh(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(ch);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(uh(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(uh(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:dh(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(lh.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function dh(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 lh=/[\(\)\[\]\?\:\|]/,ch=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function uh(e){return 1===e.length?e[0]:e}function hh(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 fh(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 fh(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 fh(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 ph(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 gh=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 ah).parse(t)}return ph(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=vh(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function vh(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=vh(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=hh(t.args);!(d=l()).done;){var c=vh(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=hh(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 mh(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 $h(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 $h(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 $h(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 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 bh=nh("9",15),wh=/[- ]/,Ch=new RegExp("["+el+"]*\\$1["+el+"]*(\\$\\d["+el+"]*)*$"),kh=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 yh(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"===Ll(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=mh(this.matchingFormats);!(i=r()).done;){var o=i.value,s=rh(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,eh),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(eh),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 gh(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":Ch.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=mh(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()&&wh.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(eh,t+1),n++;return ih(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,eh)+nh(eh,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=bh.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(Gl,e.nationalPrefixFormattingRule());if(jl(e.nationalPrefixFormattingRule())===(r||"")+jl("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,eh),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),eh);return c||(o?p=nh(eh,o.length)+" "+p:r&&(p=nh(eh,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=Xu(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(th)<0)return;t=e.search(th),e=e.replace(th,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],ih(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 Sh(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 Ih(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 Ih(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 Ih(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 xh(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 Oh=new RegExp("^"+("["+el+Qd+"]+")+"$","i"),Eh="(?:[++]["+el+Qd+"]*|["+el+Qd+"]+)",Ah=new RegExp("[^"+el+Qd+"]+.*$"),Ph=/[^\d\[\]]/,Nh=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 xh(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(Eh);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=Sh(t,2),i=n[0],r=n[1];Oh.test(i)||(i="");return[i,r]}(e),r=Sh(i,2),o=r[0],s=r[1],a=jl(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=mc("+"+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&&Ph.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=pc(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=pc(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=fc(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=vc(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 jh(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 Th(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,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new cl(n);var i=jh(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return Th(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(rl(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 Zu({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 kh({state:this.state,metadata:this.metadata}),this.parser=new Nh({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,eh)}},{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(wc(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 cl(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=bc(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new cc(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 Uh(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Dd),e.apply(this,n)}(zc,arguments)}function Lh(e,t){return Ju.call(this,e,t,Dd)}function _h(e){return Mh.call(this,e,Dd)}function Wh(){return cl.call(this,Dd)}Lh.prototype=Object.create(Ju.prototype,{}),Lh.prototype.constructor=Lh,_h.prototype=Object.create(Mh.prototype,{}),_h.prototype.constructor=_h,Wh.prototype=Object.create(cl.prototype,{}),Wh.prototype.constructor=Wh;const Dh=e=>{if(!e)return e;const t=Uh(e.startsWith("+")?e:`+${e}`);if(!t)return e;const n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return(null==t?void 0:t.number.replace(n,"$1-$2"))||e},Fh=h((e=>{var a,d,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(jd,Ce,C,Mn,Ln,Rd)(e)){constructor(){super(...arguments),a.add(this),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),u.set(this,void 0),p.set(this,(()=>n(this,void 0,void 0,(function*(){yield i(this,l,"f").setData(ni(this.state).map((({name:e,description:t})=>({value:e,label:e,description:t}))))})))),g.set(this,(()=>{var e;const t=ai(this.state);null===(e=i(this,c,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&i(this,u,"f").setData(si(this.state))})),m.set(this,(()=>{var e,t;const n=null===(e=hi(this.state))||void 0===e?void 0:e[0],r=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:Dh(null==n?void 0:n.phone),recoveryEmail:null==n?void 0:n.recoveryEmail,recoveryPhone:Dh(null==n?void 0:n.recoveryPhone),roles:null==n?void 0:n.roleNames,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},Xn(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,r),i(this,u,"f").value=(null==n?void 0:n.userTenants)||[]}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),yield i(this,a,"m",$).call(this)}))}},d=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,a=new WeakSet,h=function(){new oe((()=>{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()))},f=function(){new oe((()=>{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:n}=e,r=t(e,["loginId"]),o=i(this,c,"f")&&!i(this,c,"f").classList.contains("hidden")?i(this,u,"f").mergedValue:void 0;this.actions.updateUser(Object.assign(Object.assign({loginId:n.split(", ")[0]},Zn(r,"customAttributes")),void 0!==o&&{userTenants:o})),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},v=function(){const e=oi(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)}))},$=function(){return n(this,void 0,void 0,(function*(){var e,t;this.editUserModal=this.createModal(),this.editUserModal.setContent(s(yield this.fetchWidgetPage("edit-user-modal.html"))),i(this,a,"m",h).call(this),i(this,a,"m",f).call(this),r(this,d,new we(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),r(this,l,new $e((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),r(this,c,null===(t=this.editUserModal.ele)||void 0===t?void 0:t.querySelector('[data-id="sub-tenant-section"]'),"f"),r(this,u,new ve((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield i(this,p,"f").call(this),i(this,d,"f").disable(),i(this,g,"f").call(this),i(this,m,"f").call(this),i(this,a,"m",v).call(this)}))}))},y})),qh=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd,Fh,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),xi)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.editButton=new oe(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()}))},a})),Bh=h((e=>{var t,r,a,d,l;return l=class extends(o(jd,Ce,C,Mn,Rd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{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=bi(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(s(yield this.fetchWidgetPage("enable-user-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`Activate ${e}?`}))}))},l})),Vh=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd,Bh,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Si)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.enableButton=new oe(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()}))},a})),Hh=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd)(e)){constructor(){super(...arguments),t.add(this),r.set(this,c((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",s).call(this)}))}},r=new WeakMap,t=new WeakSet,s=function(){var e;this.searchInput=new we(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(i(this,r,"f"))},a})),zh=new Set(["contains","not-contains","starts-with","ends-with","not-equal"]),Gh=e=>{const t=Array.isArray(e)?e[0]:e;return null==t||""===t?null:String(t)},Kh=e=>Array.isArray(e)?e:null==e||""===e?[]:[String(e)],Jh=(e,t)=>({[e]:t}),Yh=(e,t)=>({customAttributes:{[e]:t}}),Zh=(e,t)=>{var n,i;const r=Gh(t.value);if(null===r)return{};return((e,t,n)=>({searchFields:[Object.assign({field:e,valStr:t},n?{negative:!0}:{})]}))(e,`${null!==(n=t.prefix)&&void 0!==n?n:""}${r}${null!==(i=t.suffix)&&void 0!==i?i:""}`,t.operator.startsWith("not-"))},Xh=(e,t)=>((e,t)=>"equal"===t.operator&&null!=e.exactField)(e,t)?((e,t)=>{const n=Kh(t.value);return n.length?Jh(e,n):{}})(e.exactField,t):((e,t)=>zh.has(t.operator)&&null!=e.likeField)(e,t)?Zh(e.likeField,t):null,Qh=(e,t,n)=>{if((e=>"is-empty"===e.operator)(t))return Yh(e.name,null);if(!(e=>"equal"===e.operator||"is-any-of"===e.operator)(t))return{};const i=((e,t)=>{if(Array.isArray(e))return e.length?e:void 0;if(null!=e&&""!==e){if("boolean"===t)return"true"===e||"false"!==e&&void 0;if("number"===t){const t=Number(e);return Number.isFinite(t)?t:void 0}return e}})(t.value,n);return void 0===i?{}:Yh(e.name,i)},ef=(e,t)=>{const{mapping:n}=e;if(!n)return null;switch(n.kind){case"array":return((e,t)=>{if("is-any-of"!==t.operator)return null;const n=Kh(t.value);if(!n.length)return{};const i=e.valueMap?n.map((t=>{var n;return null!==(n=e.valueMap[t])&&void 0!==n?n:t})):n;return Jh(e.field,i)})(n,t);case"boolean":return((e,t)=>{if("equal"!==t.operator)return null;const n=Gh(t.value);return"true"===n?Jh(e.field,!0):"false"===n?Jh(e.field,!1):{}})(n,t);case"text":return Xh(n,t);case"customAttribute":return Qh(n,t,e.inputType);default:return null}},tf=(e,n)=>{const{searchFields:i,customAttributes:r}=n,o=t(n,["searchFields","customAttributes"]),s=i?(a=e.searchFields,d=i,[...null!=a?a:[],...d]):e.searchFields;var a,d;const l=r?((e,t)=>Object.assign(Object.assign({},null!=e?e:{}),t))(e.customAttributes,r):e.customAttributes,c=Object.assign({},e);return Object.entries(o).forEach((([e,t])=>{var n,i;c[e]=(n=c[e],i=t,Array.isArray(n)&&Array.isArray(i)?[...n,...i.filter((e=>!n.includes(e)))]:i)})),Object.assign(Object.assign({},c),{searchFields:s,customAttributes:l})},nf=(e,t=[])=>{const n={};(e=>{const t=new Set(["searchFields","customAttributes"]);return e.forEach((e=>{const n=null==e?void 0:e.mapping;n&&("array"===n.kind||"boolean"===n.kind?t.add(n.field):"text"===n.kind&&n.exactField&&t.add(n.exactField))})),t})(t).forEach((e=>{n[e]=void 0}));const i=new Map(t.filter((e=>Boolean(e))).map((e=>[e.id,e])));return e.reduce(((e,t)=>{const n=((e,t)=>{if(e.column&&e.operator)return t.get(e.column)})(t,i);if(!n)return e;const r=ef(n,t);return r?tf(e,r):e}),n)},rf="customAttributes.",of="roles",sf=e=>{if("string"==typeof e)return{value:e,label:e};const{value:t,label:n}=e;return{value:t,label:n||t}},af=(e,t)=>{const n=e.id.slice(17),i=null==t?void 0:t.find((e=>e.name===n));if(!i)return e;const r=e.label||i.displayName||n,o=(e=>Array.isArray(e.options)&&e.options.length?e.options.map(sf):void 0)(i),s=Object.assign(Object.assign({},e),{label:r});return o&&(s.options=o),s},df=(e,t,n)=>{var i;const r=((e,t)=>{if(!(null==t?void 0:t.length))return e.filter((e=>(null==e?void 0:e.id)!==of));const n=t.map((e=>({value:e.name,label:e.name})));return e.map((e=>(null==e?void 0:e.id)===of?Object.assign(Object.assign({},e),{options:n}):e))})(null!==(i=null==e?void 0:e.slice())&&void 0!==i?i:[],t);return((e,t)=>e.filter((e=>{var n;if(!(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n.startsWith(rf))||!(null==t?void 0:t.length))return!0;const i=e.id.slice(17);return t.some((e=>e.name===i))})).map((e=>{var n;return(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n.startsWith(rf))?af(e,t):e})))(r,n)},lf=h((e=>{var t,s,a,l,c,u,h,f;return f=class extends(o(C,Rd,jd)(e)){constructor(){super(...arguments),t.set(this,null),s.set(this,(()=>i(this,t,"f")?[...i(this,t,"f")]:this.filter.data)),a.set(this,(e=>{const t=Array.isArray(null==e?void 0:e.value)?e.value:[];this.actions.searchUsers(Object.assign(Object.assign({},nf(t,i(this,s,"f").call(this))),{page:0}))})),l.set(this,(()=>{this.actions.searchUsers(Object.assign(Object.assign({},nf([],i(this,s,"f").call(this))),{page:0}))})),c.set(this,d(((e,t,n)=>{this.filter.data=df(e,t,n)}))),u.set(this,(()=>{var e;(null===(e=this.filter)||void 0===e?void 0:e.isExists)&&i(this,c,"f").call(this,i(this,t,"f"),ni(this.state),oi(this.state))})),h.set(this,(()=>{r(this,t,Object.freeze(this.filter.data.slice()),"f"),i(this,u,"f").call(this)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t,n;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this);const r=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector("descope-filter");this.filter=new re(r,{logger:this.logger}),this.filter.isExists&&(this.filter.onDataChange(i(this,h,"f")),i(this,h,"f").call(this),this.subscribe(i(this,u,"f"),ni),this.subscribe(i(this,u,"f"),oi),this.filter.onApply(i(this,a,"f")),this.filter.onClear(i(this,l,"f")))}))}},t=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,h=new WeakMap,f}));const cf={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},uf=h((e=>{var t,r,s,a,l;return l=class extends(o(C,jd,Ie,E)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{e.length&&(e.forEach((({type:e,msg:n})=>{const o=i(this,t,"m",s).call(this,e);o.setContent(i(this,t,"m",r).call(this,{type:e,msg:n})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(i(this,a,"f").bind(this),ri)}))}},a=new WeakMap,t=new WeakSet,r=function({type:e,msg:t}){const n=cf[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}`},s=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},l})),hf=h((e=>{var t,r,a,d,l;return l=class extends(o(jd,Ce,C,Mn,Rd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{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=bi(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(s(yield this.fetchWidgetPage("remove-passkey-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`Remove passkey for ${e}?`}))}))},l})),ff=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd,hf,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Oi)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.removePasskeyButton=new oe(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()}))},a})),pf=h((e=>{var t,r,s,a,l,u,h,f;return f=class extends(o(jd,C,Rd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{this.usersTable.data=e}))),l.set(this,c(((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})}))),u.set(this,d((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 n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",s).call(this),i(this,a,"f").call(this,ui(this.state)),i(this,u,"f").call(this,oi(this.state)),this.subscribe(i(this,u,"f").bind(this),oi),this.subscribe(i(this,a,"f").bind(this),ui)}))}},a=new WeakMap,l=new WeakMap,u=new WeakMap,t=new WeakSet,r=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}},s=function(){var e;this.usersTable=new ce(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(i(this,t,"m",h).bind(this)),i(this,t,"m",r).call(this),i(this,t,"m",h).call(this)},h=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{i(this,l,"f").call(this,e.target,e.detail)}))}))},f})),gf=h((e=>{var t,r,a;return a=class extends(o(jd,Ce,C,Mn,Rd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",r).call(this)}))}},t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(s(yield this.fetchWidgetPage("generated-password-modal.html")));new oe((()=>{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()}))}))},a})),vf=h((e=>{var t,r,a,d,l;return l=class extends(o(jd,Ce,C,Mn,Rd,gf)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield i(this,t,"m",d).call(this)}))}},t=new WeakSet,r=function(){new oe((()=>{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()))},a=function(){new oe((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){var e;const t=bi(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()}))))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(s(yield this.fetchWidgetPage("reset-password-modal.html"))),i(this,t,"m",r).call(this),i(this,t,"m",a).call(this);const o=new be(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ki(this.state);o.text=`This will generate a new temporary password for ${e}?`}))}))},l})),mf=h((e=>{var t,r,s,a;return a=class extends(o(C,Rd,jd,vf,Mn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;i(this,t,"m",r).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(i(this,s,"f").bind(this),Ei)}))}},s=new WeakMap,t=new WeakSet,r=function(){var e;this.resetPasswordButton=new oe(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()}))},a})),$f=h((e=>class extends(o(je,A)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),yf=h((e=>{var t,s,a,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(_n,$f,jd,ke,C,Mn,Rd,Hn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.set(this,void 0),l.set(this,[]),c.set(this,null),u.set(this,null),$.set(this,d((e=>{i(this,l,"f").forEach((t=>{"onlyOne"===t.enableMode&&1===e.length||"oneOrMore"===t.enableMode&&e.length>0||"always"===t.enableMode?t.enable():t.disable()}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),i(this,t,"m",p).call(this),i(this,t,"m",f).call(this),i(this,$,"f").call(this,ii(this.state))}))}},s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,$=new WeakMap,t=new WeakSet,h=function(e){const n=new ae(e,{logger:this.logger});n.onClick((()=>{i(this,t,"m",m).call(this,n.flowId)})),this.subscribe(i(this,$,"f").bind(this),ii),i(this,l,"f").push(n)},f=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{i(this,t,"m",h).call(this,e)}))},p=function(){r(this,s,this.createFlowModal({"data-id":"generic-flow-modal"}),"f"),i(this,s,"f").afterClose=()=>{var e;i(this,c,"f")&&(null===(e=i(this,u,"f"))||void 0===e||e.call(this),r(this,c,null,"f"))},r(this,a,new se((()=>{var e;return null===(e=i(this,s,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(i(this,a,"f"))},g=function(){var e;i(this,s,"f").open(),null===(e=i(this,u,"f"))||void 0===e||e.call(this)},v=function(e,n){n=()=>i(this,t,"m",g).call(this),r(this,u,i(this,a,"f").onPageUpdated(n),"f")},m=function(e){i(this,s,"f").setContent(this.createFlowTemplate({flowId:e,lazyStart:!1,client:{userIds:fi(this.state),loginIds:pi(this.state),usersAndRoles:gi(this.state)},tenant:this.tenantId})),i(this,t,"m",v).call(this,i(this,s,"f"),i(this,c,"f")),i(this,a,"f").onSuccess((()=>{i(this,s,"f").close(),this.actions.searchUsers()}))},y})),bf="widget-flow",wf=h((e=>{var t,r,s;return s=class extends(o(_n,E,ke,jd,Dn,C,je,Hn)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this);const o=ei(bf);o&&(!function(e){if(window.history.replaceState&&ei(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())}}(bf),i(this,t,"m",r).call(this,o))}))}},t=new WeakSet,r=function(e){const t=this.createFlowModal({"data-id":"redirect-flow"});t.setContent(this.createFlowTemplate({flowId:e}));new se((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close()})),t.afterClose=()=>{t.remove()},t.open()},s})),Cf=h((e=>class extends(o(_,je,wf,pf,Md,Ld,qh,Vh,Wd,mf,ff,Hh,lf,uf,yf,Jn)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),kf=o((e=>class extends(Cf(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(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 Sm})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.20.3"}}}))}}))(HTMLElement);customElements.define("descope-user-management-widget",kf);const Sf=(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 If,xf,Of,Ef,Af,Pf,Nf,jf,Rf,Tf;const Mf=document.createElement("template");Mf.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';const Uf=o(J)(HTMLElement);class Lf extends Uf{constructor(){var e;super(),If.add(this),xf.set(this,new $({messages:[]})),Of.set(this,void 0),Ef.set(this,void 0),Af.set(this,void 0),Pf.set(this,{resize:i(this,If,"m",Tf).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Mf.content.cloneNode(!0)),this.injectStyle('\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'),r(this,Of,this.shadowRoot.querySelector(".debugger"),"f"),i(this,Of,"f").style.top="32px",i(this,Of,"f").style.left=window.innerWidth-300-32+"px",r(this,Ef,i(this,Of,"f").querySelector(".content"),"f"),r(this,Af,i(this,Of,"f").querySelector(".header"),"f")}updateData(e){i(this,xf,"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]=Sf(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})(i(this,Of,"f"),i(this,Af,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",i(this,Pf,"f").resize),(e=i(this,Of,"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},i(this,Of,"f").onresize=i(this,If,"m",Rf).bind(this),i(this,xf,"f").subscribe(i(this,If,"m",Nf).bind(this))}disconnectedCallback(){i(this,xf,"f").unsubscribeAll(),window.removeEventListener("resize",i(this,Pf,"f").resize)}}xf=new WeakMap,Of=new WeakMap,Ef=new WeakMap,Af=new WeakMap,Pf=new WeakMap,If=new WeakSet,Nf=function(e){i(this,If,"m",jf).call(this,e),i(this,If,"m",Rf).call(this)},jf=function(e){i(this,Ef,"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("")},Rf=function(){i(this,Ef,"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)}))},Tf=function(){const[e,t]=Sf(i(this,Of,"f"),Number.parseInt(i(this,Of,"f").style.left,10),Number.parseInt(i(this,Of,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});i(this,Of,"f").style.top=`${t}px`,i(this,Of,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Lf);var _f=Object.freeze({__proto__:null,default:Lf});const Wf="undefined"!=typeof localStorage,Df="J151000",Ff="E103205",qf="E108201",Bf=Wf&&localStorage.getItem("base.content.url")||"",Vf="base.ui.components.url";Wf&&localStorage.getItem(Vf),Wf&&localStorage.getItem(Vf);const Hf="descope-login-flow",zf="code",Gf="redirect_mode",Kf="err",Jf="data-exclude-field",Yf="data-exclude-next",Zf="dls_last_auth",Xf="dls_last_submitted_login_id",Qf="state_id",ep="saml_idp_state_id",tp="wsfed_idp_state_id",np="saml_idp_username",ip="descope_idp_initiated",rp="sso_app_id",op="custom_app_id",sp="third_party_app_id",ap="third_party_app_state_id",dp="oidc_login_hint",lp="oidc_prompt",cp="oidc_resource",up="oidc_error_redirect_uri",hp="application_scopes",fp="data-type",pp="redirect",gp="poll",vp="webauthnCreate",mp="webauthnGet",$p="nativeBridge",yp="loadForm",bp="submit",wp="polling",Cp=["descope-multi-select-combo-box","descope-text-area"],kp="dls_last_auth_in_flight",Sp=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts","data","totp","notp","sentTo","sso","selfProvisionDomains"];var Ip;!function(e){e.backward="backward",e.forward="forward"}(Ip||(Ip={}));const xp=["descope-enriched-text"];function Op(e){return new URLSearchParams(window.location.search).get(e)}function Ep(e){if(window.history.replaceState&&Op(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 Ap(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?Ip.forward:n<i?Ip.backward:void 0}const Pp=e=>{let[t="",n=""]=(Op(Hf)||"").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 Np(){Ep(Hf)}function jp(){return Op(rp)}function Rp(){Ep(rp)}const Tp=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),Mp=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=Pp(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&Np();const o=Op("t")||void 0;o&&Ep("t");const s=Op(zf)||void 0;s&&Ep(zf);const a="popup"===Op(Gf);a&&Ep(Gf);const d=Op(Kf)||void 0;d&&Ep(Kf);const{redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h}={redirectAuthCodeChallenge:Op("ra-challenge"),redirectAuthCallbackUrl:Op("ra-callback"),redirectAuthBackupCallbackUri:Op("ra-backup-callback"),redirectAuthInitiator:Op("ra-initiator")},f=Op(Qf);f&&Ep(Qf);const p=Op(ep);p&&Ep(ep);const g=Op(tp);g&&Ep(tp);const v=Op(np);p&&Ep(np);const m=Op(ip);m&&Ep(ip);const $=jp();$&&Rp();const y=Op(op);y&&Ep(op);const b=Op(sp);b&&Ep(sp);const w=Op(ap);w&&Ep(ap);const C=Op(hp);C&&Ep(hp);const k=Op(dp);k&&Ep(dp);const S=Op(lp);S&&Ep(lp);const I=Op(up);I&&Ep(up);const x=Op(cp);return x&&Ep(cp),{executionId:n,stepId:i,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h,ssoQueryParams:{oidcIdpStateId:f,samlIdpStateId:p,wsfedIdpStateId:g,samlIdpUsername:v,descopeIdpInitiated:"true"===m,ssoAppId:$,customAppId:y,oidcLoginHint:k,oidcPrompt:S,oidcErrorRedirectUri:I,oidcResource:x,thirdPartyAppId:b,thirdPartyAppStateId:w,applicationScopes:C}}},Up=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}})},Lp=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector('*[name]:not([auto-focus="false"]):not([aria-hidden="true"])');setTimeout((()=>{null==t||t.focus()}))}};function _p(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 Wp=(e,{oidcIdpStateId:t,samlIdpStateId:n,wsfedIdpStateId:i,samlIdpUsername:r,ssoAppId:o,customAppId:s,oidcLoginHint:a,oidcPrompt:d,oidcErrorRedirectUri:l,oidcResource:c,thirdPartyAppId:u,thirdPartyAppStateId:h,applicationScopes:f})=>!(!e||t||n||i||r||o||s||a||d||l||c||u||h||f),Dp=(e,t,n)=>{const i=document.createElement("input");return i.type="hidden",i.name=e,i.value=t,n&&i.setAttribute("role",n),i},Fp=e=>null==e?void 0:e.submit(),qp=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},Bp=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}},Vp={minLength:"data-password-policy-value-minlength",strength:"data-password-policy-value-passwordstrength",disallowedChars:"data-password-policy-value-disallowedchars",email:"data-password-policy-value-email",activePolicies:"active-policies",availablePolicies:"available-policies"},Hp=(e,t)=>{var n;const i=null==e?void 0:e.componentsDynamicAttrs;if(!i)return;const r=Object.entries(i).find((([e])=>(e=>{var t;return null===(t=e.match(/\[data-name=["']([^"']+)["']\]/))||void 0===t?void 0:t[1]})(e)===t));return null===(n=null==r?void 0:r[1])||void 0===n?void 0:n.attributes},zp=[{key:"totp",from:e=>e.totp},{key:"notp",from:e=>e.notp},{key:"sentTo",from:e=>e.sentTo},{key:"sso",from:e=>e.sso},{key:"selfProvisionDomains",from:e=>e.selfProvisionDomains},{key:"inboundAppApproveScopes",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.thirdPartyAppApproveScopes)||void 0===n?void 0:n.data}},{key:"securityQuestionsSetup",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqSetup}},{key:"securityQuestionsVerify",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqVerify}},{key:"userTenants",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userSelectedTenant)||void 0===n?void 0:n.data}},{key:"userRoles",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userRoles)||void 0===n?void 0:n.data}},{key:"ssoApplications",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoApplications)||void 0===n?void 0:n.data}},{key:"ssoConfigurations",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoConfigurations)||void 0===n?void 0:n.data}},{key:"samlAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlMappings)||void 0===n?void 0:n.options}},{key:"oidcAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.oidcMappings)||void 0===n?void 0:n.options}},{key:"samlGroupMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlGroupMappings)||void 0===n?void 0:n.options}},{key:"passwordPolicy",from:e=>{var t;return(e=>{if(!e)return;const t=Object.fromEntries(Object.entries(Vp).map((([t,n])=>[t,e[n]])).filter((([,e])=>void 0!==e)));return Object.keys(t).length?t:void 0})(null===(t=e.componentsConfig)||void 0===t?void 0:t.newPassword)}},{key:"recoveryCodes",from:e=>(e=>{const t=Hp(e,"recoveryCodes");if(t)return Array.isArray(t.data)?t.data.map((e=>e.value)):[]})(e.componentsConfig)},{key:"outboundApp",from:e=>(e=>{const t=Hp(e,"outboundApp");if(t)return{label:t.label,iconSrc:t["icon-src"],appId:t["data-descope-outbound-oauth-app-id"]}})(e.componentsConfig)}],Gp=e=>{const t=Object.assign({},e);return e.inboundAppApproveScopes&&(t.thirdPartyAppApproveScopes=e.inboundAppApproveScopes),t};function Kp(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var Jp,Yp,Zp,Xp;function Qp(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(!Qp(o,s))return!1}else if(o!==s)return!1}return!0}let eg=class{constructor(e={},{forceUpdate:t=!1}={}){Jp.set(this,void 0),Yp.set(this,{}),Zp.set(this,0),Xp.set(this,!0),this.update=e=>{const t="function"==typeof e?e(i(this,Jp,"f")):e,n=Object.assign(Object.assign({},i(this,Jp,"f")),t),o=i(this,Jp,"f");r(this,Jp,n,"f"),Object.freeze(i(this,Jp,"f")),setTimeout((()=>{Object.values(i(this,Yp,"f")).forEach((({cb:e,selector:t,forceUpdate:r})=>{const s=t(o),a=t(n);(i(this,Xp,"f")||r||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(a)?!Qp(s,a):s!==a))&&e(a,s,((e,t)=>n=>e[n]!==t[n])(a,s))}))}),0)},r(this,Jp,e,"f"),r(this,Xp,t,"f")}get current(){return Object.assign({},i(this,Jp,"f"))}set forceUpdate(e){r(this,Xp,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return r(this,Zp,i(this,Zp,"f")+1,"f"),i(this,Yp,"f")[i(this,Zp,"f")]={cb:e,selector:t,forceUpdate:n},i(this,Zp,"f").toString()}unsubscribe(e){const t=!!i(this,Yp,"f")[e];return t&&delete i(this,Yp,"f")[e],t}unsubscribeAll(){return r(this,Yp,{},"f"),!0}};Jp=new WeakMap,Yp=new WeakMap,Zp=new WeakMap,Xp=new WeakMap;const tg=["*","#","/","(",")","[","]","_","<",">","`"],ng=e=>"string"!=typeof e?e:e.replace((e=>{const t=tg.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),ig=["disabled"],rg=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Jf}])`)).forEach((e=>{e.value=n}))}))},og=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),sg=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?ng(og(t,i)):og(t,i))),ag=(e,t,n)=>{e.querySelectorAll(`[${fp}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},dg=(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})`))},lg=(e,n,i,r)=>{var o,s;ag(e,"totp-link",null===(o=null==n?void 0:n.totp)||void 0===o?void 0:o.provisionUrl),ag(e,"notp-link",null===(s=null==n?void 0:n.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=>xp.includes(e))(e.localName);e.textContent=sg(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",sg(i,t))}))})(e,n),((e,n,i)=>{if(!n)return;const{componentsDynamicAttrs:r}=n,o=t(n,["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 n=s[t];Object.keys(n).forEach((t=>{let r=n[t];if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){i.error(`Could not stringify value "${r}" for "${t}"`,e.message),r=""}e.setAttribute(t,r)}))}))}))})(e,null==n?void 0:n.componentsConfig,r),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=sg(e.value,t)}))}))})(e,n),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{ig.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,i)},cg=Up((()=>n(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 _p(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}}))));let ug;const hg=(e,t)=>{ug?ug.setItem(e,t):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.setItem(e,t)},fg=e=>ug?ug.getItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)?window.localStorage.getItem(e):null,pg="dls_ab_testing_id",gg={"lastAuth.loginId":{"not-empty":e=>{var t;return!!e.loginId||!!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)},empty:e=>{var t;return!e.loginId&&!(null===(t=e.lastAuth)||void 0===t?void 0:t.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,"greater-than-or-equal":(e,t)=>(e.abTestingKey||0)>=t,"less-than-or-equal":(e,t)=>(e.abTestingKey||0)<=t,"in-range":(e,t)=>{const[n,i]=t?t.split(",").map(Number):[void 0,void 0];return(e.abTestingKey||0)>=(null!=n?n:0)&&(e.abTestingKey||0)<=(null!=i?i:0)},"not-in-range":(e,t)=>{const[n,i]=t?t.split(",").map(Number):[void 0,void 0];return!(void 0!==n&&void 0!==i&&!Number.isNaN(n)&&!Number.isNaN(i))||(e.abTestingKey||0)<n||(e.abTestingKey||0)>i},"devised-by":(e,t)=>{const n=Number(t);return!Number.isNaN(n)&&(e.abTestingKey||0)%n==0}}};function vg(e,t){const n={};try{Object.assign(n,JSON.parse(fg(Zf)))}catch(e){null==t||t.warn("[Descope] Failed to read last auth from storage",String(e))}return n.loginId||e?n:{}}function mg(e,t){(null==e?void 0:e.authMethod)&&(t&&!e.loginId||hg(Zf,JSON.stringify(e)))}function $g(){try{return JSON.parse(fg(kp)||"{}")}catch(e){return{}}}function yg(e){try{(e=>{ug?ug.removeItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.removeItem(e)})(kp)}catch(t){null==e||e.warn("[Descope] Failed to clear in-flight last auth storage",String(t))}}const bg=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if(Array.isArray(e[i]))return Object.assign(Object.assign({},n),{[i]:{value:e[i].map((e=>"object"==typeof e&&null!==e?bg(e):e))}});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),bg(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}),[]),wg=h((e=>{var t,n,r,o;return o=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;i(this,t,"m",n).call(this)&&i(this,t,"m",r).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)},r=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)},o})),Cg=["input","change"];function kg(e){if("number"==typeof e&&Number.isFinite(e))return{value:e,ok:!0};if("boolean"==typeof e)return{value:e?1:0,ok:!0};if("string"==typeof e){if(""===e.trim())return{value:0,ok:!1};const t=Number(e);if(Number.isFinite(t))return{value:t,ok:!0}}return{value:0,ok:!1}}function Sg(e){return null==e?"":"string"==typeof e?e:"boolean"==typeof e?e?"true":"false":"number"==typeof e?Number.isFinite(e)?String(e):"":String(e)}function Ig(e){if("boolean"==typeof e)return{value:e,ok:!0};if("string"==typeof e){if("true"===e)return{value:!0,ok:!0};if("false"===e)return{value:!1,ok:!0}}return"number"==typeof e?{value:0!==e,ok:!0}:{value:!1,ok:!1}}function xg(e){return Array.isArray(e)?e:"string"==typeof e?e.split(","):null}function Og(e){return null==e||("string"==typeof e?""===e:Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)}const Eg=new Map,Ag={equal:(e,t)=>e===t||Sg(e)===Sg(t),"not-equal":(e,t)=>e!==t&&Sg(e)!==Sg(t),contains:(e,t)=>Array.isArray(e)?e.includes(t):"string"==typeof e&&e.includes(Sg(t)),"doesnt-contains":(e,t)=>Array.isArray(e)?!e.includes(t):"string"==typeof e&&!e.includes(Sg(t)),"greater-than":(e,t)=>{const n=kg(e),i=kg(t);return n.ok&&i.ok&&n.value>i.value},"greater-than-or-equal":(e,t)=>{const n=kg(e),i=kg(t);return n.ok&&i.ok&&n.value>=i.value},"less-than":(e,t)=>{const n=kg(e),i=kg(t);return n.ok&&i.ok&&n.value<i.value},"less-than-or-equal":(e,t)=>{const n=kg(e),i=kg(t);return n.ok&&i.ok&&n.value<=i.value},empty:e=>Og(e),"not-empty":e=>!Og(e),"is-true":e=>{const t=Ig(e);return t.ok&&t.value},"is-false":e=>{const t=Ig(e);return t.ok&&!t.value},in:(e,t)=>{const n=xg(t);return null!==n&&n.includes(e)},"not-in":(e,t)=>{const n=xg(t);return null!==n&&!n.includes(e)},matches:(e,t)=>{if("string"!=typeof e)return!1;const n=function(e){var t;if(Eg.has(e))return null!==(t=Eg.get(e))&&void 0!==t?t:null;let n;try{n=new RegExp(e)}catch(e){n=null}return Eg.set(e,n),n}(Sg(t));return null!==n&&n.test(e)}};function Pg(e,t){var n;if(e)return"form"===e.kind&&e.form?t[e.form]:"list"===e.kind?(null!==(n=e.items)&&void 0!==n?n:[]).map((e=>Pg(e,t))):e.value}function Ng(e,t){const n=Ag[e.operator];return!!n&&n(Pg(e.target,t),Pg(e.predicate,t))}function jg(e,t){const n={};return(null!=e?e:[]).forEach((e=>{var i;(function(e,t){var n;return(null!==(n=e.rules)&&void 0!==n?n:[]).some((e=>function(e,t){var n;const i=null!==(n=e.atomicConditions)&&void 0!==n?n:[];return!!i.length&&(e.logicalOr?i.some((e=>Ng(e,t))):i.every((e=>Ng(e,t))))}(e,t)))})(e,t)&&(null!==(i=e.componentIds)&&void 0!==i?i:[]).forEach((t=>{n[t]=e.action}))})),n}const Rg=["hide","disable","read-only"];const Tg=/(["\\])/g;function Mg(e){return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(e):e.replace(Tg,"\\$1")}function Ug(e,t){return Array.from(e.querySelectorAll(`[id="${Mg(t)}"]`))}function Lg(e,t,n){return Object.keys(t).forEach((i=>{const r=t[i];n[i]!==r&&Ug(e,i).forEach((e=>function(e,t){switch(t){case"hide":e.classList.remove("hidden");break;case"disable":e.removeAttribute("disabled");break;case"read-only":e.removeAttribute("readonly")}}(e,r)))})),Object.keys(n).forEach((i=>{const r=n[i],o=t[i];r!==o&&Ug(e,i).forEach((e=>function(e,t){switch(t){case"hide":e.classList.add("hidden");break;case"disable":e.setAttribute("disabled","true");break;case"read-only":e.setAttribute("readonly","true")}}(e,r)))})),Object.assign({},n)}const _g="component-conditions:";function Wg(e){return e instanceof HTMLInputElement?"checkbox"===e.type?e.checked:e.value:"checked"in e?e.checked:"value"in e?e.value:void 0}function Dg(e,t){const n=Object.keys(e),i=Object.keys(t);return n.length===i.length&&n.every((n=>e[n]===t[n]))}function Fg(){return{conditions:[],touchedIds:new Set,snapshot:{},applied:{},serverBaseline:{},debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:null}}function qg(e,t,n){const i={};return n.forEach((n=>{e[n]?i[n]=e[n]:t[n]&&(i[n]=t[n])})),i}const Bg=h((e=>{var t,n,s,a,d,l;const c=o(C)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,Fg())}applyComponentsState(e,t){t&&(Object.entries(t).forEach((([e,t])=>{Rg.includes(t)||this.logger.error(`Unknown component action "${t}" for component with id "${e}"`,`Valid actions are ${Rg.map((e=>`"${e}"`)).join(", ")}`)})),Lg(e,{},t))}initRealtimeConditions(e,o){var a,l,c,u;i(this,t,"m",d).call(this);const h=null!==(a=null==o?void 0:o.realtimeComponentsConditions)&&void 0!==a?a:[];if(!h.length)return void this.logger.debug(`${_g} no real-time rules to apply on this screen`);this.logger.info(`${_g} found ${h.length} real-time rule(s) for this screen`);const f={};Object.entries(null!==(l=null==o?void 0:o.form)&&void 0!==l?l:{}).forEach((([e,t])=>{f[`form.${e}`]=t})),function(e){const t=new Set,n=e=>{var i;e&&("form"===e.kind&&e.form?t.add(e.form):"list"===e.kind&&(null!==(i=e.items)&&void 0!==i?i:[]).forEach(n))};return(null!=e?e:[]).forEach((e=>{var t;return(null!==(t=e.rules)&&void 0!==t?t:[]).forEach((e=>{var t;return(null!==(t=e.atomicConditions)&&void 0!==t?t:[]).forEach((e=>{n(e.target),n(e.predicate)}))}))})),t}(h).forEach((t=>{const n=function(e,t){const n=t.startsWith("form.")?t.slice(5):t;return e.querySelector(`[name="${Mg(t)}"]`)||e.querySelector(`[name="${Mg(n)}"]`)}(e,t);if(!n)return;const i=Wg(n);void 0!==i&&(f[t]=i)}));const p=function(e){const t=new Set;return(null!=e?e:[]).forEach((e=>{var n;(null!==(n=e.componentIds)&&void 0!==n?n:[]).forEach((e=>t.add(e)))})),t}(h),g={},v={};Object.entries(null!==(c=null==o?void 0:o.componentsState)&&void 0!==c?c:{}).forEach((([e,t])=>{p.has(e)&&(v[e]=t)})),Object.entries(null!==(u=null==o?void 0:o.serverOnlyComponentsState)&&void 0!==u?u:{}).forEach((([e,t])=>{p.has(e)&&(g[e]=t)}));const m={conditions:h,touchedIds:p,snapshot:f,applied:v,serverBaseline:g,debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:e},$=qg(jg(h,f),g,p);Dg(v,$)||(m.applied=Lg(e,v,$)),m.inputHandler=e=>i(this,t,"m",s).call(this,e),Cg.forEach((t=>{e.addEventListener(t,m.inputHandler,!0)})),this.logger.debug(`${_g} listening for "${Cg.join('" and "')}" events on form fields; ${Object.keys(v).length} component(s) start hidden / disabled / read-only by these rules`);const y=this.nextRequestStatus;if(null==y?void 0:y.subscribe){const e=({isLoading:e})=>{m.paused=e,e&&m.debounceTimer&&(clearTimeout(m.debounceTimer),m.debounceTimer=null)},t=y.subscribe(e);m.unsubscribePauseListener=()=>{var e;null!=t&&(null===(e=y.unsubscribe)||void 0===e||e.call(y,t))}}r(this,n,m,"f")}disconnectedCallback(){var e;null===(e=super.disconnectedCallback)||void 0===e||e.call(this),i(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(e){var r,o;const s=i(this,n,"f");if(!s.root||s.paused)return;const d=e.target;if(!d)return;if(null===(r=d.hasAttribute)||void 0===r?void 0:r.call(d,Jf))return;const l=null===(o=d.getAttribute)||void 0===o?void 0:o.call(d,"name");if(!l)return;const c=function(e){return e.startsWith("form.")?e:`form.${e}`}(l);s.snapshot[c]=Wg(d),s.debounceTimer&&clearTimeout(s.debounceTimer),s.debounceTimer=setTimeout((()=>{s.debounceTimer=null,i(this,t,"m",a).call(this)}),50)},a=function(){const e=i(this,n,"f");if(!e.root)return;let t;try{t=qg(jg(e.conditions,e.snapshot),e.serverBaseline,e.touchedIds)}catch(e){return void this.logger.error(`${_g} failed to evaluate real-time rules — keeping the previous state`,null==e?void 0:e.message)}const r=e.applied;Dg(r,t)||(this.logger.debug(`${_g} form changed — updating components: was ${JSON.stringify(r)}, now ${JSON.stringify(t)}`),e.applied=Lg(e.root,r,t))},d=function(){const e=i(this,n,"f");e.debounceTimer&&clearTimeout(e.debounceTimer),e.unsubscribePauseListener&&e.unsubscribePauseListener(),e.root&&(Object.keys(e.applied).length>0&&e.root.isConnected&&Lg(e.root,e.applied,{}),Cg.forEach((t=>{e.root.removeEventListener(t,e.inputHandler,!0)}))),r(this,n,Fg(),"f")},l})),Vg="project-id",Hg="flow-id",zg=e=>{const t=(e=>{const t=e.getAttribute(Vg),n=e.getAttribute(Hg);return t&&n?Array.from(e.ownerDocument.querySelectorAll("descope-wc")).filter((e=>e.getAttribute(Vg)===t&&e.getAttribute(Hg)===n)):[]})(e);return t.length>1&&t[0]!==e},Gg=h((e=>{var t,n,s,a;const d=o(C)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}connectedCallback(){var e;null===(e=super.connectedCallback)||void 0===e||e.call(this),i(this,t,"m",s).call(this)}attributeChangedCallback(e,n,r){var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,r),n===r||e!==Vg&&e!==Hg||i(this,t,"m",s).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){queueMicrotask((()=>{if(!this.isConnected)return;const e=this.getAttribute(Vg),t=this.getAttribute(Hg),o=`${e}|${t}`;i(this,n,"f")!==o&&zg(this)&&(r(this,n,o,"f"),this.logger.warn("Multiple Descope flow components detected on the same page",`The same flow ("${t}") and project ("${e}") are running more than once on this page. This is not supported and may cause the flow to behave unexpectedly.`))}))},a})),Kg=["externalId","email","phone"],Jg=["newPassword","password"],Yg="data-username-anchor",Zg=e=>{var t;if(!e)return"";try{const n=null===(t=window.sessionStorage)||void 0===t?void 0:t.getItem(Xf);if(!n)return"";const i=JSON.parse(n);return i.executionId===e&&i.loginId||""}catch(e){return""}},Xg=h((e=>{var t,n,s,a,d;const l=o(C)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}updateScreenUser(e){var o,d,l;r(this,n,{email:null==e?void 0:e.email,loginIds:(null===(o=null==e?void 0:e.loginIds)||void 0===o?void 0:o.length)?e.loginIds:[Zg(i(this,t,"a",a))||(null===(l=null===(d=i(this,t,"a",s).sdk)||void 0===d?void 0:d.getLastUserLoginId)||void 0===l?void 0:l.call(d))].filter(Boolean)},"f")}updateUsernameAnchor(){document.querySelectorAll(`[${Yg}="true"]`).forEach((e=>e.remove())),((e,t,n,i)=>{var r;const o=(null==n?void 0:n.email)||(null===(r=null==n?void 0:n.loginIds)||void 0===r?void 0:r[0]);(e=>e.querySelector("descope-new-password")||e.querySelector("descope-password"))(t)?o?(e=>{const t=['input[autocomplete="username"]',...Kg.map((e=>`[name="${e}"]`))].join(", ");return e.some((e=>e.querySelector(t)))})([e,t])?i.debug("Username anchor: screen already has an identifier field"):(i.debug("Username anchor: injecting hidden username input"),e.appendChild((e=>{const t=document.createElement("input");return t.setAttribute("autocomplete","username"),t.setAttribute("name","username"),t.setAttribute("type","email"),t.setAttribute("readonly","true"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.setAttribute(Jf,"true"),t.setAttribute(Yg,"true"),t.setAttribute("value",e),t.value=e,Object.assign(t.style,{position:"absolute",opacity:"0",pointerEvents:"none",height:"0",border:"0"}),t})(o))):i.debug("Username anchor: no user identifier available"):i.debug("Username anchor: no password component on screen")})(this,i(this,t,"a",s).contentRootElement,i(this,n,"f"),this.logger)}captureLastSubmittedLoginId(e={},n){const r=qp(e,Kg);r&&((e,t)=>{var n;if(e&&t)try{null===(n=window.sessionStorage)||void 0===n||n.setItem(Xf,JSON.stringify({executionId:t,loginId:e}))}catch(e){}})(r,n||i(this,t,"a",a))}storeCredentials(e={}){var t,r,o,s,a,d;const l=qp(e,Kg)||(null===(t=i(this,n,"f"))||void 0===t?void 0:t.email)||(null===(o=null===(r=i(this,n,"f"))||void 0===r?void 0:r.loginIds)||void 0===o?void 0:o[0]),c=qp(e,Jg);if(l&&c)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:l,password:c});null===(d=null===(a=null===(s=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,e))||void 0===d||d.catch((e=>{this.logger.error("Could not store credentials",null==e?void 0:e.message)}))}catch(e){this.logger.error("Could not store credentials",e.message)}}},n=new WeakMap,t=new WeakSet,s=function(){return this},a=function(){var e,n;return(null===(n=null===(e=i(this,t,"a",s).flowState)||void 0===e?void 0:e.current)||void 0===n?void 0:n.executionId)||""},d})),Qg=e=>`${e.screenId}|${e.field}|${e.rule}`,ev=()=>{try{return crypto.randomUUID()}catch(e){return`${Date.now()}-${Math.round(1e9*Math.random())}`}},tv=(e,t)=>e?e.badInput?"bad-input":e.valueMissing?"required":e.typeMismatch?"email"===t||"url"===t?t:"type-mismatch":e.patternMismatch?"pattern":e.tooShort?"too-short":e.tooLong?"too-long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.customError?"custom":"unknown":"unknown",nv=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g,v,m,$,y,b,w,k,S;const I=o(C)(e);return S=class extends I{constructor(){super(...arguments),t.add(this),n.set(this,[]),s.set(this,void 0),a.set(this,void 0),d.set(this,new Set),l.set(this,!1),c.set(this,0),u.set(this,void 0),h.set(this,!1),f.set(this,(()=>i(this,t,"m",y).call(this,!1))),p.set(this,(()=>{"hidden"===document.visibilityState&&i(this,t,"m",y).call(this,!0)})),g.set(this,(()=>i(this,t,"m",y).call(this,!0)))}setValidationTrackingEnabled(e){i(this,h,"f")!==e&&(r(this,h,e,"f"),e||i(this,t,"m",$).call(this))}setValidationTrackingSender(e){r(this,u,e,"f")}setValidationTrackingExecution(e){i(this,h,"f")&&e&&i(this,n,"f").length&&(r(this,s,e,"f"),i(this,t,"m",y).call(this,!1))}trackValidationErrors(e,n){var r,o;try{i(this,t,"m",v).call(this,e,n)}catch(e){null===(o=null===(r=this.logger)||void 0===r?void 0:r.debug)||void 0===o||o.call(r,"Failed to track validation errors",String(e))}}teardownValidationTracking(){i(this,t,"m",y).call(this,!1),r(this,c,i(this,c,"f")+1,"f"),i(this,d,"f").forEach(clearTimeout),i(this,d,"f").clear(),i(this,l,"f")&&(r(this,l,!1,"f"),this.removeEventListener("screen-updated",i(this,f,"f")),this.removeEventListener("success",i(this,f,"f")),this.removeEventListener("error",i(this,f,"f")),document.removeEventListener("visibilitychange",i(this,p,"f")),window.removeEventListener("pagehide",i(this,g,"f")))}},n=new WeakMap,s=new WeakMap,a=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,v=function(e,o){if(!i(this,h,"f")||!(null==e?void 0:e.length))return;const a=o||{};i(this,t,"m",k).call(this),e.forEach((e=>{if(i(this,n,"f").length>=20)return;const o=((e,t)=>{var n;const i=null===(n=null==e?void 0:e.getAttribute)||void 0===n?void 0:n.call(e,"name");return i?{id:ev(),field:i,rule:tv(e.validity,e.type),message:e.validationMessage||"",screenId:t.screenId||"",screenName:t.screenName||"",ts:Date.now()}:null})(e,a);if(!o)return;const d=Qg(o);i(this,n,"f").some((e=>Qg(e)===d))||(i(this,n,"f").push(o),r(this,s,a.executionId||i(this,s,"f"),"f"),i(this,n,"f").length>=20&&i(this,t,"m",y).call(this,!1))})),i(this,n,"f").length>=20?i(this,t,"m",y).call(this,!1):i(this,t,"m",m).call(this)},m=function(){clearTimeout(i(this,a,"f")),r(this,a,setTimeout((()=>i(this,t,"m",y).call(this,!1)),2e3),"f")},$=function(){clearTimeout(i(this,a,"f")),r(this,c,i(this,c,"f")+1,"f"),i(this,d,"f").forEach(clearTimeout),i(this,d,"f").clear(),r(this,n,[],"f"),r(this,s,void 0,"f")},y=function(e){var o,d;if(clearTimeout(i(this,a,"f")),!i(this,n,"f").length)return void r(this,s,void 0,"f");if(!i(this,s,"f"))return;if(!i(this,u,"f"))return;const l=i(this,n,"f"),h=i(this,s,"f");r(this,n,[],"f"),r(this,s,void 0,"f");try{const n={executionId:h,events:l};e?i(this,u,"f").call(this,n,{keepalive:!0}).catch((()=>{})):i(this,t,"m",b).call(this,n,2,i(this,c,"f"))}catch(e){null===(d=null===(o=this.logger)||void 0===o?void 0:o.debug)||void 0===d||d.call(o,"Failed to send validation events",String(e))}},b=function(e,n,r){i(this,u,"f").call(this,e,{keepalive:!1}).then((o=>{!o.ok&&o.retryable&&n>0&&i(this,t,"m",w).call(this,e,n,r)})).catch((()=>{n>0&&i(this,t,"m",w).call(this,e,n,r)}))},w=function(e,n,r){if(r!==i(this,c,"f"))return;const o=setTimeout((()=>{i(this,d,"f").delete(o),r===i(this,c,"f")&&i(this,t,"m",b).call(this,e,n-1,r)}),800*(2-n+1));i(this,d,"f").add(o)},k=function(){i(this,l,"f")||(r(this,l,!0,"f"),this.addEventListener("screen-updated",i(this,f,"f")),this.addEventListener("success",i(this,f,"f")),this.addEventListener("error",i(this,f,"f")),document.addEventListener("visibilitychange",i(this,p,"f")),window.addEventListener("pagehide",i(this,g,"f")))},S}));var iv,rv,ov,sv,av,dv,lv,cv,uv,hv,fv,pv,gv,vv,mv,$v,yv,bv,wv,Cv,kv,Sv,Iv,xv,Ov,Ev;const Av=o(je,M,wg,Bg,Gg,Xg,J,Vn,nv)(HTMLElement);class Pv extends Av{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","send-session-token","style-id"]}constructor(e){super(),iv.add(this),this.sdkVersion="4.4.2",ov.set(this,!1),sv.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),i(this,iv,"m",Ev).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)}},av.set(this,new eg),dv.set(this,new eg),lv.set(this,{}),this.getComponentsContext=()=>i(this,lv,"f"),this.nextRequestStatus=new eg({isLoading:!1}),cv.set(this,void 0),uv.set(this,{popstate:i(this,iv,"m",vv).bind(this),componentsContext:i(this,iv,"m",Cv).bind(this)}),hv.set(this,void 0),this.getConfig=()=>n(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),kv.set(this,void 0),Sv.set(this,void 0),r(this,hv,e,"f"),i(this,iv,"m",pv).call(this)}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}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 sendSessionToken(){return"true"===this.getAttribute("send-session-token")}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{return bg(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 popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return i(this,sv,"f")}set customStorage(e){if(e&&"function"!=typeof e.getItem)throw new Error("Custom storage must have a getItem method");if(e&&"function"!=typeof e.setItem)throw new Error("Custom storage must have a setItem method");if(e&&"function"!=typeof e.removeItem)throw new Error("Custom storage must have a removeItem method");r(this,sv,e,"f"),(e=>{ug=e})(e)}get lazyStart(){return"true"===this.getAttribute("lazy-start")}start(){var e;null===(e=i(this,Sv,"f"))||void 0===e||e.call(this),r(this,kv,Promise.resolve(),"f")}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return n(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 n(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Cp.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()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return n(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 n(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),i(this,dv,"f").subscribe(i(this,iv,"m",Ov).bind(this)),i(this,dv,"f").update({isDebug:this.debug}),i(this,iv,"m",gv).call(this),yield i(this,iv,"m",bv).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");const{executionId:o,stepId:s,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:g}=Mp(this.flowId,this.loggerWrapper);window.addEventListener("popstate",i(this,uv,"f").popstate),window.addEventListener("components-context",i(this,uv,"f").componentsContext),i(this,av,"f").subscribe(i(this,iv,"m",yv).bind(this)),i(this,av,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:s,executionId:o,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},g)),r(this,ov,!0,"f")}))}disconnectedCallback(){var e;i(this,av,"f").unsubscribeAll(),i(this,dv,"f").unsubscribeAll(),i(this,iv,"m",xv).call(this),window.removeEventListener("popstate",i(this,uv,"f").popstate),window.removeEventListener("components-context",i(this,uv,"f").componentsContext),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}attributeChangedCallback(e,t,n){var r;if(null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,t,n),this.shadowRoot.isConnected&&i(this,ov,"f")&&t!==n&&rv.observedAttributes.includes(e)){i(this,iv,"m",gv).call(this);const r=null===t;i(this,av,"f").update((({stepId:t,executionId:i})=>{let o=t,s=i;return r||(s=null,o=null,Np()),{[Tp(e)]:n,stepId:o,executionId:s}})),i(this,dv,"f").update({isDebug:this.debug})}}}var Nv,jv,Rv,Tv,Mv,Uv,Lv,_v,Wv,Dv,Fv,qv,Bv,Vv,Hv,zv,Gv,Kv,Jv,Yv,Zv,Xv,Qv,em,tm,nm,im,rm,om,sm,am,dm,lm,cm,um,hm,fm,pm,gm,vm,mm,$m,ym,bm,wm;rv=Pv,ov=new WeakMap,sv=new WeakMap,av=new WeakMap,dv=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,hv=new WeakMap,kv=new WeakMap,Sv=new WeakMap,iv=new WeakSet,fv=function(){this.injectStyle("\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 ")},pv=function(){i(this,iv,"m",fv).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},gv=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","send-session-token","style-id","outbound-app-id","outbound-app-scopes","theme-override"];rv.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Tp(t)])throw Error(`${t} cannot be empty`)}))},vv=function(){const{stepId:e,executionId:t}=Pp(this.flowId);i(this,av,"f").update({stepId:e,executionId:t})},mv=function(e,t){pd&&"function"==typeof pd||this.logger.error("SDK was not loaded properly",pd,JSON.stringify(pd));const r=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},rv.sdkConfigOverrides),{projectId:e,baseUrl:t});i(this,sv,"f")&&(r.customStorage=i(this,sv,"f")),this.sdk=pd(r);const o={start:1,next:7};["start","next"].forEach((e=>{const t=function(e,t,i){return(...r)=>n(this,void 0,void 0,(function*(){let n;const o=i+1;for(let s=0;s<o;s++)try{return yield e(...r)}catch(e){n=e,s<i&&(yield new Promise((e=>{setTimeout(e,t*Math.pow(2,s+1))})))}throw n}))}(this.sdk.flow[e],1e3,3);this.sdk.flow[e]=(...r)=>n(this,void 0,void 0,(function*(){const n=[...r],s=o[e],a=i(this,iv,"m",$v).call(this,n[s]);void 0!==a&&(n[s]=a);try{return yield t(...n)}catch(t){return this.logger.error(`Error in sdk flow ${e} function`,t),{error:{errorCode:Df,errorDescription:t.toString()}}}}))}));const s=this.sdk.flow.start;this.sdk.flow.start=(...e)=>n(this,void 0,void 0,(function*(){return yield i(this,iv,"m",Iv).call(this),s.apply(this.sdk.flow,e)}))},$v=function(e){if(!this.sendSessionToken)return e;const t=null==wa?void 0:wa(this.storagePrefix);return t?Object.assign(Object.assign({},null!=e?e:{}),{sessionJwt:t}):e},yv=function(e,t,r){return n(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:n}=e;if(r("projectId")||r("baseUrl")){if(!t)return;i(this,iv,"m",mv).call(this,t,n)}i(this,hv,"f").call(this,e)}))},bv=function(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield i(this,iv,"m",wv).call(this))}))},wv=function(){return n(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(Bf||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 n(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}}))},Cv=function(e){r(this,lv,Object.assign(Object.assign({},i(this,lv,"f")),e.detail),"f")},Iv=function(){return this.lazyStart?(i(this,kv,"f")||r(this,kv,new Promise((e=>{r(this,Sv,e,"f")})),"f"),i(this,kv,"f")):Promise.resolve()},xv=function(){var e;null===(e=i(this,cv,"f"))||void 0===e||e.remove(),r(this,cv,null,"f")},Ov=function(e){return n(this,arguments,void 0,(function*({isDebug:e}){e?(r(this,cv,document.createElement("descope-debugger"),"f"),Object.assign(i(this,cv,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return Fm})),document.body.appendChild(i(this,cv,"f"))):i(this,iv,"m",xv).call(this)}))},Ev=function(e,t){var n;e&&this.debug&&(null===(n=i(this,cv,"f"))||void 0===n||n.updateData({title:e,description:t}))},Pv.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.4.2"}};const Cm="__descope_webauthn_timed_out__";class km extends Pv{static set sdkConfigOverrides(e){Pv.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Pv.sdkConfigOverrides}constructor(){const e=new eg({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),Nv.add(this),this.stepState=new eg({}),jv.set(this,void 0),Rv.set(this,null),Tv.set(this,null),Mv.set(this,{visibilitychange:i(this,Nv,"m",Uv).bind(this)}),this.bridgeVersion=km.bridgeVersion,Lv.set(this,void 0),this.nativeCallbacks={},Hv.set(this,!1),this.handleRedirect=e=>{window.location.assign(e)},Kv.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()?i(this,Nv,"m",Jv).call(this,t):t()})),Yv.set(this,((e,t,o,s,a=!1)=>{const d=[Ff,"E103202",qf];if(this.flowState.current.action===gp){if(i(this,Xv,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const l=Date.now(),c=a?500:2e3;r(this,jv,setTimeout((()=>n(this,void 0,void 0,(function*(){var n,r;this.logger.debug("polling - Calling next");const u=this.sdk.flow.next(e,t,wp,o,s,{}),h=document.hidden&&!a&&Date.now()-l>c+500;let f;h&&this.logger.debug("polling - The polling seems to be throttled");try{const e=h?1e3:6e3;f=yield _p(e,u)}catch(n){return this.logger.warn(`polling - The ${h?"throttled fetch":"fetch"} call timed out or was aborted`),void i(this,Yv,"f").call(this,e,t,o,s,h)}if((null===(n=null==f?void 0:f.error)||void 0===n?void 0:n.errorCode)===Df)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void i(this,Yv,"f").call(this,e,t,o,s);this.logger.debug("polling - Got a response"),(null==f?void 0:f.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),(null===(r=null==f?void 0:f.error)||void 0===r?void 0:r.errorCode)&&d.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):i(this,Yv,"f").call(this,e,t,o,s),i(this,Qv,"f").call(this,f)}))),c),"f")}})),Zv.set(this,(()=>{clearTimeout(i(this,jv,"f")),r(this,jv,null,"f")})),Xv.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),Qv.set(this,(e=>{var t,n,o,s,a,d,l,c,u,h,f,p,g;if(!(null==e?void 0:e.ok)){const r=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===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;i(this,Nv,"m",bm).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:l,errorMessage:r}),this.loggerWrapper.error((null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorDescription)||r,(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&&c!==Ff&&c!==qf||!this.isRestartOnError||i(this,Nv,"m",Vv).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 v=null===(f=null===(h=null===(u=e.data)||void 0===u?void 0:u.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:$,lastAuth:y,action:b,openInNewTabUrl:w}=e.data;if(b!==gp&&i(this,Zv,"f").call(this),"completed"===m){this.storeLastAuthenticatedUser&&mg(Object.assign(Object.assign({},y),{lastUsedPerScreen:$g()})),yg(this.loggerWrapper);const t=Object.assign({},$);return e.data.output&&Object.keys(e.data.output).length>0&&(t.flowOutput=e.data.output),this.setValidationTrackingExecution(e.data.executionId),void i(this,Nv,"m",bm).call(this,"success",t)}this.storeLastAuthenticatedUser&&mg(y,!0),w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:I,redirect:x,webauthn:O,error:E,samlIdpResponse:A,wsFedIdpResponse:P,nativeResponse:N}=e.data,j=Date.now();b!==gp?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:I,status:m,stepId:k,stepName:S,action:b,error:E}),(null===(g=I.state)||void 0===g?void 0:g.clientScripts)&&r(this,Tv,this.loadSdkScripts(I.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==x?void 0:x.url,redirectIsPopup:null==x?void 0:x.isPopup,screenId:null==I?void 0:I.id,screenState:null==I?void 0:I.state,webauthnTransactionId:null==O?void 0:O.transactionId,webauthnOptions:null==O?void 0:O.options,samlIdpResponseUrl:null==A?void 0:A.url,samlIdpResponseSamlResponse:null==A?void 0:A.samlResponse,samlIdpResponseRelayState:null==A?void 0:A.relayState,wsFedIdpResponseUrl:null==P?void 0:P.url,wsFedIdpResponseWresult:null==P?void 0:P.wresult,wsFedIdpResponseWctx:null==P?void 0:P.wctx,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:j})):this.flowState.update({action:b,reqTimestamp:j})})),em.set(this,Up((()=>n(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)}}))))),rm.set(this,void 0),om.set(this,void 0),cm.set(this,null),pm.set(this,Bp(((e,t,r)=>n(this,void 0,void 0,(function*(){var n,o;if("true"===e.getAttribute("formnovalidate")||i(this,Nv,"m",dm).call(this)){const s=null==e?void 0:e.getAttribute("id");i(this,Nv,"m",mm).call(this,e,s,r),i(this,Nv,"m",um).call(this,e);const a=yield i(this,Nv,"m",lm).call(this),d=(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);this.nextRequestStatus.update({isLoading:!0});const l=Object.assign(Object.assign(Object.assign({},d),a),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin}),c=yield t(s,l);this.nextRequestStatus.update({isLoading:!1}),this.captureLastSubmittedLoginId(a,null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.executionId),this.storeCredentials(a)}}))))),this.flowState=e,this.setValidationTrackingSender(((e,t)=>n(this,[e,t],void 0,(function*({executionId:e,events:t},{keepalive:n}){const i=yield this.sdk.flow.event(e,t,n);return{ok:i.ok,retryable:i.code>=500||429===i.code}}))))}nativeResume(e,t){var n,r,o,s,a,d;const l=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let e,{exchangeCode:t}=l;if(!t){const i=new URL(l.url);t=null===(n=i.searchParams)||void 0===n?void 0:n.get(zf),e=(null===(r=i.searchParams)||void 0===r?void 0:r.get(Kf))||void 0}null===(s=(o=this.nativeCallbacks).complete)||void 0===s||s.call(o,{exchangeCode:t,exchangeError:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(l.url),t=e.searchParams.get("t"),n=e.searchParams.get(Hf).split("_").pop();i(this,Zv,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const{screenResolve:e}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:t}=l;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=l,{screenNext:n}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(d=(a=this.nativeCallbacks).complete)||void 0===d||d.call(a,l)}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:{[Kp(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 i=Promise.all(null==e?void 0:e.map((e=>n(this,void 0,void 0,(function*(){var n,i,r;const o=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(o){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=o;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}(null===(i=globalThis.descope)||void 0===i?void 0:i[e.id])||(yield this.injectNpmLib("@descope/flow-scripts","1.0.19",`dist/${e.id}.js`));const s=null===(r=globalThis.descope)||void 0===r?void 0:r[e.id];return new Promise(((n,i)=>{try{const i=s(e.initArgs,{baseUrl:this.baseUrl,ref:this},t(e,n),this.loggerWrapper);if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t);const r=this.nextRequestStatus.subscribe((()=>{var n;this.loggerWrapper.debug("Stopping script",e.id),(null===(n=i.stop)||void 0===n?void 0:n.call(i))&&(this.nextRequestStatus.unsubscribe(r),this.loggerWrapper.debug("Removing script",e.id),this.shadowRoot.removeChild(t))}));"function"==typeof i.present&&n(e.id)}}catch(e){i(e)}}))}))))),r=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([i,r])}get isDismissScreenErrorOnInput(){return"true"===this.getAttribute("dismiss-screen-error-on-input")}init(){var e,t;if(!window.descopeBridge)return this._init();this.lazyInit=this._init,r(this,Lv,null===(t=null===(e=null===window||void 0===window?void 0:window.descopeBridge)||void 0===e?void 0:e.registerFlow)||void 0===t?void 0:t.call(e,this),"f")}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(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)),i(this,Nv,"m",qv).call(this),window.addEventListener("visibilitychange",i(this,Mv,"f").visibilitychange)),yield null===(n=e.init)||void 0===n?void 0:n.call(this)}))}disconnectedCallback(){var e,t,n;super.disconnectedCallback(),this.teardownValidationTracking(),i(this,Lv,"f")&&(null===(t=null===(e=window.descopeBridge)||void 0===e?void 0:e.unregisterFlow)||void 0===t||t.call(e,i(this,Lv,"f")),r(this,Lv,void 0,"f")),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),i(this,Zv,"f").call(this),null===(n=i(this,Rv,"f"))||void 0===n||n.abort(),r(this,Rv,null,"f"),window.removeEventListener("visibilitychange",i(this,Mv,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return n(this,void 0,void 0,(function*(){let n;const i=y(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 n(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,o,s){return n(this,void 0,void 0,(function*(){var a,d;const{projectId:l,flowId:c,tenant:u,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectIsPopup:$,redirectUrl:b,token:w,code:C,isPopup:k,exchangeError:S,webauthnTransactionId:I,webauthnOptions:x,redirectAuthCodeChallenge:O,redirectAuthCallbackUrl:E,redirectAuthBackupCallbackUri:A,redirectAuthInitiator:P,locale:N,samlIdpResponseUrl:j,samlIdpResponseSamlResponse:R,samlIdpResponseRelayState:T,wsFedIdpResponseUrl:M,wsFedIdpResponseWresult:U,wsFedIdpResponseWctx:L,nativeResponseType:_,nativePayload:W,reqTimestamp:D}=e,F=t(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx","nativeResponseType","nativePayload","reqTimestamp"]);let q,B,V;const H=(()=>{const e=fg(pg);if(!e){const e=Math.floor(100*Math.random()+1);return hg(pg,e.toString()),e}return Number(e)})(),{outboundAppId:z,outboundAppScopes:G}=this,K=this.sdk.getLastUserLoginId();s("flowId")&&this.setValidationTrackingEnabled(!1);const J=yield this.getFlowConfig();i(this,Nv,"m",sm).call(this,J,f,s);const Y=yield this.getProjectConfig(),Z=Object.entries(Y.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),X=E&&O?{callbackUrl:E,codeChallenge:O,backupCallbackUri:A}:void 0,Q=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect,externalAuthRedirect:this.nativeOptions.externalAuthRedirect}:void 0;let ee={};if(!f){yg(this.loggerWrapper);const e=[...J.clientScripts||[],...J.sdkScripts||[]];if(J.conditions){let t=[];({startScreenId:q,conditionInteractionId:V,startScreenName:B,clientScripts:t,componentsConfig:ee}=((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=gg[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:K,code:C,token:w,abTestingKey:H,lastAuth:vg(K,this.loggerWrapper)},J.conditions)),e.push(...t||[])}else J.condition?({startScreenId:q,startScreenName:B,conditionInteractionId:V}=((e,t)=>{var n;const i=null===(n=gg[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}})(J.condition,{loginId:K,code:C,token:w,abTestingKey:H,lastAuth:vg(K,this.loggerWrapper)})):(B=J.startScreenName,q=J.startScreenId);if(r(this,rm,q,"f"),r(this,om,B,"f"),r(this,Tv,this.loadSdkScripts(e),"f"),J.fingerprintEnabled&&J.fingerprintKey?yield Pa(J.fingerprintKey,this.baseUrl):sa(Ea),!Wp(q,F)){const e=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},F),{client:this.client}),b&&{redirectUrl:b}),{lastAuth:vg(K,this.loggerWrapper),abTestingKey:H,locale:y(N).locale,nativeOptions:Q,outboundAppId:z,outboundAppScopes:G}),V,"",Y.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),C?{exchangeCode:C,idpInitiated:!0}:{}),F.descopeIdpInitiated&&{idpInitiated:!0}),w?{token:w}:{}),F.oidcLoginHint?{externalId:F.oidcLoginHint}:{}));return i(this,Qv,"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(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:k,code:C,exchangeError:S,isCodeChanged:s("code"),isExchangeErrorChanged:s("exchangeError")})),k&&(s("code")&&C||s("exchangeError")&&S))return void i(this,Nv,"m",wm).call(this,f,C,S);if(f&&(s("token")&&w||s("code")&&C||s("exchangeError")&&S)){const e=yield this.sdk.flow.next(f,h,bp,J.version,Y.componentsVersion,{token:w,exchangeCode:C,exchangeError:S});return i(this,Qv,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===yp&&j&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>s(e)))){if(!R)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.appendChild(Dp("SAMLResponse",t,"saml-response")),r.appendChild(Dp("RelayState",n,"saml-relay-state"));const o=document.createElement("input");o.type="submit",o.id="SAMLSubmitButton",o.value="Continue",o.style.display="none",r.appendChild(o),document.body.appendChild(r),i(r)})(j,R,T||"",Fp)}if(p===yp&&M&&["wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx"].some((e=>s(e)))){if(!U)return void this.loggerWrapper.error("Did not get wsfed idp params data to load");((e,t,n,i)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.appendChild(Dp("wa","wsignin1.0")),r.appendChild(Dp("wresult",t)),r.appendChild(Dp("wctx",n));const o=document.createElement("input");o.type="submit",o.id="WSFedSubmitButton",o.value="Continue",o.style.display="none",r.appendChild(o),document.body.appendChild(r),i(r)})(M,U,L||"",Fp)}if(p===pp&&(s("redirectTo")||s("deferredRedirect"))){if(!m)return void this.loggerWrapper.error("Did not get redirect url");if("no-op"===m)return;if("android"===P&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${$}`),$){this.loggerWrapper.debug("Opening redirect in popup");const e=((e,t,n,i)=>{const r=void 0!==window.screenLeft?window.screenLeft:window.screen.left,o=void 0!==window.screenTop?window.screenTop:window.screen.top,s=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-n)/2+r,a=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-i)/2+o,d=function(){const e=navigator.userAgent||"",t=/\b(iPhone)\b/.test(e),n=/Safari/.test(e)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(e);return t&&n}()?"about:blank":"",l=window.open(d,t,`width=${n},height=${i},top=${a},left=${s},scrollbars=yes,resizable=yes`);return l.location.href=e,l.focus(),l})(m,"?",598,700),t=this.shouldUsePopupPostMessage();t&&(e.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(t?"postMessage":"BroadcastChannel"));let n=!1;const r=e=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(e.data));const i=t?this.popupOrigin:window.location.origin;if(e.origin!==i)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${e.origin}", expected: "${i}"`);const{action:r,data:o}=e.data||{};"code"===r&&(n=!0,this.flowState.update({code:o.code,exchangeError:o.exchangeError}))};let o;this.loggerWrapper.debug("Starting popup closed detection");const s=setInterval((()=>{e.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(s),i(this,Nv,"m",bm).call(this,"popupclosed",{abandoned:!n}),this.loggerWrapper.debug("Cleaning up popup listeners"),null==o||o())}),1e3);if(t)window.addEventListener("message",r),o=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",r)};else{this.loggerWrapper.debug("Creating broadcast channel");const e=new BroadcastChannel(f);e.onmessage=r,o=()=>{this.loggerWrapper.debug("Closing channel"),e.close()}}}else this.handleRedirect(m),this.flowState.update({redirectTo:"no-op"}),i(this,Nv,"m",bm).call(this,"popupclosed",{});return}if(p===vp||p===mp){if(!I||!x)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");null===(d=i(this,Rv,"f"))||void 0===d||d.abort(),r(this,Rv,null,"f");const e=yield i(this,Nv,"m",Gv).call(this,p,x),t=yield this.sdk.flow.next(f,h,bp,J.version,Y.componentsVersion,Object.assign({transactionId:I},e));i(this,Qv,"f").call(this,t)}if(p===$p)return this.nativeCallbacks.complete=e=>n(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,bp,J.version,Y.componentsVersion,e);i(this,Qv,"f").call(this,t)})),i(this,Nv,"m",Dv).call(this,_,W),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((s("action")||s("deferredPolling"))&&i(this,Yv,"f").call(this,f,h,J.version,Y.componentsVersion),!g&&!q)return void this.loggerWrapper.warn("No screen was found to show");const te=q||g,ne=yield this.getHtmlFilenameWithLocale(N,te),{oidcLoginHint:ie,oidcPrompt:re,oidcErrorRedirectUri:oe,oidcResource:se,samlIdpUsername:ae}=F,de={direction:Ap(h,o.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:K,name:this.sdk.getLastUserDisplayName()||K},componentsConfig:Object.assign(Object.assign(Object.assign({},J.componentsConfig),ee),null==v?void 0:v.componentsConfig)}),htmlFilename:`${te}.html`,htmlLocaleFilename:ne,screenId:te,stepName:e.stepName||B,samlIdpUsername:ae,oidcLoginHint:ie,oidcPrompt:re,oidcErrorRedirectUri:oe,oidcResource:se,action:p,locale:y(N).locale},le=vg(K,this.loggerWrapper);Wp(q,F)?de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==J?void 0:J.clientScripts)||[];yield i(this,Nv,"m",gm).call(this,n);const r=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},F),{lastAuth:le,preview:this.preview,abTestingKey:H,client:this.client}),b&&{redirectUrl:b}),{locale:y(N).locale,nativeOptions:Q,outboundAppId:z,outboundAppScopes:G}),V,e,Y.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),Gp(t)),C&&{exchangeCode:C,idpInitiated:!0}),F.descopeIdpInitiated&&{idpInitiated:!0}),w&&{token:w}),de.next.isCustomScreen);return i(this,Qv,"f").call(this,r),r})):(s("projectId")||s("baseUrl")||s("executionId")||s("stepId"))&&(de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==v?void 0:v.clientScripts)||[];yield i(this,Nv,"m",gm).call(this,n);const r=yield this.sdk.flow.next(f,h,e,J.version,Y.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),Gp(t)),de.next.isCustomScreen);return i(this,Qv,"f").call(this,r),r}))),this.loggerWrapper.debug("Got a screen with id",de.screenId),yield i(this,Nv,"m",zv).call(this,de),this.stepState.update(de)}))}onStepChange(e,t){return n(this,void 0,void 0,(function*(){var r,o,s;const{htmlFilename:a,htmlLocaleFilename:d,direction:l,next:c,screenState:u,screenId:h}=e;this.loggerWrapper.debug("Rendering a flow screen"),this.updateScreenUser(null==u?void 0:u.user);const f=document.createElement("template");f.innerHTML=yield this.getPageContent(a,d);const p=f.content.cloneNode(!0),g=this.loadDescopeUiComponents(f);this.sdk.webauthn.helpers.isSupported()?yield i(this,Nv,"m",nm).call(this,p,c):(e=>{e.querySelectorAll(`descope-button[${fp}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(p),!e.samlIdpUsername||(null===(r=u.form)||void 0===r?void 0:r.loginId)||(null===(o=u.form)||void 0===o?void 0:o.email)||(u.form||(u.form={}),u.form.loginId=e.samlIdpUsername,u.form.email=e.samlIdpUsername),lg(p,u,this.formConfig,this.loggerWrapper),this.applyComponentsState(p,null==u?void 0:u.componentsState);const{geo:v}=null!==(s=yield this.getExecutionContext())&&void 0!==s?s:{};((e,t)=>{Object.entries({"default-code":"autoDetect","default-country":"autoDetect"}).forEach((([n,i])=>{Array.from(e.querySelectorAll(`[${n}="${i}"]`)).forEach((e=>{e.setAttribute(n,t||i)}))}))})(p,v),((e,t)=>{let n=t;if(t)try{const[e]=Intl.getCanonicalLocales(t);e&&(n=e)}catch(e){}Object.entries({lang:"autoDetect"}).forEach((([t,i])=>{Array.from(e.querySelectorAll(`[${t}="${i}"]`)).forEach((e=>{e.setAttribute(t,n||i)}))}))})(p,e.locale);const m=()=>n(this,void 0,void 0,(function*(){var n,r;yield g;const o=this.contentRootElement;((e,t)=>{dg(e,"descope-totp-image",t)})(o,null===(n=null==u?void 0:u.totp)||void 0===n?void 0:n.image),((e,t)=>{dg(e,"descope-notp-image",t)})(o,null===(r=null==u?void 0:u.notp)||void 0===r?void 0:r.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{if(!t.querySelector(r))return void 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.debug(`Could not find component class for ${r}`,"Check if the component is registered")}))})(o,p,u.cssVars,this.loggerWrapper),o.replaceChildren(p);const s=!t.htmlFilename;setTimeout((()=>{i(this,Nv,"m",hm).call(this),this.updateUsernameAnchor(),this.validateOnBlur&&((e,t)=>{e.querySelectorAll("*[name]").forEach((n=>{n.addEventListener("blur",(()=>{var i;const r=()=>{var e;const i=n.focus;n.focus=()=>{};const r=null===(e=n.reportValidity)||void 0===e?void 0:e.call(n);t&&!1===r&&t(n),setTimeout((()=>{n.focus=i}))};if("true"===n.getAttribute("invalid")||(null===(i=n.value)||void 0===i?void 0:i.length))return void r();const o={timer:void 0},s=e=>{"true"===e.target.getAttribute("formnovalidate")&&(clearTimeout(o.timer),o.timer=void 0)};o.timer=setTimeout((()=>{e.removeEventListener("click",s),r(),o.timer=void 0}),150),e.addEventListener("click",s,{once:!0})}))}))})(o,(e=>this.trackValidationErrors([e],i(this,Nv,"a",am)))),((e,t)=>{rg(e,null==t?void 0:t.inputs),rg(e,null==t?void 0:t.form)})(o,u),this.initRealtimeConditions(o,u),i(this,Nv,"m",im).call(this,{isFirstScreen:s,isCustomScreen:!1,stepName:e.stepName}),Lp(o,this.autoFocus,s),i(this,Nv,"m",$m).call(this,h)})),i(this,Nv,"m",ym).call(this,c,h),o.querySelector(`[${fp}="polling"]`)&&c(wp,{})}));l?i(this,Nv,"m",Jv).call(this,m):m()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${Jf}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch(e){return!1}return!0}}jv=new WeakMap,Rv=new WeakMap,Tv=new WeakMap,Mv=new WeakMap,Lv=new WeakMap,Hv=new WeakMap,Kv=new WeakMap,Yv=new WeakMap,Zv=new WeakMap,Xv=new WeakMap,Qv=new WeakMap,em=new WeakMap,rm=new WeakMap,om=new WeakMap,cm=new WeakMap,pm=new WeakMap,Nv=new WeakSet,Uv=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},_v=function(e,t,r){return n(this,void 0,void 0,(function*(){var n;return(null===(n=this.nativeOptions)||void 0===n?void 0:n.bridgeVersion)>=2&&new Promise((n=>{this.nativeCallbacks.screenNext=r,this.nativeCallbacks.screenResolve=n,i(this,Nv,"m",Dv).call(this,"beforeScreen",{screen:e,context:t})}))}))},Wv=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&i(this,Nv,"m",Dv).call(this,"afterScreen",{screen:e})},Dv=function(e,t){i(this,Nv,"m",bm).call(this,"bridge",{type:e,payload:t})},Fv=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(`[${fp}="${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()},qv=function(){var e,n,r,o;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var n=e.screenState,i=t(void 0===n?{}:n,["errorText","errorType"]),r=t(e,["screenState"]);return Object.assign(Object.assign({},r),{screenState:i})})),null===(n=this.stepState)||void 0===n||n.subscribe(i(this,Nv,"m",Fv).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}}),{forceUpdate:!0}),null===(r=this.stepState)||void 0===r||r.subscribe(i(this,Nv,"m",Bv).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}}),{forceUpdate:!0}),null===(o=this.flowState)||void 0===o||o.subscribe((({screenId:e,executionId:t})=>{var n;try{this.updateTelemetryContext({screenId:e,executionId:t})}catch(e){null===(n=this.logger)||void 0===n||n.error("Error updating telemetry screenId:",e)}}),(e=>({screenId:e.screenId,executionId:e.executionId})))},Bv=function({errorText:e,errorType:t}){(t||e)&&(this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((e=>{e.shadowRoot.querySelectorAll("descope-text-field[data-id]").forEach((e=>{e.value=""}))})),Lp(this.contentRootElement,this.autoFocus,!1))},Vv=function(){return n(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")}))},zv=function(e){return n(this,void 0,void 0,(function*(){var n;const o=Object.assign(Object.assign({},this.stepState.current),e),{next:s,stepName:a}=o,d=(e=>{const t=(n=e.screenState,i=(e,t)=>Sp.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;(r||o)&&(t.error={text:r,type:o}),e.action&&(t.action=e.action);const s=(e=>{if(!e)return;const t={};return zp.forEach((({key:n,from:i})=>{const r=i(e);void 0!==r&&(t[n]=r)})),Object.keys(t).length?t:void 0})(e.screenState);return s&&(t.data=s),t})(t(o,["next","stepName"]));let l=yield i(this,Nv,"m",_v).call(this,a,d,s);l||(l=Boolean(yield null===(n=this.onScreenUpdate)||void 0===n?void 0:n.call(this,a,d,s,this)));const c=!this.stepState.current.htmlFilename;if(i(this,Kv,"f").call(this,l),s&&(s.isCustomScreen=l),i(this,Hv,"f")!==l){const[e,t]=["flow","custom"].sort((()=>l?-1:1));this.loggerWrapper.debug(`Switching from ${t} screen to ${e} screen`),r(this,Hv,l,"f"),l?this.stepState.unsubscribeAll():i(this,Nv,"m",qv).call(this)}l?(this.loggerWrapper.debug("Showing a custom screen"),i(this,Nv,"m",im).call(this,{isFirstScreen:c,isCustomScreen:l,stepName:e.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=l}))},Gv=function(e,t){return n(this,void 0,void 0,(function*(){const n=new AbortController;try{const i=e===vp?this.sdk.webauthn.helpers.create(t,n):this.sdk.webauthn.helpers.get(t,n),r=yield _p(9e4,i,Cm);return r!==Cm?{response:r}:(n.abort(),this.loggerWrapper.warn("WebAuthn operation timed out after 90000ms"),{failure:"AbortError",failureReason:"aborted",failureMessage:"Passkey operation timed out"})}catch(e){return"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),{failure:e.name,failureReason:e.reason,failureMessage:e.message}}}))},Jv=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")},tm=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)}))}},nm=function(e,t){return n(this,void 0,void 0,(function*(){var o;null===(o=i(this,Rv,"f"))||void 0===o||o.abort();const s=e.querySelector('*[autocomplete="webauthn"]');if(s&&(yield cg())){const{options:e,transactionId:o}=(yield i(this,em,"f").call(this))||{};e&&o&&(i(this,Nv,"m",tm).call(this,s),r(this,Rv,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,i(this,Rv,"f")).then((e=>n(this,void 0,void 0,(function*(){t(s.id,{transactionId:o,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},im=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&i(this,Nv,"m",bm).call(this,"ready",{}),t||i(this,Nv,"m",Wv).call(this,n),i(this,Nv,"m",bm).call(this,"page-updated",{screenName:n}),i(this,Nv,"m",bm).call(this,"screen-updated",{screenName:n})},sm=function(e,t,n){this.setValidationTrackingEnabled(!!e.clientValidationTrackingEnabled),t&&n("executionId")&&this.setValidationTrackingExecution(t)},am=function(){var e,t,n,r,o,s,a;const d=null===(e=this.flowState)||void 0===e?void 0:e.current;return(null==d?void 0:d.executionId)?{executionId:d.executionId,screenId:d.screenId,screenName:(null===(a=null===(s=this.stepState)||void 0===s?void 0:s.current)||void 0===a?void 0:a.stepName)||d.stepName}:{executionId:void 0,screenId:null!==(t=i(this,rm,"f"))&&void 0!==t?t:null==d?void 0:d.screenId,screenName:null!==(n=i(this,om,"f"))&&void 0!==n?n:(null===(o=null===(r=this.stepState)||void 0===r?void 0:r.current)||void 0===o?void 0:o.stepName)||(null==d?void 0:d.stepName)}},dm=function(){let e=!0;const t=[];return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((n=>{var i,r;"slot"===n.localName||n.classList.contains("hidden")||(null===(i=n.reportValidity)||void 0===i||i.call(n),n.validity&&!n.validity.valid&&t.push(n),e&&(e=null===(r=n.checkValidity)||void 0===r?void 0:r.call(n)))})),t.length&&this.trackValidationErrors(t,i(this,Nv,"a",am)),e},lm=function(){return n(this,void 0,void 0,(function*(){const e=this.getInputs();return(yield Promise.all(e.map((e=>n(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})),{})}))},um=function(e){var t,o;const s=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((t=>t!==e)),a=(null===(o=null===(t=this.flowState.current)||void 0===t?void 0:t.screenState)||void 0===o?void 0:o.clientScripts)||[],d=()=>{e.removeAttribute("loading"),s.forEach((e=>{e.removeAttribute("disabled")}))},l=e=>n(this,void 0,void 0,(function*(){var t;if(this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",l),!0===(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.abandoned)&&a.length)return r(this,Tv,(()=>n(this,void 0,void 0,(function*(){try{yield this.loadSdkScripts(a)}catch(e){this.loggerWrapper.warn("Failed to refresh client scripts on popup close",null==e?void 0:e.message)}})))(),"f"),void d();d();const i=yield this.getFlowConfig(),o=[...i.clientScripts||[],...i.sdkScripts||[]];this.loadSdkScripts(o)})),c=()=>{var e;window.removeEventListener("pageshow",i(this,cm,"f")),r(this,cm,(e=>{e.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),l())}),"f"),window.addEventListener("pageshow",i(this,cm,"f"),{once:!0});const t=null===(e=this.stepState)||void 0===e?void 0:e.subscribe(((e,n)=>{e===n&&l(),this.removeEventListener("popupclosed",l),this.stepState.unsubscribe(t)}),(e=>e.screenId),{forceUpdate:!0})},u=this.nextRequestStatus.subscribe((({isLoading:t})=>{t?(this.addEventListener("popupclosed",l,{once:!0}),e.setAttribute("loading","true"),s.forEach((e=>e.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(u),"success"===this.flowStatus?(this.removeEventListener("popupclosed",l),d()):c())}))},hm=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>i(this,Nv,"m",fm).call(this,e)))},fm=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)}))},gm=function(e){return n(this,void 0,void 0,(function*(){if(i(this,Tv,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield i(this,Tv,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const t=this.loadSdkScriptsModules(),n=e.map((e=>e.id));for(const e of t)if(n.includes(e.id))try{"function"==typeof e.present&&((yield e.present())||this.loggerWrapper.debug(`Sdk script ${e.id} was cancelled`))}catch(t){this.loggerWrapper.error(`Failed to present ${e.id} script module`,t.message)}const r=[];for(const e of t)"function"==typeof e.refresh&&r.push(e.refresh());if(r.length>0)try{yield _p(5e3,Promise.all(r),null)}catch(e){this.loggerWrapper.error("Failed to refresh script module",e.message)}}))},vm=function(e,t){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((n=>{n.addEventListener("input",(()=>{var r;(null===(r=n.checkValidity)||void 0===r?void 0:r.call(n))&&i(this,pm,"f").call(this,n,e,t)}))}))},mm=function(e,t,n){t&&n&&"true"===e.getAttribute("data-opt-in-last-used-auth")&&function(e,t,n){try{const n=$g();n[e]=t,hg(kp,JSON.stringify(n))}catch(e){null==n||n.warn("[Descope] Failed to update in-flight last auth storage",String(e))}}(n,t,this.loggerWrapper)},$m=function(e){var t;const n=null===(t=vg(this.sdk.getLastUserLoginId(),this.loggerWrapper).lastUsedPerScreen)||void 0===t?void 0:t[e];if(!n)return;const i=this.contentRootElement.querySelector('descope-attachment[data-type="last-auth-badge"]'),r=this.contentRootElement.querySelector(`#${CSS.escape(n)}`);i&&r&&(r.replaceWith(i),i.appendChild(r))},ym=function(e,t){this.contentRootElement.querySelectorAll(`descope-button:not([${Yf}]), [data-type="button"]:not([${Yf}]`).forEach((n=>{n.onclick=()=>{i(this,pm,"f").call(this,n,e,t)}})),i(this,Nv,"m",vm).call(this,e,t),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Jf}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},bm=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},wm=function(e,t,n){var i;const[r,o]=(null===(i=window.name)||void 0===i?void 0:i.split("|"))||[],s={data:{code:t,exchangeError:n},action:"code"};if("descope-wc"===r&&o){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",o);try{window.opener.postMessage(s,o)}catch(e){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",null==e?void 0:e.message)}}else{this.loggerWrapper.debug("Creating popup channel",e);const t=new BroadcastChannel(e);t.postMessage(s),t.close()}try{window.close()}catch(e){}},km.bridgeVersion=3,customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",km);var Sm=Object.freeze({__proto__:null,default:km});const Im=(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))]},xm=(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]=Im(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};var Om,Em,Am,Pm,Nm,jm,Rm,Tm,Mm,Um,Lm;const _m=document.createElement("template");_m.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';const Wm=o(J)(HTMLElement);class Dm extends Wm{constructor(){super(),Om.add(this),Em.set(this,new eg({messages:[]})),Am.set(this,void 0),Pm.set(this,void 0),Nm.set(this,void 0),jm.set(this,{resize:i(this,Om,"m",Lm).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(_m.content.cloneNode(!0)),r(this,Am,this.shadowRoot.querySelector(".debugger"),"f"),r(this,Pm,i(this,Am,"f").querySelector(".content"),"f"),r(this,Nm,i(this,Am,"f").querySelector(".header"),"f"),i(this,Om,"m",Rm).call(this)}updateData(e){i(this,Em,"f").update((t=>({messages:t.messages.concat(e)})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;null===(t=e.init)||void 0===t||t.call(this),xm(i(this,Am,"f"),i(this,Nm,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",i(this,jm,"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}})(i(this,Am,"f")),i(this,Am,"f").onresize=i(this,Om,"m",Um).bind(this),i(this,Em,"f").subscribe(i(this,Om,"m",Tm).bind(this))}))}disconnectedCallback(){i(this,Em,"f").unsubscribeAll(),window.removeEventListener("resize",i(this,jm,"f").resize)}}Em=new WeakMap,Am=new WeakMap,Pm=new WeakMap,Nm=new WeakMap,jm=new WeakMap,Om=new WeakSet,Rm=function(){this.injectStyle('\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'),i(this,Am,"f").style.top="32px",i(this,Am,"f").style.left=window.innerWidth-300-32+"px"},Tm=function(e){i(this,Om,"m",Mm).call(this,e),i(this,Om,"m",Um).call(this)},Mm=function(e){i(this,Pm,"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("")},Um=function(){i(this,Pm,"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)}))},Lm=function(){const[e,t]=Im(i(this,Am,"f"),Number.parseInt(i(this,Am,"f").style.left,10),Number.parseInt(i(this,Am,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});i(this,Am,"f").style.top=`${t}px`,i(this,Am,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Dm);var Fm=Object.freeze({__proto__:null,default:Dm});return kf}();
|
|
7
7
|
//# sourceMappingURL=index.js.map
|