@descope/audit-management-widget 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * @descope/audit-management-widget v0.3.3
3
+ * @descope/audit-management-widget v0.4.1
4
4
  */
5
- this["descope-audit-management-widget"]=function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function r(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function o(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function i(...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])),c=(e,t=500)=>{let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}},l=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 r=e(n);return r[t]=!0,r}};var u,d,h,p;function f(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const o=n[r],i=e[o],s=t[o];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!f(i,s))return!1}else if(i!==s)return!1}return!0}let g=class{constructor(e={},{forceUpdate:t=!1}={}){u.set(this,void 0),d.set(this,{}),h.set(this,0),p.set(this,!0),this.update=e=>{const t="function"==typeof e?e(r(this,u,"f")):e,n=Object.assign(Object.assign({},r(this,u,"f")),t);if(r(this,p,"f")||!f(r(this,u,"f"),n)){const e=r(this,u,"f");o(this,u,n,"f"),Object.freeze(r(this,u,"f")),setTimeout((()=>{Object.values(r(this,d,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},o(this,u,e,"f"),o(this,p,t,"f")}get current(){return Object.assign({},r(this,u,"f"))}subscribe(e){return o(this,h,r(this,h,"f")+1,"f"),r(this,d,"f")[r(this,h,"f")]=e,r(this,h,"f").toString()}unsubscribe(e){const t=!!r(this,d,"f")[e];return t&&delete r(this,d,"f")[e],t}unsubscribeAll(){return o(this,d,{},"f"),!0}};u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap;const m=["error","warn","info","debug"],v=l((e=>{var t,n,i,s;return s=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,r(this,t,"m",i).call(this,console))}set logger(e){o(this,n,r(this,t,"m",i).call(this,e||console),"f")}get logger(){return r(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return m.reduce(((t,n)=>(t[n]=(...t)=>{var r;this.onLogEvent(n,t),null===(r=e[n])||void 0===r||r.call(e,...t)},t)),{})},s})),y="undefined"!=typeof localStorage,b=y&&localStorage.getItem("base.content.url")||"",w=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,k=l((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)&&r(this,t,"f")&&(o(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),j=l((e=>{var t,n;const o=i(v,k)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=r(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){r(this,t,"f")[e]||(r(this,t,"f")[e]=[]);const o=r(this,t,"f")[e].push(n);return()=>r(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),I=e=>t=>{var n,o,s;const a=i(v,k,j)(t),c=Object.keys(e);return s=class extends a{constructor(...e){super(...e),n.add(this),this.observeAttributes(c,r(this,n,"m",o).bind(this))}async init(){var e;c.forEach((e=>r(this,n,"m",o).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,o=function(t,n){const r=e[t],o="function"==typeof r?r(t,n):r;o&&this.logger.error(o)},s};I.missingAttrValidator=w;const O=l((e=>{const t=i(I({"project-id":w}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),S=l((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),x="Trying the next fallback URL...";function E({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:r="https://static.descope.com/pages"}){const o=new URL(r);return o.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(o.pathname,e,n,t),o.baseUrl=r,o}const C=l((e=>{var t,n,s,a,c;const l=i(v,O,S)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0)}async fetchStaticResource(e,n){const i=r(this,t,"m",a).call(this,e),c=Array.isArray(i)?e=>{if(e!==i.length-1){const{baseUrl:t}=i[e];o(this,s,t,"f")}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:r})=>{const o=Array.isArray(e)?e:[e];for(let e=0;e<o.length;e++){const i=o[e],s=e===o.length-1;try{const o=await fetch(i.toString(),t);if(o.ok)return null==r||r(e),o;const a=`Error fetching URL ${i} [${o.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${x}`)}catch(e){const t=`Error fetching URL ${i} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${x}`)}}})(i,{cache:"default"},{logger:this.logger,onSuccess:c});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,t=new WeakSet,a=function(e){const t=b||this.baseStaticUrl;if(t)return E({projectId:this.projectId,filename:e,baseUrl:t});const i=r(this,n,"f")!==this.baseUrl,a=i&&!!this.baseUrl;i&&(o(this,n,this.baseUrl,"f"),o(this,s,void 0,"f"));const c=E({projectId:this.projectId,filename:e,baseUrl:r(this,s,"f")});if(!a)return c;return[E({projectId:this.projectId,filename:e,baseUrl:this.baseUrl+"/pages"}),c]},c})),_=l((e=>{var t,n;const o=i(I({"project-id":w}))(e);return n=class extends o{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return r(this,t,"f").set(e,n),()=>{r(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(r(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=r(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),A=l((e=>{var t,n,s,a,c;const l=i(C,_,k)(e);return c=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",r(this,t,"m",n).bind(this))}get config(){return r(this,s,"f")||o(this,s,r(this,a,"f").call(this),"f"),r(this,s,"f")}},s=new WeakMap,a=new WeakMap,t=new WeakSet,n=function(){o(this,s,void 0,"f")},c})),R=l((e=>{var t,n,s,a,c,l,u;return u=class extends(i(k,v)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var i;null===(i=super.attributeChangedCallback)||void 0===i||i.call(this,e,n,o),"debug"===e&&r(this,t,"m",c).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&r(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)),r(this,t,"m",c).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){var e;null===(e=r(this,n,"f"))||void 0===e||e.remove(),o(this,n,null,"f")},a=async function(){o(this,n,document.createElement("descope-debugger"),"f"),Object.assign(r(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Ws})),document.body.appendChild(r(this,n,"f"))},c=function(){this.debug?r(this,t,"m",a).call(this):r(this,t,"m",s).call(this)},l=function(e,t){var o;e&&(null===(o=r(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},u})),T="load-descope-ui",P="base.ui.components.url",$=y&&localStorage.getItem(P)||"https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",U=y&&localStorage.getItem(P)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",M=y&&localStorage.getItem(P)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",D=e=>{const t=document.createElement("script");return t.id=e,t},L=(e,t)=>e.replace("<version>",t),N=l((e=>{var t,n,s,a,c,l,u,d,h,p,f,g;const m=i(v,A)(e);return g=class extends m{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),s.set(this,Symbol("loadCbs")),h.set(this,void 0)}get descopeUi(){return r(this,h,"f")||o(this,h,r(this,t,"m",f).call(this),"f"),r(this,h,"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=>r(this,t,"m",p).call(this,e))))}get baseCdnUrl(){return this.getAttribute("base-cdn-url")}},n=new WeakMap,s=new WeakMap,h=new WeakMap,t=new WeakSet,a=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},c=function(e){const t=r(this,n,"f"),o=r(this,s,"f");e[t]=[],e[o]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[o].push(t)}})},l=async function(e,n,o,i){this.logger.debug("Trying to load DescopeUI from a fallback URL");const s=D(o);document.body.append(s),s.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${s.src}"`)))})),s.addEventListener("load",(()=>{n.forEach((e=>e()))})),s.src=L(i,await r(this,t,"m",a).call(this))},u=function(e){e.addEventListener("error",(()=>{e[r(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),r(this,t,"m",l).call(this,[r(this,t,"m",l).bind(this,e[r(this,n,"f")],e[r(this,s,"f")],"load-descope-ui-fallback-script-2",M),...e[r(this,n,"f")]],e[r(this,s,"f")],"load-descope-ui-fallback-script",U)})),e.addEventListener("load",(()=>{e[r(this,s,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${T}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=D(T);document.body.append(e),r(this,t,"m",c).call(this,e),r(this,t,"m",u).call(this,e),e.src=L(this.baseCdnUrl||$,await r(this,t,"m",a).call(this))}return document.getElementById(T)},p=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},f=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),r(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},g})),W="content-root",z="root",q=l((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${z}, #${W} {\n height: 100%;\n }\n #${z} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${z}">\n <div id="${W}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(W),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(z)}})),F="descope-modal";var H,J;let V=class{constructor(e,t){H.set(this,void 0),this.nodeName="",o(this,H,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>new Promise((t=>{const n=setInterval((()=>{const r="function"==typeof e?e():e;r&&(clearInterval(n),t(r))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(r(this,H,"f"))}get ele(){var e,t;const n="function"==typeof r(this,H,"f")?r(this,H,"f").call(this):r(this,H,"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)}};H=new WeakMap;const K=/^descope-grid-([^-]+)-column$/,B={text:class extends V{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 V{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 Y=class extends V{constructor(){super(...arguments),this.nodeName="descope-grid",J.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 r=null===(n=K.exec(t.localName))||void 0===n?void 0:n[1],o=B[r];return o?(e.push(new o(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const o=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);a(o,this.ele.columns)||(this.ele.columns=o,null===(n=r(this,J,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){o(this,J,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};var X;J=new WeakMap;let G=class extends V{constructor(){super(...arguments),X.set(this,void 0),this.nodeName="descope-modal"}close(){var e,t;null===(e=this.ele)||void 0===e||e.removeAttribute("opened"),null===(t=this.afterClose)||void 0===t||t.call(this)}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),r(this,X,"f")&&(null===(e=this.ele)||void 0===e||e.append(r(this,X,"f").content.cloneNode(!0)))}setContent(e){o(this,X,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}};X=new WeakMap;let Z=class extends V{constructor(){super(...arguments),this.nodeName="descope-combo-box"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}},Q=class extends V{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()}},ee=class extends V{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")}};l((e=>{var t,n;const o=i(k,q,N)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends G{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(F);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([F]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const te="descope-notification";l((e=>{var t,n;const o=i(k,q,N)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Q{setContent(t){const n="string"==typeof t?s(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(te);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(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([te])}},t=new WeakMap,n}));const ne=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',re=l((e=>{var t,n,s,a,c,l,u,d,h,p,f,g,m,v;const y=i(I({theme:ne}),C,k,N,A,q,j)(e);return v=class extends y{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),f.set(this,(()=>{r(this,t,"m",g).call(this),r(this,m,"f").call(this,"os"===this.getAttribute("theme"))})),m.set(this,(e=>{var n,o,i;const s=e?"addEventListener":"removeEventListener";null===(i=null===(o=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===o?void 0:o[s])||void 0===i||i.call(o,"change",(()=>r(this,t,"m",g).call(this)))}))}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}get styleId(){return this.getAttribute("style-id")||"theme"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),r(this,t,"m",l).call(this),r(this,t,"m",u).call(this),r(this,f,"f").call(this),this.observeAttributes(["theme"],r(this,f,"f")),this.observeAttributes(["style-id"],(()=>{o(this,s,null,"f"),r(this,t,"m",h).call(this),r(this,t,"m",l).call(this),r(this,t,"m",u).call(this)}))}},n=new WeakMap,s=new WeakMap,f=new WeakMap,m=new WeakMap,t=new WeakSet,a=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(P))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(P),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")}},c=function(){return r(this,s,"f")||(o(this,s,r(this,t,"m",a).call(this),"f"),r(this,s,"f").then((e=>this.logger.debug("Fetched theme",e)))),r(this,s,"f")},l=async function(){var e,i;const s=await r(this,t,"a",c);s&&(r(this,n,"f")||(o(this,n,document.createElement("style"),"f"),r(this,n,"f").id="global-style",this.shadowRoot.appendChild(r(this,n,"f"))),r(this,n,"f").innerText=((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.globals)||"")+((null===(i=null==s?void 0:s.dark)||void 0===i?void 0:i.globals)||""))},u=async function(){var e,n;const o=Object.assign({},await r(this,t,"a",c));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},d=async function(){var e,t;const{projectConfig:n}=await this.config||{},r=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],o=null==n?void 0:n.cssTemplate,i=r||o;return null===(t=null==i?void 0:i[this.theme])||void 0===t?void 0:t.fonts},h=async function(){const e=await r(this,t,"m",d).call(this);e?Object.values(e).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))})):this.logger.debug("No fonts to load")},p=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)},g=function(){r(this,t,"m",h).call(this),r(this,t,"m",p).call(this)},v}));var oe=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ie=()=>Math.random().toString(36).substring(7).split("").join("."),se={INIT:`@@redux/INIT${ie()}`,REPLACE:`@@redux/REPLACE${ie()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ie()}`};function ae(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 ce(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 le(e){let t=typeof e;return t=ce(e),t}function ue(e,t,n){if("function"!=typeof e)throw new Error(`Expected the root reducer to be a function. Instead, received: '${le(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: '${le(n)}'`);return n(ue)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function u(){if(c)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 o}function d(e){if("function"!=typeof e)throw new Error(`Expected the listener to be a function. Instead, received: '${le(e)}'`);if(c)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(c)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),i=null}}}function h(e){if(!ae(e))throw new Error(`Actions must be plain objects. Instead, the actual type was: '${le(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: '${le(e.type)}'. Value was: '${e.type}' (stringified)`);if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach((e=>{e()})),e}h({type:se.INIT});return{dispatch:h,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(`Expected the nextReducer to be a function. Instead, received: '${le(e)}`);r=e,h({type:se.REPLACE})},[oe]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(`Expected the observer to be an object. Instead, received: '${le(t)}'`);function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[oe](){return this}}}}}function de(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function he(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];void 0===e[o]&&de(`No reducer provided for key "${o}"`),"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o,i;o={};try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:se.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:se.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 '${se.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)}))}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;{const r=function(e,t,n,r){const o=Object.keys(t),i=n&&n.type===se.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===o.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!ae(e))return`The ${i} has unexpected type of "${le(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!r[e]));return s.forEach((e=>{r[e]=!0})),n&&n.type===se.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,o);r&&de(r)}let s=!1;const a={};for(let o=0;o<r.length;o++){const i=r[o],c=n[i],l=e[i],u=c(l,t);if(void 0===u){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 "${i}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[i]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function pe(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function fe(e){return ae(e)&&"type"in e&&"string"==typeof e.type}var ge=Symbol.for("immer-nothing"),me=Symbol.for("immer-draftable"),ve=Symbol.for("immer-state"),ye=[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 be(e,...t){{const n=ye[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}}var we=Object.getPrototypeOf;function ke(e){return!!e&&!!e[ve]}function je(e){return!!e&&(Oe(e)||Array.isArray(e)||!!e[me]||!!e.constructor?.[me]||_e(e)||Ae(e))}var Ie=Object.prototype.constructor.toString();function Oe(e){if(!e||"object"!=typeof e)return!1;const t=we(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)===Ie}function Se(e,t){0===xe(e)?Object.entries(e).forEach((([n,r])=>{t(n,r,e)})):e.forEach(((n,r)=>t(r,n,e)))}function xe(e){const t=e[ve];return t?t.type_:Array.isArray(e)?1:_e(e)?2:Ae(e)?3:0}function Ee(e,t){return 2===xe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ce(e,t,n){const r=xe(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function _e(e){return e instanceof Map}function Ae(e){return e instanceof Set}function Re(e){return e.copy_||e.base_}function Te(e,t){if(_e(e))return new Map(e);if(Ae(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Oe(e)){if(!we(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ve];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(we(e),n)}function Pe(e,t=!1){return Ue(e)||ke(e)||!je(e)||(xe(e)>1&&(e.set=e.add=e.clear=e.delete=$e),Object.freeze(e),t&&Se(e,((e,t)=>Pe(t,!0)))),e}function $e(){be(2)}function Ue(e){return Object.isFrozen(e)}var Me,De={};function Le(e){const t=De[e];return t||be(0,e),t}function Ne(){return Me}function We(e,t){t&&(Le("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ze(e){qe(e),e.drafts_.forEach(He),e.drafts_=null}function qe(e){e===Me&&(Me=e.parent_)}function Fe(e){return Me={drafts_:[],parent_:Me,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function He(e){const t=e[ve];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Je(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ve].modified_&&(ze(t),be(4)),je(e)&&(e=Ve(t,e),t.parent_||Be(t,e)),t.patches_&&Le("Patches").generateReplacementPatches_(n[ve].base_,e,t.patches_,t.inversePatches_)):e=Ve(t,n,[]),ze(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ge?e:void 0}function Ve(e,t,n){if(Ue(t))return t;const r=t[ve];if(!r)return Se(t,((o,i)=>Ke(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Be(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),Se(o,((o,s)=>Ke(e,r,t,o,s,n,i))),Be(e,t,!1),n&&e.patches_&&Le("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ke(e,t,n,r,o,i,s){if(o===n&&be(5),ke(o)){const s=Ve(e,o,i&&t&&3!==t.type_&&!Ee(t.assigned_,r)?i.concat(r):void 0);if(Ce(n,r,s),!ke(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(je(o)&&!Ue(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ve(e,o),t&&t.scope_.parent_||Be(e,o)}}function Be(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Pe(t,n)}var Ye={get(e,t){if(t===ve)return e;const n=Re(e);if(!Ee(n,t))return function(e,t,n){const r=Ze(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!je(r)?r:r===Ge(e.base_,t)?(et(e),e.copy_[t]=tt(r,e)):r},has:(e,t)=>t in Re(e),ownKeys:e=>Reflect.ownKeys(Re(e)),set(e,t,n){const r=Ze(Re(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Ge(Re(e),t),o=r?.[ve];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,r)&&(void 0!==n||Ee(e.base_,t)))return!0;et(e),Qe(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!==Ge(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,et(e),Qe(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Re(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){be(11)},getPrototypeOf:e=>we(e.base_),setPrototypeOf(){be(12)}},Xe={};function Ge(e,t){const n=e[ve];return(n?Re(n):e)[t]}function Ze(e,t){if(!(t in e))return;let n=we(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=we(n)}}function Qe(e){e.modified_||(e.modified_=!0,e.parent_&&Qe(e.parent_))}function et(e){e.copy_||(e.copy_=Te(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Se(Ye,((e,t)=>{Xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Xe.deleteProperty=function(e,t){return isNaN(parseInt(t))&&be(13),Xe.set.call(this,e,t,void 0)},Xe.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&be(14),Ye.set.call(this,e[0],t,n,e[0])};function tt(e,t){const n=_e(e)?Le("MapSet").proxyMap_(e,t):Ae(e)?Le("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ne(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ye;n&&(o=[r],i=Xe);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:Ne()).drafts_.push(n),n}function nt(e){return ke(e)||be(10,e),rt(e)}function rt(e){if(!je(e)||Ue(e))return e;const t=e[ve];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Te(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Te(e,!0);return Se(n,((e,t)=>{Ce(n,e,rt(t))})),t&&(t.finalized_=!1),n}var ot=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 r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&be(6),void 0!==n&&"function"!=typeof n&&be(7),je(e)){const o=Fe(this),i=tt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?ze(o):qe(o)}return We(o,n),Je(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===ge&&(r=void 0),this.autoFreeze_&&Pe(r,!0),n){const t=[],o=[];Le("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}be(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;const o=this.produce(e,t,((e,t)=>{n=e,r=t}));return[o,n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){je(e)||be(8),ke(e)&&(e=nt(e));const t=Fe(this),n=tt(e,void 0);return n[ve].isManual_=!0,qe(t),n}finishDraft(e,t){const n=e&&e[ve];n&&n.isManual_||be(9);const{scope_:r}=n;return We(r,t),Je(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Le("Patches").applyPatches_;return ke(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},it=ot.produce;ot.produceWithPatches.bind(ot),ot.setAutoFreeze.bind(ot),ot.setUseStrictShallowCopy.bind(ot),ot.applyPatches.bind(ot),ot.createDraft.bind(ot),ot.finishDraft.bind(ot);var st=(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})}}},at=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=r((()=>({})),...o);if(!(a.apply(null,i)===a.apply(null,s))){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:i,secondInputs:s,stack:e})}},ct={inputStabilityCheck:"once",identityFunctionCheck:"once"};var lt=e=>Array.isArray(e)?e:[e];function ut(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:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},pt=0,ft=1;function gt(){return{s:pt,v:void 0,o:null,p:null}}function mt(e,t={}){let n=gt();const{resultEqualityCheck:r}=t;let o,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=gt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=gt(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===ft)c=t.v;else if(c=e.apply(null,arguments),i++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==i&&i--);o="object"==typeof c&&null!==c||"function"==typeof c?new ht(c):c}return a.s=ft,a.v=c,c}return s.clearCache=()=>{n=gt(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function vt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:c,memoizeOptions:l=[],argsMemoize:u=mt,argsMemoizeOptions:d=[],devModeChecks:h={}}=a,p=lt(l),f=lt(d),g=ut(e),m=c((function(){return r++,s.apply(null,arguments)}),...p);let v=!0;const y=u((function(){o++;const e=dt(g,arguments);t=m.apply(null,e);{const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...ct,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:st},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:at}}})(v,h);if(n.shouldRun&&n.run(s,e,t),r.shouldRun){const t=dt(g,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:c,memoizeOptions:p},arguments)}v&&(v=!1)}return t}),...f);return Object.assign(y,{resultFunc:s,memoizedResultFunc:m,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var yt=vt(mt),bt=Object.assign(((e,t=yt)=>{!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);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>bt});function wt(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var kt=wt(),jt=wt;((...e)=>{const t=vt(...e)})(mt);var It="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?pe:pe.apply(null,arguments)},Ot=e=>e&&"function"==typeof e.match;function St(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>fe(t)&&t.type===e,n}function xt(e){return"function"==typeof e&&"type"in e&&Ot(e)}function Et(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 Ct=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 _t(e){return je(e)?it(e,(()=>{})):e}function At(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error("No insert provided for key not already in map");const r=n.insert(t,e);return e.set(t,r),r}function Rt(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Tt(e,t,n){const r=Pt(e,t,n);return{detectMutations:()=>$t(e,t,r,n)}}function Pt(e,t=[],n,r="",o=new Set){const i={value:n};if(!e(n)&&!o.has(n)){o.add(n),i.children={};for(const o in n){const s=r?r+"."+o:o;t.length&&-1!==t.indexOf(s)||(i.children[o]=Pt(e,t,n[o],s))}}return i}function $t(e,t=[],n,r,o=!1,i=""){const s=n?n.value:void 0,a=s===r;if(o&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:i};if(e(s)||e(r))return{wasMutated:!1};const c={};for(let e in n.children)c[e]=!0;for(let e in r)c[e]=!0;const l=t.length>0;for(let o in c){const s=i?i+"."+o:o;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const c=$t(e,t,n.children[o],r[o],a,s);if(c.wasMutated)return c}return{wasMutated:!1}}function Ut(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ae(e)}function Mt(e,t="",n=Ut,r,o=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=r?r(e):Object.entries(e),c=o.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(c){if(o.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Mt(l,a,n,r,o,i),s))return s}return i&&Dt(e)&&i.add(e),!1}function Dt(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Dt(t))return!1;return!0}function Lt(e){return"boolean"==typeof e}var Nt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let i=new Ct;if(t&&(Lt(t)?i.push(kt):i.push(jt(t.extraArgument))),n){let e={};Lt(n)||(e=n),i.unshift(function(e={}){{let t=function(e,t,r,o){return JSON.stringify(e,n(t,o),r)},n=function(e,t){let n=[],r=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(o,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,o):r.push(o),~n.indexOf(i)&&(i=t.call(this,o,i))}else n.push(i);return null==e?i:e.call(this,o,i)}},{isImmutable:r=Rt,ignoredPaths:o,warnAfter:i=32}=e;const s=Tt.bind(null,r,o);return({getState:e})=>{let n,r=e(),o=s(r);return a=>c=>{const l=Et(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(r=e(),n=o.detectMutations(),o=s(r),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 u=a(c);return l.measureTime((()=>{if(r=e(),n=o.detectMutations(),o=s(r),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(c)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),u}}}}(e))}if(r){let e={};Lt(r)||(e=r),i.push(function(e={}){{const{isSerializable:t=Ut,getEntries:n,ignoredActions:r=[],ignoredActionPaths:o=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:c=!1,disableCache:l=!1}=e,u=!l&&WeakSet?new WeakSet:void 0;return e=>l=>d=>{if(!fe(d))return l(d);const h=l(d),p=Et(s,"SerializableStateInvariantMiddleware");return c||r.length&&-1!==r.indexOf(d.type)||p.measureTime((()=>{const e=Mt(d,"",t,n,o,u);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: ",d,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const r=Mt(e.getState(),"",t,n,i,u);if(r){const{keyPath:e,value:t}=r;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: ${d.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(o){let e={};Lt(o)||(e=o),i.unshift(function(e={}){const{isActionCreator:t=xt}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}return i},Wt=e=>t=>{setTimeout(t,e)},zt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Wt(10),qt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ct(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,i=!1,s=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?zt:"callback"===e.type?e.queueNotification:Wt(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>o&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,i=!o,i&&(s||(s=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r};function Ft(e){const t=Nt(),{reducer:n,middleware:r,devTools:o=!0,preloadedState:i,enhancers:s}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!ae(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=he(n)}if(r&&"function"!=typeof r)throw new Error("`middleware` field must be a callback");if("function"==typeof r){if(c=r(t),!Array.isArray(c))throw new Error("when using a middleware builder function, an array of middleware must be returned")}else c=t();if(c.some((e=>"function"!=typeof e)))throw new Error("each middleware provided to configureStore must be a function");let l=pe;o&&(l=It({trace:!0,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map((e=>e(s)));return i=pe(...a)(o.dispatch),{...o,dispatch:i}}}(...c),d=qt(u);if(s&&"function"!=typeof s)throw new Error("`enhancers` field must be a callback");let h="function"==typeof s?s(d):d();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");c.length&&!h.includes(u)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return ue(a,i,l(...h))}function Ht(e){const t={},n=[];let r;const o={addCase(e,i){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)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]=i,o},addMatcher(e,t){if(r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),o},addDefaultCase(e){if(r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,o}};return e(o),[t,n,r]}function Jt(...e){return t=>e.some((e=>((e,t)=>Ot(e)?e.match(t):e(t))(e,t)))}var Vt=["name","message","stack","code"],Kt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Bt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Yt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Vt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Xt=(()=>{function e(e,t,n){const r=St(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=St(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=St(e+"/rejected",((e,t,r,o,i)=>({payload:o,error:(n&&n.serializeError||Yt)(e||"Rejected"),meta:{...i||{},arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,c)=>{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})(),u=new AbortController;let d;function h(e){d=e,u.abort()}const p=async function(){let p;try{let i=n?.condition?.(e,{getState:a,extra:c});if(null!==(f=i)&&"object"==typeof f&&"function"==typeof f.then&&(i=await i),!1===i||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const g=new Promise(((e,t)=>u.signal.addEventListener("abort",(()=>t({name:"AbortError",message:d||"Aborted"})))));s(o(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:c}))),p=await Promise.race([g,Promise.resolve(t(e,{dispatch:s,getState:a,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Kt(e,t),fulfillWithValue:(e,t)=>new Bt(e,t)})).then((t=>{if(t instanceof Kt)throw t;return t instanceof Bt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){p=t instanceof Kt?i(null,l,e,t.payload,t.meta):i(t,l,e)}var f;return n&&!n.dispatchConditionRejection&&i.match(p)&&p.meta.condition||s(p),p}();return Object.assign(p,{abort:h,requestId:l,arg:e,unwrap:()=>p.then(Gt)})}}),{pending:o,rejected:i,fulfilled:r,settled:Jt(i,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Gt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Zt=Symbol.for("rtk-slice-createasyncthunk");function Qt(e,t){return`${e}/${t}`}function en(e,t,n,r){function o(o,...i){let s=n.call(e,o);if(void 0===s){if(!r)throw new Error("selectState returned undefined for an uninjected slice reducer");s=e.getInitialState()}return t(s,...i)}return o.unwrapped=t,o}var tn=function({creators:e}={}){const t=e?.asyncThunk?.[Zt];return function(e){const{name:n,reducerPath:r=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 o=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(o),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 c(){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=[],r]="function"==typeof e.extraReducers?Ht(e.extraReducers):[e.extraReducers],o={...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,[r,o,i]=Ht(t);if(function(e){return"function"==typeof e}(e))n=()=>_t(e());else{const t=_t(e);n=()=>t}function s(e=n(),t){let s=[r[t.type],...o.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(ke(e)){const r=n(e,t);return void 0===r?e:r}if(je(e))return it(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in o)e.addCase(t,o[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}))}i.forEach((r=>{const i=o[r],s={reducerName:r,type:Qt(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},r,o){let i,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error("Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=r.reducer,s=r.prepare}else i=r;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?St(e,s):St(e))}(s,i,a):function({type:e,reducerName:t},n,r,o){if(!o)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:i,fulfilled:s,pending:a,rejected:c,settled:l,options:u}=n,d=o(e,i,u);r.exposeAction(t,d),s&&r.addCase(d.fulfilled,s);a&&r.addCase(d.pending,a);c&&r.addCase(d.rejected,c);l&&r.addMatcher(d.settled,l);r.exposeCaseReducer(t,{fulfilled:s||nn,pending:a||nn,rejected:c||nn,settled:l||nn})}(s,i,a,t)}));const l=e=>e,u=new WeakMap;let d;const h={name:n,reducerPath:r,reducer:(e,t)=>(d||(d=c()),d(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(d||(d=c()),d.getInitialState()),getSelectors(t=l){const n=At(u,this,{insert:()=>new WeakMap});return At(n,t,{insert:()=>{const n={};for(const[r,o]of Object.entries(e.selectors??{}))n[r]=en(this,o,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 r=t??this.reducerPath;return e.inject({reducerPath:r,reducer:this.reducer},n),{...this,reducerPath:r}}};return h}}();function nn(){}var rn="listenerMiddleware";St(`${rn}/add`),St(`${rn}/removeAll`),St(`${rn}/remove`);const on=e=>l((t=>{const n=tn(e),r=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(i(v)(t)){constructor(...e){super(...e);const t=Ft({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),o=e=>async(...n)=>{const r=await t.dispatch(e(...n));try{Gt(r)}catch(e){this.logger.error(e.message,r.type,e.stack)}return r},i=Object.keys(r).reduce(((e,t)=>(e[t]=o(r[t]),e)),{});this.actions=i,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}}));l((e=>class extends(v(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));const sn=(e,t)=>t?{[e]:t}:{},an=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},cn=e=>e.selectedAuditId,ln=yt((e=>e.auditList.data),(e=>e.map((e=>{const n=e||{},{occurred:r,ID:o,type:i}=n,s=n.data,a=void 0===s?{saml_request:"",saml_response:"",saml_generated_user:"",saml_generated_roles:"",oidc_response:"",oidc_generated_user:""}:s,{saml_request:c,saml_response:l,saml_generated_user:u,saml_generated_roles:d,oidc_response:h,oidc_generated_user:p}=a,f=t(a,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user"]),g=t(n,["occurred","ID","type","data"]);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:f}),sn("type",(e=>e&&e[0].toUpperCase()+e.slice(1))(i))),sn("saml_request",c)),sn("saml_response",l)),sn("saml_generated_user",an(u))),sn("saml_generated_roles",an(d))),sn("oidc_response",an(h))),sn("oidc_generated_user",an(p))),{occurredFormatted:r?new Date(Number(r)||0).toLocaleString():"N/A"})}))));yt(cn,ln,((e,t)=>t.find((t=>e===t.id)))),yt(cn,(e=>!!e));const un=Xt("audit/search",((e,{extra:{api:t},getState:n})=>{const r=n().searchParams;return t.audit.search(Object.assign(Object.assign({},r),e))})),dn=(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)}))}))})(un)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(hn=e=>e.auditList,{onFulfilled:e=>{hn(e).loading=!1},onPending:e=>{hn(e).loading=!0,hn(e).error=null},onRejected:(e,t)=>{hn(e).loading=!1,hn(e).error=t.error}}));var hn;const pn={action:un,reducer:dn},fn={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""};class gn extends Error{}function mn(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 vn(e,t){if("string"!=typeof e)throw new gn("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new gn(`Invalid token specified: missing part #${n+1}`);let o;try{o=mn(r)}catch(e){throw new gn(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new gn(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}gn.prototype.name="InvalidTokenError";var yn="/v1/auth/accesskey/exchange",bn="/v1/auth/otp/verify",wn="/v1/auth/otp/signin",kn="/v1/auth/otp/signup",jn={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},In="/v1/auth/otp/signup-in",On="/v1/auth/magiclink/verify",Sn="/v1/auth/magiclink/signin",xn="/v1/auth/magiclink/signup",En={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},Cn="/v1/auth/magiclink/signup-in",_n="/v1/auth/enchantedlink/verify",An="/v1/auth/enchantedlink/signin",Rn="/v1/auth/enchantedlink/signup",Tn="/v1/auth/enchantedlink/pending-session",Pn={email:"/v1/auth/enchantedlink/update/email"},$n="/v1/auth/enchantedlink/signup-in",Un="/v1/auth/oauth/authorize",Mn="/v1/auth/oauth/exchange",Dn="v1/auth/oauth/native/start",Ln="v1/auth/oauth/native/finish",Nn="/v1/auth/saml/authorize",Wn="/v1/auth/saml/exchange",zn="/v1/auth/totp/verify",qn="/v1/auth/totp/signup",Fn="/v1/auth/totp/update",Hn="/v1/auth/notp/whatsapp/signin",Jn="/v1/auth/notp/whatsapp/signup",Vn="/v1/auth/notp/whatsapp/signup-in",Kn="/v1/auth/notp/pending-session",Bn={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},Yn={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},Xn={start:"/v1/auth/webauthn/signup-in/start"},Gn={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Zn="/v1/auth/password/signup",Qn="/v1/auth/password/signin",er="/v1/auth/password/reset",tr="/v1/auth/password/update",nr="/v1/auth/password/replace",rr="/v1/auth/password/policy",or="/v1/auth/refresh",ir="/v1/auth/tenant/select",sr="/v1/auth/logout",ar="/v1/auth/logoutall",cr="/v1/auth/me",lr="/v1/auth/me/tenants",ur="/v1/auth/me/history",dr="/v1/flow/start",hr="/v1/flow/next";const pr="<region>",fr=`https://api.${pr}descope.com`,gr=6e5,mr="dct",vr=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};let yr;const br=()=>{if(yr)return yr;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 yr=`${t}-${n}`,yr};var wr,kr;(kr=wr||(wr={})).get="GET",kr.delete="DELETE",kr.post="POST",kr.put="PUT",kr.patch="PATCH";const jr=({path:e,baseUrl:t,queryParams:n,projectId:r})=>{const o=r.slice(1,-27);t=t.replace(pr,o?o+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,r)=>{i=`${i}${0===r?"?":""}${t}=${encodeURIComponent(n[t])}${r===e.length-1?"":"&"}`}))}return i},Ir=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,r])=>(e[n]=r,e)),e),e}),{})),Or={"Content-Type":"application/json"},Sr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},xr=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},Er=({baseUrl:e,projectId:t,baseConfig:n,logger:r,hooks:o,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n})(t||fetch);return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...t)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>vr().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const r=await n(...t);return e[r.ok?"log":"error"](await(async e=>{const t=await e.text();return vr().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(r)),r}:n})(r,s),c=async r=>{var s;const c=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:l,body:u,headers:d,queryParams:h,method:p,token:f}=c,g=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:Ir(Sr(t,f),{"x-descope-sdk-session-id":br(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.35.0"},(null==n?void 0:n.baseHeaders)||{},xr(g)?Or:{},d),method:p,body:g};null!==i&&(m.credentials=i||"include");const v=await a(jr({path:l,baseUrl:e,queryParams:h,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==v?void 0:v.clone()),null==o?void 0:o.transformResponse){const e=await v.json(),t=((null===(s=v.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,r]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:r})}),{}),n=Object.assign(Object.assign({},v),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}return v};return{get:(e,{headers:t,queryParams:n,token:r}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:wr.get,token:r}),post:(e,t,{headers:n,queryParams:r,token:o}={})=>c({path:e,headers:n,queryParams:r,body:t,method:wr.post,token:o}),patch:(e,t,{headers:n,queryParams:r,token:o}={})=>c({path:e,headers:n,queryParams:r,body:t,method:wr.patch,token:o}),put:(e,t,{headers:n,queryParams:r,token:o}={})=>c({path:e,headers:n,queryParams:r,body:t,method:wr.put,token:o}),delete:(e,{headers:t,queryParams:n,token:r}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:wr.delete,token:r}),hooks:o,buildUrl:(n,r)=>jr({projectId:t,baseUrl:e,path:n,queryParams:r})}};var Cr=429;function _r(e,t,n){var r;let o=Ar(e);if(t){if(!(null==o?void 0:o.tenants)&&(null==o?void 0:o[mr])===t)return(null==o?void 0:o[n])||[];o=null===(r=null==o?void 0:o.tenants)||void 0===r?void 0:r[t]}const i=null==o?void 0:o[n];return Array.isArray(i)?i:[]}function Ar(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return vn(e)}function Rr(e){const{exp:t}=Ar(e);return(new Date).getTime()/1e3>t}function Tr(e){let t=Ar(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Pr(e,t){return _r(e,t,"permissions")}function $r(e,t){return _r(e,t,"roles")}const Ur=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Mr(e,t){var n;const r=await e,o={code:r.status,ok:r.ok,response:r},i=await r.clone().json();return r.ok?o.data=i:(o.error=i,r.status===Cr&&Object.assign(o.error,{retryAfter:Number.parseInt(null===(n=r.headers)||void 0===n?void 0:n.get("retry-after"))||0})),o}const Dr=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Lr=(e,t)=>(n=t)=>t=>{const r=e.filter((e=>e(t)));return!(r.length<e.length)&&(n?n.replace("{val}",t):r.join(" OR "))},Nr=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Wr=e=>t=>e.test(t),zr=Wr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),qr=Wr(/^\+[1-9]{1}[0-9]{3,14}$/),Fr=Dr(zr,'"{val}" is not a valid email'),Hr=Dr(qr,'"{val}" is not a valid phone number'),Jr=Dr((e=>e.length>=1),"Minimum length is 1");const Vr=Dr((e=>"string"==typeof e),"Input is not a string"),Kr=Dr((e=>Array.isArray(e)),"Input is not an array"),Br=Dr((e=>"boolean"==typeof e),"Input is not a boolean"),Yr=Dr((e=>void 0===e),"Input is defined"),Xr=Lr([Vr(),Yr()],"Input is not a string or undefined"),Gr=Lr([Kr(),Br()],"Input is not an array or boolean"),Zr=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Nr(...e).validate(n[t]))),t(...n)),Qr=e=>[Vr(`"${e}" must be a string`)],eo=e=>[Vr(`"${e}" must be a string`),Jr(`"${e}" must not be empty`)],to=e=>[Vr(`"${e}" must be a string`),Fr()],no=e=>[Vr(`"${e}" must be a string`),Hr()],ro=Zr(eo("accessKey")),oo=e=>({exchange:ro(((t,n)=>Mr(e.post(yn,{loginOptions:n},{token:t}))))}),io=(e,t,n)=>(t.forEach((t=>{const r=t.split(".");let o=r.shift(),i=e;for(;r.length>0;){if(i=i[o],!o||!i)throw Error(`Invalid path "${t}", "${o}" is missing or has no value`);o=r.shift()}if("function"!=typeof i[o])throw Error(`"${t}" is not a function`);const s=i[o];i[o]=n(s)})),e),so=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||gr,gr)});var ao,co;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(ao||(ao={})),function(e){e.email="email"}(co||(co={}));const lo=Object.assign(Object.assign({},ao),co);var uo;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(uo||(uo={}));const ho=eo("loginId"),po=Zr(eo("token")),fo=Zr(ho),go=Zr(eo("pendingRef")),mo=Zr(ho,to("email")),vo=e=>({verify:po((t=>Mr(e.post(_n,{token:t})))),signIn:fo(((t,n,r,o)=>Mr(e.post(Ur(An,lo.email),{loginId:t,URI:n,loginOptions:r},{token:o})))),signUpOrIn:fo(((t,n,r)=>Mr(e.post(Ur($n,lo.email),{loginId:t,URI:n,loginOptions:r})))),signUp:fo(((t,n,r,o)=>Mr(e.post(Ur(Rn,lo.email),{loginId:t,URI:n,user:r,loginOptions:o})))),waitForSession:go(((t,n)=>new Promise((r=>{const{pollingIntervalMs:o,timeoutMs:i}=so(n);let s;const a=setInterval((async()=>{const n=await e.post(Tn,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Mr(Promise.resolve(n))))}),o);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:mo(((t,n,r,o,i)=>Mr(e.post(Pn.email,Object.assign({loginId:t,email:n,URI:r},i),{token:o}))))}}),yo=Zr(eo("flowId")),bo=Zr(eo("executionId"),eo("stepId"),eo("interactionId")),wo=e=>({start:yo(((t,n,r,o,i,s,a)=>Mr(e.post(dr,{flowId:t,options:n,conditionInteractionId:r,interactionId:o,componentsVersion:i,flowVersions:s,input:a})))),next:bo(((t,n,r,o,i,s)=>Mr(e.post(hr,{executionId:t,stepId:n,interactionId:r,version:o,componentsVersion:i,input:s}))))}),ko=eo("loginId"),jo=Zr(eo("token")),Io=Zr(ko),Oo=Zr(ko,no("phone")),So=Zr(ko,to("email")),xo=Object.keys(lo).filter((e=>e!==ao.voice)),Eo=e=>({verify:jo((t=>Mr(e.post(On,{token:t})))),signIn:xo.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Io(((t,r,o,i)=>Mr(e.post(Ur(Sn,n),{loginId:t,URI:r,loginOptions:o},{token:i}))))})),{}),signUp:xo.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Io(((t,r,o,i)=>Mr(e.post(Ur(xn,n),{loginId:t,URI:r,user:o,loginOptions:i}))))})),{}),signUpOrIn:xo.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Io(((t,r,o)=>Mr(e.post(Ur(Cn,n),{loginId:t,URI:r,loginOptions:o}))))})),{}),update:{email:So(((t,n,r,o,i)=>Mr(e.post(En.email,Object.assign({loginId:t,email:n,URI:r},i),{token:o})))),phone:Object.keys(ao).filter((e=>e!==ao.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Oo(((t,r,o,i,s)=>Mr(e.post(Ur(En.phone,n),Object.assign({loginId:t,phone:r,URI:o},s),{token:i}))))})),{})}});var Co;!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"}(Co||(Co={}));const _o=Zr(eo("code")),Ao=e=>({start:Object.assign(((t,n,r,o)=>Mr(e.post(Un,r||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:o}))),Object.keys(Co).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,r,o)=>Mr(e.post(Un,r||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:o}))})),{})),exchange:_o((t=>Mr(e.post(Mn,{code:t})))),startNative:(t,n,r)=>Mr(e.post(Dn,{provider:t,loginOptions:n,implicit:r})),finishNative:(t,n,r,o,i)=>Mr(e.post(Ln,{provider:t,stateId:n,user:r,code:o,idToken:i}))}),Ro=eo("loginId"),To=Zr(Ro,eo("code")),Po=Zr(Ro),$o=Zr(Ro,no("phone")),Uo=Zr(Ro,to("email")),Mo=e=>({verify:Object.keys(lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:To(((t,r)=>Mr(e.post(Ur(bn,n),{code:r,loginId:t}))))})),{}),signIn:Object.keys(lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Po(((t,r,o)=>Mr(e.post(Ur(wn,n),{loginId:t,loginOptions:r},{token:o}))))})),{}),signUp:Object.keys(lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Po(((t,r,o)=>Mr(e.post(Ur(kn,n),{loginId:t,user:r,loginOptions:o}))))})),{}),signUpOrIn:Object.keys(lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Po(((t,r)=>Mr(e.post(Ur(In,n),{loginId:t,loginOptions:r}))))})),{}),update:{email:Uo(((t,n,r,o)=>Mr(e.post(jn.email,Object.assign({loginId:t,email:n},o),{token:r})))),phone:Object.keys(ao).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:$o(((t,r,o,i)=>Mr(e.post(Ur(jn.phone,n),Object.assign({loginId:t,phone:r},i),{token:o}))))})),{})}}),Do=Zr(eo("tenant")),Lo=Zr(eo("code")),No=e=>({start:Do(((t,n,r,o,i)=>Mr(e.post(Nn,r||{},Object.assign({queryParams:Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i})},o&&{token:o}))))),exchange:Lo((t=>Mr(e.post(Wn,{code:t}))))}),Wo=eo("loginId"),zo=Zr(Wo,eo("code")),qo=Zr(Wo),Fo=Zr(Wo),Ho=e=>({signUp:qo(((t,n)=>Mr(e.post(qn,{loginId:t,user:n})))),verify:zo(((t,n,r,o)=>Mr(e.post(zn,{loginId:t,code:n,loginOptions:r},{token:o})))),update:Fo(((t,n)=>Mr(e.post(Fn,{loginId:t},{token:n}))))}),Jo=eo("loginId"),Vo=eo("newPassword"),Ko=Zr(Jo,eo("password")),Bo=Zr(Jo),Yo=Zr(Jo,Vo),Xo=Zr(Jo,eo("oldPassword"),Vo),Go=e=>({signUp:Ko(((t,n,r,o)=>Mr(e.post(Zn,{loginId:t,password:n,user:r,loginOptions:o})))),signIn:Ko(((t,n,r)=>Mr(e.post(Qn,{loginId:t,password:n,loginOptions:r})))),sendReset:Bo(((t,n,r)=>Mr(e.post(er,{loginId:t,redirectUrl:n,templateOptions:r})))),update:Yo(((t,n,r)=>Mr(e.post(tr,{loginId:t,newPassword:n},{token:r})))),replace:Xo(((t,n,r)=>Mr(e.post(nr,{loginId:t,oldPassword:n,newPassword:r})))),policy:()=>Mr(e.get(rr))}),Zo=Qr("loginId"),Qo=eo("loginId"),ei=eo("origin"),ti=Zr(Qo,ei,eo("name")),ni=Zr(Qo,ei),ri=Zr(Zo,ei),oi=Zr(Qo,ei,eo("token")),ii=Zr(eo("transactionId"),eo("response")),si=e=>({signUp:{start:ti(((t,n,r,o)=>Mr(e.post(Bn.start,{user:{loginId:t,name:r},origin:n,passkeyOptions:o})))),finish:ii(((t,n)=>Mr(e.post(Bn.finish,{transactionId:t,response:n}))))},signIn:{start:ri(((t,n,r,o,i)=>Mr(e.post(Yn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:i},{token:o})))),finish:ii(((t,n)=>Mr(e.post(Yn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:ni(((t,n,r)=>Mr(e.post(Xn.start,{loginId:t,origin:n,passkeyOptions:r}))))},update:{start:oi(((t,n,r,o)=>Mr(e.post(Gn.start,{loginId:t,origin:n,passkeyOptions:o},{token:r})))),finish:ii(((t,n)=>Mr(e.post(Gn.finish,{transactionId:t,response:n}))))}}),ai=Qr("loginId"),ci=Zr(ai),li=Zr(eo("pendingRef")),ui=e=>({signUpOrIn:ci(((t,n)=>Mr(e.post(Vn,{loginId:t,loginOptions:n})))),signUp:ci(((t,n,r)=>Mr(e.post(Jn,{loginId:t,user:n,loginOptions:r})))),signIn:ci(((t,n,r)=>Mr(e.post(Hn,{loginId:t,loginOptions:n},{token:r})))),waitForSession:li(((t,n)=>new Promise((r=>{const{pollingIntervalMs:o,timeoutMs:i}=so(n);let s;const a=setInterval((async()=>{const n=await e.post(Kn,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Mr(Promise.resolve(n))))}),o);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),di=Zr(eo("token")),hi=Zr([Xr('"token" must be string or undefined')]);var pi,fi=Zr([(pi=eo("projectId"),Dr(((e,t)=>n=>Nr(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=n.length;let o=0,i=e===Object(e)?e:void 0;for(;null!=i&&o<r;)i=i[n[o++]];return o&&o===r&&void 0!==i?i:void 0})(n,e)))("projectId",pi))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:r,cookiePolicy:o,baseHeaders:i={},fetch:s})=>{return a=Er({baseUrl:n||fr,projectId:e,logger:t,hooks:r,cookiePolicy:o,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:oo(a),otp:Mo(a),magicLink:Eo(a),enchantedLink:vo(a),oauth:Ao(a),saml:No(a),totp:Ho(a),notp:ui(a),webauthn:si(a),password:Go(a),flow:wo(a),refresh:hi(((e,t)=>Mr(a.post(or,{},{token:e,queryParams:t})))),selectTenant:Zr([Vr("tenantId")],[Xr('"token" must be string or undefined')])(((e,t)=>Mr(a.post(ir,{tenant:e},{token:t})))),logout:hi((e=>Mr(a.post(sr,{},{token:e})))),logoutAll:hi((e=>Mr(a.post(ar,{},{token:e})))),me:hi((e=>Mr(a.get(cr,{token:e})))),myTenants:Zr([Gr('"tenants" must a string array or a boolean')],[Xr('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,Mr(a.post(lr,n,{token:t}))})),history:hi((e=>Mr(a.get(ur,{token:e})))),isJwtExpired:di(Rr),getTenants:di(Tr),getJwtPermissions:di(Pr),getJwtRoles:di($r),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const r=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==r?void 0:r.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var r;const o=[].concat((null===(r=e.hooks)||void 0===r?void 0:r.afterRequest)||[]);0!=o.length&&(await Promise.allSettled(null==o?void 0:o.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),gi=Object.assign(fi,{DeliveryMethods:lo});
5
+ this["descope-audit-management-widget"]=function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function r(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function o(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function i(...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])),c=(e,t=500)=>{let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}},l=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 r=e(n);return r[t]=!0,r}};var u,d,h,p;function f(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const o=n[r],i=e[o],s=t[o];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!f(i,s))return!1}else if(i!==s)return!1}return!0}let g=class{constructor(e={},{forceUpdate:t=!1}={}){u.set(this,void 0),d.set(this,{}),h.set(this,0),p.set(this,!0),this.update=e=>{const t="function"==typeof e?e(r(this,u,"f")):e,n=Object.assign(Object.assign({},r(this,u,"f")),t);if(r(this,p,"f")||!f(r(this,u,"f"),n)){const e=r(this,u,"f");o(this,u,n,"f"),Object.freeze(r(this,u,"f")),setTimeout((()=>{Object.values(r(this,d,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},o(this,u,e,"f"),o(this,p,t,"f")}get current(){return Object.assign({},r(this,u,"f"))}subscribe(e){return o(this,h,r(this,h,"f")+1,"f"),r(this,d,"f")[r(this,h,"f")]=e,r(this,h,"f").toString()}unsubscribe(e){const t=!!r(this,d,"f")[e];return t&&delete r(this,d,"f")[e],t}unsubscribeAll(){return o(this,d,{},"f"),!0}};u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap;const m=["error","warn","info","debug"],v=l((e=>{var t,n,i,s;return s=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,r(this,t,"m",i).call(this,console))}set logger(e){o(this,n,r(this,t,"m",i).call(this,e||console),"f")}get logger(){return r(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return m.reduce(((t,n)=>(t[n]=(...t)=>{var r;this.onLogEvent(n,t),null===(r=e[n])||void 0===r||r.call(e,...t)},t)),{})},s})),y="undefined"!=typeof localStorage,b=y&&localStorage.getItem("base.content.url")||"",w=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,k=l((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)&&r(this,t,"f")&&(o(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),j=l((e=>{var t,n;const o=i(v,k)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=r(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){r(this,t,"f")[e]||(r(this,t,"f")[e]=[]);const o=r(this,t,"f")[e].push(n);return()=>r(this,t,"f")[e].splice(o,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),I=e=>t=>{var n,o,s;const a=i(v,k,j)(t),c=Object.keys(e);return s=class extends a{constructor(...e){super(...e),n.add(this),this.observeAttributes(c,r(this,n,"m",o).bind(this))}async init(){var e;c.forEach((e=>r(this,n,"m",o).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,o=function(t,n){const r=e[t],o="function"==typeof r?r(t,n):r;o&&this.logger.error(o)},s};I.missingAttrValidator=w;const O=l((e=>{const t=i(I({"project-id":w}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),S=l((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),x="Trying the next fallback URL...";function C({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:r="https://static.descope.com/pages"}){const o=new URL(r);return o.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(o.pathname,e,n,t),o.baseUrl=r,o}const E=l((e=>{var t,n,s,a,c;const l=i(v,O,S)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0)}async fetchStaticResource(e,n){const i=r(this,t,"m",a).call(this,e),c=Array.isArray(i)?e=>{if(e!==i.length-1){const{baseUrl:t}=i[e];o(this,s,t,"f")}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:r})=>{const o=Array.isArray(e)?e:[e];for(let e=0;e<o.length;e++){const i=o[e],s=e===o.length-1;try{const o=await fetch(i.toString(),t);if(o.ok)return null==r||r(e),o;const a=`Error fetching URL ${i} [${o.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${x}`)}catch(e){const t=`Error fetching URL ${i} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${x}`)}}})(i,{cache:"default"},{logger:this.logger,onSuccess:c});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,t=new WeakSet,a=function(e){const t=b||this.baseStaticUrl;if(t)return C({projectId:this.projectId,filename:e,baseUrl:t});const i=r(this,n,"f")!==this.baseUrl,a=i&&!!this.baseUrl;i&&(o(this,n,this.baseUrl,"f"),o(this,s,void 0,"f"));const c=C({projectId:this.projectId,filename:e,baseUrl:r(this,s,"f")});if(!a)return c;return[C({projectId:this.projectId,filename:e,baseUrl:this.baseUrl+"/pages"}),c]},c})),_=l((e=>{var t,n;const o=i(I({"project-id":w}))(e);return n=class extends o{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return r(this,t,"f").set(e,n),()=>{r(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(r(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=r(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),A=l((e=>{var t,n,s,a,c;const l=i(E,_,k)(e);return c=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",r(this,t,"m",n).bind(this))}get config(){return r(this,s,"f")||o(this,s,r(this,a,"f").call(this),"f"),r(this,s,"f")}},s=new WeakMap,a=new WeakMap,t=new WeakSet,n=function(){o(this,s,void 0,"f")},c})),R=l((e=>{var t,n,s,a,c,l,u;return u=class extends(i(k,v)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var i;null===(i=super.attributeChangedCallback)||void 0===i||i.call(this,e,n,o),"debug"===e&&r(this,t,"m",c).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&r(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)),r(this,t,"m",c).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){var e;null===(e=r(this,n,"f"))||void 0===e||e.remove(),o(this,n,null,"f")},a=async function(){o(this,n,document.createElement("descope-debugger"),"f"),Object.assign(r(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return qs})),document.body.appendChild(r(this,n,"f"))},c=function(){this.debug?r(this,t,"m",a).call(this):r(this,t,"m",s).call(this)},l=function(e,t){var o;e&&(null===(o=r(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},u})),T="load-descope-ui",P="base.ui.components.url",$=y&&localStorage.getItem(P)||"https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",U=y&&localStorage.getItem(P)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",M=y&&localStorage.getItem(P)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",D=e=>{const t=document.createElement("script");return t.id=e,t},L=(e,t)=>e.replace("<version>",t),N=l((e=>{var t,n,s,a,c,l,u,d,h,p,f,g;const m=i(v,A)(e);return g=class extends m{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),s.set(this,Symbol("loadCbs")),h.set(this,void 0)}get descopeUi(){return r(this,h,"f")||o(this,h,r(this,t,"m",f).call(this),"f"),r(this,h,"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=>r(this,t,"m",p).call(this,e))))}get baseCdnUrl(){return this.getAttribute("base-cdn-url")}},n=new WeakMap,s=new WeakMap,h=new WeakMap,t=new WeakSet,a=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},c=function(e){const t=r(this,n,"f"),o=r(this,s,"f");e[t]=[],e[o]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[o].push(t)}})},l=async function(e,n,o,i){this.logger.debug("Trying to load DescopeUI from a fallback URL");const s=D(o);document.body.append(s),s.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${s.src}"`)))})),s.addEventListener("load",(()=>{n.forEach((e=>e()))})),s.src=L(i,await r(this,t,"m",a).call(this))},u=function(e){e.addEventListener("error",(()=>{e[r(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),r(this,t,"m",l).call(this,[r(this,t,"m",l).bind(this,e[r(this,n,"f")],e[r(this,s,"f")],"load-descope-ui-fallback-script-2",M),...e[r(this,n,"f")]],e[r(this,s,"f")],"load-descope-ui-fallback-script",U)})),e.addEventListener("load",(()=>{e[r(this,s,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${T}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=D(T);document.body.append(e),r(this,t,"m",c).call(this,e),r(this,t,"m",u).call(this,e),e.src=L(this.baseCdnUrl||$,await r(this,t,"m",a).call(this))}return document.getElementById(T)},p=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},f=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),r(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},g})),W="content-root",z="root",q=l((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${z}, #${W} {\n height: 100%;\n }\n #${z} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${z}">\n <div id="${W}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(W),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(z)}})),F="descope-modal";var H,J;let V=class{constructor(e,t){H.set(this,void 0),this.nodeName="",o(this,H,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>new Promise((t=>{const n=setInterval((()=>{const r="function"==typeof e?e():e;r&&(clearInterval(n),t(r))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(r(this,H,"f"))}get ele(){var e,t;const n="function"==typeof r(this,H,"f")?r(this,H,"f").call(this):r(this,H,"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)}};H=new WeakMap;const K=/^descope-grid-([^-]+)-column$/,B={text:class extends V{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 V{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 Y=class extends V{constructor(){super(...arguments),this.nodeName="descope-grid",J.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 r=null===(n=K.exec(t.localName))||void 0===n?void 0:n[1],o=B[r];return o?(e.push(new o(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const o=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);a(o,this.ele.columns)||(this.ele.columns=o,null===(n=r(this,J,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){o(this,J,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};var X;J=new WeakMap;let G=class extends V{constructor(){super(...arguments),X.set(this,void 0),this.nodeName="descope-modal"}close(){var e,t;null===(e=this.ele)||void 0===e||e.removeAttribute("opened"),null===(t=this.afterClose)||void 0===t||t.call(this)}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),r(this,X,"f")&&(null===(e=this.ele)||void 0===e||e.append(r(this,X,"f").content.cloneNode(!0)))}setContent(e){o(this,X,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}};X=new WeakMap;let Z=class extends V{constructor(){super(...arguments),this.nodeName="descope-combo-box"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}},Q=class extends V{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()}},ee=class extends V{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")}};l((e=>{var t,n;const o=i(k,q,N)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends G{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(F);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([F]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const te="descope-notification";l((e=>{var t,n;const o=i(k,q,N)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Q{setContent(t){const n="string"==typeof t?s(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(te);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(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([te])}},t=new WeakMap,n}));const ne=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',re=l((e=>{var t,n,s,a,c,l,u,d,h,p,f,g,m,v;const y=i(I({theme:ne}),E,k,N,A,q,j)(e);return v=class extends y{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),f.set(this,(()=>{r(this,t,"m",g).call(this),r(this,m,"f").call(this,"os"===this.getAttribute("theme"))})),m.set(this,(e=>{var n,o,i;const s=e?"addEventListener":"removeEventListener";null===(i=null===(o=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===o?void 0:o[s])||void 0===i||i.call(o,"change",(()=>r(this,t,"m",g).call(this)))}))}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}get styleId(){return this.getAttribute("style-id")||"theme"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),r(this,t,"m",l).call(this),r(this,t,"m",u).call(this),r(this,f,"f").call(this),this.observeAttributes(["theme"],r(this,f,"f")),this.observeAttributes(["style-id"],(()=>{o(this,s,null,"f"),r(this,t,"m",h).call(this),r(this,t,"m",l).call(this),r(this,t,"m",u).call(this)}))}},n=new WeakMap,s=new WeakMap,f=new WeakMap,m=new WeakMap,t=new WeakSet,a=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(P))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(P),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")}},c=function(){return r(this,s,"f")||(o(this,s,r(this,t,"m",a).call(this),"f"),r(this,s,"f").then((e=>this.logger.debug("Fetched theme",e)))),r(this,s,"f")},l=async function(){var e,i;const s=await r(this,t,"a",c);s&&(r(this,n,"f")||(o(this,n,document.createElement("style"),"f"),r(this,n,"f").id="global-style",this.shadowRoot.appendChild(r(this,n,"f"))),r(this,n,"f").innerText=((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.globals)||"")+((null===(i=null==s?void 0:s.dark)||void 0===i?void 0:i.globals)||""))},u=async function(){var e,n;const o=Object.assign({},await r(this,t,"a",c));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},d=async function(){var e,t;const{projectConfig:n}=await this.config||{},r=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],o=null==n?void 0:n.cssTemplate,i=r||o;return null===(t=null==i?void 0:i[this.theme])||void 0===t?void 0:t.fonts},h=async function(){const e=await r(this,t,"m",d).call(this);e?Object.values(e).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))})):this.logger.debug("No fonts to load")},p=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)},g=function(){r(this,t,"m",h).call(this),r(this,t,"m",p).call(this)},v}));var oe=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ie=()=>Math.random().toString(36).substring(7).split("").join("."),se={INIT:`@@redux/INIT${ie()}`,REPLACE:`@@redux/REPLACE${ie()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ie()}`};function ae(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 ce(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 le(e){let t=typeof e;return t=ce(e),t}function ue(e,t,n){if("function"!=typeof e)throw new Error(`Expected the root reducer to be a function. Instead, received: '${le(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: '${le(n)}'`);return n(ue)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function u(){if(c)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 o}function d(e){if("function"!=typeof e)throw new Error(`Expected the listener to be a function. Instead, received: '${le(e)}'`);if(c)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(c)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),i=null}}}function h(e){if(!ae(e))throw new Error(`Actions must be plain objects. Instead, the actual type was: '${le(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: '${le(e.type)}'. Value was: '${e.type}' (stringified)`);if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach((e=>{e()})),e}h({type:se.INIT});return{dispatch:h,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(`Expected the nextReducer to be a function. Instead, received: '${le(e)}`);r=e,h({type:se.REPLACE})},[oe]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(`Expected the observer to be an object. Instead, received: '${le(t)}'`);function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[oe](){return this}}}}}function de(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function he(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];void 0===e[o]&&de(`No reducer provided for key "${o}"`),"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o,i;o={};try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:se.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:se.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 '${se.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)}))}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;{const r=function(e,t,n,r){const o=Object.keys(t),i=n&&n.type===se.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===o.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!ae(e))return`The ${i} has unexpected type of "${le(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!r[e]));return s.forEach((e=>{r[e]=!0})),n&&n.type===se.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,o);r&&de(r)}let s=!1;const a={};for(let o=0;o<r.length;o++){const i=r[o],c=n[i],l=e[i],u=c(l,t);if(void 0===u){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 "${i}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[i]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function pe(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function fe(e){return ae(e)&&"type"in e&&"string"==typeof e.type}var ge=Symbol.for("immer-nothing"),me=Symbol.for("immer-draftable"),ve=Symbol.for("immer-state"),ye=[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 be(e,...t){{const n=ye[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}}var we=Object.getPrototypeOf;function ke(e){return!!e&&!!e[ve]}function je(e){return!!e&&(Oe(e)||Array.isArray(e)||!!e[me]||!!e.constructor?.[me]||_e(e)||Ae(e))}var Ie=Object.prototype.constructor.toString();function Oe(e){if(!e||"object"!=typeof e)return!1;const t=we(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)===Ie}function Se(e,t){0===xe(e)?Object.entries(e).forEach((([n,r])=>{t(n,r,e)})):e.forEach(((n,r)=>t(r,n,e)))}function xe(e){const t=e[ve];return t?t.type_:Array.isArray(e)?1:_e(e)?2:Ae(e)?3:0}function Ce(e,t){return 2===xe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ee(e,t,n){const r=xe(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function _e(e){return e instanceof Map}function Ae(e){return e instanceof Set}function Re(e){return e.copy_||e.base_}function Te(e,t){if(_e(e))return new Map(e);if(Ae(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Oe(e)){if(!we(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ve];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(we(e),n)}function Pe(e,t=!1){return Ue(e)||ke(e)||!je(e)||(xe(e)>1&&(e.set=e.add=e.clear=e.delete=$e),Object.freeze(e),t&&Se(e,((e,t)=>Pe(t,!0)))),e}function $e(){be(2)}function Ue(e){return Object.isFrozen(e)}var Me,De={};function Le(e){const t=De[e];return t||be(0,e),t}function Ne(){return Me}function We(e,t){t&&(Le("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ze(e){qe(e),e.drafts_.forEach(He),e.drafts_=null}function qe(e){e===Me&&(Me=e.parent_)}function Fe(e){return Me={drafts_:[],parent_:Me,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function He(e){const t=e[ve];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Je(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ve].modified_&&(ze(t),be(4)),je(e)&&(e=Ve(t,e),t.parent_||Be(t,e)),t.patches_&&Le("Patches").generateReplacementPatches_(n[ve].base_,e,t.patches_,t.inversePatches_)):e=Ve(t,n,[]),ze(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ge?e:void 0}function Ve(e,t,n){if(Ue(t))return t;const r=t[ve];if(!r)return Se(t,((o,i)=>Ke(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Be(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),Se(o,((o,s)=>Ke(e,r,t,o,s,n,i))),Be(e,t,!1),n&&e.patches_&&Le("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ke(e,t,n,r,o,i,s){if(o===n&&be(5),ke(o)){const s=Ve(e,o,i&&t&&3!==t.type_&&!Ce(t.assigned_,r)?i.concat(r):void 0);if(Ee(n,r,s),!ke(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(je(o)&&!Ue(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ve(e,o),t&&t.scope_.parent_||Be(e,o)}}function Be(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Pe(t,n)}var Ye={get(e,t){if(t===ve)return e;const n=Re(e);if(!Ce(n,t))return function(e,t,n){const r=Ze(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!je(r)?r:r===Ge(e.base_,t)?(et(e),e.copy_[t]=tt(r,e)):r},has:(e,t)=>t in Re(e),ownKeys:e=>Reflect.ownKeys(Re(e)),set(e,t,n){const r=Ze(Re(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Ge(Re(e),t),o=r?.[ve];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,r)&&(void 0!==n||Ce(e.base_,t)))return!0;et(e),Qe(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!==Ge(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,et(e),Qe(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Re(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){be(11)},getPrototypeOf:e=>we(e.base_),setPrototypeOf(){be(12)}},Xe={};function Ge(e,t){const n=e[ve];return(n?Re(n):e)[t]}function Ze(e,t){if(!(t in e))return;let n=we(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=we(n)}}function Qe(e){e.modified_||(e.modified_=!0,e.parent_&&Qe(e.parent_))}function et(e){e.copy_||(e.copy_=Te(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Se(Ye,((e,t)=>{Xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Xe.deleteProperty=function(e,t){return isNaN(parseInt(t))&&be(13),Xe.set.call(this,e,t,void 0)},Xe.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&be(14),Ye.set.call(this,e[0],t,n,e[0])};function tt(e,t){const n=_e(e)?Le("MapSet").proxyMap_(e,t):Ae(e)?Le("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ne(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ye;n&&(o=[r],i=Xe);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:Ne()).drafts_.push(n),n}function nt(e){return ke(e)||be(10,e),rt(e)}function rt(e){if(!je(e)||Ue(e))return e;const t=e[ve];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Te(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Te(e,!0);return Se(n,((e,t)=>{Ee(n,e,rt(t))})),t&&(t.finalized_=!1),n}var ot=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 r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&be(6),void 0!==n&&"function"!=typeof n&&be(7),je(e)){const o=Fe(this),i=tt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?ze(o):qe(o)}return We(o,n),Je(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===ge&&(r=void 0),this.autoFreeze_&&Pe(r,!0),n){const t=[],o=[];Le("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}be(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;const o=this.produce(e,t,((e,t)=>{n=e,r=t}));return[o,n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){je(e)||be(8),ke(e)&&(e=nt(e));const t=Fe(this),n=tt(e,void 0);return n[ve].isManual_=!0,qe(t),n}finishDraft(e,t){const n=e&&e[ve];n&&n.isManual_||be(9);const{scope_:r}=n;return We(r,t),Je(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Le("Patches").applyPatches_;return ke(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},it=ot.produce;ot.produceWithPatches.bind(ot),ot.setAutoFreeze.bind(ot),ot.setUseStrictShallowCopy.bind(ot),ot.applyPatches.bind(ot),ot.createDraft.bind(ot),ot.finishDraft.bind(ot);var st=(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})}}},at=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=r((()=>({})),...o);if(!(a.apply(null,i)===a.apply(null,s))){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:i,secondInputs:s,stack:e})}},ct={inputStabilityCheck:"once",identityFunctionCheck:"once"};var lt=e=>Array.isArray(e)?e:[e];function ut(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:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},pt=0,ft=1;function gt(){return{s:pt,v:void 0,o:null,p:null}}function mt(e,t={}){let n=gt();const{resultEqualityCheck:r}=t;let o,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=gt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=gt(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===ft)c=t.v;else if(c=e.apply(null,arguments),i++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==i&&i--);o="object"==typeof c&&null!==c||"function"==typeof c?new ht(c):c}return a.s=ft,a.v=c,c}return s.clearCache=()=>{n=gt(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function vt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:c,memoizeOptions:l=[],argsMemoize:u=mt,argsMemoizeOptions:d=[],devModeChecks:h={}}=a,p=lt(l),f=lt(d),g=ut(e),m=c((function(){return r++,s.apply(null,arguments)}),...p);let v=!0;const y=u((function(){o++;const e=dt(g,arguments);t=m.apply(null,e);{const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...ct,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:st},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:at}}})(v,h);if(n.shouldRun&&n.run(s,e,t),r.shouldRun){const t=dt(g,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:c,memoizeOptions:p},arguments)}v&&(v=!1)}return t}),...f);return Object.assign(y,{resultFunc:s,memoizedResultFunc:m,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var yt=vt(mt),bt=Object.assign(((e,t=yt)=>{!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);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>bt});function wt(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var kt=wt(),jt=wt;((...e)=>{const t=vt(...e)})(mt);var It="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?pe:pe.apply(null,arguments)},Ot=e=>e&&"function"==typeof e.match;function St(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>fe(t)&&t.type===e,n}function xt(e){return"function"==typeof e&&"type"in e&&Ot(e)}function Ct(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 Et=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 _t(e){return je(e)?it(e,(()=>{})):e}function At(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error("No insert provided for key not already in map");const r=n.insert(t,e);return e.set(t,r),r}function Rt(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Tt(e,t,n){const r=Pt(e,t,n);return{detectMutations:()=>$t(e,t,r,n)}}function Pt(e,t=[],n,r="",o=new Set){const i={value:n};if(!e(n)&&!o.has(n)){o.add(n),i.children={};for(const o in n){const s=r?r+"."+o:o;t.length&&-1!==t.indexOf(s)||(i.children[o]=Pt(e,t,n[o],s))}}return i}function $t(e,t=[],n,r,o=!1,i=""){const s=n?n.value:void 0,a=s===r;if(o&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:i};if(e(s)||e(r))return{wasMutated:!1};const c={};for(let e in n.children)c[e]=!0;for(let e in r)c[e]=!0;const l=t.length>0;for(let o in c){const s=i?i+"."+o:o;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const c=$t(e,t,n.children[o],r[o],a,s);if(c.wasMutated)return c}return{wasMutated:!1}}function Ut(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||ae(e)}function Mt(e,t="",n=Ut,r,o=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=r?r(e):Object.entries(e),c=o.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(c){if(o.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Mt(l,a,n,r,o,i),s))return s}return i&&Dt(e)&&i.add(e),!1}function Dt(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Dt(t))return!1;return!0}function Lt(e){return"boolean"==typeof e}var Nt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let i=new Et;if(t&&(Lt(t)?i.push(kt):i.push(jt(t.extraArgument))),n){let e={};Lt(n)||(e=n),i.unshift(function(e={}){{let t=function(e,t,r,o){return JSON.stringify(e,n(t,o),r)},n=function(e,t){let n=[],r=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(o,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,o):r.push(o),~n.indexOf(i)&&(i=t.call(this,o,i))}else n.push(i);return null==e?i:e.call(this,o,i)}},{isImmutable:r=Rt,ignoredPaths:o,warnAfter:i=32}=e;const s=Tt.bind(null,r,o);return({getState:e})=>{let n,r=e(),o=s(r);return a=>c=>{const l=Ct(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(r=e(),n=o.detectMutations(),o=s(r),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 u=a(c);return l.measureTime((()=>{if(r=e(),n=o.detectMutations(),o=s(r),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(c)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),u}}}}(e))}if(r){let e={};Lt(r)||(e=r),i.push(function(e={}){{const{isSerializable:t=Ut,getEntries:n,ignoredActions:r=[],ignoredActionPaths:o=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:c=!1,disableCache:l=!1}=e,u=!l&&WeakSet?new WeakSet:void 0;return e=>l=>d=>{if(!fe(d))return l(d);const h=l(d),p=Ct(s,"SerializableStateInvariantMiddleware");return c||r.length&&-1!==r.indexOf(d.type)||p.measureTime((()=>{const e=Mt(d,"",t,n,o,u);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: ",d,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(p.measureTime((()=>{const r=Mt(e.getState(),"",t,n,i,u);if(r){const{keyPath:e,value:t}=r;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: ${d.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),p.warnIfExceeded()),h}}}(e))}if(o){let e={};Lt(o)||(e=o),i.unshift(function(e={}){const{isActionCreator:t=xt}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}return i},Wt=e=>t=>{setTimeout(t,e)},zt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Wt(10),qt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Et(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,i=!1,s=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?zt:"callback"===e.type?e.queueNotification:Wt(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>o&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,i=!o,i&&(s||(s=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r};function Ft(e){const t=Nt(),{reducer:n,middleware:r,devTools:o=!0,preloadedState:i,enhancers:s}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!ae(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=he(n)}if(r&&"function"!=typeof r)throw new Error("`middleware` field must be a callback");if("function"==typeof r){if(c=r(t),!Array.isArray(c))throw new Error("when using a middleware builder function, an array of middleware must be returned")}else c=t();if(c.some((e=>"function"!=typeof e)))throw new Error("each middleware provided to configureStore must be a function");let l=pe;o&&(l=It({trace:!0,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map((e=>e(s)));return i=pe(...a)(o.dispatch),{...o,dispatch:i}}}(...c),d=qt(u);if(s&&"function"!=typeof s)throw new Error("`enhancers` field must be a callback");let h="function"==typeof s?s(d):d();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");c.length&&!h.includes(u)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return ue(a,i,l(...h))}function Ht(e){const t={},n=[];let r;const o={addCase(e,i){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)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]=i,o},addMatcher(e,t){if(r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),o},addDefaultCase(e){if(r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,o}};return e(o),[t,n,r]}function Jt(...e){return t=>e.some((e=>((e,t)=>Ot(e)?e.match(t):e(t))(e,t)))}var Vt=["name","message","stack","code"],Kt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Bt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Yt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Vt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Xt=(()=>{function e(e,t,n){const r=St(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=St(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=St(e+"/rejected",((e,t,r,o,i)=>({payload:o,error:(n&&n.serializeError||Yt)(e||"Rejected"),meta:{...i||{},arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,c)=>{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})(),u=new AbortController;let d;function h(e){d=e,u.abort()}const p=async function(){let p;try{let i=n?.condition?.(e,{getState:a,extra:c});if(null!==(f=i)&&"object"==typeof f&&"function"==typeof f.then&&(i=await i),!1===i||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const g=new Promise(((e,t)=>u.signal.addEventListener("abort",(()=>t({name:"AbortError",message:d||"Aborted"})))));s(o(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:c}))),p=await Promise.race([g,Promise.resolve(t(e,{dispatch:s,getState:a,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Kt(e,t),fulfillWithValue:(e,t)=>new Bt(e,t)})).then((t=>{if(t instanceof Kt)throw t;return t instanceof Bt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){p=t instanceof Kt?i(null,l,e,t.payload,t.meta):i(t,l,e)}var f;return n&&!n.dispatchConditionRejection&&i.match(p)&&p.meta.condition||s(p),p}();return Object.assign(p,{abort:h,requestId:l,arg:e,unwrap:()=>p.then(Gt)})}}),{pending:o,rejected:i,fulfilled:r,settled:Jt(i,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Gt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Zt=Symbol.for("rtk-slice-createasyncthunk");function Qt(e,t){return`${e}/${t}`}function en(e,t,n,r){function o(o,...i){let s=n.call(e,o);if(void 0===s){if(!r)throw new Error("selectState returned undefined for an uninjected slice reducer");s=e.getInitialState()}return t(s,...i)}return o.unwrapped=t,o}var tn=function({creators:e}={}){const t=e?.asyncThunk?.[Zt];return function(e){const{name:n,reducerPath:r=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 o=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},i=Object.keys(o),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 c(){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=[],r]="function"==typeof e.extraReducers?Ht(e.extraReducers):[e.extraReducers],o={...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,[r,o,i]=Ht(t);if(function(e){return"function"==typeof e}(e))n=()=>_t(e());else{const t=_t(e);n=()=>t}function s(e=n(),t){let s=[r[t.type],...o.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(ke(e)){const r=n(e,t);return void 0===r?e:r}if(je(e))return it(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in o)e.addCase(t,o[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}))}i.forEach((r=>{const i=o[r],s={reducerName:r,type:Qt(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},r,o){let i,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error("Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=r.reducer,s=r.prepare}else i=r;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?St(e,s):St(e))}(s,i,a):function({type:e,reducerName:t},n,r,o){if(!o)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:i,fulfilled:s,pending:a,rejected:c,settled:l,options:u}=n,d=o(e,i,u);r.exposeAction(t,d),s&&r.addCase(d.fulfilled,s);a&&r.addCase(d.pending,a);c&&r.addCase(d.rejected,c);l&&r.addMatcher(d.settled,l);r.exposeCaseReducer(t,{fulfilled:s||nn,pending:a||nn,rejected:c||nn,settled:l||nn})}(s,i,a,t)}));const l=e=>e,u=new WeakMap;let d;const h={name:n,reducerPath:r,reducer:(e,t)=>(d||(d=c()),d(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(d||(d=c()),d.getInitialState()),getSelectors(t=l){const n=At(u,this,{insert:()=>new WeakMap});return At(n,t,{insert:()=>{const n={};for(const[r,o]of Object.entries(e.selectors??{}))n[r]=en(this,o,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 r=t??this.reducerPath;return e.inject({reducerPath:r,reducer:this.reducer},n),{...this,reducerPath:r}}};return h}}();function nn(){}var rn="listenerMiddleware";St(`${rn}/add`),St(`${rn}/removeAll`),St(`${rn}/remove`);const on=e=>l((t=>{const n=tn(e),r=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(i(v)(t)){constructor(...e){super(...e);const t=Ft({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),o=e=>async(...n)=>{const r=await t.dispatch(e(...n));try{Gt(r)}catch(e){this.logger.error(e.message,r.type,e.stack)}return r},i=Object.keys(r).reduce(((e,t)=>(e[t]=o(r[t]),e)),{});this.actions=i,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}}));l((e=>class extends(v(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}}));const sn=l((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),an=(e,t)=>t?{[e]:t}:{},cn=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},ln=e=>e.selectedAuditId,un=yt((e=>e.auditList.data),(e=>e.map((e=>{const n=e||{},{occurred:r,ID:o,type:i}=n,s=n.data,a=void 0===s?{saml_request:"",saml_response:"",saml_generated_user:"",saml_generated_roles:"",oidc_response:"",oidc_generated_user:""}:s,{saml_request:c,saml_response:l,saml_generated_user:u,saml_generated_roles:d,oidc_response:h,oidc_generated_user:p}=a,f=t(a,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user"]),g=t(n,["occurred","ID","type","data"]);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:f}),an("type",(e=>e&&e[0].toUpperCase()+e.slice(1))(i))),an("saml_request",c)),an("saml_response",l)),an("saml_generated_user",cn(u))),an("saml_generated_roles",cn(d))),an("oidc_response",cn(h))),an("oidc_generated_user",cn(p))),{occurredFormatted:r?new Date(Number(r)||0).toLocaleString():"N/A"})}))));yt(ln,un,((e,t)=>t.find((t=>e===t.id)))),yt(ln,(e=>!!e));const dn=Xt("audit/search",((e,{extra:{api:t},getState:n})=>{const r=n().searchParams;return t.audit.search(Object.assign(Object.assign({},r),e))})),hn=(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)}))}))})(dn)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(pn=e=>e.auditList,{onFulfilled:e=>{pn(e).loading=!1},onPending:e=>{pn(e).loading=!0,pn(e).error=null},onRejected:(e,t)=>{pn(e).loading=!1,pn(e).error=t.error}}));var pn;const fn={action:dn,reducer:hn},gn={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""};class mn extends Error{}function vn(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 yn(e,t){if("string"!=typeof e)throw new mn("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new mn(`Invalid token specified: missing part #${n+1}`);let o;try{o=vn(r)}catch(e){throw new mn(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new mn(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}mn.prototype.name="InvalidTokenError";var bn="/v1/auth/accesskey/exchange",wn="/v1/auth/otp/verify",kn="/v1/auth/otp/signin",jn="/v1/auth/otp/signup",In={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},On="/v1/auth/otp/signup-in",Sn="/v1/auth/magiclink/verify",xn="/v1/auth/magiclink/signin",Cn="/v1/auth/magiclink/signup",En={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},_n="/v1/auth/magiclink/signup-in",An="/v1/auth/enchantedlink/verify",Rn="/v1/auth/enchantedlink/signin",Tn="/v1/auth/enchantedlink/signup",Pn="/v1/auth/enchantedlink/pending-session",$n={email:"/v1/auth/enchantedlink/update/email"},Un="/v1/auth/enchantedlink/signup-in",Mn="/v1/auth/oauth/authorize",Dn="/v1/auth/oauth/exchange",Ln="v1/auth/oauth/native/start",Nn="v1/auth/oauth/native/finish",Wn="/v1/auth/saml/authorize",zn="/v1/auth/saml/exchange",qn="/v1/auth/totp/verify",Fn="/v1/auth/totp/signup",Hn="/v1/auth/totp/update",Jn="/v1/auth/notp/whatsapp/signin",Vn="/v1/auth/notp/whatsapp/signup",Kn="/v1/auth/notp/whatsapp/signup-in",Bn="/v1/auth/notp/pending-session",Yn={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},Xn={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},Gn={start:"/v1/auth/webauthn/signup-in/start"},Zn={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Qn="/v1/auth/password/signup",er="/v1/auth/password/signin",tr="/v1/auth/password/reset",nr="/v1/auth/password/update",rr="/v1/auth/password/replace",or="/v1/auth/password/policy",ir="/v1/auth/refresh",sr="/v1/auth/tenant/select",ar="/v1/auth/logout",cr="/v1/auth/logoutall",lr="/v1/auth/me",ur="/v1/auth/me/tenants",dr="/v1/auth/me/history",hr="/v1/flow/start",pr="/v1/flow/next";const fr="<region>",gr=`https://api.${fr}descope.com`,mr=6e5,vr="dct",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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};let br;const wr=()=>{if(br)return br;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 br=`${t}-${n}`,br};var kr,jr;(jr=kr||(kr={})).get="GET",jr.delete="DELETE",jr.post="POST",jr.put="PUT",jr.patch="PATCH";const Ir=({path:e,baseUrl:t,queryParams:n,projectId:r})=>{const o=r.slice(1,-27);t=t.replace(fr,o?o+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,r)=>{i=`${i}${0===r?"?":""}${t}=${encodeURIComponent(n[t])}${r===e.length-1?"":"&"}`}))}return i},Or=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,r])=>(e[n]=r,e)),e),e}),{})),Sr={"Content-Type":"application/json"},xr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Cr=e=>{const t={"x-descope-sdk-session-id":wr(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.36.0"};return e&&(t["x-descope-refresh-cookie-name"]=e),t},Er=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},_r=({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:r,logger:o,hooks:i,cookiePolicy:s,fetch:a})=>{const c=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n})(t||fetch);return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...t)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>yr().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const r=await n(...t);return e[r.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).build()})(r)),r}:n})(o,a),l=async o=>{var a;const l=(null==i?void 0:i.beforeRequest)?i.beforeRequest(o):o,{path:u,body:d,headers:h,queryParams:p,method:f,token:g}=l,m=(e=>void 0===e?void 0:JSON.stringify(e))(d),v={headers:Or(xr(t,g),Cr(r),(null==n?void 0:n.baseHeaders)||{},Er(m)?Sr:{},h),method:f,body:m};null!==s&&(v.credentials=s||"include");const y=await c(Ir({path:u,baseUrl:e,queryParams:p,projectId:t}),v);if((null==i?void 0:i.afterRequest)&&await i.afterRequest(o,null==y?void 0:y.clone()),null==i?void 0:i.transformResponse){const e=await y.json(),t=((null===(a=y.headers)||void 0===a?void 0:a.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,r]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:r})}),{}),n=Object.assign(Object.assign({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,i.transformResponse(n)}return y};return{get:(e,{headers:t,queryParams:n,token:r}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:kr.get,token:r}),post:(e,t,{headers:n,queryParams:r,token:o}={})=>l({path:e,headers:n,queryParams:r,body:t,method:kr.post,token:o}),patch:(e,t,{headers:n,queryParams:r,token:o}={})=>l({path:e,headers:n,queryParams:r,body:t,method:kr.patch,token:o}),put:(e,t,{headers:n,queryParams:r,token:o}={})=>l({path:e,headers:n,queryParams:r,body:t,method:kr.put,token:o}),delete:(e,{headers:t,queryParams:n,token:r}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:kr.delete,token:r}),hooks:i,buildUrl:(n,r)=>Ir({projectId:t,baseUrl:e,path:n,queryParams:r})}};var Ar=429;function Rr(e,t,n){var r;let o=Tr(e);if(t){if(!(null==o?void 0:o.tenants)&&(null==o?void 0:o[vr])===t)return(null==o?void 0:o[n])||[];o=null===(r=null==o?void 0:o.tenants)||void 0===r?void 0:r[t]}const i=null==o?void 0:o[n];return Array.isArray(i)?i:[]}function Tr(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return yn(e)}function Pr(e){const{exp:t}=Tr(e);return(new Date).getTime()/1e3>t}function $r(e){let t=Tr(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Ur(e,t){return Rr(e,t,"permissions")}function Mr(e,t){return Rr(e,t,"roles")}const Dr=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Lr(e,t){var n;const r=await e,o={code:r.status,ok:r.ok,response:r},i=await r.clone().json();return r.ok?o.data=i:(o.error=i,r.status===Ar&&Object.assign(o.error,{retryAfter:Number.parseInt(null===(n=r.headers)||void 0===n?void 0:n.get("retry-after"))||0})),o}const Nr=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Wr=(e,t)=>(n=t)=>t=>{const r=e.filter((e=>e(t)));return!(r.length<e.length)&&(n?n.replace("{val}",t):r.join(" OR "))},zr=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),qr=e=>t=>e.test(t),Fr=qr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Hr=qr(/^\+[1-9]{1}[0-9]{3,14}$/),Jr=Nr(Fr,'"{val}" is not a valid email'),Vr=Nr(Hr,'"{val}" is not a valid phone number'),Kr=Nr((e=>e.length>=1),"Minimum length is 1");const Br=Nr((e=>"string"==typeof e),"Input is not a string"),Yr=Nr((e=>Array.isArray(e)),"Input is not an array"),Xr=Nr((e=>"boolean"==typeof e),"Input is not a boolean"),Gr=Nr((e=>void 0===e),"Input is defined"),Zr=Wr([Br(),Gr()],"Input is not a string or undefined"),Qr=Wr([Yr(),Xr()],"Input is not an array or boolean"),eo=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>zr(...e).validate(n[t]))),t(...n)),to=e=>[Br(`"${e}" must be a string`)],no=e=>[Br(`"${e}" must be a string`),Kr(`"${e}" must not be empty`)],ro=e=>[Br(`"${e}" must be a string`),Jr()],oo=e=>[Br(`"${e}" must be a string`),Vr()],io=eo(no("accessKey")),so=e=>({exchange:io(((t,n)=>Lr(e.post(bn,{loginOptions:n},{token:t}))))}),ao=(e,t,n)=>(t.forEach((t=>{const r=t.split(".");let o=r.shift(),i=e;for(;r.length>0;){if(i=i[o],!o||!i)throw Error(`Invalid path "${t}", "${o}" is missing or has no value`);o=r.shift()}if("function"!=typeof i[o])throw Error(`"${t}" is not a function`);const s=i[o];i[o]=n(s)})),e),co=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||mr,mr)});var lo,uo;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(lo||(lo={})),function(e){e.email="email"}(uo||(uo={}));const ho=Object.assign(Object.assign({},lo),uo);var po;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(po||(po={}));const fo=no("loginId"),go=eo(no("token")),mo=eo(fo),vo=eo(no("pendingRef")),yo=eo(fo,ro("email")),bo=e=>({verify:go((t=>Lr(e.post(An,{token:t})))),signIn:mo(((t,n,r,o)=>Lr(e.post(Dr(Rn,ho.email),{loginId:t,URI:n,loginOptions:r},{token:o})))),signUpOrIn:mo(((t,n,r)=>Lr(e.post(Dr(Un,ho.email),{loginId:t,URI:n,loginOptions:r})))),signUp:mo(((t,n,r,o)=>Lr(e.post(Dr(Tn,ho.email),{loginId:t,URI:n,user:r,loginOptions:o})))),waitForSession:vo(((t,n)=>new Promise((r=>{const{pollingIntervalMs:o,timeoutMs:i}=co(n);let s;const a=setInterval((async()=>{const n=await e.post(Pn,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Lr(Promise.resolve(n))))}),o);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:yo(((t,n,r,o,i)=>Lr(e.post($n.email,Object.assign({loginId:t,email:n,URI:r},i),{token:o}))))}}),wo=eo(no("flowId")),ko=eo(no("executionId"),no("stepId"),no("interactionId")),jo=e=>({start:wo(((t,n,r,o,i,s,a)=>Lr(e.post(hr,{flowId:t,options:n,conditionInteractionId:r,interactionId:o,componentsVersion:i,flowVersions:s,input:a})))),next:ko(((t,n,r,o,i,s)=>Lr(e.post(pr,{executionId:t,stepId:n,interactionId:r,version:o,componentsVersion:i,input:s}))))}),Io=no("loginId"),Oo=eo(no("token")),So=eo(Io),xo=eo(Io,oo("phone")),Co=eo(Io,ro("email")),Eo=Object.keys(ho).filter((e=>e!==lo.voice)),_o=e=>({verify:Oo((t=>Lr(e.post(Sn,{token:t})))),signIn:Eo.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:So(((t,r,o,i)=>Lr(e.post(Dr(xn,n),{loginId:t,URI:r,loginOptions:o},{token:i}))))})),{}),signUp:Eo.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:So(((t,r,o,i)=>Lr(e.post(Dr(Cn,n),{loginId:t,URI:r,user:o,loginOptions:i}))))})),{}),signUpOrIn:Eo.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:So(((t,r,o)=>Lr(e.post(Dr(_n,n),{loginId:t,URI:r,loginOptions:o}))))})),{}),update:{email:Co(((t,n,r,o,i)=>Lr(e.post(En.email,Object.assign({loginId:t,email:n,URI:r},i),{token:o})))),phone:Object.keys(lo).filter((e=>e!==lo.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xo(((t,r,o,i,s)=>Lr(e.post(Dr(En.phone,n),Object.assign({loginId:t,phone:r,URI:o},s),{token:i}))))})),{})}});var Ao;!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"}(Ao||(Ao={}));const Ro=eo(no("code")),To=e=>({start:Object.assign(((t,n,r,o)=>Lr(e.post(Mn,r||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:o}))),Object.keys(Ao).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,r,o)=>Lr(e.post(Mn,r||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:o}))})),{})),exchange:Ro((t=>Lr(e.post(Dn,{code:t})))),startNative:(t,n,r)=>Lr(e.post(Ln,{provider:t,loginOptions:n,implicit:r})),finishNative:(t,n,r,o,i)=>Lr(e.post(Nn,{provider:t,stateId:n,user:r,code:o,idToken:i}))}),Po=no("loginId"),$o=eo(Po,no("code")),Uo=eo(Po),Mo=eo(Po,oo("phone")),Do=eo(Po,ro("email")),Lo=e=>({verify:Object.keys(ho).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:$o(((t,r)=>Lr(e.post(Dr(wn,n),{code:r,loginId:t}))))})),{}),signIn:Object.keys(ho).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Uo(((t,r,o)=>Lr(e.post(Dr(kn,n),{loginId:t,loginOptions:r},{token:o}))))})),{}),signUp:Object.keys(ho).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Uo(((t,r,o)=>Lr(e.post(Dr(jn,n),{loginId:t,user:r,loginOptions:o}))))})),{}),signUpOrIn:Object.keys(ho).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Uo(((t,r)=>Lr(e.post(Dr(On,n),{loginId:t,loginOptions:r}))))})),{}),update:{email:Do(((t,n,r,o)=>Lr(e.post(In.email,Object.assign({loginId:t,email:n},o),{token:r})))),phone:Object.keys(lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Mo(((t,r,o,i)=>Lr(e.post(Dr(In.phone,n),Object.assign({loginId:t,phone:r},i),{token:o}))))})),{})}}),No=eo(no("tenant")),Wo=eo(no("code")),zo=e=>({start:No(((t,n,r,o,i)=>Lr(e.post(Wn,r||{},Object.assign({queryParams:Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i})},o&&{token:o}))))),exchange:Wo((t=>Lr(e.post(zn,{code:t}))))}),qo=no("loginId"),Fo=eo(qo,no("code")),Ho=eo(qo),Jo=eo(qo),Vo=e=>({signUp:Ho(((t,n)=>Lr(e.post(Fn,{loginId:t,user:n})))),verify:Fo(((t,n,r,o)=>Lr(e.post(qn,{loginId:t,code:n,loginOptions:r},{token:o})))),update:Jo(((t,n)=>Lr(e.post(Hn,{loginId:t},{token:n}))))}),Ko=no("loginId"),Bo=no("newPassword"),Yo=eo(Ko,no("password")),Xo=eo(Ko),Go=eo(Ko,Bo),Zo=eo(Ko,no("oldPassword"),Bo),Qo=e=>({signUp:Yo(((t,n,r,o)=>Lr(e.post(Qn,{loginId:t,password:n,user:r,loginOptions:o})))),signIn:Yo(((t,n,r)=>Lr(e.post(er,{loginId:t,password:n,loginOptions:r})))),sendReset:Xo(((t,n,r)=>Lr(e.post(tr,{loginId:t,redirectUrl:n,templateOptions:r})))),update:Go(((t,n,r)=>Lr(e.post(nr,{loginId:t,newPassword:n},{token:r})))),replace:Zo(((t,n,r)=>Lr(e.post(rr,{loginId:t,oldPassword:n,newPassword:r})))),policy:()=>Lr(e.get(or))}),ei=to("loginId"),ti=no("loginId"),ni=no("origin"),ri=eo(ti,ni,no("name")),oi=eo(ti,ni),ii=eo(ei,ni),si=eo(ti,ni,no("token")),ai=eo(no("transactionId"),no("response")),ci=e=>({signUp:{start:ri(((t,n,r,o)=>Lr(e.post(Yn.start,{user:{loginId:t,name:r},origin:n,passkeyOptions:o})))),finish:ai(((t,n)=>Lr(e.post(Yn.finish,{transactionId:t,response:n}))))},signIn:{start:ii(((t,n,r,o,i)=>Lr(e.post(Xn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:i},{token:o})))),finish:ai(((t,n)=>Lr(e.post(Xn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:oi(((t,n,r)=>Lr(e.post(Gn.start,{loginId:t,origin:n,passkeyOptions:r}))))},update:{start:si(((t,n,r,o)=>Lr(e.post(Zn.start,{loginId:t,origin:n,passkeyOptions:o},{token:r})))),finish:ai(((t,n)=>Lr(e.post(Zn.finish,{transactionId:t,response:n}))))}}),li=to("loginId"),ui=eo(li),di=eo(no("pendingRef")),hi=e=>({signUpOrIn:ui(((t,n)=>Lr(e.post(Kn,{loginId:t,loginOptions:n})))),signUp:ui(((t,n,r)=>Lr(e.post(Vn,{loginId:t,user:n,loginOptions:r})))),signIn:ui(((t,n,r)=>Lr(e.post(Jn,{loginId:t,loginOptions:n},{token:r})))),waitForSession:di(((t,n)=>new Promise((r=>{const{pollingIntervalMs:o,timeoutMs:i}=co(n);let s;const a=setInterval((async()=>{const n=await e.post(Bn,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Lr(Promise.resolve(n))))}),o);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),pi=eo(no("token")),fi=eo([Zr('"token" must be string or undefined')]);var gi,mi=eo([(gi=no("projectId"),Nr(((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("."),r=n.length;let o=0,i=e===Object(e)?e:void 0;for(;null!=i&&o<r;)i=i[n[o++]];return o&&o===r&&void 0!==i?i:void 0})(n,e)))("projectId",gi))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:r,cookiePolicy:o,baseHeaders:i={},refreshCookieName:s,fetch:a})=>{return c=_r({baseUrl:n||gr,projectId:e,logger:t,hooks:r,cookiePolicy:o,baseConfig:{baseHeaders:i},refreshCookieName:s,fetch:a}),{accessKey:so(c),otp:Lo(c),magicLink:_o(c),enchantedLink:bo(c),oauth:To(c),saml:zo(c),totp:Vo(c),notp:hi(c),webauthn:ci(c),password:Qo(c),flow:jo(c),refresh:fi(((e,t)=>Lr(c.post(ir,{},{token:e,queryParams:t})))),selectTenant:eo([Br("tenantId")],[Zr('"token" must be string or undefined')])(((e,t)=>Lr(c.post(sr,{tenant:e},{token:t})))),logout:fi((e=>Lr(c.post(ar,{},{token:e})))),logoutAll:fi((e=>Lr(c.post(cr,{},{token:e})))),me:fi((e=>Lr(c.get(lr,{token:e})))),myTenants:eo([Qr('"tenants" must a string array or a boolean')],[Zr('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,Lr(c.post(ur,n,{token:t}))})),history:fi((e=>Lr(c.get(dr,{token:e})))),isJwtExpired:pi(Pr),getTenants:pi($r),getJwtPermissions:pi(Ur),getJwtRoles:pi(Mr),httpClient:c};var c})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const r=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==r?void 0:r.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var r;const o=[].concat((null===(r=e.hooks)||void 0===r?void 0:r.afterRequest)||[]);0!=o.length&&(await Promise.allSettled(null==o?void 0:o.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),vi=Object.assign(mi,{DeliveryMethods:ho});
6
6
  /*! js-cookie v3.0.5 | MIT */
7
- function mi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var vi=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=mi({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in o)o[s]&&(i+="; "+s,!0!==o[s]&&(i+="="+o[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(r[a]=t.read(s,a),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",mi({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,mi({},this.attributes,t))},withConverter:function(t){return e(mi({},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 yi={default:"endpoint"},bi="Blocked by CSP",wi="The endpoint parameter is not a valid URL",ki="Failed to load the JS script of the agent",ji="9319";function Ii(e,t){var n,r,o,i,s,a=[],c=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||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),i=0,r=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},o=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===bi||s===wi)n.exclude(),i=0;else if(s===ji)n.exclude();else if(s===ki){var a=Date.now()-e.getTime()<50,c=n.current();c&&a&&!o.has(c)&&(o.add(c),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+r()-Date.now()]}]),l=c[0],u=c[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var d=function(e){var n=new Date,r=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},o=t(e);return o.then((function(){return r()}),r),o.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=u(n,e);if(!t)throw s;var r,o=t[0],i=t[1];return(r=i,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return d(o)}))}))};return d(l).then((function(e){return[e,a]}))}var Oi="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Si=Oi;function xi(n){var r;n.scriptUrlPattern;var o=n.token,i=n.apiKey,s=void 0===i?o:i,a=t(n,["scriptUrlPattern","token","apiKey"]),c=null!==(r=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(n,"scriptUrlPattern"))&&void 0!==r?r:Oi,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(document,"visibilitychange",t);return t(),[e,n]}(),u=l[0],d=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)}))}(c,s);return Ii(e,Ei)})).catch((function(e){throw d(),function(e){return e instanceof Error&&e.message===ji?new Error(ki):e}(e)})).then((function(t){var n=t[0],r=t[1];return d(),n.load(e(e({},a),{ldi:{attempts:r,visibilityStates:u}}))}))}function Ei(e){return function(e,t,n){var r,o=document,i="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,a())};o.addEventListener(i,s);var a=function(){return o.removeEventListener(i,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(),r)return n(r);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(wi);var r=document.createElement("script"),o=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},i=document.head||document.getElementsByTagName("head")[0];r.onload=function(){o(),t()},r.onerror=function(){o(),n(new Error(ki))},r.async=!0,r.src=e,i.appendChild(r)}))}(e)}),(function(){throw new Error(bi)})).then(Ci)}function Ci(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,r=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==r?void 0:r.configurable)?delete e[t]:r&&!r.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(ji);return n}const _i=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,r)=>{var o;return n[r]=[].concat((null===(o=e.hooks)||void 0===o?void 0:o[r])||[]).concat((null==t?void 0:t[r])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Ai=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},Ri=async e=>{const t=await Ai(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Ti="undefined"!=typeof localStorage,Pi=(e,t)=>Ti&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),$i=e=>Ti&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Ui=e=>Ti&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Mi=(...e)=>{console.debug(...e)},Di="undefined"!=typeof window,Li=Math.pow(2,31)-1,Ni="DS",Wi="DSR";function zi(e=""){return $i(`${e}${Wi}`)||""}function qi(e=""){return vi.get(Ni)||$i(`${e}${Ni}`)||""}function Fi(e=""){Ui(`${e}${Wi}`),Ui(`${e}${Ni}`),vi.remove(Ni)}const Hi=Di&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Ji="vsid",Vi="vrid",Ki=(e=!1)=>{const t=localStorage.getItem("fp");if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Bi=async(e,t=Hi)=>{try{if(Ki())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=o.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=xi({apiKey:e,endpoint:[r.toString(),yi],scriptUrlPattern:[i,Si]}),a=await s,{requestId:c}=await a.get({linkedId:n}),l=((e,t)=>({[Ji]:e,[Vi]:t}))(n,c);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem("fp",JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Yi=e=>{const t=Ki(!0);return t&&e.body&&(e.body.fpData=t),e},Xi="dls_last_user_login_id",Gi="dls_last_user_display_name",Zi=()=>$i(Xi),Qi=()=>$i(Gi),es=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,r={}]=t,o=Zi(),i=Qi();return o&&(null!==(n=r.lastAuth)&&void 0!==n||(r.lastAuth={}),r.lastAuth.loginId=o,r.lastAuth.name=i),await e(...t)};function ts(){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 ns(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=cs(n.publicKey.challenge),n.publicKey.user.id=cs(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=cs(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:ls(n.rawId),type:n.type,response:{attestationObject:ls(n.response.attestationObject),clientDataJSON:ls(n.response.clientDataJSON)}});var n}async function rs(e){const t=ss(e);return as(await navigator.credentials.get(t))}async function os(e,t){const n=ss(e);return n.signal=t.signal,n.mediation="conditional",as(await navigator.credentials.get(n))}async function is(e=!1){if(!Di)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function ss(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=cs(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=cs(e.id)})),n}function as(e){return JSON.stringify({id:e.id,rawId:ls(e.rawId),type:e.type,response:{authenticatorData:ls(e.response.authenticatorData),clientDataJSON:ls(e.response.clientDataJSON),signature:ls(e.response.signature),userHandle:e.response.userHandle?ls(e.response.userHandle):void 0}})}function cs(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function ls(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var us,ds=(us=e=>({async signUp(t,n,r){const o=await e.webauthn.signUp.start(t,window.location.origin,n,r);if(!o.ok)return o;const i=await ns(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,i)},async signIn(t,n){const r=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!r.ok)return r;const o=await rs(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,o)},async signUpOrIn(t,n){var r;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!o.ok)return o;if(null===(r=o.data)||void 0===r?void 0:r.create){const t=await ns(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await rs(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n,r){const o=await e.webauthn.update.start(t,window.location.origin,n,r);if(!o.ok)return o;const i=await ns(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,i)},helpers:{create:ns,get:rs,isSupported:is,conditional:os}}),(...e)=>{const t=us(...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 hs="/fedcm/config",ps=(e,t)=>({async oneTap(t,n,r,o,i){const s=null!=t?t:"google",a=await e.oauth.startNative(s,r,!0);if(!a.ok)return a;const{clientId:c,stateId:l,nonce:u}=a.data,d=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var r,a;d.initialize(Object.assign(Object.assign({},n),{itp_support:null===(r=null==n?void 0:n.itp_support)||void 0===r||r,use_fedcm_for_prompt:null===(a=null==n?void 0:n.use_fedcm_for_prompt)||void 0===a||a,client_id:c,callback:n=>{t(e.oauth.finishNative(s,l,"","",n.credential))},nonce:u})),d.prompt((e=>{var t,n;if(i&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);null==i||i(n)}else if(o&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);null==o||o(t)}}))}))},async launch(n){var r;const o={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+hs),clientId:t}]}},i=await(null===(r=navigator.credentials)||void 0===r?void 0:r.get(o));return e.refresh(i.token)},isSupported:()=>Di&&"IdentityCredential"in window,async isLoggedIn(n){var r;const o=e.httpClient.buildUrl(t+hs);try{const e={identity:{context:n||"signin",providers:[{configURL:o,clientId:t}]}},i=await(null===(r=navigator.credentials)||void 0===r?void 0:r.get(e));return!!i&&!!i.token}catch(e){return!1}}});var fs=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await is(),r=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=r,e.flow.start(...t)}});const gs=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>n=>{var{fpKey:r,fpLoad:o}=n,i=t(n,["fpKey","fpLoad"]);return Di?(r&&o&&Bi(r).catch((()=>null)),e(_i(i,{beforeRequest:Yi}))):e(i)}),(e=>n=>{var{autoRefresh:r}=n,o=t(n,["autoRefresh"]);if(!r)return e(o);const{clearAllTimers:i,setTimer:s}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let a,c;Di&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>a&&(Mi("Expiration time passed, refreshing session"),l.refresh(zi()||c))}));const l=e(_i(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:r}=await Ai(t);if(401===(null==t?void 0:t.status))Mi("Received 401, canceling all timers"),i();else if(r){if(a=(e=>{try{const t=vn(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(r),!a)return void Mi("Could not extract expiration time from session token");c=n;let e=((o=a)?o.getTime()-(new Date).getTime():0)-2e4;e>Li&&(Mi(`Timeout is too large (${e}ms), setting it to ${Li}ms`),e=Li),i();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Mi(`Setting refresh timer for ${t}. (${e}ms)`),s((()=>{Mi("Refreshing session due to timer"),l.refresh(zi()||n)}),e)}var o}}));return io(l,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Mi("Clearing all timers"),i(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.24.1"},t.baseHeaders)}))),(e=>t=>{const n=ts(),r=ts(),o=e(_i(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),r.pub(null);else{const e=await Ri(t);e&&r.pub(e);const{sessionJwt:o}=await Ai(t);o&&n.pub(o)}}})),i=io(o,["logout","logoutAll"],(e=>async(...t)=>{const o=await e(...t);return n.pub(null),r.pub(null),o}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:r.sub})}),(e=>n=>{var{storeLastAuthenticatedUser:r=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=n,i=t(n,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!r)return Object.assign(e(i),{getLastUserLoginId:Zi,getLastUserDisplayName:Qi});const s=e(_i(i,{afterRequest:async(e,t)=>{var n;const r=await Ri(t),o=null===(n=null==r?void 0:r.loginIds)||void 0===n?void 0:n[0],i=null==r?void 0:r.name;o&&((e=>{Pi(Xi,e)})(o),(e=>{Pi(Gi,e)})(i))}}));let a=io(s,["flow.start"],es);return a=io(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const r=await t(...n);return e||(Ui(Xi),Ui(Gi)),r})(o)),Object.assign(a,{getLastUserLoginId:Zi,getLastUserDisplayName:Qi})}),(e=>n=>{var{persistTokens:r,sessionTokenViaCookie:o,storagePrefix:i}=n,s=t(n,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!r||!Di)return e(s);const a=e(_i(s,{beforeRequest:(c=i,e=>Object.assign(e,{token:e.token||zi(c)})),afterRequest:async(e,n)=>{const r=/^\/v\d+\/mgmt\//.test(e.path);401===(null==n?void 0:n.status)?r||Fi(i):((e={},n,r)=>{var{refreshJwt:o,sessionJwt:i}=e,s=t(e,["refreshJwt","sessionJwt"]);void 0===n&&(n=!1),void 0===r&&(r=""),o&&Pi(`${r}${Wi}`,o),i&&(n?function(e,t,{cookiePath:n,cookieDomain:r,cookieExpiration:o,cookieSameSite:i="Strict"}){if(t){const s=new Date(1e3*o),a=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(r);vi.set(e,t,{path:n,domain:a?r:void 0,expires:s,sameSite:i,secure:!0})}}(Ni,i,Object.assign(Object.assign({},s),{cookieSameSite:!0===n?"Strict":n.sameSite})):Pi(`${r}${Ni}`,i))})(await Ai(n),o,i)}}));var c;const l=io(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const r=await t(...n);return Fi(e),r})(i));return Object.assign(l,{getRefreshToken:()=>zi(i),getSessionToken:()=>qi(i)})}))(((...e)=>{const t=gi(...e);return Object.assign(Object.assign({},t),{refresh:e=>{const n=qi();return t.refresh(e,{dcs:n?"t":"f"})},flow:fs(t),webauthn:ds(t),fedcm:ps(t,e[0].projectId)})})),ms={search:"/v1/mgmt/audit/search"},vs=e=>n(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const r=[];for(let e=1;e<9;e+=1)r.push({id:`Audit ${e}`,action:`Action ${e}`,actorId:`Actor ${e}`,type:"info",method:`Method ${e}`,userId:`User ${e}`,device:`Device ${e}`,geo:`Geo ${e}`,remoteAddress:`127.0.0.${e}`,externalIds:[`Login ID ${e}`],occurred:(new Date).getTime()});t.forEach((e=>{r.sort(((t,n)=>{var r,o;return e.desc?null===(o=n[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(r=t[e.field])||void 0===r?void 0:r.localeCompare(n[e.field])}))})),n(r.filter((t=>t.id.toLowerCase().includes(e.toLowerCase())||t.action.toLowerCase().includes(e.toLowerCase())||t.type.toLowerCase().includes(e.toLowerCase())||t.device.toLowerCase().includes(e.toLowerCase())||t.method.toLowerCase().includes(e.toLowerCase())||t.geo.toLowerCase().includes(e.toLowerCase())||t.remoteAddress.toLowerCase().includes(e.toLowerCase())||t.externalIds.includes(e.toLowerCase())||t.userId.toLowerCase().includes(e.toLowerCase()))))}))})),ys=({httpClient:e,tenant:t,mock:r})=>({search:(...o)=>n(void 0,[...o],void 0,(function*({page:o,limit:i=1e4,text:s,sort:a,from:c}={}){if(r)return vs({page:o,limit:i,text:s,sort:a},t);const l=yield e.post(ms.search,{limit:i,page:o,text:s,sort:a,from:c},{queryParams:{tenant:t}});yield(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)})))(l);return(yield l.json()).audits}))}),bs=l((e=>{var t,s,a,c;const l=i(O,j,v,S,I({tenant:I.missingAttrValidator}))(e);return c=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return r(this,s,"f")||r(this,t,"m",a).call(this),r(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"],(()=>{r(this,s,"f")&&r(this,t,"m",a).call(this)}))}))}},s=new WeakMap,t=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),o(this,s,((e,t,n,r)=>{const o=gs(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":r,"x-descope-widget-version":"0.3.3"}}));return{audit:ys({httpClient:o.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenantId,"true"===this.mock,this.widgetId),"f")},c})),ws=l((e=>{const t=i(on({name:"widget",initialState:fn,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{pn.reducer(e)},asyncActions:{searchAudit:pn.action}}),k,v,bs)(e);return class extends t{constructor(...e){super(...e),this.state=fn,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),ks=l((e=>{const t=i(C,I({"widget-id":I.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return n(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),js=l((e=>{var t,o,a;return a=class extends(i(v,k,N,q,ks,ws)(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),yield Promise.all([r(this,t,"m",o).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,o=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})),Is=l((e=>{var t,o,s,a,l;return l=class extends(i(v,js,ws)(e)){constructor(){super(...arguments),t.add(this),o.set(this,c((()=>{const e=this.rangeInput.value,t=new Date;let n;switch(e){case"minuets15":n=t.setMinutes(t.getMinutes()-15);break;case"hour":n=t.setHours(t.getHours()-1);break;case"hour6":n=t.setHours(t.getHours()-6);break;case"day":default:n=t.setDate(t.getDate()-1);break;case"day3":n=t.setDate(t.getDate()-3);break;case"week":n=t.setDate(t.getDate()-7);break;case"week2":n=t.setDate(t.getDate()-14);break;case"month":n=t.setMonth(t.getMonth()-1)}this.actions.searchAudit({text:this.searchInput.value,from:Math.floor(new Date(n).getTime())})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",s).call(this),r(this,t,"m",a).call(this)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.searchInput=new ee(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(r(this,o,"f"))},a=function(){var e;this.rangeInput=new Z(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(r(this,o,"f"))},l})),Os=l((e=>{var t,o,s,c;return c=class extends(i(ws,v,js)(e)){constructor(){super(...arguments),t.add(this),s.set(this,(e=>{let t,n;return(...r)=>(t&&a(t,r)||(t=r,n=e(...r)),n)})((e=>{this.auditTable.data=e})))}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),r(this,t,"m",o).call(this),r(this,s,"f").call(this,ln(this.state)),this.subscribe(r(this,s,"f").bind(this),ln)}))}},s=new WeakMap,t=new WeakSet,o=function(){var e;this.auditTable=new Y(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="audit-table"]'),{logger:this.logger}),this.auditTable.onSelectedItemsChange((e=>{this.actions.setSelectedAuditId(e.detail.value.map((({id:e})=>e)))}))},c})),Ss=l((e=>class extends(i(R,re,Os,Is)(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)}))}})),xs=i((e=>class extends(Ss(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",xs);const Es=(e,t,n,r={})=>{var o,i,s,a;return[Math.min(Math.max(t,("all"===r.left?e.offsetWidth:null!==(o=r.left)&&void 0!==o?o:0)-e.offsetWidth),window.innerWidth-("all"===r.right?e.offsetWidth:null!==(i=r.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===r.top?e.offsetHeight:null!==(s=r.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===r.bottom?e.offsetHeight:null!==(a=r.bottom)&&void 0!==a?a:0))]};var Cs,_s,As,Rs,Ts,Ps,$s,Us,Ms,Ds;const Ls=document.createElement("template");Ls.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Ns extends HTMLElement{constructor(){var e;super(),Cs.add(this),_s.set(this,new g({messages:[]})),As.set(this,void 0),Rs.set(this,void 0),Ts.set(this,void 0),Ps.set(this,{resize:r(this,Cs,"m",Ds).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ls.content.cloneNode(!0)),o(this,As,this.shadowRoot.querySelector(".debugger"),"f"),o(this,Rs,r(this,As,"f").querySelector(".content"),"f"),o(this,Ts,r(this,As,"f").querySelector(".header"),"f")}updateData(e){r(this,_s,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let r=0,o=0,i=0,s=0;function a(t){t.preventDefault(),r=i-t.clientX,o=s-t.clientY,i=t.clientX,s=t.clientY;const[a,c]=Es(e,e.offsetLeft-r,e.offsetTop-o,n);e.style.top=`${c}px`,e.style.left=`${a}px`}function c(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=c,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(r(this,As,"f"),r(this,Ts,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",r(this,Ps,"f").resize),(e=r(this,As,"f")).onmousemove=t=>{var n;const r=t.target;(r.w&&r.w!==r.offsetWidth||r.h&&r.h!==r.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),r.w=r.offsetWidth,r.h=r.offsetHeight},r(this,As,"f").onresize=r(this,Cs,"m",Ms).bind(this),r(this,_s,"f").subscribe(r(this,Cs,"m",$s).bind(this))}disconnectedCallback(){r(this,_s,"f").unsubscribeAll(),window.removeEventListener("resize",r(this,Ps,"f").resize)}}_s=new WeakMap,As=new WeakMap,Rs=new WeakMap,Ts=new WeakMap,Ps=new WeakMap,Cs=new WeakSet,$s=function(e){r(this,Cs,"m",Us).call(this,e),r(this,Cs,"m",Ms).call(this)},Us=function(e){r(this,Rs,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Ms=function(){r(this,Rs,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),r=n.scrollWidth>n.clientWidth,o=n.clientHeight>20;r||o?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Ds=function(){const[e,t]=Es(r(this,As,"f"),Number.parseInt(r(this,As,"f").style.left,10),Number.parseInt(r(this,As,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});r(this,As,"f").style.top=`${t}px`,r(this,As,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Ns);var Ws=Object.freeze({__proto__:null,default:Ns});return xs}();
7
+ function yi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var bi=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=yi({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in o)o[s]&&(i+="; "+s,!0!==o[s]&&(i+="="+o[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(r[a]=t.read(s,a),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",yi({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,yi({},this.attributes,t))},withConverter:function(t){return e(yi({},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 wi={default:"endpoint"},ki="Blocked by CSP",ji="The endpoint parameter is not a valid URL",Ii="Failed to load the JS script of the agent",Oi="9319";function Si(e,t){var n,r,o,i,s,a=[],c=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||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),i=0,r=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},o=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===ki||s===ji)n.exclude(),i=0;else if(s===Oi)n.exclude();else if(s===Ii){var a=Date.now()-e.getTime()<50,c=n.current();c&&a&&!o.has(c)&&(o.add(c),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+r()-Date.now()]}]),l=c[0],u=c[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var d=function(e){var n=new Date,r=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},o=t(e);return o.then((function(){return r()}),r),o.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=u(n,e);if(!t)throw s;var r,o=t[0],i=t[1];return(r=i,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return d(o)}))}))};return d(l).then((function(e){return[e,a]}))}var xi="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Ci=xi;function Ei(n){var r;n.scriptUrlPattern;var o=n.token,i=n.apiKey,s=void 0===i?o:i,a=t(n,["scriptUrlPattern","token","apiKey"]),c=null!==(r=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(n,"scriptUrlPattern"))&&void 0!==r?r:xi,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(document,"visibilitychange",t);return t(),[e,n]}(),u=l[0],d=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)}))}(c,s);return Si(e,_i)})).catch((function(e){throw d(),function(e){return e instanceof Error&&e.message===Oi?new Error(Ii):e}(e)})).then((function(t){var n=t[0],r=t[1];return d(),n.load(e(e({},a),{ldi:{attempts:r,visibilityStates:u}}))}))}function _i(e){return function(e,t,n){var r,o=document,i="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,a())};o.addEventListener(i,s);var a=function(){return o.removeEventListener(i,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(),r)return n(r);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(ji);var r=document.createElement("script"),o=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},i=document.head||document.getElementsByTagName("head")[0];r.onload=function(){o(),t()},r.onerror=function(){o(),n(new Error(Ii))},r.async=!0,r.src=e,i.appendChild(r)}))}(e)}),(function(){throw new Error(ki)})).then(Ai)}function Ai(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,r=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==r?void 0:r.configurable)?delete e[t]:r&&!r.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(Oi);return n}const Ri=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,r)=>{var o;return n[r]=[].concat((null===(o=e.hooks)||void 0===o?void 0:o[r])||[]).concat((null==t?void 0:t[r])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Ti=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},Pi=async e=>{const t=await Ti(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},$i="undefined"!=typeof localStorage,Ui=(e,t)=>$i&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Mi=e=>$i&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Di=e=>$i&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Li=(...e)=>{console.debug(...e)},Ni="undefined"!=typeof window,Wi=Math.pow(2,31)-1,zi="DS",qi="DSR";function Fi(e=""){return Mi(`${e}${qi}`)||""}function Hi(e=""){return bi.get(zi)||Mi(`${e}${zi}`)||""}function Ji(e=""){Di(`${e}${qi}`),Di(`${e}${zi}`),bi.remove(zi)}const Vi=Ni&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Ki="vsid",Bi="vrid",Yi=(e=!1)=>{const t=localStorage.getItem("fp");if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Xi=async(e,t=Vi)=>{try{if(Yi())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=o.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Ei({apiKey:e,endpoint:[r.toString(),wi],scriptUrlPattern:[i,Ci]}),a=await s,{requestId:c}=await a.get({linkedId:n}),l=((e,t)=>({[Ki]:e,[Bi]:t}))(n,c);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem("fp",JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Gi=e=>{const t=Yi(!0);return t&&e.body&&(e.body.fpData=t),e},Zi="dls_last_user_login_id",Qi="dls_last_user_display_name",es=()=>Mi(Zi),ts=()=>Mi(Qi),ns=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,r={}]=t,o=es(),i=ts();return o&&(null!==(n=r.lastAuth)&&void 0!==n||(r.lastAuth={}),r.lastAuth.loginId=o,r.lastAuth.name=i),await e(...t)};function rs(){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 os(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=us(n.publicKey.challenge),n.publicKey.user.id=us(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=us(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:ds(n.rawId),type:n.type,response:{attestationObject:ds(n.response.attestationObject),clientDataJSON:ds(n.response.clientDataJSON)}});var n}async function is(e){const t=cs(e);return ls(await navigator.credentials.get(t))}async function ss(e,t){const n=cs(e);return n.signal=t.signal,n.mediation="conditional",ls(await navigator.credentials.get(n))}async function as(e=!1){if(!Ni)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function cs(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=us(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=us(e.id)})),n}function ls(e){return JSON.stringify({id:e.id,rawId:ds(e.rawId),type:e.type,response:{authenticatorData:ds(e.response.authenticatorData),clientDataJSON:ds(e.response.clientDataJSON),signature:ds(e.response.signature),userHandle:e.response.userHandle?ds(e.response.userHandle):void 0}})}function us(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function ds(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var hs,ps=(hs=e=>({async signUp(t,n,r){const o=await e.webauthn.signUp.start(t,window.location.origin,n,r);if(!o.ok)return o;const i=await os(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,i)},async signIn(t,n){const r=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!r.ok)return r;const o=await is(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,o)},async signUpOrIn(t,n){var r;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!o.ok)return o;if(null===(r=o.data)||void 0===r?void 0:r.create){const t=await os(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await is(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n,r){const o=await e.webauthn.update.start(t,window.location.origin,n,r);if(!o.ok)return o;const i=await os(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,i)},helpers:{create:os,get:is,isSupported:as,conditional:ss}}),(...e)=>{const t=hs(...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 fs="/fedcm/config",gs=(e,t)=>({async oneTap(t,n,r,o,i){const s=null!=t?t:"google",a=await e.oauth.startNative(s,r,!0);if(!a.ok)return a;const{clientId:c,stateId:l,nonce:u}=a.data,d=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var r,a;d.initialize(Object.assign(Object.assign({},n),{itp_support:null===(r=null==n?void 0:n.itp_support)||void 0===r||r,use_fedcm_for_prompt:null===(a=null==n?void 0:n.use_fedcm_for_prompt)||void 0===a||a,client_id:c,callback:n=>{t(e.oauth.finishNative(s,l,"","",n.credential))},nonce:u})),d.prompt((e=>{var t,n;if(i&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);null==i||i(n)}else if(o&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);null==o||o(t)}}))}))},async launch(n){var r;const o={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+fs),clientId:t}]}},i=await(null===(r=navigator.credentials)||void 0===r?void 0:r.get(o));return e.refresh(i.token)},isSupported:()=>Ni&&"IdentityCredential"in window,async isLoggedIn(n){var r;const o=e.httpClient.buildUrl(t+fs);try{const e={identity:{context:n||"signin",providers:[{configURL:o,clientId:t}]}},i=await(null===(r=navigator.credentials)||void 0===r?void 0:r.get(e));return!!i&&!!i.token}catch(e){return!1}}});var ms=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await as(),r=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=r,e.flow.start(...t)}});const vs=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>n=>{var{fpKey:r,fpLoad:o}=n,i=t(n,["fpKey","fpLoad"]);return Ni?(r&&o&&Xi(r).catch((()=>null)),e(Ri(i,{beforeRequest:Gi}))):e(i)}),(e=>n=>{var{autoRefresh:r}=n,o=t(n,["autoRefresh"]);if(!r)return e(o);const{clearAllTimers:i,setTimer:s}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let a,c;Ni&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>a&&(Li("Expiration time passed, refreshing session"),l.refresh(Fi()||c))}));const l=e(Ri(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:r}=await Ti(t);if(401===(null==t?void 0:t.status))Li("Received 401, canceling all timers"),i();else if(r){if(a=(e=>{try{const t=yn(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(r),!a)return void Li("Could not extract expiration time from session token");c=n;let e=((o=a)?o.getTime()-(new Date).getTime():0)-2e4;e>Wi&&(Li(`Timeout is too large (${e}ms), setting it to ${Wi}ms`),e=Wi),i();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Li(`Setting refresh timer for ${t}. (${e}ms)`),s((()=>{Li("Refreshing session due to timer"),l.refresh(Fi()||n)}),e)}var o}}));return ao(l,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Li("Clearing all timers"),i(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.25.0"},t.baseHeaders)}))),(e=>t=>{const n=rs(),r=rs(),o=e(Ri(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),r.pub(null);else{const e=await Pi(t);e&&r.pub(e);const{sessionJwt:o}=await Ti(t);o&&n.pub(o)}}})),i=ao(o,["logout","logoutAll"],(e=>async(...t)=>{const o=await e(...t);return n.pub(null),r.pub(null),o}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:r.sub})}),(e=>n=>{var{storeLastAuthenticatedUser:r=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=n,i=t(n,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!r)return Object.assign(e(i),{getLastUserLoginId:es,getLastUserDisplayName:ts});const s=e(Ri(i,{afterRequest:async(e,t)=>{var n;const r=await Pi(t),o=null===(n=null==r?void 0:r.loginIds)||void 0===n?void 0:n[0],i=null==r?void 0:r.name;o&&((e=>{Ui(Zi,e)})(o),(e=>{Ui(Qi,e)})(i))}}));let a=ao(s,["flow.start"],ns);return a=ao(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const r=await t(...n);return e||(Di(Zi),Di(Qi)),r})(o)),Object.assign(a,{getLastUserLoginId:es,getLastUserDisplayName:ts})}),(e=>n=>{var{persistTokens:r,sessionTokenViaCookie:o,storagePrefix:i}=n,s=t(n,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!r||!Ni)return e(s);const a=e(Ri(s,{beforeRequest:(c=i,e=>Object.assign(e,{token:e.token||Fi(c)})),afterRequest:async(e,n)=>{const r=/^\/v\d+\/mgmt\//.test(e.path);401===(null==n?void 0:n.status)?r||Ji(i):((e={},n,r)=>{var{refreshJwt:o,sessionJwt:i}=e,s=t(e,["refreshJwt","sessionJwt"]);void 0===n&&(n=!1),void 0===r&&(r=""),o&&Ui(`${r}${qi}`,o),i&&(n?function(e,t,{cookiePath:n,cookieDomain:r,cookieExpiration:o,cookieSameSite:i="Strict"}){if(t){const s=new Date(1e3*o),a=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(r);bi.set(e,t,{path:n,domain:a?r:void 0,expires:s,sameSite:i,secure:!0})}}(zi,i,Object.assign(Object.assign({},s),{cookieSameSite:!0===n?"Strict":n.sameSite})):Ui(`${r}${zi}`,i))})(await Ti(n),o,i)}}));var c;const l=ao(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const r=await t(...n);return Ji(e),r})(i));return Object.assign(l,{getRefreshToken:()=>Fi(i),getSessionToken:()=>Hi(i)})}))(((...e)=>{const t=vi(...e);return Object.assign(Object.assign({},t),{refresh:e=>{const n=Hi();return t.refresh(e,{dcs:n?"t":"f"})},flow:ms(t),webauthn:ps(t),fedcm:gs(t,e[0].projectId)})})),ys={search:"/v1/mgmt/audit/search"},bs=e=>n(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const r=[];for(let e=1;e<9;e+=1)r.push({id:`Audit ${e}`,action:`Action ${e}`,actorId:`Actor ${e}`,type:"info",method:`Method ${e}`,userId:`User ${e}`,device:`Device ${e}`,geo:`Geo ${e}`,remoteAddress:`127.0.0.${e}`,externalIds:[`Login ID ${e}`],occurred:(new Date).getTime()});t.forEach((e=>{r.sort(((t,n)=>{var r,o;return e.desc?null===(o=n[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(r=t[e.field])||void 0===r?void 0:r.localeCompare(n[e.field])}))})),n(r.filter((t=>t.id.toLowerCase().includes(e.toLowerCase())||t.action.toLowerCase().includes(e.toLowerCase())||t.type.toLowerCase().includes(e.toLowerCase())||t.device.toLowerCase().includes(e.toLowerCase())||t.method.toLowerCase().includes(e.toLowerCase())||t.geo.toLowerCase().includes(e.toLowerCase())||t.remoteAddress.toLowerCase().includes(e.toLowerCase())||t.externalIds.includes(e.toLowerCase())||t.userId.toLowerCase().includes(e.toLowerCase()))))}))})),ws=({httpClient:e,tenant:t,mock:r})=>({search:(...o)=>n(void 0,[...o],void 0,(function*({page:o,limit:i=1e4,text:s,sort:a,from:c}={}){if(r)return bs({page:o,limit:i,text:s,sort:a},t);const l=yield e.post(ys.search,{limit:i,page:o,text:s,sort:a,from:c},{queryParams:{tenant:t}});yield(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)})))(l);return(yield l.json()).audits}))}),ks=l((e=>{var t,s,a,c;const l=i(O,j,v,S,sn,I({tenant:I.missingAttrValidator}))(e);return c=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return r(this,s,"f")||r(this,t,"m",a).call(this),r(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"],(()=>{r(this,s,"f")&&r(this,t,"m",a).call(this)}))}))}},s=new WeakMap,t=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),o(this,s,((e,t,n,r)=>{const o=vs(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":r,"x-descope-widget-version":"0.4.1"}}));return{audit:ws({httpClient:o.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},c})),js=l((e=>{const t=i(on({name:"widget",initialState:gn,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{fn.reducer(e)},asyncActions:{searchAudit:fn.action}}),k,v,ks)(e);return class extends t{constructor(...e){super(...e),this.state=gn,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Is=l((e=>{const t=i(E,I({"widget-id":I.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return n(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Os=l((e=>{var t,o,a;return a=class extends(i(v,k,N,q,Is,js)(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),yield Promise.all([r(this,t,"m",o).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,o=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})),Ss=l((e=>{var t,o,s,a,l;return l=class extends(i(v,Os,js)(e)){constructor(){super(...arguments),t.add(this),o.set(this,c((()=>{const e=this.rangeInput.value,t=new Date;let n;switch(e){case"minuets15":n=t.setMinutes(t.getMinutes()-15);break;case"hour":n=t.setHours(t.getHours()-1);break;case"hour6":n=t.setHours(t.getHours()-6);break;case"day":default:n=t.setDate(t.getDate()-1);break;case"day3":n=t.setDate(t.getDate()-3);break;case"week":n=t.setDate(t.getDate()-7);break;case"week2":n=t.setDate(t.getDate()-14);break;case"month":n=t.setMonth(t.getMonth()-1)}this.actions.searchAudit({text:this.searchInput.value,from:Math.floor(new Date(n).getTime())})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",s).call(this),r(this,t,"m",a).call(this)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.searchInput=new ee(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(r(this,o,"f"))},a=function(){var e;this.rangeInput=new Z(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(r(this,o,"f"))},l})),xs=l((e=>{var t,o,s,c;return c=class extends(i(js,v,Os)(e)){constructor(){super(...arguments),t.add(this),s.set(this,(e=>{let t,n;return(...r)=>(t&&a(t,r)||(t=r,n=e(...r)),n)})((e=>{this.auditTable.data=e})))}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),r(this,t,"m",o).call(this),r(this,s,"f").call(this,un(this.state)),this.subscribe(r(this,s,"f").bind(this),un)}))}},s=new WeakMap,t=new WeakSet,o=function(){var e;this.auditTable=new Y(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="audit-table"]'),{logger:this.logger}),this.auditTable.onSelectedItemsChange((e=>{this.actions.setSelectedAuditId(e.detail.value.map((({id:e})=>e)))}))},c})),Cs=l((e=>class extends(i(R,re,xs,Ss)(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)}))}})),Es=i((e=>class extends(Cs(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Es);const _s=(e,t,n,r={})=>{var o,i,s,a;return[Math.min(Math.max(t,("all"===r.left?e.offsetWidth:null!==(o=r.left)&&void 0!==o?o:0)-e.offsetWidth),window.innerWidth-("all"===r.right?e.offsetWidth:null!==(i=r.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===r.top?e.offsetHeight:null!==(s=r.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===r.bottom?e.offsetHeight:null!==(a=r.bottom)&&void 0!==a?a:0))]};var As,Rs,Ts,Ps,$s,Us,Ms,Ds,Ls,Ns;const Ws=document.createElement("template");Ws.innerHTML=`\n<style>\n .debugger {\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class zs extends HTMLElement{constructor(){var e;super(),As.add(this),Rs.set(this,new g({messages:[]})),Ts.set(this,void 0),Ps.set(this,void 0),$s.set(this,void 0),Us.set(this,{resize:r(this,As,"m",Ns).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ws.content.cloneNode(!0)),o(this,Ts,this.shadowRoot.querySelector(".debugger"),"f"),o(this,Ps,r(this,Ts,"f").querySelector(".content"),"f"),o(this,$s,r(this,Ts,"f").querySelector(".header"),"f")}updateData(e){r(this,Rs,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let r=0,o=0,i=0,s=0;function a(t){t.preventDefault(),r=i-t.clientX,o=s-t.clientY,i=t.clientX,s=t.clientY;const[a,c]=_s(e,e.offsetLeft-r,e.offsetTop-o,n);e.style.top=`${c}px`,e.style.left=`${a}px`}function c(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=c,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(r(this,Ts,"f"),r(this,$s,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",r(this,Us,"f").resize),(e=r(this,Ts,"f")).onmousemove=t=>{var n;const r=t.target;(r.w&&r.w!==r.offsetWidth||r.h&&r.h!==r.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),r.w=r.offsetWidth,r.h=r.offsetHeight},r(this,Ts,"f").onresize=r(this,As,"m",Ls).bind(this),r(this,Rs,"f").subscribe(r(this,As,"m",Ms).bind(this))}disconnectedCallback(){r(this,Rs,"f").unsubscribeAll(),window.removeEventListener("resize",r(this,Us,"f").resize)}}Rs=new WeakMap,Ts=new WeakMap,Ps=new WeakMap,$s=new WeakMap,Us=new WeakMap,As=new WeakSet,Ms=function(e){r(this,As,"m",Ds).call(this,e),r(this,As,"m",Ls).call(this)},Ds=function(e){r(this,Ps,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Ls=function(){r(this,Ps,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),r=n.scrollWidth>n.clientWidth,o=n.clientHeight>20;r||o?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Ns=function(){const[e,t]=_s(r(this,Ts,"f"),Number.parseInt(r(this,Ts,"f").style.left,10),Number.parseInt(r(this,Ts,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});r(this,Ts,"f").style.top=`${t}px`,r(this,Ts,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",zs);var qs=Object.freeze({__proto__:null,default:zs});return Es}();
8
8
  //# sourceMappingURL=index.js.map